overpaying with patron credit can generate a double credit

Bug #727432 reported by Dan Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Undecided
Dan Wells

Bug Description

If you overpay a bill with 'Payment Type' of 'Patron Credit', but also have the 'Convert Change to Patron Credit' option turned on, you will get a double credit for the overage, as it is passed in as the 'patron_credit' option, then the overage is applied to the credit inside the function as well. For example:

Bill - $1
Patron Credit Payment - $3

results in:

request open-ils.circ open-ils.circ.money.payment "myauthkey",{"userid":7,"note":"","payment_type":"credit_payment","payments":[["9","1.00"]],"patron_credit":"2.00"},...

Which works out to:
$2 (passed in credit, $3 payment - $1 bill)
-$1 (payment)
= net $1 of credit

Ultimately, the interface should probably not be generating "change" for patron credit payments at all, so the patron_credit for any credit payment should always be zero. It is tempting to simply zero-out any patron_credit for credit payments, but ultimately we cannot always know where that number came from.

Revision history for this message
Dan Wells (dbw2) wrote :

If we want to allow for cash refunds of patron credit, instead of sending a zero amount for patron_credit, we could always ensure we send the full payment amount. The key is to inform the server in some accurate way of the actual credit being "used", as we do not receive this from the patron, but rather retrieve it from their account.

Revision history for this message
Jason Etheridge (phasefx) wrote : Re: [Bug 727432] [NEW] overpaying with patron credit can generate a double credit

>  Ultimately, the interface should probably not be generating "change"
>  for patron credit payments at all, so the patron_credit for any credit
>  payment should always be zero.

I'm in favor of the UI doing this.

Revision history for this message
Dan Wells (dbw2) wrote :

The attached patch handles all the cases I could come up with in testing, including 'cashing out' patron credits. One thing I am unsure of; is bills.js defunct? It seems so, but I want to sure.

Dan Wells (dbw2)
Changed in evergreen:
status: New → Fix Committed
assignee: nobody → Dan Wells (dbw2)
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.