1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

fixes for eWay

This commit is contained in:
David Bomba 2022-03-08 19:43:48 +11:00
parent e7f2582986
commit 62b1591a9f

View File

@ -146,9 +146,22 @@ class CreditCard
}
$invoice_numbers = '';
if($this->eway_driver->payment_hash->data)
$invoice_numbers = collect($this->eway_driver->payment_hash->data->invoices)->pluck('invoice_number')->implode(',');
$amount = array_sum(array_column($this->eway_driver->payment_hash->invoices(), 'amount')) + $this->eway_driver->payment_hash->fee_total;
$description = "Invoices: {$invoice_numbers} for {$amount} for client {$this->eway_driver->client->present()->name()}";
$transaction = [
'Payment' => [
'TotalAmount' => $this->convertAmountForEway(),
'CurrencyCode' => $this->eway_driver->client->currency()->code,
'InvoiceNumber' => $invoice_numbers,
'Description' => $description,
'InvoiceReference' => $description,
],
'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
'SecuredCardData' => $request->input('securefieldcode'),
@ -225,12 +238,22 @@ class CreditCard
{
$amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;
if($this->eway_driver->payment_hash->data)
$invoice_numbers = collect($this->eway_driver->payment_hash->data->invoices)->pluck('invoice_number')->implode(',');
$description = "Invoices: {$invoice_numbers} for {$amount} for client {$this->eway_driver->client->present()->name()}";
$transaction = [
'Customer' => [
'TokenCustomerID' => $token,
],
'Payment' => [
'TotalAmount' => $this->convertAmountForEway($amount),
'CurrencyCode' => $this->eway_driver->client->currency()->code,
'InvoiceNumber' => $invoice_numbers,
'Description' => $description,
'InvoiceReference' => $description,
],
'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING,
];