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 | |
| parent | 83053569b3d965924e2e1d4f5b199609ec7c29af (diff) | |
new status for pending third-party payments, fix for #12808
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/ClientAPI/Signup.pm | 4 | ||||
| -rw-r--r-- | FS/FS/cust_main/Billing_Realtime.pm | 16 | ||||
| -rw-r--r-- | FS/FS/cust_pay_pending.pm | 4 | 
3 files changed, 22 insertions, 2 deletions
diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index b18f21f74..6c9e81261 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -904,8 +904,8 @@ sub capture_payment {      return { error => '_decline', bill_error => $bill_error };    } -  if ($cust_pay_pending->status ne 'pending') { -    my $bill_error = "Payment with id $paypendingnum is not pending, but ". +  if ($cust_pay_pending->status ne 'thirdparty') { +    my $bill_error = "Payment with id $paypendingnum is not thirdparty, but ".                       $cust_pay_pending->status.  "; Transaction aborted.";      return { error => '_decline', bill_error => $bill_error };    } diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index caa3ab37d..fd192416d 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 ) }; diff --git a/FS/FS/cust_pay_pending.pm b/FS/FS/cust_pay_pending.pm index e54690e4b..f03ed1f3a 100644 --- a/FS/FS/cust_pay_pending.pm +++ b/FS/FS/cust_pay_pending.pm @@ -96,6 +96,10 @@ Aquires basic lock on payunique  Transaction is pending with the gateway +=item thirdparty + +Customer has been sent to an off-site payment gateway to complete processing +  =item authorized  Only used for two-stage transactions that require a separate capture step  | 
