1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

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);
$response = $controller->executeWithApiResponse($this->authorize->mode());
if($response != null &&$response->getMessages()->getResultCode() == "Ok")
{
$tresponse = $response->getTransactionResponse();
if ($tresponse != null && $tresponse->getMessages() != null)
{
echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
echo "Charge Customer Profile APPROVED :" . "\n";
echo " Charge Customer Profile AUTH CODE : " . $tresponse->getAuthCode() . "\n";
echo " Charge Customer Profile TRANS ID : " . $tresponse->getTransId() . "\n";
echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n";
echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
info(" Transaction Response code : " . $tresponse->getResponseCode() );
info( "Charge Customer Profile APPROVED :" );
info(" Charge Customer Profile AUTH CODE : " . $tresponse->getAuthCode() );
info(" Charge Customer Profile TRANS ID : " . $tresponse->getTransId() );
info(" Code : " . $tresponse->getMessages()[0]->getCode() );
info(" Description : " . $tresponse->getMessages()[0]->getDescription() );
}
else
{
echo "Transaction Failed \n";
info("Transaction Failed \n";
if($tresponse->getErrors() != null)
{
echo " Error code : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
info(" Error code : " . $tresponse->getErrors()[0]->getErrorCode() );
info(" Error message : " . $tresponse->getErrors()[0]->getErrorText() );
}
}
}
else
{
echo "Transaction Failed \n";
info("Transaction Failed \n";
$tresponse = $response->getTransactionResponse();
if($tresponse != null && $tresponse->getErrors() != null)
{
echo " Error code : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
info(" Error code : " . $tresponse->getErrors()[0]->getErrorCode() );
info(" Error message : " . $tresponse->getErrors()[0]->getErrorText() );
}
else
{
echo " Error code : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
}
info(" Error code : " . $response->getMessages()->getMessage()[0]->getCode() );
info(" Error message : " . $response->getMessages()->getMessage()[0]->getText() );
}
}
return $response;
}
}