English 中文(简体)
Magento PayPal Duplicate Invoice Error
原标题:Magento PayPal Duplicate Invoice Error

客户每一次在试图提交的订单时都会遇到错误。 PayPal Gateway拒绝了要求。 由于提供了一张重复发票,交易被拒。 我认为,在把这个问题推向上之后,我已经缩小了这一问题。 在最近几起案件中,一名客户在4个月前试图发出命令,并从Pal获得一份<>Internal Error。 我从与Palal说,该客户的信用卡已经贴出。 当他们试图发出第一份命令时,Pal拒绝了,但仍然认为我们的Magento Store提供了“被利用的”发票。

今天的快车道......是新的客户。 Magento STILL从9月份起在sales_flat_quote的表格中用了老字。 当他们gged住时,他们装上了客户的报价(仍然很活跃),并试图将它用于这一命令。 这导致Duplicate Invoice ID错误。

我见Mage_Sales_Model_。 观察员班次:cleanExpired Quotes 从岗位上寻找的方法。 然而,这只是用“is_active”表示的影响。 0. 由于这一引语被认为是活跃的,它从未被清除。

因此,马格托法典和佩拉尔之间显然存在脱节。 但是,就我而言,情况如此。 是否有其他人经历过这种情况? 如果是,任何建议?

EDIT:

我更进一步。 我在支票索引主计长中添加了密码,以弥补这一错误,如果是Duplicate Invoice Error,则在引用“saveOrderAction。 由此引出保留新的身份证,然后提交工资单。 现在的问题是,当它第二次尝试新的发票号码时,所有金额均为零。 我试图确定“的总数——收集——flag/strong”为假,以便收回总数,但总是有第二次。 更具体地说,的总数 Mage_Sales_Model_Quote_Address0,即 Mage_Sales_Model_Order 最终使用。 页: 1 Mage_Sales_Model_Quote <>/strong> 是正确的,但是,在引文的<编码>上填写。

显然,在第一次尝试之后,一些东西破坏了所有价值观,但我不知道什么或什么地方。 如果任何人有任何想法,我会爱听他们的话!

最佳回答

从根本上来说,情况是,magento正在发出工资单。 该系统已经支付的账单(发票号码)。 由此可以支付回购,表明发票号码是重复的。 因此,我在这里做的是试图发现这一信息反应,产生新的命令,并重新提出支付再处理的费用。

这里的行动始于向magento发送信息的整个链条。 位于Mage_Paypal_Controller_ Express_Abstract 。 我修改了“薪棕榈”反应产生的信号。 该标注将包含有关所发生错误的信息。

startAction(){
    ...
    $token = $this->_checkout->start(Mage::getUrl( */*/return ), Mage::getUrl( */*/cancel ));
    if ($token && $url = $this->_checkout->getRedirectUrl()) {
        $this->_initToken($token);
        ...
    }
}

to:

startAction(){
    ...
    $token = $this->_checkout->start(Mage::getUrl( */*/return ), Mage::getUrl( */*/cancel ));

    //while this token is invalid
    while (isset($token[ error ])) {
        //generate a new token
        $token = $this->_checkout->start(Mage::getUrl( */*/return ),Mage::getUrl( */*/cancel ), TRUE);
    }
    if ($token[ token ] && $url = $this->_checkout->getRedirectUrl()) {
        $this->_initToken($token[ token ]);
         ...
    }

}

This token is generated by the start() method in Mage_Paypal_Model_Express_Checkout . start() also handles the entire process of object manipulation. Here, we will conditionally alter the productId.

the modified function will look like this:

