diff --git a/app/Models/Account.php b/app/Models/Account.php index 4222fde64ae1..d2b41875e754 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -251,6 +251,8 @@ class Account extends Eloquent 'description', 'discount', 'due_date', + 'gateway_fee_item', + 'gateway_fee_description', 'hours', 'id_number', 'invoice', diff --git a/app/Ninja/Repositories/InvoiceRepository.php b/app/Ninja/Repositories/InvoiceRepository.php index e44fe739fa82..9d405d1c1ce3 100644 --- a/app/Ninja/Repositories/InvoiceRepository.php +++ b/app/Ninja/Repositories/InvoiceRepository.php @@ -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; diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 1f8922fc6e2c..2e4b45d5eeec 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -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', );