Skip to content

Commit

Permalink
Always fire checkoutDidFail
Browse files Browse the repository at this point in the history
  • Loading branch information
markmur committed Apr 22, 2024
1 parent ebad670 commit 43c8ac6
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,12 @@ extension CheckoutWebViewController: CheckoutWebViewDelegate {

func checkoutViewDidFailWithError(error: CheckoutError) {
CheckoutWebView.invalidate()
delegate?.checkoutDidFail(error: error)

let shouldAttemptRecovery = delegate?.shouldRecoverFromError(error: error) ?? false

if shouldAttemptRecovery {
self.presentFallbackViewController(url: self.checkoutURL)
} else {
delegate?.checkoutDidFail(error: error)
}
}

Expand All @@ -238,8 +237,4 @@ extension CheckoutWebViewController: CheckoutWebViewDelegate {
func checkoutViewDidEmitWebPixelEvent(event: PixelEvent) {
delegate?.checkoutDidEmitWebPixelEvent(event: event)
}

private func isErrorRecoverable(error: CheckoutError) -> Bool {
return error.isRecoverable
}
}

0 comments on commit 43c8ac6

Please sign in to comment.