mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 20:14:31 -04:00
Support customizing ‘gateway fee’ label
This commit is contained in:
parent
36f2ddb3f5
commit
73e2f070a9
@ -251,6 +251,8 @@ class Account extends Eloquent
|
|||||||
'description',
|
'description',
|
||||||
'discount',
|
'discount',
|
||||||
'due_date',
|
'due_date',
|
||||||
|
'gateway_fee_item',
|
||||||
|
'gateway_fee_description',
|
||||||
'hours',
|
'hours',
|
||||||
'id_number',
|
'id_number',
|
||||||
'invoice',
|
'invoice',
|
||||||
|
@ -1310,10 +1310,23 @@ class InvoiceRepository extends BaseRepository
|
|||||||
|
|
||||||
$data = $invoice->toArray();
|
$data = $invoice->toArray();
|
||||||
$fee = $invoice->calcGatewayFee($gatewayTypeId);
|
$fee = $invoice->calcGatewayFee($gatewayTypeId);
|
||||||
|
$date = $account->getDateTime()->format($account->getCustomDateFormat());
|
||||||
|
$feeItemLabel = $account->getLabel('gateway_fee_item') ?: ($fee >= 0 ? trans('texts.surcharge') : trans('texts.discount'));
|
||||||
|
|
||||||
|
if ($feeDescriptionLabel = $account->getLabel('gateway_fee_description')) {
|
||||||
|
if (strpos($feeDescriptionLabel, '$date') !== false) {
|
||||||
|
$feeDescriptionLabel = str_replace('$date', $date, $feeDescriptionLabel);
|
||||||
|
} else {
|
||||||
|
$feeDescriptionLabel .= ' • ' . $date;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$feeDescriptionLabel = $fee >= 0 ? trans('texts.online_payment_surcharge') : trans('texts.online_payment_discount');
|
||||||
|
$feeDescriptionLabel .= ' • ' . $date;
|
||||||
|
}
|
||||||
|
|
||||||
$item = [];
|
$item = [];
|
||||||
$item['product_key'] = $fee >= 0 ? trans('texts.surcharge') : trans('texts.discount');
|
$item['product_key'] = $feeItemLabel;
|
||||||
$item['notes'] = $fee >= 0 ? trans('texts.online_payment_surcharge') : trans('texts.online_payment_discount');
|
$item['notes'] = $feeDescriptionLabel;
|
||||||
$item['qty'] = 1;
|
$item['qty'] = 1;
|
||||||
$item['cost'] = $fee;
|
$item['cost'] = $fee;
|
||||||
$item['tax_rate1'] = $settings->fee_tax_rate1;
|
$item['tax_rate1'] = $settings->fee_tax_rate1;
|
||||||
|
@ -2836,6 +2836,8 @@ $LANG = array(
|
|||||||
'proposal_editor' => 'proposal editor',
|
'proposal_editor' => 'proposal editor',
|
||||||
'background' => 'Background',
|
'background' => 'Background',
|
||||||
'guide' => 'Guide',
|
'guide' => 'Guide',
|
||||||
|
'gateway_fee_item' => 'Gateway Fee Item',
|
||||||
|
'gateway_fee_description' => 'Gateway Fee Surcharge',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user