X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Fpayment.cgi;h=27b8186602d9ec4e3454152716066a37048dce70;hb=a3fc8a9a062757f2c288a36eece7367e8f653e5f;hp=e09cb570c53d76f942cd70674ed564ae4849cb75;hpb=17470f0458a1cf5cf3ef7ebbcbbda836d37a7ee1;p=freeside.git diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index e09cb570c..27b818660 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -81,11 +81,16 @@ if ( $payby eq 'CHEK' ) { $payinfo = $cust_main->payinfo; } else { $cgi->param('payinfo1') =~ /^(\d+)$/ - or errorpage("illegal account number ". $cgi->param('payinfo1')); + or errorpage("Illegal account number ". $cgi->param('payinfo1')); my $payinfo1 = $1; $cgi->param('payinfo2') =~ /^(\d+)$/ - or errorpage("illegal ABA/routing number ". $cgi->param('payinfo2')); + or errorpage("Illegal ABA/routing number ". $cgi->param('payinfo2')); my $payinfo2 = $1; + if ( $conf->config('echeck-country') eq 'CA' ) { + $cgi->param('payinfo3') =~ /^(\d{5})$/ + or errorpage("Illegal branch number ". $cgi->param('payinfo2')); + $payinfo2 = "$1.$payinfo2"; + } $payinfo = $payinfo1. '@'. $payinfo2; } @@ -117,6 +122,8 @@ if ( $payby eq 'CHEK' ) { or errorpage("CVV2 (CVC2/CID) is three digits."); $paycvv = $1; } + }elsif( $conf->exists('backoffice-require_cvv') ){ + errorpage("CVV2 is required"); } } @@ -124,7 +131,7 @@ if ( $payby eq 'CHEK' ) { die "unknown payby $payby"; } -$cgi->param('discount_term') =~ /^\d*$/ +$cgi->param('discount_term') =~ /^(\d*)$/ or errorpage("illegal discount_term"); my $discount_term = $1; @@ -205,7 +212,15 @@ if ( $cgi->param('save') ) { $new->set( 'paycvv' => ''); } - $new->set( $_ => $cgi->param($_) ) foreach @{$payby2fields{$payby}}; + if ( $payby eq 'CARD' ) { + my $bill_location = FS::cust_location->new; + $bill_location->set( $_ => $cgi->param($_) ) + 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}}; + } my $error = $new->replace($cust_main); errorpage("payment processed successfully, but error saving info: $error")