微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php-即使PayPal付款失败,Magento订单状态也会更新为“处理中”

Magento 1.9和PayPal付款方式存在问题.
当客户使用PayPal付款并且有付款审核时,在这种情况下,订单状态将设置为正确的“付款审核”.

但是,问题是,在付款实际失败的情况下(即客户帐户中的资金不足),Magento将订单状态更新为“处理中”和“客户最终获得免费商品.

我需要做的是,当调用“失败” IPN时,我需要将“关闭”状态设置为该特定顺序.我花了4个多小时来找到解决方案,但没有找到合适的解决方案.

如果有人对此有任何修复,请与我分享.

PayPal IPN响应变量:

        [payer_email] => xxx@xxx.com
        [payer_id] => xxxxxxxxxxxx
        [payer_status] => unverified
        [payment_date] => 14:33:46 Jun 08, 2015 PDT
        [payment_gross] => 43.24
        [payment_status] => Failed
        [payment_type] => echeck
        [protection_eligibility] => Ineligible

提前致谢.

解决方法:

我们面临同样的问题,并找到了根本原因.在Magento Bug Tracker上,这似乎是一个解决的问题.

查看https://www.magentocommerce.com/bug-tracking/issue/index/id/1041

您可以通过重写Ipn模型来修复它,如下所示:

<?PHP
/**
 * Rewrite the core fix an issue with IPN notifications of "Failed" payments
 */
class Magento_CoreFixes_Model_Paypal_Ipn extends Mage_Paypal_Model_Ipn
{

    /**
     * @see https://www.magentocommerce.com/bug-tracking/issue/index/id/1041
     */
    protected function _registerPaymentFailure()
    {
        $this->_importPaymentinformation();

        // This is the fix allowing order to get the cancelled status
        foreach ($this->_order->getInvoiceCollection() as $invoice){
            $invoice->cancel()->save();
        }

        $this->_order
            ->registerCancellation($this->_createIpnComment(''), false)
            ->save();
    }
}

希望能帮助到你!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