public function start($returnUrl, $cancelUrl, $errorAgain = FALSE)
{
    $this->_quote->collectTotals();

    if (!$this->_quote->getGrandTotal() && !$this->_quote->hasNominalItems()) {
        Mage::throwException(Mage::helper( paypal )->__( PayPal does not support processing orders with zero amount. To complete your purchase, proceed to the standard checkout process. ));
    }
    if ($errorAgain) {
        Mage::log( why is this running? );
        $this->_quote->setReservedOrderId($this->_quote->getReservedOrderId($this->_quote));
        $this->_quote->reserveOrderId()->save();
    }
    //$this->_quote->setReservedOrderId($this->_quote->_getResource()->getReservedOrderId($this->_quote));
    //$this->_quote->setReservedOrderId($this->_quote->getReservedOrderId($this->_quote));
    $this->_quote->reserveOrderId()->save();
    // prepare API
    $this->_getApi();
    $this->_api->setAmount($this->_quote->getBaseGrandTotal())
        ->setCurrencyCode($this->_quote->getBaseCurrencyCode())
        ->setInvNum($this->_quote->getReservedOrderId())
        ->setReturnUrl($returnUrl)
        ->setCancelUrl($cancelUrl)
        ->setSolutionType($this->_config->solutionType)
        ->setPaymentAction($this->_config->paymentAction)
    ;
    if ($this->_giropayUrls) {
        list($successUrl, $cancelUrl, $pendingUrl) = $this->_giropayUrls;
        $this->_api->addData(array(
             giropay_cancel_url  => $cancelUrl,
             giropay_success_url  => $successUrl,
             giropay_bank_txn_pending_url  => $pendingUrl,
        ));
    }

    $this->_setBillingAgreementRequest();

    if ($this->_config->requireBillingAddress == Mage_Paypal_Model_Config::REQUIRE_BILLING_ADDRESS_ALL) {
        $this->_api->setRequireBillingAddress(1);
    }

    // supress or export shipping address
    if ($this->_quote->getIsVirtual()) {
        if ($this->_config->requireBillingAddress == Mage_Paypal_Model_Config::REQUIRE_BILLING_ADDRESS_VIRTUAL) {
            $this->_api->setRequireBillingAddress(1);
        }
        $this->_api->setSuppressShipping(true);
    } else {
        $address = $this->_quote->getShippingAddress();
        $isOverriden = 0;
        if (true === $address->validate()) {
            $isOverriden = 1;
            $this->_api->setAddress($address);
        }
        $this->_quote->getPayment()->setAdditionalInformation(
            self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN, $isOverriden
        );
        $this->_quote->getPayment()->save();
    }

    // add line items
    $paypalCart = Mage::getModel( paypal/cart , array($this->_quote));
    $this->_api->setPaypalCart($paypalCart)
        ->setIsLineItemsEnabled($this->_config->lineItemsEnabled)
    ;

    // add shipping options if needed and line items are available
    if ($this->_config->lineItemsEnabled && $this->_config->transferShippingOptions && $paypalCart->getItems()) {
        if (!$this->_quote->getIsVirtual() && !$this->_quote->hasNominalItems()) {
            if ($options = $this->_prepareShippingOptions($address, true)) {
                $this->_api->setShippingOptionsCallbackUrl(
                    Mage::getUrl( */*/shippingOptionsCallback , array( quote_id  => $this->_quote->getId()))
                )->setShippingOptions($options);
            }
        }
    }

    // add recurring payment profiles information
    if ($profiles = $this->_quote->prepareRecurringPaymentProfiles()) {
        foreach ($profiles as $profile) {
            $profile->setMethodCode(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS);
            if (!$profile->isValid()) {
                Mage::throwException($profile->getValidationErrors(true, true));
            }
        }
        $this->_api->addRecurringPaymentProfiles($profiles);
    }

    $this->_config->exportExpressCheckoutStyleSettings($this->_api);

    // call API and redirect with token
    $response = $this->_api->callSetExpressCheckout();
    $token[ token ] = $this->_api->getToken();
    $this->_redirectUrl = $this->_config->getExpressCheckoutStartUrl($token[ token ]);
    if ($response ==  duplicate ) {
        $token[ error ] =  duplicate ;
        return $token;
    } elseif (isset($token[ error ])) {
        unset($token[ error ]);
    }
    $this->_quote->getPayment()->unsAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
    $this->_quote->getPayment()->save();
    return $token;
}

现在,最后一部分处理实际工资要求和反应。 这样做是因为Mage_Paypal_Model_Api_Nvp。

After the response is generated we shall check for the error response and, instead of redirecting, we shall simply return it up the chain.

位于997线以下:

if ($response[ L_SHORTMESSAGE0 ] ==  Duplicate invoice ) {
    return $response;
}

顺便提一下:

startaction()->start()->call()->start()->startaction()->redirect();

如果存在重复的录用错误,它将这样做。

startaction()->start()->call(error)->start()->call()->start()->staraction()->redirect();

让我知道,你是否有任何问题。

问题回答
  1. Log in to your Paypal account
  2. Go to Profile > Payment Receiving Preferences
  3. Under Block accidental payments select No, allow multiple payments per invoice ID

enter image description here

我认为,如果你有多个Magento设施,都向同一个Pal账户指出,这可能是一个必要的变化。 我刚刚安装了一座新马亨托设施,并从新仓库收到了错误。 我的猜测是关于新安装的早期发票识别器之一,与我现有设施之一的早期发票识别相重叠。

One option as mentioned by @george here is to edit your PayPal settings, which will get you up and running ASAP. That does open the door for some risk though. What s probably better is to install a plugin such as Custom Order Prefix on all of your Magento installations. That way each installation will pass invoice IDs with a different prefix despite the invoice IDs themselves overlapping.

还没有这样做,但似乎喜欢安装Fooman分机,有可能用错误/旧令确定报价。 这对你来说是否可行?

亲爱听。 I m 准备处理这一问题,使我们的薪酬例外更加合理(使用。 因此,如果你找到帮助的话,就会爱心。

Edit: Found some further info here. Apparently the Fooman extension helps, but doesn t fix the problems completely. Does this help solve your problem?

Edit: Per the change log for Magento 1.7.0.0 (which came out in April), they think they ve fixed the problem:

Fixed: “Wrong order ID” exception in PayPal Express module under heavy load

谁能证实,升至Magento 1.7确实解决问题? 每当我看一看它时,似乎就是一个Pal Express问题(通常通过Pal Pro支付,而且似乎没有错误)。

www.un.org/Depts/DGACM/index_spanish.htm CAUSE OF THE PROBLEM:

提出的解决办法是仅为工作arounds,解决根本问题,即:关于发票的<编码>increment_last_id落后于<编码>increment_last_id。

《Magento法典》没有任何错误,它是一个有问题的国家。 这通常发生在Magento更新之后。

为了解决这个问题,你只得把你的发票<编码>increment_last_id与订单相同。

<>>>>>

As pointed out by others, it is normal that these ids are not in sync, but if the invoice id is too much BEHIND the order id (and not the other way around) problems with PayPal can occur (more information here). Before turning down this solution, just try it out, it worked perfectly for me and others.

HOW TO FIX:

利用您的优惠的亚洲开发银行管理工具(,PHPmyAdmin,Adminer , ......)上到eav_entity_store 的表格并核对这些数值。 它应当th。 类似:

+-----------------+----------------+----------+------------------+-------------------+
| entity_store_id | entity_type_id | store_id | increment_prefix | increment_last_id |
+-----------------+----------------+----------+------------------+-------------------+
|               1 |              5 |        1 |                1 |         100001708 |
|               2 |              6 |        1 |                1 |         100000926 |
|               3 |              8 |        1 |                1 |         100000888 |
|               4 |              7 |        1 |                1 |         100000054 |
+-----------------+----------------+----------+------------------+-------------------+

这里令人感兴趣的价值观是:

  1. ORDER increment_last_id: entity_type_id = 5 (100001708)
  2. INVOICE increment_last_id: entity_type_id = 6 (100000926)

因此,我们在此必须做的唯一事情是将国际志愿人员组织的价值确定在欧安会的价值中。 我们能够利用任何 d管理工具,或直接与 s指挥系统一道这样做。

UPDATE eav_entity_store
  SET increment_last_id="100001708"
  WHERE entity_type_id="6" AND store_id="1"

如果你有多家商店,你就不得不更换店铺。

回答的依据是this article





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...