From: Jonathan Prykop Date: Tue, 3 Jan 2017 23:33:26 +0000 (-0600) Subject: 71513: Card tokenization [banned_pay tweaks, v3 merge] X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=a1f5ae700fef217160ca7aca669ca37abb1f9b7f;p=freeside.git 71513: Card tokenization [banned_pay tweaks, v3 merge] --- diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index a4622f57e..3e7a5fbf9 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -364,7 +364,6 @@ sub realtime_bop { $options{amount} = $amount; } - ### # optional credit card surcharge ### @@ -403,6 +402,13 @@ sub realtime_bop { $self->_bop_defaults(\%options); + # check for banned credit card/ACH + my $ban = FS::banned_pay->ban_search( + 'payby' => $bop_method2payby{$options{method}}, + 'payinfo' => $options{payinfo}, + ); + return "Banned credit card" if $ban && $ban->bantype ne 'warn'; + # possibly run a separate transaction to tokenize card number, # so that we never store tokenized card info in cust_pay_pending if (($options{method} eq 'CC') && !$self->tokenized($options{'payinfo'})) { @@ -447,16 +453,6 @@ sub realtime_bop { eval "use $namespace"; die $@ if $@; - ### - # check for banned credit card/ACH - ### - - my $ban = FS::banned_pay->ban_search( - 'payby' => $bop_method2payby{$options{method}}, - 'payinfo' => $options{payinfo}, - ); - return "Banned credit card" if $ban && $ban->bantype ne 'warn'; - ### # check for term discount validity ### @@ -1801,6 +1797,13 @@ sub realtime_verify_bop { warn " $_ => $options{$_}\n" foreach keys %options; } + # check for banned credit card/ACH + my $ban = FS::banned_pay->ban_search( + 'payby' => $bop_method2payby{'CC'}, + 'payinfo' => $options{payinfo}, + ); + return "Banned credit card" if $ban && $ban->bantype ne 'warn'; + # possibly run a separate transaction to tokenize card number, # so that we never store tokenized card info in cust_pay_pending if (($options{method} eq 'CC') && !$self->tokenized($options{'payinfo'})) { @@ -1820,16 +1823,6 @@ sub realtime_verify_bop { eval "use $namespace"; die $@ if $@; - ### - # check for banned credit card/ACH - ### - - my $ban = FS::banned_pay->ban_search( - 'payby' => $bop_method2payby{'CC'}, - 'payinfo' => $options{payinfo} || $self->payinfo, - ); - return "Banned credit card" if $ban && $ban->bantype ne 'warn'; - ### # massage data ### @@ -2257,6 +2250,13 @@ sub realtime_tokenize { return '' unless $options{method} eq 'CC'; return '' if FS::payinfo_Mixin->tokenized($options{payinfo}); #already tokenized + # check for banned credit card/ACH + my $ban = FS::banned_pay->ban_search( + 'payby' => $bop_method2payby{'CC'}, + 'payinfo' => $options{payinfo}, + ); + return "Banned credit card" if $ban && $ban->bantype ne 'warn'; + ### # select a gateway ### @@ -2283,16 +2283,6 @@ sub realtime_tokenize { my %supported_actions = $transaction->info('supported_actions'); return '' unless $supported_actions{'CC'} and grep(/^Tokenize$/,@{$supported_actions{'CC'}}); - ### - # check for banned credit card/ACH - ### - - my $ban = FS::banned_pay->ban_search( - 'payby' => $bop_method2payby{'CC'}, - 'payinfo' => $options{payinfo}, - ); - return "Banned credit card" if $ban && $ban->bantype ne 'warn'; - ### # massage data ###