From 94b60bb13c044e436800239be3e3c5a029bdff8e Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Mon, 5 Nov 2018 17:44:50 -0500 Subject: RT# 76093 - Added ability to charge a processing fee when taking a payment on the back end --- httemplate/elements/tr-amount_fee.html | 26 ++++++++++++-- httemplate/elements/tr-select-payment_options.html | 40 ++++++++++++++++++++-- httemplate/misc/payment.cgi | 1 + httemplate/misc/process/payment.cgi | 4 +++ 4 files changed, 67 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html index a84fef6ec..94795de37 100644 --- a/httemplate/elements/tr-amount_fee.html +++ b/httemplate/elements/tr-amount_fee.html @@ -8,7 +8,7 @@ VALUE = "<% $amount %>" SIZE = 8 STYLE = "text-align:right;" -% if ( $fee || $surcharge_percentage || $surcharge_flatfee ) { +% if ( $fee || $surcharge_percentage || $surcharge_flatfee || $processing_fee) { onChange = "amount_changed(this)" onKeyDown = "amount_changed(this)" onKeyUp = "amount_changed(this)" @@ -38,7 +38,23 @@ -% if ($fee || $surcharge_percentage || $surcharge_flatfee ) { +% if ( $processing_fee ) { + + <% mt('Apply processing fee') |h %> + + + + +
+ + + A processing fee of <% $processing_fee %> is being applied to this transaction. +
+ + +% } + +% if ($fee || $surcharge_percentage || $surcharge_flatfee || $processing_fee) { <%init> diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 77f5acd6a..7911a5dd9 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -29,6 +29,7 @@ ? scalar($conf->config('credit-card-surcharge-flatfee', $cust_main->agentnum)) : 0 ), + 'processing_fee' => scalar($conf->config('processing-fee', $cust_main->agentnum)), &> % if ( $conf->exists('part_pkg-term_discounts') ) { diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 7747bcbea..56bcfd872 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -41,6 +41,8 @@ my $cust_main = qsearchs({ my $invoice = ($cgi->param('invoice') =~ /^(\d+)$/) ? $cgi->param('invoice') : ''; +my $processing_fee = $cgi->param('processing_fee') ? $cgi->param('processing_fee') : ''; + $cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/ or errorpage("illegal amount ". $cgi->param('amount')); my $amount = $1; @@ -233,6 +235,7 @@ if ( $cgi->param('batch') ) { 'paydate' => $paydate, 'payname' => $payname, 'invnum' => $invoice, + 'processing-fee' => $processing_fee, map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}} ); @@ -256,6 +259,7 @@ if ( $cgi->param('batch') ) { 'no_auto_apply' => ($cgi->param('apply') eq 'never') ? 'Y' : '', 'no_invnum' => 1, 'invnum' => $invoice, + 'processing-fee' => $processing_fee, map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}} ); errorpage($error) if $error; -- cgit v1.2.1