[freeside-commits] branch FREESIDE_3_BRANCH updated. bc03aa6e1cebc712789dfc254901c6f8d8935057

Jonathan Prykop jonathan at 420.am
Thu Oct 29 20:42:07 PDT 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  bc03aa6e1cebc712789dfc254901c6f8d8935057 (commit)
       via  4fdc60587141db78b4baf67168cb5ab2122210d4 (commit)
       via  83ac7e044f6ca98c57207537e9c7b0a4d469162a (commit)
      from  f08ff59915dc9e5478e97e10824e268b0b9c3371 (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 bc03aa6e1cebc712789dfc254901c6f8d8935057
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Thu Oct 29 22:17:08 2015 -0500

    RT#38671: Do not include charges and credits from failed signup processing [added void reason]

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index cb3f8d9..64a443f 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -2486,8 +2486,8 @@ sub _do_bop_realtime {
 
         #this used to apply a credit, but now we can void invoices...
         foreach my $cust_bill (@cust_bill) {
-          my $voiderror = $cust_bill->void();
-          warn "Error voiding cust bill after decline: $voiderror";
+          my $voiderror = $cust_bill->void('automatic payment failed');
+          warn "Error voiding cust bill after decline: $voiderror" if $voiderror;
         }
 
       }
diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm
index f255405..3208396 100644
--- a/FS/FS/ClientAPI/Signup.pm
+++ b/FS/FS/ClientAPI/Signup.pm
@@ -834,8 +834,8 @@ sub new_customer {
 
       #this used to apply a credit, but now we can void invoices...
       foreach my $cust_bill (@cust_bill) {
-        my $voiderror = $cust_bill->void();
-        warn "Error voiding cust bill after decline: $voiderror";
+        my $voiderror = $cust_bill->void('automatic payment failed');
+        warn "Error voiding cust bill after decline: $voiderror" if $voiderror;
       }
 
       #should check list for errors...

commit 4fdc60587141db78b4baf67168cb5ab2122210d4
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Oct 27 19:09:07 2015 -0500

    RT#38671: Do not include charges and credits from failed signup processing [deprecated signup_credit_type]

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 7c220b7..e55cd6f 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4375,9 +4375,10 @@ and customer address. Include units.',
     reason_type_options('R'),
   },
 
+  # was only used to negate invoices during signup when card was declined, now we just void
   {
     'key'         => 'signup_credit_type',
-    'section'     => 'billing', #self-service?
+    'section'     => 'deprecated', #self-service?
     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
     reason_type_options('R'),
   },
diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm
index 752d842..4e0c4c8 100644
--- a/FS/FS/cust_credit.pm
+++ b/FS/FS/cust_credit.pm
@@ -41,7 +41,6 @@ $FS::UID::callback{'FS::cust_credit'} = sub {
 
 our %reasontype_map = ( 'referral_credit_type' => 'Referral Credit',
                         'cancel_credit_type'   => 'Cancellation Credit',
-                        'signup_credit_type'   => 'Self-Service Credit',
                       );
 
 =head1 NAME

commit 83ac7e044f6ca98c57207537e9c7b0a4d469162a
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Oct 27 18:55:02 2015 -0500

    RT#38671: Do not include charges and credits from failed signup processing

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 88b9ed6..cb3f8d9 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -2389,7 +2389,7 @@ sub change_pkg {
 
   if ( $conf->exists('signup_server-realtime') ) {
 
-    my $bill_error = _do_bop_realtime( $cust_main, $status, 'no_credit'=>1 );
+    my $bill_error = _do_bop_realtime( $cust_main, $status, 'no_invoice_void'=>1 );
 
     if ($bill_error) {
       $err_or_cust_pkg->suspend;
@@ -2465,8 +2465,12 @@ sub _do_bop_realtime {
 
     my $old_balance = $cust_main->balance;
 
-    my $bill_error =    $cust_main->bill
-                     || $cust_main->apply_payments_and_credits;
+    my @cust_bill;
+    my $bill_error = $cust_main->bill(
+      'return_bill'   => \@cust_bill,
+    );
+
+    $bill_error ||= $cust_main->apply_payments_and_credits;
 
     $bill_error ||= $cust_main->realtime_collect('selfservice' => 1)
       if $cust_main->payby =~ /^(CARD|CHEK)$/;
@@ -2478,14 +2482,14 @@ sub _do_bop_realtime {
             )
        )
     {
-      unless ( $opt{'no_credit'} ) {
-        #this makes sense.  credit is "un-doing" the invoice
-        my $conf = new FS::Conf;
-        $cust_main->credit( sprintf("%.2f", $cust_main->balance-$old_balance ),
-                            'self-service decline',
-                            reason_type=>$conf->config('signup_credit_type'),
-                          );
-        $cust_main->apply_credits( 'order' => 'newest' );
+      unless ( $opt{'no_invoice_void'} ) {
+
+        #this used to apply a credit, but now we can void invoices...
+        foreach my $cust_bill (@cust_bill) {
+          my $voiderror = $cust_bill->void();
+          warn "Error voiding cust bill after decline: $voiderror";
+        }
+
       }
 
       return { 'error' => '_decline', 'bill_error' => $bill_error };
diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm
index c778e59..f255405 100644
--- a/FS/FS/ClientAPI/Signup.pm
+++ b/FS/FS/ClientAPI/Signup.pm
@@ -793,7 +793,11 @@ sub new_customer {
 
     #warn "$me Billing customer...\n" if $Debug;
 
-    my $bill_error = $cust_main->bill( 'depend_jobnum'=>$placeholder->jobnum );
+    my @cust_bill;
+    my $bill_error = $cust_main->bill(
+      'depend_jobnum' => $placeholder->jobnum,
+      'return_bill'   => \@cust_bill,
+    );
     #warn "$me error billing new customer: $bill_error"
     #  if $bill_error;
 
@@ -828,11 +832,11 @@ sub new_customer {
 
     if ( $cust_main->balance > 0 ) {
 
-      #this makes sense.  credit is "un-doing" the invoice
-      $cust_main->credit( $cust_main->balance, 'signup server decline',
-                          'reason_type' => $conf->config('signup_credit_type'),
-                        );
-      $cust_main->apply_credits;
+      #this used to apply a credit, but now we can void invoices...
+      foreach my $cust_bill (@cust_bill) {
+        my $voiderror = $cust_bill->void();
+        warn "Error voiding cust bill after decline: $voiderror";
+      }
 
       #should check list for errors...
       #$cust_main->suspend;

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

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm |   26 +++++++++++++++-----------
 FS/FS/ClientAPI/Signup.pm    |   16 ++++++++++------
 FS/FS/Conf.pm                |    3 ++-
 FS/FS/cust_credit.pm         |    1 -
 4 files changed, 27 insertions(+), 19 deletions(-)




More information about the freeside-commits mailing list