Commit 2357fb8
committed
6643 Allow retries of failed interac refunds
When an interac refund fails, we show an error with a “Try again” button.
When the user taps that, we attempt to cancel the Interac refund “intent” using the `refundCancelable` that Stripe Terminal gives us in response to `SCPTerminal.collectRefundPaymentMethod()`
When there’s been a failure or error in the refund, the `refundCancelable` that Stripe gave us ends up in an unexpected situation: it’s not `completed`, but it also doesn’t call back the completion handler when we call `cancel`. This meant that our previous “Try again” handler did not start the new refund attempt.
Cancelling a refund after Stripe have called the completion handler from `processRefund`, or given us an error from `collectRefundPaymentMethod`, shouldn’t be required: those calls from Stripe have already told us that the original refund attempt is complete (even if failed), so we can’t cancel it anyway.
This change sets the `refundCancelable` to nil when Stripe have told us that the refund is complete, resulting in a `noRefundInProgress` error being returned to the `handleRefundFailureAndRetryRefund` handler. We don’t need to worry about this error or whether the cancellation was successful: in either case, we should try the refund again.
This change does not address that some refund errors should not be retriable: that will follow in future work.1 parent b882be2 commit 2357fb8
File tree
2 files changed
+13
-19
lines changed- Hardware/Hardware/CardReader/StripeCardReader
- WooCommerce/Classes/ViewRelated/Orders/Refund
2 files changed
+13
-19
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| 521 | + | |
521 | 522 | | |
522 | 523 | | |
523 | 524 | | |
524 | 525 | | |
| 526 | + | |
525 | 527 | | |
526 | 528 | | |
527 | 529 | | |
| |||
Lines changed: 11 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
110 | 115 | | |
111 | 116 | | |
112 | 117 | | |
| |||
232 | 237 | | |
233 | 238 | | |
234 | 239 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
278 | 279 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
292 | 284 | | |
293 | 285 | | |
294 | 286 | | |
| |||
0 commit comments