1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Support customizing ‘gateway fee’ label

This commit is contained in:
Hillel Coren 2018-04-15 13:21:16 +03:00
parent 36f2ddb3f5
commit 73e2f070a9
3 changed files with 19 additions and 2 deletions

View File

@ -251,6 +251,8 @@ class Account extends Eloquent
'description',
'discount',
'due_date',
'gateway_fee_item',
'gateway_fee_description',
'hours',
'id_number',
'invoice',

View File

@ -1310,10 +1310,23 @@ class InvoiceRepository extends BaseRepository
$data = $invoice->toArray();
$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['product_key'] = $fee >= 0 ? trans('texts.surcharge') : trans('texts.discount');
$item['notes'] = $fee >= 0 ? trans('texts.online_payment_surcharge') : trans('texts.online_payment_discount');
$item['product_key'] = $feeItemLabel;
$item['notes'] = $feeDescriptionLabel;
$item['qty'] = 1;
$item['cost'] = $fee;
$item['tax_rate1'] = $settings->fee_tax_rate1;

View File

@ -2836,6 +2836,8 @@ $LANG = array(
'proposal_editor' => 'proposal editor',
'background' => 'Background',
'guide' => 'Guide',
'gateway_fee_item' => 'Gateway Fee Item',
'gateway_fee_description' => 'Gateway Fee Surcharge',
);