improve echeck validation for canada, deprecate echeck-nonus and cust_main-require...
[freeside.git] / httemplate / misc / process / payment.cgi
index efbdb76..506e266 100644 (file)
@@ -86,8 +86,8 @@ if ( $payby eq 'CHEK' ) {
     $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";
     }
@@ -129,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;