0

几天前,我在我的基于 Magento 的网站上安装了一个 realex 扩展程序,但我一直无法让它工作。我们在尝试完成订单时遇到错误 - 它会返回通用弹出窗口:

处理您的订单时出现问题

在联系 Realex 自己后,他们告诉我们,他们可以看到我们正在尝试连接,并且这在他们的终端上不是问题。

我检查了网站的错误日志,发现:

2013-05-02T08:47:50+00:00 ERR (3): 
exception 'Ampersand_Realex_Model_Exception_Hash' with message 'Hash does not match.' in /home/excellen/public_html/app/code/community/Ampersand/Realex/Model/Adapter/Remote/Abstract.php:41
Stack trace:
#0 /home/excellen/public_html/app/code/community/Ampersand/Realex/Model/Adapter/Remote/AuthCaptureAbstract.php(299): Ampersand_Realex_Model_Adapter_Remote_Abstract->_validateResponseHash()
#1 /home/excellen/public_html/app/code/core/Ampersand/PaymentGateway/Model/Service/Abstract.php(585): Ampersand_Realex_Model_Adapter_Remote_AuthCaptureAbstract->callbackForFinalAuth()
#2 /home/excellen/public_html/app/code/core/Ampersand/PaymentGateway/Model/Service/Abstract.php(249): Ampersand_PaymentGateway_Model_Service_Abstract->_processServiceMessages()
#3 /home/excellen/public_html/app/code/core/Ampersand/PaymentGateway/Model/Service/Abstract.php(220): Ampersand_PaymentGateway_Model_Service_Abstract->_authorizeAndCapture(Object(Mage_Sales_Model_Order_Payment), '40')
#4 /home/excellen/public_html/app/code/core/Ampersand/PaymentGateway/Model/Method/DirectAbstract.php(203): Ampersand_PaymentGateway_Model_Service_Abstract->capture(Object(Mage_Sales_Model_Order_Payment), '40')
#5 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Order/Payment.php(408): Ampersand_PaymentGateway_Model_Method_DirectAbstract->capture(Object(Mage_Sales_Model_Order_Payment), '40')
#6 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Order/Invoice.php(385): Mage_Sales_Model_Order_Payment->capture(Object(Mage_Sales_Model_Order_Invoice))
#7 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Order/Payment.php(569): Mage_Sales_Model_Order_Invoice->capture()
#8 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Order/Payment.php(375): Mage_Sales_Model_Order_Payment->_invoice()
#9 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Order/Payment.php(317): Mage_Sales_Model_Order_Payment->capture(NULL)
#10 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Order.php(877): Mage_Sales_Model_Order_Payment->place()
#11 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Order.php(1095): Mage_Sales_Model_Order->_placePayment()
#12 /home/excellen/public_html/app/code/core/Mage/Core/Model/Resource/Transaction.php(105): Mage_Sales_Model_Order->place()
#13 /home/excellen/public_html/app/code/core/Mage/Core/Model/Resource/Transaction.php(159): Mage_Core_Model_Resource_Transaction->_runCallbacks(Array)
#14 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(189): Mage_Core_Model_Resource_Transaction->save()
#15 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(249): Mage_Sales_Model_Service_Quote->submitOrder()
#16 /home/excellen/public_html/app/code/core/Mage/Checkout/Model/Type/Onepage.php(774): Mage_Sales_Model_Service_Quote->submitAll()
#17 /home/excellen/public_html/app/code/core/Mage/Checkout/controllers/OnepageController.php(511): Mage_Checkout_Model_Type_Onepage->saveOrder()
#18 /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_OnepageController->saveOrderAction()
#19 /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch()
#20 /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match('saveOrder')
#21 /home/excellen/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch(Object(Mage_Core_Controller_Request_Http))
#22 /home/excellen/public_html/app/Mage.php(683): Mage_Core_Model_App->run()
#23 /home/excellen/public_html/index.php(87): Mage::run(Array)
#24 {main}

这是文件中告诉我存在问题的部分:

/**
 * Validate the response hash from Realex.
 */
