2

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

2 に答える 2