Stripe Payment Intents and Negative Bills

Bug #1965579 reported by Terran McCanna
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Critical
Unassigned
3.8
Fix Released
Critical
Unassigned

Bug Description

Evergreen 3.8 with Stripe (using the new Payment Intents code) in the Bootstrap OPAC:

Since the upgrade we've had an intermittent issue with some patrons attempting to pay online and their bills not getting credited to Evergreen - in some cases, patrons try repeatedly, and their credit cards get charged each time.

One scenario that I've found that causes this is when a patron has some negative bills on their account. When a patron has a positive bill and a negative bill on their account (with their total amount positive), it appears that Evergreen will send a payment amount to Stripe (which isn't actually the correct amount), Stripe will bill the credit card, and then when Stripe sends back the message to Evergreen, Evergreen will throw an error and not credit the patron's account.

For example, I created a bill for $1 and a negative bill for $-0.40. (I created the negative bill by creating a bill for 0.50, forgiving 0.40 of it, and then voiding it - note that when I voided it, it asked if I wanted to void 0.60.)

The OPAC shows that I owe 0.60 which is correct. I paid, then it gave me "ERR_BLOCKED_BY_CLIENT" in the console and "Invalid parameters were encountered in a method" and "Negative credit card payments are not allowed" in the browser. (See screenshot)

My credit card was charged $1.60 instead of the $0.60 it should have been charged, and my Evergreen account was not updated.

Revision history for this message
Terran McCanna (tmccanna) wrote :
Changed in evergreen:
status: New → Confirmed
Revision history for this message
Jessica Woolford (jwoolford) wrote :

I can replicate this on a server running 3.8. If the negative bill is unchecked, the payment goes through successfully, but if it is check the error message appears and the credit card is charged.

On 3.6, the error appears and the credit card is NOT charged. This is more desirable, but still leads to a potentially frustrating loop for the patron. It would be better if the negative billing could not be selected when paying fines in the OPAC.

Revision history for this message
Terran McCanna (tmccanna) wrote :

Note - as a temporary workaround, we're hiding the payment buttons if there are any negative bills and directing them to staff to resolve those before they can pay. That's clearly not the best solution, though.

Revision history for this message
Terran McCanna (tmccanna) wrote :

Well, I think there could also be a problem if the negative bill is not selected because if they have a negative bill for $1 and a regular bill for $2 then overall they really only owe $1. Allowing them to pay $2 would leave their account with a negative balance, so the library would have to do a refund.

If they were at the desk, the staff would just charge them $1 and clear both the negative and positive bills at once.

My preference would be either to prevent them from paying at all, or to limit what they can pay to the total balance owed.

Revision history for this message
Jason Etheridge (phasefx) wrote :

Just noting that this problem also affects another payment processor I'm implementing, but manifests differently. I'm going to give it some tuits, but I'm open to ideas about how to handle this. It's really up to a given library's policy whether or not negative billings count as refunds owed to the patron, right? If so, EG might not should be advertising these to the patrons without a library setting. We also don't have a mechanism for allowing a patron to use their "patron credit" as a way of paying fines in the OPAC.

Revision history for this message
Jason Etheridge (phasefx) wrote :

Another note, the specific error I'm getting is visible in the OPAC:

Invalid parameters were encountered in a method
Negative credit card payments not allowed

It also results in a payment not registering on the Evergreen side but happening on the credit processor's side. Stripe Payment Intents is supposed to be more robust here, so I'll focus on that first, detecting the error and not completing the Stripe payment, but we still need to think about negative billings in general.

Revision history for this message
Terran McCanna (tmccanna) wrote :

I may be oversimplifying, but I believe the key points are:

- Negative bills should not be allowed to be selected
- The overall amount that is sent to the payment processor should not exceed the patron's total balance owed

Revision history for this message
Jason Etheridge (phasefx) wrote :

Terran, I think as a stop-gap the community version of EG should be doing what PINES is doing, and disallow OPAC payments in the presence of negative billings. Would you like to submit a localizable version of your patch? Or I can, no problem. Longer term, we should discuss what we want to do here, perhaps a different presentation of negative billings to patrons and some smart reconciliation on the backend. Thanks!

Revision history for this message
Jason Etheridge (phasefx) wrote :

Terran, I'm going to grab it. Thanks!

Changed in evergreen:
assignee: nobody → Jason Etheridge (phasefx)
Revision history for this message
Jason Etheridge (phasefx) wrote :
tags: added: pullrequest
Changed in evergreen:
assignee: Jason Etheridge (phasefx) → nobody
Revision history for this message
Terran McCanna (tmccanna) wrote :

Thanks, Jason!

Changed in evergreen:
assignee: nobody → Terran McCanna (tmccanna)
Revision history for this message
Terran McCanna (tmccanna) wrote :

That works for me as a stopgap. My sign off is at:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/mccanna/lp1965579-opac-negative-bills-signoff

(I agree there needs to be a more nuanced way of handling this that allows the patron to pay what they actually owe in this situation rather than blocking them from paying at all, but this is better than nothing.)

Changed in evergreen:
assignee: Terran McCanna (tmccanna) → nobody
Michele Morgan (mmorgan)
tags: added: signedoff
Revision history for this message
Galen Charlton (gmc) wrote :

Committed down to rel_3_8. Thanks, Jason and Terran!

Changed in evergreen:
milestone: none → 3.9.1
status: Confirmed → Fix Committed
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.