Skip to content

feat: Implement PAY_NL_KAARTDIRECT in CheckoutComponents#1685

Draft
borisprimer wants to merge 2 commits intobn/feature/checkout-componentsfrom
bn/ACC-7015/kaartdirect-checkout-components
Draft

feat: Implement PAY_NL_KAARTDIRECT in CheckoutComponents#1685
borisprimer wants to merge 2 commits intobn/feature/checkout-componentsfrom
bn/ACC-7015/kaartdirect-checkout-components

Conversation

@borisprimer
Copy link
Copy Markdown
Contributor

@borisprimer borisprimer commented Apr 14, 2026

Summary

  • Register PAY_NL_KAARTDIRECT as a WebRedirect payment method in CheckoutComponents
  • The backend returns NATIVE_SDK implementation type (due to custom drop-in button styling), but the actual flow is a standard redirect to Pay.nl's hosted gift card page
  • Mirrors the WEB SDK approach (mergeConfigWithLocalDefinitions) by including known NATIVE_SDK redirect types during WebRedirect registration

Changes

  • Add payNLKaartdirect case to PrimerPaymentMethodType enum with PAY_NL provider mapping
  • Register Kaartdirect alongside WebRedirect APMs in DefaultCheckoutScope.registerPaymentMethods()
  • Add icon mapping (generic card, same as MOLLIE_GIFTCARD)
  • Add exhaustive switch case in UserInterfaceModule for DropIn support
  • Add KaartdirectRegistrationTests (11 tests covering enum, encoding, registration, scope creation)
  • Add icon test in PrimerPaymentMethodTypeImageNameTests

Jira

ACC-7015

Test plan

  • All 11 Kaartdirect registration tests pass
  • All 63 WebRedirect + icon tests pass
  • Debug App builds successfully
  • Manual test with client session containing PAY_NL_KAARTDIRECT

@borisprimer borisprimer requested a review from a team as a code owner April 14, 2026 12:57
@borisprimer borisprimer self-assigned this Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

@borisprimer borisprimer marked this pull request as draft April 16, 2026 13:31
@borisprimer borisprimer marked this pull request as ready for review April 20, 2026 14:18
@borisprimer borisprimer force-pushed the bn/ACC-7015/kaartdirect-checkout-components branch from e2faf9c to c0d7ce4 Compare April 21, 2026 09:28
borisprimer added a commit that referenced this pull request Apr 21, 2026
CheckoutComponents test classes write into the global `DIContainer.shared`
but do not reset it between tests, so singleton registrations and
resolution state leak across tests. Under varying test-run orderings this
manifests as `circularDependency`, stale mock call counts, and tests
asserting against state left by a previous class. Four recent PRs
(#1685, #1686, #1691, #1705) have been flaking on this.

Changes:
- Add `ContainerTestHelpers.resetSharedContainer()` and call it from
  `setUp` and `tearDown` of the 12 test files that use `DIContainer.shared`.
- Add `ContainerTestHelpers.createSettledCheckoutScope()` — creates a
  `DefaultCheckoutScope` with a pre-wired test container and returns only
  after its async init leaves `.initializing`. Use in the three
  `DefaultPaymentMethodSelectionScope*Tests` classes so downstream
  `loadPaymentMethods()` no longer waits forever on a scope stuck in
  `.initializing`.
- Fix `test_onDismiss_setsNavigationStateToDismissed` race: build the SUT
  with `isInitScreenEnabled: false` so the async init task cannot
  overwrite `.dismissed` with `.loading`; drop the 500 ms sleep and the
  `|| == .loading` hedge — both `updateState` calls on the dismiss path
  are synchronous.
- Fix `test_deleteVaultedPaymentMethod_whenDeleteThrows_propagatesErrorWithoutRefresh`:
  capture a post-init baseline of `fetchVaultedPaymentMethodsCallCount`
  and assert the failed delete did not increment it, instead of asserting
  the absolute count is zero (the settled scope now legitimately refreshes
  once during init).
Register Kaartdirect as a WebRedirect payment method. The backend
returns NATIVE_SDK implementation type (due to custom drop-in button)
but the actual flow is a standard redirect to Pay.nl's hosted page.

This mirrors the WEB SDK approach (mergeConfigWithLocalDefinitions)
by including NATIVE_SDK redirect types alongside WEB_REDIRECT types
during payment method registration.
DefaultCheckoutScope.init calls registerPaymentMethods() which calls
reset(), wiping test-registered payment methods. Move .register() calls
to after scope creation.
@borisprimer borisprimer force-pushed the bn/ACC-7015/kaartdirect-checkout-components branch from c0d7ce4 to f29a585 Compare April 21, 2026 09:39
@sonarqubecloud
Copy link
Copy Markdown

@borisprimer borisprimer marked this pull request as draft April 23, 2026 10:36
@borisprimer
Copy link
Copy Markdown
Contributor Author

Converting to draft. Replaced by platform PR https://github.com/primer-io/platform/pull/7250, which adds mobile-override-implementation-type: WEB_REDIRECT to the spec and removes the need for the nativeSdkRedirectTypes local override in DefaultCheckoutScope. Will close once the platform change ships and I've verified the method auto-registers via the existing implementationType == .webRedirect path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants