Repository navigation
feat(core): harden refund idempotency - #113
Closed
alexasomba wants to merge 1 commit into
Closed
alexasomba wants to merge 1 commit into
alexasomba wants to merge 1 commit into
Conversation
Author
|
Superseded by #115. No review had started, so the two small safety fixes were combined to reduce the stack. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the Flutterwave follow-up in #97. Independent of the split work.
Why
The admin refund route generated a fresh
refund:${orderId}:${randomId()}for every click. If the provider accepted the refund but the response was lost, the operator's retry used a new key and could create a second refund. Flutterwave's duplicate guard is a comment tag plusGET /v3/refunds, and that list endpoint is unauthorized on some keys, so the package cannot always catch it.What
refundRequestId(1–200 letters, digits,:,_,-). If omitted, it still generates one, so existing callers are unchanged.refundOrderlooks up the request id before calling the provider. A repeated id returns the recorded refund, with no second provider call and no second email. This is the local ledger.failednow shows an error instead of "Refund issued".Tests
upstream/main, 0 failures.Notes
Idempotency-Key, Flutterwave's comment tag).