diff options
author | ivan <ivan> | 2012-01-14 07:05:15 +0000 |
---|---|---|
committer | ivan <ivan> | 2012-01-14 07:05:15 +0000 |
commit | fa33561ed20c57b0f63221d6a0f9c0cf5ebbef14 (patch) | |
tree | 4228f84cbe9ec763598097aa86aecdd3b275a407 /httemplate/misc | |
parent | 679fbd2023aa5d87308c2f3d7d5360cfd3c8354a (diff) |
improve echeck validation for canada, deprecate echeck-nonus and cust_main-require-bank-branch config in favor of echeck-country, RT#15982
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/payment.cgi | 17 | ||||
-rw-r--r-- | httemplate/misc/process/payment.cgi | 4 |
2 files changed, 14 insertions, 7 deletions
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 4a867d28d..093494a06 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -140,7 +140,7 @@ % or die "unparsable payinfo ". $cust_main->payinfo; % ($account, $aba) = ($1, $2); % ($branch,$aba) = split('\.',$aba) -% if $conf->exists('cust_main-require-bank-branch'); +% if $conf->config('echeck-country') eq 'CA'; % $payname = $cust_main->payname; % $ss = $cust_main->ss; % $paytype = $cust_main->getfield('paytype'); @@ -148,6 +148,13 @@ % $stateid = $cust_main->getfield('stateid'); % $stateid_state = $cust_main->getfield('stateid_state'); % } +% +% #false laziness w/{edit,view}/cust_main/billing.html +% my $routing_label = $conf->config('echeck-country') eq 'US' +% ? 'ABA/Routing number' +% : 'Routing number'; +% my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10; +% my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9; <INPUT TYPE="hidden" NAME="month" VALUE="12"> <INPUT TYPE="hidden" NAME="year" VALUE="2037"> @@ -158,17 +165,17 @@ <TD><SELECT NAME="paytype"><% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes) %></SELECT></TD> </TR> <TR> - <TD ALIGN="right"><% mt('ABA/Routing number') |h %></TD> + <TD ALIGN="right"><% mt($routing_label) |h %></TD> <TD> - <INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="payinfo2" VALUE="<%$aba%>"> + <INPUT TYPE="text" SIZE="<% $routing_size %>" MAXLENGTH="<% $routing_maxlength %>" NAME="payinfo2" VALUE="<%$aba%>"> (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;"><% mt('help') |h %></A>) </TD> </TR> -% if ( $conf->exists('cust_main-require-bank-branch') ) { +% if ( $conf->config('echeck-country') eq 'CA' ) { <TR> <TD ALIGN="right"><% mt('Branch number') |h %></TD> <TD> - <INPUT TYPE="text" NAME="payinfo3" VALUE="<%$branch%>"> + <INPUT TYPE="text" NAME="payinfo3" VALUE="<%$branch%>" SIZE=6 MAXLENGTH=5> </TD> </TR> % } diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index f4f9561dc..506e26684 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -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"; } |