From c85d36a31cd15e8d06f9dfc7d2591f918d278d89 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Fri, 11 May 2018 11:29:36 -0400 Subject: RT# 79737 - Added ability to us a cc surcharge of a flat fee. Conflicts: FS/FS/cust_main/Billing_Realtime.pm httemplate/elements/tr-select-payment_options.html --- httemplate/elements/tr-amount_fee.html | 3 + httemplate/elements/tr-select-payment_options.html | 99 ++++++++++++++++++++++ httemplate/misc/payment.cgi | 5 ++ 3 files changed, 107 insertions(+) create mode 100644 httemplate/elements/tr-select-payment_options.html (limited to 'httemplate') diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html index 12488521a..e3b8d7800 100644 --- a/httemplate/elements/tr-amount_fee.html +++ b/httemplate/elements/tr-amount_fee.html @@ -94,6 +94,9 @@ if ( $amount > 0 ) { $amount += $amount * $opt{'surcharge_percentage'}/100 if $opt{'surcharge_percentage'} > 0; + $amount += $opt{'surcharge_flatfee'} + if $opt{'surcharge_flatfee'} > 0; + $amount = sprintf("%.2f", $amount); } diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html new file mode 100644 index 000000000..8859b9b36 --- /dev/null +++ b/httemplate/elements/tr-select-payment_options.html @@ -0,0 +1,99 @@ +<%doc> + +Example: + + include( '/elements/tr-select-payment_options.html', + + #opt - most get used in /elements/tr-amount-fee + 'custnum' => 4, # customer number needed for selecting invoices + 'prefix' => 'pre', # prefix to fields and row ID's + 'amount' => 1, # payment amount + 'process-pkgpart' => scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)), + 'process-display' => scalar($conf->config('manual_process-display')), + 'process-skip_first' => $conf->exists('manual_process-skip_first'), + 'num_payments' => scalar($cust_main->cust_pay), + 'surcharge_percentage' => + ( $payby eq 'CARD' + ? scalar($conf->config('credit-card-surcharge-percentage', $cust_main->agentnum)) + : 0 + ), + 'surcharge_flatfee' => + ( $payby eq 'CARD' + ? scalar($conf->config('credit-card-surcharge-flatfee', $cust_main->agentnum)) + : 0 + ), + ) + + + + + <% mt('Payment options') |h %> + + + + + + <& /elements/tr-select-invoice.html, + 'custnum' => $opt{custnum}, + 'prefix' => $opt{prefix}, + &> + + <& /elements/tr-amount_fee.html, + 'row_style' => 'STYLE="display:none;"', + %opt + &> + + + +<%init> + +my %opt = @_; + + \ No newline at end of file diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 4fa3df773..36ae77bdf 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -22,6 +22,11 @@ ? scalar($conf->config('credit-card-surcharge-percentage', $cust_main->agentnum)) : 0 ), + 'surcharge_flatfee:Q' => + ( $payby eq 'CARD' + ? scalar($conf->config('credit-card-surcharge-flatfee', $cust_main->agentnum)) + : 0 + ), &> % if ( $conf->exists('part_pkg-term_discounts') ) { -- cgit v1.2.1