Tech
The four-line diff that charges your customers twice
Here's a change any of us could approve tomorrow.
Checkout fails when the bank is slow, so you ask your agent to retry. It wraps the charge call in a retry: three attempts, on timeout. Tests pass. The diff is four lines. You approve it.
Now one question. If the bank already took the money and only the response timed out, what does the retry do?
It charges the customer again. Nothing in those four lines makes the second attempt the same charge as the first.
The code was easy to read, ...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to