mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Working on token billing
'
This commit is contained in:
parent
5dc0fcca0d
commit
a9f2f35d55
@ -109,7 +109,22 @@ class AuthorizeCreditCard
|
|||||||
$payment = $this->createPaymentRecord($data, $amount);
|
$payment = $this->createPaymentRecord($data, $amount);
|
||||||
|
|
||||||
$this->authorize->attachInvoices($payment, $invoice->hashed_id);
|
$this->authorize->attachInvoices($payment, $invoice->hashed_id);
|
||||||
//up to here
|
|
||||||
|
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||||
|
|
||||||
|
$vars = [
|
||||||
|
'hashed_ids' => $invoice->hashed_id,
|
||||||
|
'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_SUCCESS, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -160,9 +175,14 @@ class AuthorizeCreditCard
|
|||||||
|
|
||||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||||
|
|
||||||
|
$vars = [
|
||||||
|
'hashed_ids' => $request->input('hashed_ids'),
|
||||||
|
'amount' => $request->input('amount')
|
||||||
|
];
|
||||||
|
|
||||||
$logger_message = [
|
$logger_message = [
|
||||||
'server_response' => $response->getTransactionResponse()->getTransId(),
|
'server_response' => $response->getTransactionResponse()->getTransId(),
|
||||||
'data' => $this->formatGatewayResponse($data, $request)
|
'data' => $this->formatGatewayResponse($data, $vars)
|
||||||
];
|
];
|
||||||
|
|
||||||
SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||||
@ -176,17 +196,17 @@ class AuthorizeCreditCard
|
|||||||
info(print_r($data,1));
|
info(print_r($data,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function formatGatewayResponse($data, $request)
|
private function formatGatewayResponse($data, $vars)
|
||||||
{
|
{
|
||||||
$response = $data['response'];
|
$response = $data['response'];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'transaction_reference' => $response->getTransactionResponse()->getTransId(),
|
'transaction_reference' => $response->getTransactionResponse()->getTransId(),
|
||||||
'amount' => $request->input('amount'),
|
'amount' => $vars['amount'],
|
||||||
'auth_code' => $response->getTransactionResponse()->getAuthCode(),
|
'auth_code' => $response->getTransactionResponse()->getAuthCode(),
|
||||||
'code' => $response->getTransactionResponse()->getMessages()[0]->getCode(),
|
'code' => $response->getTransactionResponse()->getMessages()[0]->getCode(),
|
||||||
'description' => $response->getTransactionResponse()->getMessages()[0]->getDescription(),
|
'description' => $response->getTransactionResponse()->getMessages()[0]->getDescription(),
|
||||||
'invoices' => $request->hashed_ids,
|
'invoices' => $vars['hashed_ids'],
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user