In the refund completion handler, the response logic and storage of the last operation result were recently updated. After that, the behavior started to diverge from the expected contract on commit errors and on repeated calls with the same request key.
POST /refunds/finalize endpoint accepts JSON of the form:{
"payment_id": "p-100",
"amount": 150
}
Idempotency-Key header is required and determines request repetition within the process.200 OK and JSON with refund_id and status.Idempotency-Key after a successful first call must return the same result.Store from the changes.Idempotency-Key: same-key and body:{"payment_id":"p-100","amount":150}
Store.failCommit = true before calling the handler.same-key key;{"payment_id":"p-999","amount":10}
500, without giving the client the appearance of a successful completion.Idempotency-Key is allowed only for the same logical request; a mismatching body must result in a conflict error, not in someone else’s saved result.1.24Store, no external databasePOST /refunds/finalize, JSON request, required Idempotency-Key headerStore.failCommit = true before the requestUse line comments to explain the problem, its impact, the fix and how to test it.