$cgi->param('payinfo2') =~ /^(\d+)$/
or errorpage("Illegal ABA/routing number ". $cgi->param('payinfo2'));
my $payinfo2 = $1;
- if ( $conf->exists('cust_main-require-bank-branch') ) {
- $cgi->param('payinfo3') =~ /^(\d+)$/
+ if ( $conf->config('echeck-country') eq 'CA' ) {
+ $cgi->param('payinfo3') =~ /^(\d{5})$/
or errorpage("Illegal branch number ". $cgi->param('payinfo2'));
$payinfo2 = "$1.$payinfo2";
}
or errorpage("CVV2 (CVC2/CID) is three digits.");
$paycvv = $1;
}
+ }elsif( $conf->exists('backoffice-require_cvv') ){
+ errorpage("CVV2 is required");
}
}
$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")