@@ -290,20 +290,12 @@ private extension RefundSubmissionUseCase {
290290 // TODO: 5984 - tracks in-person refund error
291291 DDLogError ( " Failed to refund: \( error. localizedDescription) " )
292292 // Informs about the error.
293+ //TODO: Check which refund errors can't be retried, and use that to call nonRetryableError(from: self.rootViewController, error: cancelError)
293294 alerts. error ( error: error, tryAgain: { [ weak self] in
294- // Cancels current payment.
295- self ? . cardPresentRefundOrchestrator. cancelRefund { [ weak self] result in
296- guard let self = self else { return }
297-
298- switch result {
299- case . success:
300- // Retries refund.
301- self . attemptCardPresentRefund ( refundAmount: refundAmount, charge: charge, onCompletion: onCompletion)
302- case . failure( let cancelError) :
303- // Informs that payment can't be retried.
304- self . alerts. nonRetryableError ( from: self . rootViewController, error: cancelError)
305- onCompletion ( . failure( error) )
306- }
295+ // Cancels current refund, if possible.
296+ self ? . cardPresentRefundOrchestrator. cancelRefund { [ weak self] _ in
297+ // Regardless of whether the refund could be cancelled (e.g. it completed but failed), retry the refund.
298+ self ? . attemptCardPresentRefund ( refundAmount: refundAmount, charge: charge, onCompletion: onCompletion)
307299 }
308300 } , dismissCompletion: {
309301 onCompletion ( . failure( error) )
0 commit comments