projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT# 76093 - Added ability to charge a processing fee when taking a payment on the...
[freeside.git]
/
httemplate
/
misc
/
process
/
payment.cgi
diff --git
a/httemplate/misc/process/payment.cgi
b/httemplate/misc/process/payment.cgi
index
b7d427e
..
4d4e62a
100644
(file)
--- a/
httemplate/misc/process/payment.cgi
+++ b/
httemplate/misc/process/payment.cgi
@@
-32,6
+32,8
@@
my $custnum = $1;
my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
die "unknown custnum $custnum" unless $cust_main;
my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
die "unknown custnum $custnum" unless $cust_main;
+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;
$cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/
or errorpage("illegal amount ". $cgi->param('amount'));
my $amount = $1;
@@
-42,11
+44,11
@@
if ( $cgi->param('fee') =~ /^\s*(\d*(\.\d\d)?)\s*$/ ) {
$amount = sprintf('%.2f', $amount + $fee);
}
$amount = sprintf('%.2f', $amount + $fee);
}
-$cgi->param('year') =~ /^(\d
+)$
/
+$cgi->param('year') =~ /^(\d
{4})
/
or errorpage("illegal year ". $cgi->param('year'));
my $year = $1;
or errorpage("illegal year ". $cgi->param('year'));
my $year = $1;
-$cgi->param('month') =~ /^(\d
+)$
/
+$cgi->param('month') =~ /^(\d
{2})
/
or errorpage("illegal month ". $cgi->param('month'));
my $month = $1;
or errorpage("illegal month ". $cgi->param('month'));
my $month = $1;
@@
-110,7
+112,7
@@
if ( $payby eq 'CHEK' ) {
validate($payinfo)
or errorpage(gettext('invalid_card'));
validate($payinfo)
or errorpage(gettext('invalid_card'));
- unless ( $
self->
payinfo =~ /^99\d{14}$/ ) { #token
+ unless ( $payinfo =~ /^99\d{14}$/ ) { #token
my $cardtype = cardtype($payinfo);
my $cardtype = cardtype($payinfo);
@@
-124,7
+126,9
@@
if ( $payby eq 'CHEK' ) {
if ( defined $cust_main->dbdef_table->column('paycvv') ) {
if ( length($cgi->param('paycvv') ) ) {
if ( defined $cust_main->dbdef_table->column('paycvv') ) {
if ( length($cgi->param('paycvv') ) ) {
- if ( cardtype($payinfo) eq 'American Express card' ) {
+ if ( $cgi->param('paycvv') =~ /^\*+$/ ) {
+ $paycvv = $cust_main->paycvv;
+ } elsif ( cardtype($payinfo) eq 'American Express card' ) {
$cgi->param('paycvv') =~ /^(\d{4})$/
or errorpage("CVV2 (CID) for American Express cards is four digits.");
$paycvv = $1;
$cgi->param('paycvv') =~ /^(\d{4})$/
or errorpage("CVV2 (CID) for American Express cards is four digits.");
$paycvv = $1;
@@
-164,7
+168,10
@@
if ( $cgi->param('save') ) {
#false laziness w/FS:;cust_main::realtime_bop - check both to make sure
# working correctly
if ( $payby eq 'CARD' &&
#false laziness w/FS:;cust_main::realtime_bop - check both to make sure
# working correctly
if ( $payby eq 'CARD' &&
- grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save') ) {
+ ( (grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save'))
+ || $conf->exists('business-onlinepayment-verification')
+ )
+ ) {
$new->set( 'paycvv' => $paycvv );
} else {
$new->set( 'paycvv' => '');
$new->set( 'paycvv' => $paycvv );
} else {
$new->set( 'paycvv' => '');
@@
-172,12
+179,12
@@
if ( $cgi->param('save') ) {
if ( $payby eq 'CARD' ) {
my $bill_location = FS::cust_location->new;
if ( $payby eq 'CARD' ) {
my $bill_location = FS::cust_location->new;
- $bill_location->set( $_ =>
$cgi->param($_
) )
+ $bill_location->set( $_ =>
scalar($cgi->param($_)
) )
foreach @{$payby2fields{$payby}};
$new->set('bill_location' => $bill_location);
# will do nothing if the fields are all unchanged
} else {
foreach @{$payby2fields{$payby}};
$new->set('bill_location' => $bill_location);
# will do nothing if the fields are all unchanged
} else {
- $new->set( $_ =>
$cgi->param($_
) ) foreach @{$payby2fields{$payby}};
+ $new->set( $_ =>
scalar($cgi->param($_)
) ) foreach @{$payby2fields{$payby}};
}
my $error = $new->replace($cust_main);
}
my $error = $new->replace($cust_main);
@@
-199,7
+206,8
@@
if ( $cgi->param('batch') ) {
'payinfo' => $payinfo,
'paydate' => "$year-$month-01",
'payname' => $payname,
'payinfo' => $payinfo,
'paydate' => "$year-$month-01",
'payname' => $payname,
- map { $_ => $cgi->param($_) }
+ 'processing-fee' => $processing_fee,
+ map { $_ => scalar($cgi->param($_)) }
@{$payby2fields{$payby}}
);
errorpage($error) if $error;
@{$payby2fields{$payby}}
);
errorpage($error) if $error;
@@
-218,7
+226,10
@@
if ( $cgi->param('batch') ) {
'paycvv' => $paycvv,
'paynum_ref' => \$paynum,
'discount_term' => $discount_term,
'paycvv' => $paycvv,
'paynum_ref' => \$paynum,
'discount_term' => $discount_term,
- map { $_ => $cgi->param($_) } @{$payby2fields{$payby}}
+ 'no_auto_apply' => ($cgi->param('apply') eq 'never') ? 'Y' : '',
+ 'no_invnum' => 1,
+ 'processing-fee' => $processing_fee,
+ map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}}
);
errorpage($error) if $error;
);
errorpage($error) if $error;
@@
-233,12
+244,12
@@
if ( $cgi->param('batch') ) {
#and generate an invoice for it now too
$error = $cust_main->bill( 'pkg_list' => [ $cust_pkg ] );
#and generate an invoice for it now too
$error = $cust_main->bill( 'pkg_list' => [ $cust_pkg ] );
- errorpage("payment processed and fee ordered sucessfully, but error billing fee: $error")
+ errorpage("payment processed and fee ordered suc
c
essfully, but error billing fee: $error")
if $error;
}
if $error;
}
- $cust_main->apply_payments;
+ $cust_main->apply_payments
if ($cgi->param('apply') eq 'yes')
;
}
}