diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index 39712889fc3b..e0dec9726c3e 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -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) diff --git a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php index a8edbbca6579..186e89ee49c4 100644 --- a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php +++ b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php @@ -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'], ]; } diff --git a/tests/Integration/PaymentDrivers/AuthorizeTest.php b/tests/Integration/PaymentDrivers/AuthorizeTest.php index 54928a2beef2..33934756a289 100644 --- a/tests/Integration/PaymentDrivers/AuthorizeTest.php +++ b/tests/Integration/PaymentDrivers/AuthorizeTest.php @@ -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();