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;
|
protected $db;
|
||||||
|
|
||||||
|
public $tries = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new job instance.
|
* Create a new job instance.
|
||||||
*
|
*
|
||||||
@ -64,7 +66,6 @@ class SendRecurring implements ShouldQueue
|
|||||||
->applyNumber()
|
->applyNumber()
|
||||||
->createInvitations()
|
->createInvitations()
|
||||||
->fillDefaults()
|
->fillDefaults()
|
||||||
->setExchangeRate()
|
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
nlog("Invoice {$invoice->number} created");
|
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");
|
nlog("updating recurring invoice dates");
|
||||||
/* Set next date here to prevent a recurring loop forming */
|
/* Set next date here to prevent a recurring loop forming */
|
||||||
$this->recurring_invoice->next_send_date = $this->recurring_invoice->nextSendDate()->format('Y-m-d');
|
$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();
|
$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)
|
public function failed($exception = null)
|
||||||
|
@ -211,12 +211,17 @@ class AuthorizeCreditCard
|
|||||||
{
|
{
|
||||||
$response = $data['response'];
|
$response = $data['response'];
|
||||||
|
|
||||||
|
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'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -310,6 +310,28 @@ class AuthorizeTest extends TestCase
|
|||||||
$controller = new CreateTransactionController($request);
|
$controller = new CreateTransactionController($request);
|
||||||
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
$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 != null) {
|
||||||
if ($response->getMessages()->getResultCode() == 'Ok') {
|
if ($response->getMessages()->getResultCode() == 'Ok') {
|
||||||
$tresponse = $response->getTransactionResponse();
|
$tresponse = $response->getTransactionResponse();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user