protected function _validateResponseHash()
{
    $hash = $this->_getHelper()->generateSha1Hash(
        $this->_getConfig()->getSharedSecret(),
        $this->getResponse()->getTimestamp(),
        $this->getResponse()->getMerchantId(),
        $this->getResponse()->getUniqueOrderId(),
        $this->getResponse()->getResult(),
        $this->getResponse()->getMessage(),
        $this->getResponse()->getPasref(),
        $this->getResponse()->getAuthCode()
    );

    if ($hash != $this->getResponse()->getSha1Hash()) {
        throw new Ampersand_Realex_Model_Exception_Hash(
            $this->_getHelper()->__('Hash does not match.')
        );
    }

    return $this;
}

在这一点上,虽然我真的达到了我的知识极限!我可以理解这两个哈希值不匹配,但是是什么导致了这种情况,我该如何解决呢?

我将尝试在 Magento 的香草版本上重新创建问题,但如果有人能发现导致问题的原因或遇到类似问题,那么我将非常感谢任何帮助!


更新:

我尝试安装另外两个可以处理信用卡支付的扩展——第一个是替代的 REALEX 扩展(由 SF9 开发),第二个是 SAGEPAY 扩展——两者都返回了错误。以下是 SagePay 插件的错误日志:

    2013-05-02T10:15:57+00:00 ERR (3): 
exception 'Mage_Core_Exception' with message 'Payment has failed, please reload checkout page and try again. Your card has not been charged.' in /home/excellen/public_html/app/Mage.php:594
Stack trace:
#0 /home/excellen/public_html/app/code/local/Ebizmarts/SagePaySuite/Model/Observer/Sales.php(127): Mage::throwException('Payment has fai...')
#1 /home/excellen/public_html/app/code/core/Mage/Core/Model/App.php(1338): Ebizmarts_SagePaySuite_Model_Observer_Sales->saveAfter(Object(Varien_Event_Observer))
#2 /home/excellen/public_html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Ebizmarts_SagePaySuite_Model_Observer_Sales), 'saveAfter', Object(Varien_Event_Observer))
#3 /home/excellen/public_html/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('sales_order_sav...', Array)
#4 /home/excellen/public_html/app/code/core/Mage/Core/Model/Abstract.php(466): Mage::dispatchEvent('sales_order_sav...', Array)
#5 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Abstract.php(53): Mage_Core_Model_Abstract->_afterSave()
#6 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Order.php(2155): Mage_Sales_Model_Abstract->_afterSave()
#7 /home/excellen/public_html/app/code/core/Mage/Core/Model/Abstract.php(319): Mage_Sales_Model_Order->_afterSave()
#8 /home/excellen/public_html/app/code/core/Mage/Core/Model/Resource/Transaction.php(151): Mage_Core_Model_Abstract->save()
#9 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(189): Mage_Core_Model_Resource_Transaction->save()
#10 /home/excellen/public_html/app/code/core/Mage/Sales/Model/Service/Quote.php(249): Mage_Sales_Model_Service_Quote->submitOrder()
#11 /home/excellen/public_html/app/code/core/Mage/Checkout/Model/Type/Onepage.php(774): Mage_Sales_Model_Service_Quote->submitAll()
#12 /home/excellen/public_html/app/code/core/Mage/Checkout/controllers/OnepageController.php(511): Mage_Checkout_Model_Type_Onepage->saveOrder()
#13 /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_OnepageController->saveOrderAction()
#14 /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('saveOrder')
#15 /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#16 /home/excellen/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#17 /home/excellen/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#18 /home/excellen/public_html/index.php(87): Mage::run('', 'store')
#19 {main}
2013-05-02T10:15:58+00:00 ERR (3): 
exception 'Zend_Mail_Transport_Exception' with message 'Unable to send mail. mail() has been disabled for security reasons' in /home/excellen/public_html/lib/Zend/Mail/Transport/Sendmail.php:137
Stack trace:
#0 /home/excellen/public_html/lib/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Sendmail->_sendMail()
#1 /home/excellen/public_html/lib/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#2 /home/excellen/public_html/app/code/core/Mage/Core/Model/Email/Template.php(454): Zend_Mail->send()
#3 /home/excellen/public_html/app/code/core/Mage/Core/Model/Email/Template.php(506): Mage_Core_Model_Email_Template->send('david@excellent...', 'Excellent Sciss...', Array)
#4 /home/excellen/public_html/app/code/core/Mage/Checkout/Helper/Data.php(221): Mage_Core_Model_Email_Template->sendTransactional('checkout_paymen...', 'general', 'david@excellent...', 'Excellent Sciss...', Array)
#5 /home/excellen/public_html/app/code/core/Mage/Checkout/controllers/OnepageController.php(528): Mage_Checkout_Helper_Data->sendPaymentFailedEmail(Object(Mage_Sales_Model_Quote), 'Payment has fai...')
#6 /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_OnepageController->saveOrderAction()
#7 /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('saveOrder')
#8 /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#9 /home/excellen/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#10 /home/excellen/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#11 /home/excellen/public_html/index.php(87): Mage::run('', 'store')
#12 {main}

