php - 函数 callDoDirectPayment() 的 Magento 支付失败

标签 php debugging magento paypal

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

我已经尝试检查错误日志,并在下面发布了结果。第一次使用这个系统和更多的前端开发人员,但我设法跟上了 php.ini 的步伐。

它似乎失败的关键行是

    $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 DEBUG (7): Hello World

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

        Mage::log($request);

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

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

        Mage::log($response);

(

[PAYMENTACTION] => 授权

[IP地址] => 81.98.95.116

[RETURNFMFDETAILS] => 1

[AMT] => 0.50

[货币代码] => 英镑

[INVNUM] => 100000063

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

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

[CREDITCAR] => xxxxxxxxxxxxxx

[扩展] => 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()

最佳答案

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

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

关于php - 函数 callDoDirectPayment() 的 Magento 支付失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15513962/

相关文章:

php - HEREDOC 干扰代码缩进

PHP Slim RESTful API - 两个表连接嵌套 JSON

c# - 值为 null,但检查返回其他值?

jquery - IE 不会响应 CSS 或 jquery

debugging - 逐步进入GDB中的特定功能

php - 从 Magento 产品 View 中的可配置产品中获取所有简单产品

magento - 检查magento中属性的值

php - 函数中的静态变量是否初始化为NULL(手动)?

php - Magento sales_order_place_before $observer getevent null

php - 如何从按特定字段分组的数据库中回显数据,然后将它们打印到单独的表中