From: ivan Date: Fri, 21 Oct 2011 16:29:39 +0000 (+0000) Subject: fix for branch numbers, RT#14859 X-Git-Tag: freeside_2_3_1~224 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=21150c775b1c91f0b1b760f6177aa4363fd4056d fix for branch numbers, RT#14859 --- diff --git a/FS/FS/pay_batch/eft_canada.pm b/FS/FS/pay_batch/eft_canada.pm index 0e4161034..23dcc2dc9 100644 --- a/FS/FS/pay_batch/eft_canada.pm +++ b/FS/FS/pay_batch/eft_canada.pm @@ -43,11 +43,16 @@ my ($trans_code, $process_date); $cust_pay_batch->first, $cust_pay_batch->last; } my ($account, $aba) = split('@', $cust_pay_batch->payinfo); - # standard format for Canadian bank ID - $aba =~ /^0(\d{3})(\d{5})$/ - or die "invalid routing number '$aba'\n"; - push @fields, sprintf('%05s', $2), - sprintf('%03s', $1), + my($bankno, $branch); + if ( $aba =~ /^0(\d{3})(\d{5})$/ ) { # standard format for Canadian bank ID + ($bankno, $branch) = ( $1, $2 ); + } elsif ( $aba =~ /^(\d{5})\.(\d{3})$/ ) { #how we store branches + ($branch, $bankno) = ( $1, $2 ); + } else { + die "invalid branch/routing number '$aba'\n"; + } + push @fields, sprintf('%05s', $branch), + sprintf('%03s', $bankno), sprintf('%012s', $account), sprintf('%.02f', $cust_pay_batch->amount); # DB = debit