Zend framework2 使用omnipay通过securepay处理时出现无效指纹异常
我试图了解使用Omnipay/SecurePay进行支付的流程,但在尝试完成购买时总是会出错 从在线文档中我可以看到,Zend framework2 使用omnipay通过securepay处理时出现无效指纹异常,zend-framework2,omnipay,Zend Framework2,Omnipay,我试图了解使用Omnipay/SecurePay进行支付的流程,但在尝试完成购买时总是会出错 从在线文档中我可以看到,completetpurchase函数应该使用与purchase函数相同的参数调用,但是当我调用completetpurchase时,我收到一个“无效指纹”异常 还将引发以下错误: Undefined index: merchant in /var/www/vendor/omnipay/securepay/src/Message/DirectPostCompletePurchas
completetpurchase
函数应该使用与purchase
函数相同的参数调用,但是当我调用completetpurchase
时,我收到一个“无效指纹”异常
还将引发以下错误:
Undefined index: merchant in /var/www/vendor/omnipay/securepay/src/Message/DirectPostCompletePurchaseRequest.php on line 28
Undefined index: refid in /var/www/vendor/omnipay/securepay/src/Message/DirectPostCompletePurchaseRequest.php on line 30
Undefined index: timestamp in /var/www/vendor/omnipay/securepay/src/Message/DirectPostCompletePurchaseRequest.php on line 32
Undefined index: summarycode in /var/www/vendor/omnipay/securepay/src/Message/DirectPostCompletePurchaseRequest.php on line 33
我是否遗漏了添加这些缺失数据的步骤?或者这些数据应该在回复中返回
代码:
$params = array(
'amount' => $data->payment['amount'] . '.00',
'currency' => $this->getOptions()->getCurrency(),
'description' => 'test purchase',
'transactionId' => '12345',
'transactionReference' => $data->course['course_code'],
'returnUrl' => 'http://test.localhost/register/55622/confirmation',
'cancelUrl' => 'http://test.localhost/register/55622/summary',
'card'=>$card
);
$gateway = new DirectPostGateway();
$gateway->setMerchantId( $this->getOptions()->getGateway( $type )['merchant_id'] );
$gateway->setTransactionPassword( $this->getOptions()->getGateway( $type )['password'] );
$gateway->setTestMode( $this->getOptions()->getTestMode() );
$response = $gateway->purchase($params)->send();
var_dump($response->getRedirectData());
$response = $gateway->completePurchase($params)->send();
var_dump($response);
//"Invalid fingerprint" exception thrown
if ($response->isSuccessful()) {
// payment was successful: update database
return $response;
} elseif ($response->isRedirect()) {
// redirect to offsite payment gateway
if($response->getRedirectData()){
var_dump($response->getRedirectData());
} else {
return $response->redirect();
}
exit;
return $response->redirect();
} else {
// payment failed: display message to customer
// echo $response->getMessage();
throw new Exception("Error Processing Request", 1);
}
你做的事情是正确的。当SecurePay返回您的网站时,应该会有包含这些参数的POST数据,以及确认请求真实性的
指纹
参数
在使用SecurePay付款时,我会查看浏览器的网络选项卡,并在付款完成后检查HTTP POST数据(并重定向到您的站点)。我的猜测是,一些htaccess或其他脚本正在进行第二次重定向,同时剥离重要的POST数据
Omnipay将自动检查POST数据,因此无需显式发送。只要您从同一请求调用completepourchase()
,它就应该正确处理付款
请参阅:Securepay正在使用endpoint,然后切换到我原本以为问题已经解决,但意识到我仍然收到了错误。从securepay返回的数据是通过GET返回的,帖子为空。我在您列出的类中进行了一些调试,$this->httpRequest->request->all()为空,而$this->httpRequest->query->all()具有来自网关的数据。通过更改类以使用查询,我可以完成事务。你认为这是类中的一个bug,还是数据应该返回到帖子中?这是我的问题。谢谢如果他们用这个新端点更新文档,那就太好了。顺便说一下,完整的url是