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 690fb84
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
disabled_rules:
- line_length
- file_length

opt_in_rules:
- array_init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ extension CartViewController: CheckoutDelegate {
errorMessage = message
}

print(errorMessage)
print(errorMessage, "Recoverable: \(error.isRecoverable)")
}

private func handleCheckoutUnavailable(_ message: String, _ code: CheckoutUnavailable) {
Expand Down
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 690fb84

Please sign in to comment.