它在测试模式下运行,因此与我在管理部分输入的详细信息无关 - 信用卡付款方式似乎有问题(因为我可以通过选择 PayPal 或其他方式成功完成订单)

真的卡在这个了,希望有人能帮忙!:(


更新: system.log 输出:

2013-05-03T08:44:20+00:00 ERR (3): Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'Mage/Realex/Model/Remote.php' for inclusion (include_path='/home/excellen/public_html/app/code/local:/home/excellen/public_html/app/code/community:/home/excellen/public_html/app/code/core:/home/excellen/public_html/lib:.:/usr/lib/php:/usr/local/lib/php')  in /home/excellen/public_html/lib/Varien/Autoload.php on line 93
2013-05-03T08:45:10+00:00 ERR (3): Warning: include(Mage/Realex/Model/Remote.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory  in /home/excellen/public_html/lib/Varien/Autoload.php on line 93
2013-05-03T08:45:10+00:00 ERR (3): Warning: include(Mage/Realex/Model/Remote.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory  in /home/excellen/public_html/lib/Varien/Autoload.php on line 93
2013-05-03T08:45:10+00:00 ERR (3): Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'Mage/Realex/Model/Remote.php' for inclusion (include_path='/home/excellen/public_html/app/code/local:/home/excellen/public_html/app/code/community:/home/excellen/public_html/app/code/core:/home/excellen/public_html/lib:.:/usr/lib/php:/usr/local/lib/php')  in /home/excellen/public_html/lib/Varien/Autoload.php on line 93
2013-05-03T08:45:19+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] /home/excellen/public_html/app/code/core/Mage/Core/Controller/Response/Http.php:52
[1] /home/excellen/public_html/lib/Zend/Controller/Response/Abstract.php:766
[2] /home/excellen/public_html/app/code/core/Mage/Core/Controller/Response/Http.php:83
[3] /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php:188
[4] /home/excellen/public_html/app/code/core/Mage/Core/Model/App.php:354
[5] /home/excellen/public_html/app/Mage.php:683
[6] /home/excellen/public_html/index.php:87
</pre>
2013-05-03T08:45:38+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] /home/excellen/public_html/app/code/core/Mage/Core/Controller/Response/Http.php:52
[1] /home/excellen/public_html/lib/Zend/Controller/Response/Abstract.php:766
[2] /home/excellen/public_html/app/code/core/Mage/Core/Controller/Response/Http.php:83
[3] /home/excellen/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php:188
[4] /home/excellen/public_html/app/code/core/Mage/Core/Model/App.php:354
[5] /home/excellen/public_html/app/Mage.php:683
[6] /home/excellen/public_html/index.php:87
</pre>
4

1 回答 1

0

您是否能够编辑该代码以获取一些日志记录?如果是这样,您可以打印出数据并在此处发布结果吗?

if ()在代码中的语句之前添加以下行。我不确定您是否可以使用方便的日志记录助手,所以我只是将它们打印到 STDOUT ...

print "Data to hash: " . $this->getResponse()->getTimestamp() . "." .
  $this->getResponse()->getMerchantId() . "." .
  $this->getResponse()->getUniqueOrderId() . "." .
  $this->getResponse()->getResult() . "." .
  $this->getResponse()->getMessage() . "." .
  $this->getResponse()->getPasref() . "." .
  $this->getResponse()->getAuthCode() . "\n";

print "Local hash: " . $hash . "\n";
print "Hash from XML: " . $this->getResponse()->getSha1Hash() . "\n";

(不要打印出你共享的秘密,绝对不要在这里发布!)

欧文

于 2013-05-02T14:16:35.733 回答