[freeside-commits] freeside/FS/FS/cust_main Billing_Realtime.pm, 1.22, 1.23

Mark Wells mark at wavetail.420.am
Thu May 12 12:57:03 PDT 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/cust_main
In directory wavetail.420.am:/tmp/cvs-serv17657/FS/FS/cust_main

Modified Files:
	Billing_Realtime.pm 
Log Message:
new status for pending third-party payments, fix for #12808

Index: Billing_Realtime.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main/Billing_Realtime.pm,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -w -d -r1.22 -r1.23
--- Billing_Realtime.pm	11 May 2011 00:49:50 -0000	1.22
+++ Billing_Realtime.pm	12 May 2011 19:57:01 -0000	1.23
@@ -522,6 +522,19 @@
     'custnum' => $self->custnum,
     'status'  => { op=>'!=', value=>'done' } 
   });
+
+  #for third-party payments only, remove pending payments if they're in the 
+  #'thirdparty' (waiting for customer action) state.
+  if ( $namespace eq 'Business::OnlineThirdPartyPayment' ) {
+    foreach ( grep { $_->status eq 'thirdparty' } @pending ) {
+      my $error = $_->delete;
+      warn "error deleting unfinished third-party payment ".
+          $_->paypendingnum . ": $error\n"
+        if $error;
+    }
+    @pending = grep { $_->status ne 'thirdparty' } @pending;
+  }
+
   return "A payment is already being processed for this customer (".
          join(', ', map 'paypendingnum '. $_->paypendingnum, @pending ).
          "); $options{method} transaction aborted."
@@ -594,6 +607,9 @@
 
   if ( $transaction->is_success() && $namespace eq 'Business::OnlineThirdPartyPayment' ) {
 
+    $cust_pay_pending->status('thirdparty');
+    my $cpp_err = $cust_pay_pending->replace;
+    return { error => $cpp_err } if $cpp_err;
     return { reference => $cust_pay_pending->paypendingnum,
              map { $_ => $transaction->$_ } qw ( popup_url collectitems ) };
 



More information about the freeside-commits mailing list