mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Send payment line item details
This commit is contained in:
parent
1b7ddc0e4e
commit
2542b1a640
@ -10,6 +10,7 @@ use App\Models\GatewayType;
|
|||||||
use App\Models\License;
|
use App\Models\License;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentMethod;
|
use App\Models\PaymentMethod;
|
||||||
|
use Omnipay\Common\Item;
|
||||||
use CreditCard;
|
use CreditCard;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Exception;
|
use Exception;
|
||||||
@ -304,7 +305,10 @@ class BasePaymentDriver
|
|||||||
|
|
||||||
// prepare and process payment
|
// prepare and process payment
|
||||||
$data = $this->paymentDetails($paymentMethod);
|
$data = $this->paymentDetails($paymentMethod);
|
||||||
$response = $gateway->purchase($data)->send();
|
$items = $this->paymentItems();
|
||||||
|
$response = $gateway->purchase($data)
|
||||||
|
->setItems($items)
|
||||||
|
->send();
|
||||||
$this->purchaseResponse = (array) $response->getData();
|
$this->purchaseResponse = (array) $response->getData();
|
||||||
|
|
||||||
// parse the transaction reference
|
// parse the transaction reference
|
||||||
@ -337,6 +341,38 @@ class BasePaymentDriver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function paymentItems()
|
||||||
|
{
|
||||||
|
$invoice = $this->invoice();
|
||||||
|
$items = [];
|
||||||
|
$total = 0;
|
||||||
|
|
||||||
|
foreach ($invoice->invoice_items as $invoiceItem) {
|
||||||
|
$item = new Item([
|
||||||
|
'name' => $invoiceItem->product_key,
|
||||||
|
'description' => $invoiceItem->notes,
|
||||||
|
'price' => $invoiceItem->cost,
|
||||||
|
'quantity' => $invoiceItem->qty,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$items[] = $item;
|
||||||
|
$total += $invoiceItem->cost * $invoiceItem->qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($total != $invoice->getRequestedAmount()) {
|
||||||
|
$item = new Item([
|
||||||
|
'name' => trans('texts.other'),
|
||||||
|
'description' => '',
|
||||||
|
'price' => $invoice->getRequestedAmount() - $total,
|
||||||
|
'quantity' => 1,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$items[] = $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
private function updateClient()
|
private function updateClient()
|
||||||
{
|
{
|
||||||
if (! $this->isGatewayType(GATEWAY_TYPE_CREDIT_CARD)) {
|
if (! $this->isGatewayType(GATEWAY_TYPE_CREDIT_CARD)) {
|
||||||
|
@ -2288,6 +2288,7 @@ $LANG = array(
|
|||||||
'deleted_recurring_expense' => 'Successfully deleted project',
|
'deleted_recurring_expense' => 'Successfully deleted project',
|
||||||
'deleted_recurring_expense' => 'Successfully deleted :count projects',
|
'deleted_recurring_expense' => 'Successfully deleted :count projects',
|
||||||
'view_recurring_expense' => 'View Recurring Expense',
|
'view_recurring_expense' => 'View Recurring Expense',
|
||||||
|
'other' => 'Other',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user