【问题标题】:Invalid fingerprint exception when processing through securepay using omnipay使用omnipay 通过securepay 处理时出现无效指纹异常
【发布时间】:2014-07-14 18:11:40
【问题描述】:

我正在尝试了解使用 Omnipay/SecurePay 的付款流程,但在尝试完成购买时总是出错。

从在线文档中我可以看到,completePurchase 函数应该使用与 purchase 函数相同的参数调用,但是当我调用 completePurchase 时,我收到“无效指纹”异常。

还会抛出这些错误:

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);
}

【问题讨论】:

    标签: zend-framework2 omnipay


    【解决方案1】:

    你做事正确。当 SecurePay 返回您的网站时,应该有包含这些参数的 POST 数据,以及确认请求真实性的 fingerprint 参数。

    我会在使用 SecurePay 付款时查看您浏览器的“网络”选项卡,并在付款完成(并重定向到您的网站)后检查 HTTP POST 数据。我的猜测是某些 htaccess 或其他脚本正在进行第二次重定向,并同时剥离重要的 POST 数据。

    Omnipay 会自动检查 POST 数据,因此无需明确发送。只要您从同一个请求中调用completePurchase(),它就应该正确处理付款。

    见:https://github.com/omnipay/securepay/blob/master/src/Message/DirectPostCompletePurchaseRequest.php

    【讨论】:

    • 我原本以为问题已解决,但意识到我仍然收到错误消息。从securepay返回的数据是通过GET和POST是空的。我在您列出的类中进行了一些调试,并且 $this->httpRequest->request->all() 为空,而 $this->httpRequest->query->all() 具有来自网关的数据。通过更改类以使用查询,我能够完成交易。您认为这是类中的错误还是预期会在 POST 中返回数据?
    【解决方案2】:

    Securepay 使用端点https://test.securepay.com.au,然后切换到https://test.api.securepay.com.au

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多