[freeside-commits] branch master updated. 90430c5c67581b41b3c4ad48f70b9e443092977b

Christopher Burger burgerc at 420.am
Tue Oct 3 08:17:46 PDT 2017


The branch, master has been updated
       via  90430c5c67581b41b3c4ad48f70b9e443092977b (commit)
       via  8f1188e8550992bf3d9078e7a6042420eaf92bd5 (commit)
      from  2e5d7c4e1a26af8a8c0f4b5f08f1a683293b9686 (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 90430c5c67581b41b3c4ad48f70b9e443092977b
Merge: 8f1188e 2e5d7c4
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue Oct 3 11:16:27 2017 -0400

    Merge branch 'master' of ssh://git.freeside.biz/home/git/freeside


commit 8f1188e8550992bf3d9078e7a6042420eaf92bd5
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue Oct 3 11:15:51 2017 -0400

    RT# 77193 - updated selfservice change payment accounts to work with version 4

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index a10a452..30ab96b 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -882,6 +882,7 @@ sub payment_info {
     if ($cust_payby) {
       $return{payname} = $cust_payby->payname
                          || ( $cust_main->first. ' '. $cust_main->get('last') );
+      $return{custpaybynum} = $cust_payby->custpaybynum;
 
       if ( $cust_payby->payby =~ /^(CARD|DCRD)$/ ) {
         $return{card_type} = cardtype($cust_payby->payinfo);
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
index 6af5e5e..1bc35e3 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
@@ -93,9 +93,10 @@ push @menu,
 
 unless ( $access_pkgnum ) {
   push @menu,
-    { title=>'Change billing address',      url=>'change_bill',     indent=>2 },
-    { title=>'Change service address',      url=>'change_ship',     indent=>2 },
-    { title=>'Change payment information',  url=>'change_pay',      indent=>2 },
+    { title=>'Change billing address',          url=>'change_bill',           indent=>2 },
+    { title=>'Change service address',          url=>'change_ship',           indent=>2 },
+    { title=>'Change credit card information',  url=>'change_creditcard_pay', indent=>2 },
+    { title=>'Change check information',        url=>'change_check_pay',      indent=>2 },
   ;
 }
 
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index cd9e32c..f194746 100755
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -12,8 +12,8 @@ use Date::Format;
 use Date::Parse 'str2time';
 use Number::Format 1.50;
 use FS::SelfService qw(
-  access_info login_info login customer_info edit_info invoice
-  payment_info process_payment realtime_collect process_prepay
+  access_info login_info login customer_info edit_info insert_payby update_payby 
+  invoice payment_info process_payment realtime_collect process_prepay
   list_pkgs order_pkg signup_info order_recharge
   part_svc_info provision_acct provision_external provision_phone provision_forward
   unprovision_svc change_pkg suspend_pkg domainselector
@@ -59,6 +59,10 @@ my @actions = ( qw(
   change_bill
   change_ship
   change_pay
+  change_creditcard_pay
+  change_check_pay
+  process_change_creditcard_pay
+  process_change_check_pay
   process_change_bill
   process_change_ship
   process_change_pay
@@ -261,19 +265,30 @@ sub myaccount {
   customer_info( 'session_id' => $session_id ); 
 }
 
-sub change_bill { my $payment_info =
-                    payment_info( 'session_id' => $session_id );
-                  return $payment_info if ( $payment_info->{'error'} );
-                  my $customer_info =
-                    customer_info( 'session_id' => $session_id );
-                  return { 
-                    %$payment_info,
-                    %$customer_info,
-                  };
-                }
+sub change_bill {
+  my $payby = shift;
+  my $payment_info;
+  if ($payby) {
+    $payment_info = payment_info( 'session_id' => $session_id, 'payment_payby' => $payby, );
+  }
+  else {
+    $payment_info = payment_info( 'session_id' => $session_id, );
+  }
+
+  return $payment_info if ( $payment_info->{'error'} );
+  my $customer_info =
+    customer_info( 'session_id' => $session_id );
+  return {
+    %$payment_info,
+    %$customer_info,
+  };
+}
 sub change_ship { change_bill(@_); }
 sub change_pay { change_bill(@_); }
 
+sub change_creditcard_pay { change_bill('CARD'); }
+sub change_check_pay { change_bill('CHEK'); }
+
 sub _process_change_info { 
   my ($erroraction, @fields) = @_;
 
@@ -298,6 +313,30 @@ sub _process_change_info {
   }
 }
 
+sub _process_change_payby {
+  my ($erroraction, @fields) = @_;
+
+  my $results = '';
+
+  $results ||= update_payby (
+    'session_id' => $session_id,
+    map { ($_ => $cgi->param($_)) } grep { defined($cgi->param($_)) } @fields,
+  );
+
+
+  if ( $results->{'error'} ) {
+    no strict 'refs';
+    $action = $erroraction;
+    return {
+      $cgi->Vars,
+      %{&$action()},
+      'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
+    };
+  } else {
+    return $results;
+  }
+}
+
 sub process_change_bill {
         _process_change_info( 'change_bill', 
           qw( first last company address1 address2 city state
@@ -342,6 +381,30 @@ sub process_change_pay {
         _process_change_info( 'change_pay', @list );
 }
 
+sub process_change_creditcard_pay {
+        my $payby  = $cgi->param( 'payby' );
+        $cgi->param('paydate', $cgi->param('year') . '-' . $cgi->param('month') . '-01');
+        my @list =
+          qw( payby payinfo payinfo1 payinfo2 paydate payname custpaybynum 
+              address1 address2 city county state zip country auto paytype
+              paystate ss stateid stateid_state invoicing_list
+            );
+
+        _process_change_payby( 'change_creditcard_pay', @list );
+}
+
+sub process_change_check_pay {
+        my $payby  = $cgi->param( 'payby' );
+        $cgi->param('paydate', $cgi->param('year') . '-' . $cgi->param('month') . '-01');
+        my @list =
+          qw( payby payinfo payinfo1 payinfo2 paydate payname custpaybynum 
+              address1 address2 city county state zip country auto paytype
+              paystate ss stateid stateid_state invoicing_list
+            );
+
+        _process_change_payby( 'change_check_pay', @list );
+}
+
 sub view_invoice {
 
   $cgi->param('invnum') =~ /^(\d+)$/ or die "illegal invnum";

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

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm                       |    1 +
 .../FS-SelfService/cgi/myaccount_menu.html         |    7 +-
 fs_selfservice/FS-SelfService/cgi/selfservice.cgi  |   87 +++++++++++++++++---
 3 files changed, 80 insertions(+), 15 deletions(-)




More information about the freeside-commits mailing list