Update AuthorizeCreditCard.php

This commit is contained in:
David Bomba 2021-03-30 14:23:29 +11:00 committed by GitHub
parent 63c0363f19
commit 26966090a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,12 +211,20 @@ class AuthorizeCreditCard
{ {
$response = $data['response']; $response = $data['response'];
$code = '';
$description = '';
if($response->getTransactionResponse()->getMessages() !== null){
$code = $response->getTransactionResponse()->getMessages()[0]->getCode();
$description = $response->getTransactionResponse()->getMessages()[0]->getDescription();
}
return [ return [
'transaction_reference' => $response->getTransactionResponse()->getTransId(), 'transaction_reference' => $response->getTransactionResponse()->getTransId(),
'amount' => $vars['amount'], 'amount' => $vars['amount'],
'auth_code' => $response->getTransactionResponse()->getAuthCode(), 'auth_code' => $response->getTransactionResponse()->getAuthCode(),
'code' => $response->getTransactionResponse()->getMessages()[0]->getCode(), 'code' => $code,
'description' => $response->getTransactionResponse()->getMessages()[0]->getDescription(), 'description' => $description,
'invoices' => $vars['invoices'], 'invoices' => $vars['invoices'],
]; ];
} }