X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Fpayment.cgi;h=981614e7674b4fb2e3c2e0c0cad464596d3c7cd3;hb=f00c16b7e3e6306723ea8b3029e061cff100b901;hp=5fa57e448ae08715a2cf916e42cca27db18c28ad;hpb=524f46a00ec9610c82a519bea2469cb1711abc1b;p=freeside.git diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 5fa57e448..981614e76 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -21,6 +21,8 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" unless $curuser->access_right('Process payment'); +my $conf = new FS::Conf; + #some false laziness w/MyAccount::process_payment $cgi->param('custnum') =~ /^(\d+)$/ @@ -79,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; } @@ -122,7 +129,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; @@ -196,7 +203,6 @@ if ( $cgi->param('save') ) { #false laziness w/FS:;cust_main::realtime_bop - check both to make sure # working correctly - my $conf = new FS::Conf; if ( $payby eq 'CARD' && grep { $_ eq cardtype($payinfo) } $conf->config('cvv-save') ) { $new->set( 'paycvv' => $paycvv ); @@ -204,7 +210,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")