fix(napm): report failed web redirect to backend when confirmation is required - #536
Open
dbashtani wants to merge 1 commit into
Open
fix(napm): report failed web redirect to backend when confirmation is required#536dbashtani wants to merge 1 commit into
dbashtani wants to merge 1 commit into
Conversation
… required When a web redirect fails (customer cancels ASWebAuthenticationSession or the session fails to start), the failure was only surfaced locally and continuePayment was never invoked, leaving the invoice pending on the backend while the merchant app received a cancellation failure. This mirrors the existing deep link behavior, which reports success: didOpenUrl when redirect.confirmationRequired is set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #535
Problem
When a
web-type redirect fails during a native alternative payment (customer closesASWebAuthenticationSession, or the session fails to start),uncheckedRedirect(to:)throws beforecontinuePaymentis called. The merchant app receivesprocessout-mobile.cancelled, but the backend is never informed — the invoice stays pending in the dashboard, disagreeing with the SDK-reported outcome.This is inconsistent with the
deep_linkbranch, which reports.init(success: didOpenUrl)whenredirect.confirmationRequiredis set.Change
On web redirect failure, when
redirect.confirmationRequiredistrue, reportredirect: .init(success: false)viacontinuePayment— mirroring the deep link semantics — then rethrow the original error.confirmationRequired, the backend's existing opt-in flag, so no confirmations are sent that the backend didn't ask for.try?): a network failure during the report cannot mask the original failure.POFailurepropagates, same events are emitted.Open questions for review
success: falsefor web redirects (fail attempt vs. allow retry) — please confirm the desired invoice transition.handleWebRedirect(failure:)completes locally without sending a redirect confirmation); if this change is accepted, a matching fix there would keep platforms consistent.