mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 14:44:32 -04:00
Merge pull request #4765 from turbo124/v5-develop
Fixes for auth.net auto billing
This commit is contained in:
commit
88bac69e13
@ -1 +1 @@
|
||||
5.0.53
|
||||
5.0.54
|
@ -87,7 +87,7 @@ class AuthorizeCreditCard
|
||||
return $this->handleResponse($data, $request);
|
||||
}
|
||||
|
||||
private function tokenBilling($cgt, $payment_hash)
|
||||
public function tokenBilling($cgt, $payment_hash)
|
||||
{
|
||||
$amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;
|
||||
|
||||
@ -95,10 +95,13 @@ class AuthorizeCreditCard
|
||||
|
||||
/*Refactor and push to BaseDriver*/
|
||||
if ($data['response'] != null && $data['response']->getMessages()->getResultCode() == 'Ok') {
|
||||
|
||||
$response = $data['response'];
|
||||
|
||||
$this->storePayment($payment_hash, $data);
|
||||
|
||||
$vars = [
|
||||
'hashed_ids' => $invoice->hashed_id,
|
||||
'invoices' => $payment_hash->invoices(),
|
||||
'amount' => $amount,
|
||||
];
|
||||
|
||||
@ -111,6 +114,19 @@ class AuthorizeCreditCard
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
||||
$vars = [
|
||||
'invoices' => $payment_hash->invoices(),
|
||||
'amount' => $amount,
|
||||
];
|
||||
|
||||
$logger_message = [
|
||||
'server_response' => $response->getTransactionResponse()->getTransId(),
|
||||
'data' => $this->formatGatewayResponse($data, $vars),
|
||||
];
|
||||
|
||||
SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -138,7 +154,7 @@ class AuthorizeCreditCard
|
||||
$payment_record = [];
|
||||
$payment_record['amount'] = $amount;
|
||||
$payment_record['payment_type'] = PaymentType::CREDIT_CARD_OTHER;
|
||||
;
|
||||
|
||||
$payment_record['transaction_reference'] = $response->getTransactionResponse()->getTransId();
|
||||
|
||||
$payment = $this->authorize->createPayment($payment_record);
|
||||
|
@ -12,7 +12,9 @@
|
||||
|
||||
namespace App\PaymentDrivers\Authorize;
|
||||
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\Payment;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\AuthorizePaymentDriver;
|
||||
use net\authorize\api\contract\v1\CreateTransactionRequest;
|
||||
use net\authorize\api\contract\v1\CustomerProfilePaymentType;
|
||||
@ -73,61 +75,105 @@ class RefundTransaction
|
||||
$tresponse = $response->getTransactionResponse();
|
||||
|
||||
if ($tresponse != null && $tresponse->getMessages() != null) {
|
||||
return [
|
||||
'transaction_reference' => $tresponse->getTransId(),
|
||||
'success' => true,
|
||||
'description' => $tresponse->getMessages()[0]->getDescription(),
|
||||
'code' => $tresponse->getMessages()[0]->getCode(),
|
||||
'transaction_response' => $tresponse->getResponseCode(),
|
||||
];
|
||||
|
||||
$data = [
|
||||
'transaction_reference' => $tresponse->getTransId(),
|
||||
'success' => true,
|
||||
'description' => $tresponse->getMessages()[0]->getDescription(),
|
||||
'code' => $tresponse->getMessages()[0]->getCode(),
|
||||
'transaction_response' => $tresponse->getResponseCode(),
|
||||
'payment_id' => $payment->id,
|
||||
'amount' => $amount,
|
||||
];
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
} else {
|
||||
|
||||
if ($tresponse->getErrors() != null) {
|
||||
return [
|
||||
'transaction_reference' => '',
|
||||
'transaction_response' => '',
|
||||
'success' => false,
|
||||
'description' => $tresponse->getErrors()[0]->getErrorText(),
|
||||
'code' => $tresponse->getErrors()[0]->getErrorCode(),
|
||||
];
|
||||
|
||||
$data = [
|
||||
'transaction_reference' => '',
|
||||
'transaction_response' => '',
|
||||
'success' => false,
|
||||
'description' => $tresponse->getErrors()[0]->getErrorText(),
|
||||
'code' => $tresponse->getErrors()[0]->getErrorCode(),
|
||||
'payment_id' => $payment->id,
|
||||
'amount' => $amount,
|
||||
];
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "Transaction Failed \n";
|
||||
$tresponse = $response->getTransactionResponse();
|
||||
if ($tresponse != null && $tresponse->getErrors() != null) {
|
||||
return [
|
||||
'transaction_reference' => '',
|
||||
'transaction_response' => '',
|
||||
'success' => false,
|
||||
'description' => $tresponse->getErrors()[0]->getErrorText(),
|
||||
'code' => $tresponse->getErrors()[0]->getErrorCode(),
|
||||
];
|
||||
|
||||
$data = [
|
||||
'transaction_reference' => '',
|
||||
'transaction_response' => '',
|
||||
'success' => false,
|
||||
'description' => $tresponse->getErrors()[0]->getErrorText(),
|
||||
'code' => $tresponse->getErrors()[0]->getErrorCode(),
|
||||
'payment_id' => $payment->id,
|
||||
'amount' => $amount,
|
||||
];
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||
|
||||
return $data;
|
||||
|
||||
} else {
|
||||
return [
|
||||
'transaction_reference' => '',
|
||||
'transaction_response' => '',
|
||||
'success' => false,
|
||||
'description' => $response->getMessages()->getMessage()[0]->getText(),
|
||||
'code' => $response->getMessages()->getMessage()[0]->getCode(),
|
||||
];
|
||||
|
||||
$data = [
|
||||
'transaction_reference' => '',
|
||||
'transaction_response' => '',
|
||||
'success' => false,
|
||||
'description' => $response->getMessages()->getMessage()[0]->getText(),
|
||||
'code' => $response->getMessages()->getMessage()[0]->getCode(),
|
||||
'payment_id' => $payment->id,
|
||||
'amount' => $amount,
|
||||
];
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
|
||||
$data = [
|
||||
'transaction_reference' => '',
|
||||
'transaction_response' => '',
|
||||
'success' => false,
|
||||
'description' => 'No response returned',
|
||||
'code' => 'No response returned',
|
||||
'payment_id' => $payment->id,
|
||||
'amount' => $amount,
|
||||
];
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
return [
|
||||
'transaction_reference' => '',
|
||||
'transaction_response' => '',
|
||||
'success' => false,
|
||||
'description' => 'No response returned',
|
||||
'code' => 'No response returned',
|
||||
];
|
||||
$data = [
|
||||
'transaction_reference' => '',
|
||||
'transaction_response' => '',
|
||||
'success' => false,
|
||||
'description' => 'No response returned',
|
||||
'code' => 'No response returned',
|
||||
'payment_id' => $payment->id,
|
||||
'amount' => $amount,
|
||||
];
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +104,8 @@ class AuthorizePaymentDriver extends BaseDriver
|
||||
|
||||
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
|
||||
{
|
||||
$this->setPaymentHash($payment_hash);
|
||||
|
||||
$this->setPaymentMethod($cgt->gateway_type_id);
|
||||
|
||||
return $this->payment_method->tokenBilling($cgt, $payment_hash);
|
||||
|
@ -13,7 +13,7 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', ''),
|
||||
'app_version' => '5.0.53',
|
||||
'app_version' => '5.0.54',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', false),
|
||||
|
Loading…
x
Reference in New Issue
Block a user