【问题标题】:Magento Payment Failure at function callDoDirectPayment()函数 callDoDirectPayment() 处的 Magento 付款失败
【发布时间】:2013-03-08 23:33:34
【问题描述】:

我在使用 Paypal Payments Pro 在 Magento 1.6.1 上调试支付网关时遇到问题。它一直失败并显示消息“处理您的订单时出错。请联系我们或稍后再试”。

我已尝试检查错误日志,并将结果发布在下面。第一次使用这个系统和更多的前端开发,但我正在设法跟随 php。

它似乎失败的关键行是

    $this->_importFromResponse($this->_doDirectPaymentResponse, $response);

有人能准确解释一下这条线的作用吗?调查这个过程的下一步应该是什么明智的?任何额外的 paypal / magento 特定知识都非常受欢迎!

我猜,既然创建了数组,那么转移到 paypal 可能会出现问题(我的 api 签名应该没问题 - 快速网关有效)- 我将如何确认或反驳这个假设?

谢谢

(var/exception.log 的前 8 行带有引用的代码 sn-ps,以及由 Mage::log() 函数生成的 var/system.log 中的一些额外内容。)

exception 'Mage_Core_Exception' with message 'There was an error processing your order.
Please contact us or try again later.' in /var/www/magento/app/Mage.php:563

堆栈跟踪:

#0 /var/www/magento/app/code/core/Mage/Paypal/Model/Api/Nvp.php(974):
  Mage::throwException('There was an er...')

if (!$this->_validateResponse($methodName, $response)) {
        Mage::logException(new Exception(
            Mage::helper('paypal')->__("PayPal response hasn't required fields.")
        ));
        Mage::throwException(Mage::helper('paypal')->__('There was an error processing
your order. 
Please contact us or try again later.'));
    }

#1 /var/www/magento/app/code/core/Mage/Paypal/Model/Api/Nvp.php(648):

 Mage_Paypal_Model_Api_Nvp->call('DoDirectPayment', Array)
 public function callDoDirectPayment()
 {
        Mage::log("hello world");

// 2013-03-20T00:04:50+00:00 调试(7):你好世界

  $request = $this->_exportToRequest($this->_doDirectPaymentRequest);

        Mage::log($request);

// 2013-03-20T00:04:50+00:00 调试(7):数组

    $this->_exportLineItems($request);
    if ($this->getAddress()) {
        $request = $this->_importAddresses($request);
    }
    $response = $this->call(self::DO_DIRECT_PAYMENT, $request);

        Mage::log($response);

(

[PAYMENTACTION] => 授权

[IPADDRESS] => 81.98.95.116

[RETURNFMFDETAILS] => 1

[AMT] => 0.50

[CURRENCYCODE] => 英镑

[INVNUM] => 100000063

[NOTIFYURL] => http://www.store.com/paypal/ipn/

[EMAIL] => hello@email

[CREDITCAR] => xxxxxxxxxxxxxx

[EXPDATE] => xxxxxx

[CVV2] => XXX

[问题编号] =>

)

$this->_importFromResponse($this->_doDirectPaymentResponse, $response);

Mage::log("nothing to see here")

// 这不会向 system.log 返回任何内容,因此我认为这是故障点

}




#2 /var/www/magento/app/code/core/Mage/Paypal/Model/Direct.php(343):  
Mage_Paypal_Model_Api_Nvp->callDoDirectPayment()


 // call api and import transaction and other payment information
 /**
 * Place an order with authorization or capture action
 *
 * @param Mage_Sales_Model_Order_Payment $payment
 * @param float $amount
 * @return Mage_Paypal_Model_Direct
 */
 protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
 { //...........(343)

    $api->callDoDirectPayment();
    $this->_importResultToPayment($api, $payment);

    try {
        $api->callGetTransactionDetails();
    } catch (Mage_Core_Exception $e) {
        // if we recieve errors, but DoDirectPayment response is Success, then set    
              Pending status for transaction
        $payment->setIsTransactionPending(true);
    }

(343)

    $this->_importResultToPayment($api, $payment);
    return $this;
}


#3 /var/www/magento/app/code/core/Mage/Paypal/Model/Direct.php(178):     
 Mage_Paypal_Model_Direct->_placeOrder(Object(Mage_Sales_Model_Order_Payment), 45)  
#4 /var/www/magento/app/code/core/Mage/Sales/Model/Order/Payment.php(1026): 
 Mage_Paypal_Model_Direct->authorize(Object(Mage_Sales_Model_Order_Payment), 45)
#5 /var/www/magento/app/code/core/Mage/Sales/Model/Order/Payment.php(311): 
 Mage_Sales_Model_Order_Payment->_authorize(true, 45)
#6 /var/www/magento/app/code/core/Mage/Sales/Model/Order.php(855):   
 Mage_Sales_Model_Order_Payment->place()
#7 /var/www/magento/app/code/core/Mage/Sales/Model/Order.php(1073):  
 Mage_Sales_Model_Order->_placePayment()
#8 [internal function]: Mage_Sales_Model_Order->place()

【问题讨论】:

    标签: php debugging magento paypal


    【解决方案1】:

    您是否在 Magento 的 PayPal 设置中启用了调试功能?如果是这样,那么您应该会在 /var/log 中看到一个日志,这样您就可以看到来回发送的 RAW 请求和响应数据。

    这将允许您查看响应中返回的实际错误代码和消息,这将帮助您找出究竟出了什么问题。

    【讨论】:

    • 我的问题可能不清楚,但上面发布的代码是 var/exception.log- 的前 8 行,其中包含引用的代码 sn-ps,以及 var/ 中的一些额外内容由 Mage::log() 函数生成的 system.log。感谢您的建议,我将修改我的问题以使其更清楚。
    • 我明白了你的意思。不太清楚我是如何错过 paypal_payment_direct.log 的!累了我想。知道下一步该怎么做吗? ( [TIMESTAMP] => 2013-03-20T10:47:01Z [CORRELATIONID] => ec92b4c870cd2 [ACK] => 失败 [VERSION] => 72.0 [BUILD] => 5479129 [L_ERRORCODE0] => 10002 [L_SHORTMESSAGE0] =>身份验证/授权失败 [L_LONGMESSAGE0] => 您无权进行此 API 调用 [L_SEVERITYCODE0] => 错误)
    猜你喜欢
    • 2019-12-26
    • 1970-01-01
    • 2012-03-12
    • 1970-01-01
    • 2012-02-06
    • 2020-01-03
    • 1970-01-01
    • 2013-07-16
    • 2014-06-28
    相关资源
    最近更新 更多