函数callDoDirectPayment()上的Magento付款失败

时间:2013-03-20 01:58:13

标签: php debugging magento paypal

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

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

它似乎失败的关键行是

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

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

我猜测,因为数组已经创建,所以转移到paypal可能会出现问题(我的api签名应该没问题 - 快速网关工作) - 我将如何确认或谴责这个假设?

谢谢

(var / exception.log-的前8行与引用的代码片段,以及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] => GBP

[INVNUM] => 100000063

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

[EMAIL] =>你好@电子邮件

[CREDITCAR] => XXXXXXXXXXXXXX

[EXPDATE] => XXXXXX

[CVV2] => XXX

[ISSUENUMBER] =>

$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()

1 个答案:

答案 0 :(得分:1)

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

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