modifies (as appropriate) void payment(s) on the transaction
to produce a zero-balance transaction, without affecting any
of the billings or real patron payments.
+
Transactions which do not have a negative balance will be
ignored.
/,
my $remainder = $U->fpdiff(-$xact->balance_owed, $payment->amount);
if ($remainder >= 0) {
- # void payment is not large enough to bring us over $0,
+ # void payment is not large enough to take us beyond $0,
# delete the whole payment.
$logger->info("deleting void payment ".$payment->id.
return if $remainder == 0; # all done
- # instead of doing math, fetch the updated transaction
- # to get the latest value for balance_owed from the DB.
+ # fetch the updated transaction from the DB to get the most
+ # accurate value for balance_owed.
$xact = $e->retrieve_money_billable_transaction_summary($xact->id);
} else {
+
# update the void payment to use the difference between
# the amount voided and the amount owed.
$remainder = -$remainder;
# we don't check to see if the xact is already closed. since the
# xact had a negative balance, it should not have been closed, so
- # assume 'now' is the real close time regardless.
+ # assume 'now' is the correct close time regardless.
my $trans = $e->retrieve_money_billable_transaction($xact_id);
$trans->xact_finish("now");