X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMyAccount.pm;h=58ab6c0b7fc2f40a24e92d7ee04f9f306af7aa1b;hp=e8ce6b43220edb4f17d98f59accf02345065cb4c;hb=88d5d75f5297eaa96d3cd0c2a5f29c981e43e126;hpb=1239c0a9987e36f2031cf56dbbe99a7ce5fd67bc diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index e8ce6b432..58ab6c0b7 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -541,6 +541,11 @@ sub order_pkg { if ( $cust_main->balance > $old_balance && $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 ), + 'self-service decline' ); + $cust_main->apply_credits( 'order' => 'newest' ); + $cust_pkg->cancel('quiet'=>1); return { 'error' => '_decline' }; } else {