feat(ad-hoc): support manual web fallback#524
Conversation
This reverts commit 2acefee.
There was a problem hiding this comment.
Pull request overview
This PR refactors web authentication and deep-link handling to support a manual web fallback for native alternative payments. The internal WebAuthenticationSession/WebAuthenticationRequest types are promoted to @_spi(PO) public POWebAuthenticationSession/POWebAuthenticationRequest and exposed on ProcessOut.shared. The native AP interactor now drives the web redirect itself via the web authentication session (so it can capture the return URL) and resolves deep-link return URLs locally instead of via global event observation in DefaultInvoicesService.
Changes:
- Promote internal web auth types to
@_spi(PO) publicPOWebAuthenticationSession/POWebAuthenticationRequestand exposeProcessOut.shared.webAuthenticationSession. - Drive the web redirect flow from
NativeAlternativePaymentDefaultInteractorand forward the resulting URL via the newresultfield ofPONativeAlternativePaymentRedirectResultV2; addresolveUrlon the service adapter /POInvoicesService. - Remove the global deep-link event plumbing (
PONativeAlternativePaymentDeepLinkResolved/ResolutionFailedEventandDefaultInvoicesService.observeEvents) in favor of the interactor handlingPODeepLinkReceivedEventdirectly.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/ProcessOut/Sources/Sessions/WebAuthentication/POWebAuthenticationSession.swift | New SPI public protocol replacing internal WebAuthenticationSession. |
| Sources/ProcessOut/Sources/Sessions/WebAuthentication/POWebAuthenticationRequest.swift | New SPI public request type with public initializer. |
| Sources/ProcessOut/Sources/Sessions/WebAuthentication/WebAuthenticationSession.swift | Old internal protocol removed. |
| Sources/ProcessOut/Sources/Sessions/WebAuthentication/WebAuthenticationRequest.swift | Old internal struct removed. |
| Sources/ProcessOut/Sources/Sessions/WebAuthentication/ThrottledWebAuthenticationSessionDecorator.swift | Updated to conform to the new SPI protocol. |
| Sources/ProcessOut/Sources/Sessions/WebAuthentication/DefaultWebAuthenticationSession.swift | Updated to use the new SPI types. |
| Sources/ProcessOut/Sources/Api/ProcessOut.swift | Exposes webAuthenticationSession on the singleton. |
| Sources/ProcessOut/Sources/Services/CustomerActions/DefaultCustomerActionsService.swift | Uses new protocol type. |
| Sources/ProcessOut/Sources/Services/AlternativePayments/DefaultAlternativePaymentsService.swift | Uses new protocol type. |
| Sources/ProcessOut/Sources/Services/Invoices/POInvoicesService.swift | Adds SPI resolveUrl with default-throwing extension. |
| Sources/ProcessOut/Sources/Services/Invoices/DefaultInvoicesService.swift | Implements resolveUrl; drops global deep-link event observation. |
| Sources/ProcessOut/Sources/Services/Invoices/Events/PONativeAlternativePaymentDeepLinkResolvedEvent.swift | Event removed. |
| Sources/ProcessOut/Sources/Services/Invoices/Events/PONativeAlternativePaymentDeepLinkResolutionFailedEvent.swift | Event removed. |
| Sources/ProcessOut/Sources/Repositories/Shared/Requests/AlternativePaymentV2/PONativeAlternativePaymentRedirectResultV2.swift | Adds nested Result and result: Result? to carry the return URL. |
| Sources/ProcessOut/Sources/Repositories/Invoices/Requests/AlternativePaymentV2/PONativeAlternativePaymentUrlResolutionRequestV2.swift | Adds public initializers for nested types. |
| Sources/ProcessOutUI/Sources/Modules/NativeAlternativePayment/Interactor/NativeAlternativePaymentDefaultInteractor.swift | Switches dependency to POWebAuthenticationSession, drives web redirect, listens for PODeepLinkReceivedEvent, and routes resolution through the service adapter. Contains invalid ProcessOut::POWebAuthenticationSession syntax. |
| Sources/ProcessOutUI/Sources/Modules/NativeAlternativePayment/Interactor/Adapter/NativeAlternativePaymentServiceAdapter.swift | Adds resolveUrl to the adapter protocol. |
| Sources/ProcessOutUI/Sources/Modules/NativeAlternativePayment/Interactor/Adapter/DefaultNativeAlternativePaymentServiceAdapter.swift | Implements resolveUrl by delegating to invoices service. |
| Sources/ProcessOutUI/Sources/Modules/NativeAlternativePayment/Component/PONativeAlternativePaymentComponent.swift | Wires webAuthenticationSession into the interactor. |
| Sources/ProcessOutUI/Sources/Modules/DynamicCheckout/Utils/ChildProvider/DynamicCheckoutInteractorDefaultChildProvider.swift | Wires webAuthenticationSession into the interactor. |
| Tests/ProcessOutTests/Sources/Mocks/WebAuthenticationSession/MockWebAuthenticationSession.swift | Mock updated to new protocol/request type names. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.