Charge Payment Profile

This commit is contained in:
David Bomba 2020-06-16 15:36:09 +10:00
parent ff82d7df06
commit 0951526fb3

View File

@ -60,45 +60,46 @@ class ChargePaymentProfile
$controller = new CreateTransactionController($request); $controller = new CreateTransactionController($request);
$response = $controller->executeWithApiResponse($this->authorize->mode()); $response = $controller->executeWithApiResponse($this->authorize->mode());
if($response != null &&$response->getMessages()->getResultCode() == "Ok") if($response != null &&$response->getMessages()->getResultCode() == "Ok")
{ {
$tresponse = $response->getTransactionResponse(); $tresponse = $response->getTransactionResponse();
if ($tresponse != null && $tresponse->getMessages() != null) if ($tresponse != null && $tresponse->getMessages() != null)
{ {
echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n"; info(" Transaction Response code : " . $tresponse->getResponseCode() );
echo "Charge Customer Profile APPROVED :" . "\n"; info( "Charge Customer Profile APPROVED :" );
echo " Charge Customer Profile AUTH CODE : " . $tresponse->getAuthCode() . "\n"; info(" Charge Customer Profile AUTH CODE : " . $tresponse->getAuthCode() );
echo " Charge Customer Profile TRANS ID : " . $tresponse->getTransId() . "\n"; info(" Charge Customer Profile TRANS ID : " . $tresponse->getTransId() );
echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; info(" Code : " . $tresponse->getMessages()[0]->getCode() );
echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n"; info(" Description : " . $tresponse->getMessages()[0]->getDescription() );
} }
else else
{ {
echo "Transaction Failed \n"; info("Transaction Failed \n";
if($tresponse->getErrors() != null) if($tresponse->getErrors() != null)
{ {
echo " Error code : " . $tresponse->getErrors()[0]->getErrorCode() . "\n"; info(" Error code : " . $tresponse->getErrors()[0]->getErrorCode() );
echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n"; info(" Error message : " . $tresponse->getErrors()[0]->getErrorText() );
} }
} }
} }
else else
{ {
echo "Transaction Failed \n"; info("Transaction Failed \n";
$tresponse = $response->getTransactionResponse(); $tresponse = $response->getTransactionResponse();
if($tresponse != null && $tresponse->getErrors() != null) if($tresponse != null && $tresponse->getErrors() != null)
{ {
echo " Error code : " . $tresponse->getErrors()[0]->getErrorCode() . "\n"; info(" Error code : " . $tresponse->getErrors()[0]->getErrorCode() );
echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n"; info(" Error message : " . $tresponse->getErrors()[0]->getErrorText() );
} }
else else
{ {
echo " Error code : " . $response->getMessages()->getMessage()[0]->getCode() . "\n"; info(" Error code : " . $response->getMessages()->getMessage()[0]->getCode() );
echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n"; info(" Error message : " . $response->getMessages()->getMessage()[0]->getText() );
} }
} }
return $response;
} }
} }