diff options
author | mark <mark> | 2011-05-12 19:57:01 +0000 |
---|---|---|
committer | mark <mark> | 2011-05-12 19:57:01 +0000 |
commit | b8d1f6382bd483b4c5718a7930ea2493a1686d50 (patch) | |
tree | af56ca4bc98e92a46e2f686f9bb52026c5ebed48 /FS/FS/cust_main | |
parent | 83053569b3d965924e2e1d4f5b199609ec7c29af (diff) |
new status for pending third-party payments, fix for #12808
Diffstat (limited to 'FS/FS/cust_main')
-rw-r--r-- | FS/FS/cust_main/Billing_Realtime.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index caa3ab3..fd19241 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -522,6 +522,19 @@ sub realtime_bop { '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 @@ sub realtime_bop { 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 ) }; |