From 67f033bc45654a380f47bffc9253dd86c4f784ec Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 7 Jan 2014 16:53:45 -0800 Subject: [PATCH] mask echeck acct# on invoices, RT#26859 --- FS/FS/payinfo_Mixin.pm | 13 ++++++++++++- httemplate/view/cust_main/payment_history.html | 11 ++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/FS/FS/payinfo_Mixin.pm b/FS/FS/payinfo_Mixin.pm index 07367f2fd..f202bbd3d 100644 --- a/FS/FS/payinfo_Mixin.pm +++ b/FS/FS/payinfo_Mixin.pm @@ -254,7 +254,18 @@ sub payby_payinfo_pretty { if ( $self->payby eq 'CARD' ) { $lh->maketext('Card #') . $self->paymask; } elsif ( $self->payby eq 'CHEK' ) { - $lh->maketext('E-check acct#') . $self->payinfo; + + #false laziness w/view/cust_main/payment_history.html::translate_payinfo + my( $account, $aba ) = split('@', $self->paymask ); + + if ( $aba =~ /^(\d{5})\.(\d{3})$/ ) { #blame canada + my($branch, $routing) = ($1, $2); + $lh->maketext("Routing [_1], Branch [_2], Acct [_3]", + $routing, $branch, $account); + } else { + $lh->maketext("Routing [_1], Acct [_2]", $aba, $account); + } + } elsif ( $self->payby eq 'BILL' ) { $lh->maketext('Check #') . $self->payinfo; } elsif ( $self->payby eq 'PREP' ) { diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index d46bc823f..502c127d3 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -555,13 +555,18 @@ sub translate_payinfo { my $payby = $object->payby; my $payinfo = $object->payinfo; - my $conf = new FS::Conf; - if ( $payby eq 'CARD' ) { $payinfo = $object->paymask; } elsif ( $payby eq 'CHEK' ) { + #false laziness w/payinfo_Mixin::payby_payinfo_pretty, should use that my( $account, $aba ) = split('@', $object->paymask ); - $payinfo = emt("ABA [_1], Acct #[_2]",$aba,$account); + if ( $aba =~ /^(\d{5})\.(\d{3})$/ ) { #blame canada + my($branch, $routing) = ($1, $2); + $payinfo = emt("Routing [_1], Branch [_2], Acct [_3]", + $routing, $branch, $account); + } else { + $payinfo = emt("Routing [_1], Acct [_2]", $aba, $account); + } } ($payby,$payinfo); -- 2.11.0