[freeside-commits] branch master updated. 799da5a4ff161203bbac930b75f3b934ccd19243

Ivan ivan at 420.am
Sun Feb 15 21:44:44 PST 2015


The branch, master has been updated
       via  799da5a4ff161203bbac930b75f3b934ccd19243 (commit)
      from  af73ad83d772e140491f65306f53e11dc0b1b4ef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 799da5a4ff161203bbac930b75f3b934ccd19243
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Feb 15 21:44:40 2015 -0800

    multiple payment options (echeck fixes), RT#23741

diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm
index a65a171..b1a7ddb 100644
--- a/FS/FS/cust_payby.pm
+++ b/FS/FS/cust_payby.pm
@@ -427,12 +427,16 @@ sub check {
 
   }
 
-  if ( $self->paydate eq '' || $self->paydate eq '-' ) {
-    return "Expiration date required"
-      # shouldn't payinfo_check do this?
-      unless $self->payby =~ /^(CHEK|DCHK)$/;
+  if ( $self->payby =~ /^(CHEK|DCHK)$/ ) {
+
     $self->paydate('');
-  } else {
+
+  } elsif ( $self->payby =~ /^(CARD|DCRD)$/ ) {
+
+    # shouldn't payinfo_check do this?
+    return "Expiration date required"
+      if $self->paydate eq '' || $self->paydate eq '-';
+
     my( $m, $y );
     if ( $self->paydate =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ ) {
       ( $m, $y ) = ( $1, length($2) == 4 ? $2 : "20$2" );
@@ -451,6 +455,7 @@ sub check {
       #&&
          !$ignore_expired_card 
       && ( $y<$nowy || ( $y==$nowy && $1<$nowm ) );
+
   }
 
   if ( $self->payname eq '' && $self->payby !~ /^(CHEK|DCHK)$/ &&
@@ -560,7 +565,7 @@ Returns the field names used in the web interface (including some pseudo-fields)
 sub cgi_cust_payby_fields {
   #my $class = shift;
   [qw( payby payinfo paydate_month paydate_year paycvv payname weight
-       payinfo1 payinfo2 payinfo3 paytype paystate )];
+       payinfo1 payinfo2 payinfo3 paytype paystate payname_CHEK )];
 }
 
 =item cgi_hash_callback HASHREF
@@ -582,7 +587,7 @@ sub cgi_hash_callback {
 
   if ( $hashref->{payby} =~ /^(CHEK|DCHK)$/ ) {
 
-    unless ( grep $hashref->{$_}, qw( payinfo1 payinfo2 payinfo3 payname ) ) {
+    unless ( grep $hashref->{$_}, qw(payinfo1 payinfo2 payinfo3 payname_CHEK)) {
       %$hashref = ();
       return;
     }
@@ -592,7 +597,7 @@ sub cgi_hash_callback {
       if $conf->config('echeck-country') eq 'CA';
     $hashref->{payinfo} .= $hashref->{'payinfo2'};
 
-    $hashref->{payname} .= $hashref->{'payname_CHEK'};
+    $hashref->{payname} = $hashref->{'payname_CHEK'};
 
   } elsif ( $hashref->{payby} =~ /^(CARD|DCRD)$/ ) {
 
diff --git a/httemplate/elements/cust_payby.html b/httemplate/elements/cust_payby.html
index 20ad343..0eb3e3e 100644
--- a/httemplate/elements/cust_payby.html
+++ b/httemplate/elements/cust_payby.html
@@ -107,15 +107,17 @@
         </SELECT>
         <BR><FONT SIZE="-1"><% mt('Account type') |h %></FONT>
       </TD>
- 
-%     my( $account, $aba ) = split('@',
-%       ( $cgi->param($name.'_payby') || $cust_payby->payby ) =~ /^(CHEK|DCHK)$/
-%         ? $cgi->param($name.'_payinfo')
-%         : $cust_payby->payinfo
-%       );
-%     my $branch = '';
-%     ($branch,$aba) = split('\.',$aba)
-%       if $echeck_country eq 'CA';
+
+%     my ( $account, $aba, $branch ) = ( '', '', '' );
+%     if ( $cgi->param($name.'_payby') =~ /^(CHEK|DCHK)$/ ) {
+%       $account = $cgi->param($name.'_payinfo1');
+%       $aba     = $cgi->param($name.'_payinfo2');
+%       $branch  = $cgi->param($name.'_payinfo3');
+%     } elsif ( $cust_payby->payby =~ /^(CHEK|DCHK)$/ ) {
+%       ( $account, $aba ) = split('@', $cust_payby->payinfo);
+%       ( $branch,  $aba ) = split('\.',$aba)
+%         if $echeck_country eq 'CA';
+%     }
 %
 %     #false laziness w/view/cust_main/billing.html and misc/payment.cgi
 %     my $routing_label = $echeck_country eq 'US' ? 'ABA/Routing #'
@@ -287,7 +289,7 @@ if ( $curr_value ) {
 } else {
   $cust_payby = new FS::cust_payby {};
 }
-my $sel_payby = $cust_payby->payby;
+my $sel_payby = $cgi->param($name.'_payby') || $cust_payby->payby;
 $sel_payby = 'CARD' if $sel_payby eq 'DCRD' || $sel_payby eq '';
 $sel_payby = 'CHEK' if $sel_payby eq 'DCHK';
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_payby.pm                 |   21 +++++++++++++--------
 httemplate/elements/cust_payby.html |   22 ++++++++++++----------
 2 files changed, 25 insertions(+), 18 deletions(-)




More information about the freeside-commits mailing list