projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
71513: Card tokenization [bug fixes to previous checkpoint]
[freeside.git]
/
httemplate
/
misc
/
process
/
payment.cgi
diff --git
a/httemplate/misc/process/payment.cgi
b/httemplate/misc/process/payment.cgi
index
d232fe7
..
1532605
100644
(file)
--- a/
httemplate/misc/process/payment.cgi
+++ b/
httemplate/misc/process/payment.cgi
@@
-72,7
+72,7
@@
$cgi->param('discount_term') =~ /^(\d*)$/
or errorpage("illegal discount_term");
my $discount_term = $1;
or errorpage("illegal discount_term");
my $discount_term = $1;
-my( $payinfo, $paycvv, $month, $year, $payname );
+my( $
cust_payby, $
payinfo, $paycvv, $month, $year, $payname );
my $paymask = '';
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
my $paymask = '';
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
@@
-80,13
+80,14
@@
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
# use stored cust_payby info
##
# use stored cust_payby info
##
-
my
$cust_payby = qsearchs('cust_payby', { custnum => $custnum,
+ $cust_payby = qsearchs('cust_payby', { custnum => $custnum,
custpaybynum => $custpaybynum, } )
or die "unknown custpaybynum $custpaybynum";
custpaybynum => $custpaybynum, } )
or die "unknown custpaybynum $custpaybynum";
+ # not needed for realtime_bop, but still needed for batch_card
$payinfo = $cust_payby->payinfo;
$paymask = $cust_payby->paymask;
$payinfo = $cust_payby->payinfo;
$paymask = $cust_payby->paymask;
- $paycvv =
'';
+ $paycvv =
$cust_payby->paycvv; # pass it if we got it, running a transaction will clear it
( $month, $year ) = $cust_payby->paydate_mon_year;
$payname = $cust_payby->payname;
( $month, $year ) = $cust_payby->paydate_mon_year;
$payname = $cust_payby->payname;
@@
-134,7
+135,7
@@
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
validate($payinfo)
or errorpage(gettext('invalid_card'));
validate($payinfo)
or errorpage(gettext('invalid_card'));
- unless ( $
payinfo =~ /^99\d{14}$/
) { #token
+ unless ( $
cust_main->tokenized($payinfo)
) { #token
my $cardtype = cardtype($payinfo);
my $cardtype = cardtype($payinfo);
@@
-164,13
+165,13
@@
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
die "unknown payby $payby";
}
die "unknown payby $payby";
}
- # save first, for proper tokenization
later
+ # save first, for proper tokenization
if ( $cgi->param('save') ) {
my %saveopt;
if ( $payby eq 'CARD' ) {
my $bill_location = FS::cust_location->new;
if ( $cgi->param('save') ) {
my %saveopt;
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}};
$saveopt{'bill_location'} = $bill_location;
$saveopt{'paycvv'} = $paycvv; # save_cust_payby contains conf logic for when to use this
foreach @{$payby2fields{$payby}};
$saveopt{'bill_location'} = $bill_location;
$saveopt{'paycvv'} = $paycvv; # save_cust_payby contains conf logic for when to use this
@@
-181,6
+182,7
@@
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
}
my $error = $cust_main->save_cust_payby(
}
my $error = $cust_main->save_cust_payby(
+ 'saved_cust_payby' => \$cust_payby,
'payment_payby' => $payby,
'auto' => scalar($cgi->param('auto')),
'weight' => scalar($cgi->param('weight')),
'payment_payby' => $payby,
'auto' => scalar($cgi->param('auto')),
'weight' => scalar($cgi->param('weight')),
@@
-191,6
+193,11
@@
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
errorpage("error saving info, payment not processed: $error")
if $error;
errorpage("error saving info, payment not processed: $error")
if $error;
+
+ } elsif ( $payby eq 'CARD' ) { # not saving
+
+ $paymask = FS::payinfo_Mixin->mask_payinfo('CARD',$payinfo); # for untokenized but tokenizable payinfo
+
}
}
}
}
@@
-220,6
+227,7
@@
if ( $cgi->param('batch') ) {
} else {
$error = $cust_main->realtime_bop( $FS::payby::payby2bop{$payby}, $amount,
} else {
$error = $cust_main->realtime_bop( $FS::payby::payby2bop{$payby}, $amount,
+ 'cust_payby' => $cust_payby, # if defined, will override passed payinfo, etc
'quiet' => 1,
'manual' => 1,
'balance' => $balance,
'quiet' => 1,
'manual' => 1,
'balance' => $balance,