mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for authorize credit cards
This commit is contained in:
parent
96c191daf0
commit
9377b9cae4
@ -35,6 +35,8 @@ class SendRecurring implements ShouldQueue
|
||||
|
||||
protected $db;
|
||||
|
||||
public $tries = 1;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
@ -64,7 +66,6 @@ class SendRecurring implements ShouldQueue
|
||||
->applyNumber()
|
||||
->createInvitations()
|
||||
->fillDefaults()
|
||||
->setExchangeRate()
|
||||
->save();
|
||||
|
||||
nlog("Invoice {$invoice->number} created");
|
||||
@ -76,16 +77,6 @@ class SendRecurring implements ShouldQueue
|
||||
}
|
||||
});
|
||||
|
||||
//Admin notification for recurring invoice sent.
|
||||
if ($invoice->invitations->count() >= 1) {
|
||||
$invoice->entityEmailEvent($invoice->invitations->first(), 'invoice', 'email_template_invoice');
|
||||
}
|
||||
|
||||
if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $this->recurring_invoice->auto_bill_enabled) {
|
||||
nlog("attempting to autobill {$invoice->number}");
|
||||
$invoice->service()->autoBill()->save();
|
||||
}
|
||||
|
||||
nlog("updating recurring invoice dates");
|
||||
/* Set next date here to prevent a recurring loop forming */
|
||||
$this->recurring_invoice->next_send_date = $this->recurring_invoice->nextSendDate()->format('Y-m-d');
|
||||
@ -103,6 +94,17 @@ class SendRecurring implements ShouldQueue
|
||||
|
||||
$this->recurring_invoice->save();
|
||||
|
||||
//Admin notification for recurring invoice sent.
|
||||
if ($invoice->invitations->count() >= 1) {
|
||||
$invoice->entityEmailEvent($invoice->invitations->first(), 'invoice', 'email_template_invoice');
|
||||
}
|
||||
|
||||
if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $this->recurring_invoice->auto_bill_enabled) {
|
||||
nlog("attempting to autobill {$invoice->number}");
|
||||
$invoice->service()->autoBill()->save();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function failed($exception = null)
|
||||
|
@ -211,12 +211,17 @@ class AuthorizeCreditCard
|
||||
{
|
||||
$response = $data['response'];
|
||||
|
||||
if($response->getTransactionResponse()->getMessages() !== null){
|
||||
$code = $response->getTransactionResponse()->getMessages()[0]->getCode();
|
||||
$description = $response->getTransactionResponse()->getMessages()[0]->getDescription();
|
||||
}
|
||||
|
||||
return [
|
||||
'transaction_reference' => $response->getTransactionResponse()->getTransId(),
|
||||
'amount' => $vars['amount'],
|
||||
'auth_code' => $response->getTransactionResponse()->getAuthCode(),
|
||||
'code' => $response->getTransactionResponse()->getMessages()[0]->getCode(),
|
||||
'description' => $response->getTransactionResponse()->getMessages()[0]->getDescription(),
|
||||
'code' => $code,
|
||||
'description' => $description,
|
||||
'invoices' => $vars['invoices'],
|
||||
];
|
||||
}
|
||||
|
@ -310,6 +310,28 @@ class AuthorizeTest extends TestCase
|
||||
$controller = new CreateTransactionController($request);
|
||||
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
||||
|
||||
// nlog($response);
|
||||
nlog($response->getTransactionResponse()->getMessages() !== null);
|
||||
nlog($response->getTransactionResponse()->getMessages());
|
||||
nlog($response->getTransactionResponse()->getMessages()[0]);
|
||||
//nlog($response->getTransactionResponse()->getMessages()[0]->getCode());
|
||||
|
||||
$code = '';
|
||||
$description = '';
|
||||
|
||||
if($response->getTransactionResponse()->getMessages() !== null){
|
||||
$code = $response->getTransactionResponse()->getMessages()[0]->getCode();
|
||||
$description = $response->getTransactionResponse()->getMessages()[0]->getDescription();
|
||||
}
|
||||
|
||||
$log = [
|
||||
'transaction_reference' => $response->getTransactionResponse()->getTransId(),
|
||||
'auth_code' => $response->getTransactionResponse()->getAuthCode(),
|
||||
'code' => $code,
|
||||
'description' => $description,
|
||||
];
|
||||
|
||||
|
||||
if ($response != null) {
|
||||
if ($response->getMessages()->getResultCode() == 'Ok') {
|
||||
$tresponse = $response->getTransactionResponse();
|
||||
|
Loading…
x
Reference in New Issue
Block a user