diff options
author | ivan <ivan> | 2004-07-10 14:46:17 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-07-10 14:46:17 +0000 |
commit | 4c4b99f655084122e9b55222dae3e94757b78cae (patch) | |
tree | d1a9f019abc68b011d331b6b302e3bd68b2c856f /FS/FS/ClientAPI | |
parent | 6c420cf8a5f93e425840c0cb8ba841affa081f76 (diff) |
fix edge case avoiding erronous decline/cancel when customer has a negative balance & purchases stuff with it
Diffstat (limited to 'FS/FS/ClientAPI')
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index ceb1e65e7..f51174e5d 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -555,7 +555,8 @@ sub order_pkg { $cust_main->apply_credits; $bill_error = $cust_main->collect; - if ( $cust_main->balance > $old_balance + if ( $cust_main->balance > $old_balance + && $cust_main->balance > 0 && $cust_main->payby !~ /^(BILL|DCRD|DCHK)$/ ) { #this makes sense. credit is "un-doing" the invoice $cust_main->credit( sprintf("%.2f", $cust_main->balance - $old_balance ), @@ -563,7 +564,7 @@ sub order_pkg { $cust_main->apply_credits( 'order' => 'newest' ); $cust_pkg->cancel('quiet'=>1); - return { 'error' => '_decline' }; + return { 'error' => '_decline', 'bill_error' => $bill_error }; } else { $cust_pkg->reexport; } |