[4/4] DropIn Actions: Present PaymentAction from the DropInRouter - #2744
Conversation
|
ℹ️ No baseline data found for 'develop'.
|
There was a problem hiding this comment.
Code Review
This pull request refactors the presentation and handling of payment actions within the Drop-In component. It replaces the ActionPresenter protocol with a centralized routing mechanism via DropInFlowRouting and PaymentActionPresenting, allowing actions to be presented on the deepest active module of the drop-in. Additionally, DropInFlowManager now manages submission tasks asynchronously, and several router protocols have been simplified by removing redundant action presentation methods. While the refactoring is well-tested, a critical bug was identified in DropInRouter.swift where an assertion condition is inverted, which would cause unexpected assertion failures during normal execution.
c038692 to
5a8b071
Compare
5a8b071 to
7e0ca50
Compare
a31968d to
f167f9b
Compare
f167f9b to
85b79b0
Compare
Sourcery scanned the repository root, including the gitignored TempProject directory that the Carthage integration tests leave behind. That directory holds a stale copy of the SDK, so mocks were generated from the wrong declarations, for example emitting `public` where the source says `package`. Exclude it. Also mark the generated mocks as generated so they collapse in review. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Introduces the module that hosts an action produced by a submitted payment: assembler, router, view model and a container view controller. Action components that manage their own navigation, such as the redirect web view, are used as is. Everything else is embedded in a container that owns the navigation item. The container offers a single trailing Done button and suppresses back navigation, since the payment has already been submitted and there is no way back to the payment details. The module is not wired into the drop in flow yet. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…nt progress leftovers The flow manager kept its own weak reference to the merchant delegate, which goes stale when the delegate is set after the manager is built. It now reads it from the drop in it already holds. `paymentInProgress` had no writers and `userDidCancel` no callers left after the cancellation moved into the flow manager, as did the `stopLoading` call, which became a no-op once the drop in stopped conforming to `LoadingComponent`.
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
85b79b0 to
a1604ad
Compare
a1604ad to
b94f426
Compare
The flow manager now presents actions on the root router itself, so the view model no longer needs to act as an action presenter or route action view controllers. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
robertdalmeida
left a comment
There was a problem hiding this comment.
Nice, looking forward to this being merged as i think the StoredPayment Screen also would need to redirect its action handling to to the DropinRouter.
erenbesel
left a comment
There was a problem hiding this comment.
Much better looking this way! some comments
# Conflicts: # AdyenDropIn/Modules/DropInFlowManager.swift
…yment-action-4 # Conflicts: # AdyenDropIn/Modules/ComponentContainer/ComponentContainerRouter.swift # AdyenDropIn/Modules/DropInFlowManager.swift # AdyenDropIn/Modules/GenericPaymentMethod/GenericPaymentMethodRouter.swift # AdyenDropIn/Modules/Root/DropInRouter.swift # AdyenDropIn/Modules/StoredPaymentMethodContent/StoredPaymentMethodContentView.swift # Tests/GeneratedMocks/AutoMockable.generated.swift # Tests/IntegrationTests/DropIn Tests/DropInFlowManagerTests.swift # Tests/IntegrationTests/DropIn Tests/DropInRouterTests.swift # Tests/IntegrationTests/DropIn Tests/PaymentMethodList/PaymentMethodListRouterTests.swift
✅ No changes detectedComparing Analyzed targets: Adyen, AdyenActions, AdyenCard, AdyenCardScanner, AdyenCashAppPay, AdyenCheckout, AdyenComponents, AdyenDelegatedAuthentication, AdyenDropIn, AdyenEncryption, AdyenSession, AdyenSwiftUI, AdyenTwint, AdyenUI, AdyenWeChatPay |
Last of four PRs splitting the drop-in payment action work. Stacked on #2743 — review #2741, #2742 and #2743 first.
Summary
ActionPresenterand building its own container. The root router now owns action presentation through the payment action module added in [1/4] DropIn Actions: Add PaymentAction module to DropIn #2741, and the action is pushed onto the existing navigation stack instead of being presented on top of it. A web view manages its own navigation, so it is still presented modally.childRouter, so presenting it does not release the module hierarchy below the root.DropInFlowManagertracks the submission: the task is cancelled when the flow moves on, and an action that arrives when none is expected is ignored, for example when the drop in was closed while the payment was in flight.ActionNavigationController,ActionPresentationHelperand the per-moduleActionPresenterconformances, sosubmit(_:from:)no longer carries a presenter.Test plan
DropInRouterTestscovers pushing onto the deepest module, the modal web view, that the child router is kept, and the dismissalDropInFlowManagerTestscovers the submission lifecycle, the ignored stale actions and the action presentationxcodebuild test -testPlan CIgreen: 970 XCTest and 262 Swift Testing tests, with one pre-existing flake (FormCardNumberValidationTests.testUC7_ReenteringFieldRestoresLogos, passes in isolation and CI retries)Ticket
CO-276