@spare-technologies/spare-link 0.1.0-beta.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -63
- package/lib/commonjs/core/models/payment-return-params.js +245 -20
- package/lib/commonjs/core/models/payment-return-params.js.map +1 -1
- package/lib/commonjs/core/models/pending-session-record.js +2 -0
- package/lib/commonjs/core/models/pending-session-record.js.map +1 -0
- package/lib/commonjs/core/services/hosted-flow-controller.js +333 -0
- package/lib/commonjs/core/services/hosted-flow-controller.js.map +1 -0
- package/lib/commonjs/core/services/hosted-flow-state.js +96 -0
- package/lib/commonjs/core/services/hosted-flow-state.js.map +1 -0
- package/lib/commonjs/index.js +42 -164
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/bank-redirect.js +20 -9
- package/lib/commonjs/internal/bank-redirect.js.map +1 -1
- package/lib/commonjs/internal/hosted/bridge-message.js +107 -0
- package/lib/commonjs/internal/hosted/bridge-message.js.map +1 -0
- package/lib/commonjs/internal/hosted/hosted-url.js +41 -0
- package/lib/commonjs/internal/hosted/hosted-url.js.map +1 -0
- package/lib/commonjs/internal/index.js +0 -7
- package/lib/commonjs/internal/index.js.map +1 -1
- package/lib/commonjs/internal/redact-uri.js +59 -15
- package/lib/commonjs/internal/redact-uri.js.map +1 -1
- package/lib/commonjs/internal/secure-store-pending-session-store.js +20 -25
- package/lib/commonjs/internal/secure-store-pending-session-store.js.map +1 -1
- package/lib/commonjs/internal/url-parts.js +145 -0
- package/lib/commonjs/internal/url-parts.js.map +1 -0
- package/lib/commonjs/public/index.js +0 -37
- package/lib/commonjs/public/index.js.map +1 -1
- package/lib/commonjs/public/payment-result.js +16 -4
- package/lib/commonjs/public/payment-result.js.map +1 -1
- package/lib/commonjs/public/recovery-result.js +7 -18
- package/lib/commonjs/public/recovery-result.js.map +1 -1
- package/lib/commonjs/public/spare-link-config.js +41 -16
- package/lib/commonjs/public/spare-link-config.js.map +1 -1
- package/lib/commonjs/public/spare-link-event.js +27 -33
- package/lib/commonjs/public/spare-link-event.js.map +1 -1
- package/lib/commonjs/public/spare-link-instance.js +67 -77
- package/lib/commonjs/public/spare-link-instance.js.map +1 -1
- package/lib/commonjs/public/spare-link-session.js +2 -9
- package/lib/commonjs/public/spare-link-session.js.map +1 -1
- package/lib/commonjs/public/spare-link.js +0 -12
- package/lib/commonjs/public/spare-link.js.map +1 -1
- package/lib/commonjs/ui/hooks/{use-payment-flow-state.js → use-hosted-flow-state.js} +4 -4
- package/lib/commonjs/ui/hooks/use-hosted-flow-state.js.map +1 -0
- package/lib/commonjs/ui/hosted/hosted-payment-page.js +177 -0
- package/lib/commonjs/ui/hosted/hosted-payment-page.js.map +1 -0
- package/lib/commonjs/ui/hosted/hosted-payment-webview.js +168 -0
- package/lib/commonjs/ui/hosted/hosted-payment-webview.js.map +1 -0
- package/lib/commonjs/ui/screens/index.js +3 -17
- package/lib/commonjs/ui/screens/index.js.map +1 -1
- package/lib/commonjs/ui/screens/page-unavailable-screen.js +101 -0
- package/lib/commonjs/ui/screens/page-unavailable-screen.js.map +1 -0
- package/lib/commonjs/ui/spare-link-host.js +220 -234
- package/lib/commonjs/ui/spare-link-host.js.map +1 -1
- package/lib/commonjs/ui/widgets/index.js +3 -10
- package/lib/commonjs/ui/widgets/index.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/core/models/payment-return-params.js +235 -20
- package/lib/module/core/models/payment-return-params.js.map +1 -1
- package/lib/module/core/models/pending-session-record.js +2 -0
- package/lib/module/core/models/pending-session-record.js.map +1 -0
- package/lib/module/core/services/hosted-flow-controller.js +328 -0
- package/lib/module/core/services/hosted-flow-controller.js.map +1 -0
- package/lib/module/core/services/hosted-flow-state.js +91 -0
- package/lib/module/core/services/hosted-flow-state.js.map +1 -0
- package/lib/module/index.js +8 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/bank-redirect.js +20 -9
- package/lib/module/internal/bank-redirect.js.map +1 -1
- package/lib/module/internal/hosted/bridge-message.js +104 -0
- package/lib/module/internal/hosted/bridge-message.js.map +1 -0
- package/lib/module/internal/hosted/hosted-url.js +36 -0
- package/lib/module/internal/hosted/hosted-url.js.map +1 -0
- package/lib/module/internal/index.js +0 -1
- package/lib/module/internal/index.js.map +1 -1
- package/lib/module/internal/redact-uri.js +59 -15
- package/lib/module/internal/redact-uri.js.map +1 -1
- package/lib/module/internal/secure-store-pending-session-store.js +20 -25
- package/lib/module/internal/secure-store-pending-session-store.js.map +1 -1
- package/lib/module/internal/url-parts.js +139 -0
- package/lib/module/internal/url-parts.js.map +1 -0
- package/lib/module/public/index.js +2 -3
- package/lib/module/public/index.js.map +1 -1
- package/lib/module/public/payment-result.js +16 -4
- package/lib/module/public/payment-result.js.map +1 -1
- package/lib/module/public/recovery-result.js +7 -17
- package/lib/module/public/recovery-result.js.map +1 -1
- package/lib/module/public/spare-link-config.js +42 -15
- package/lib/module/public/spare-link-config.js.map +1 -1
- package/lib/module/public/spare-link-event.js +27 -33
- package/lib/module/public/spare-link-event.js.map +1 -1
- package/lib/module/public/spare-link-instance.js +68 -72
- package/lib/module/public/spare-link-instance.js.map +1 -1
- package/lib/module/public/spare-link-session.js +2 -9
- package/lib/module/public/spare-link-session.js.map +1 -1
- package/lib/module/public/spare-link.js +1 -1
- package/lib/module/public/spare-link.js.map +1 -1
- package/lib/module/ui/hooks/{use-payment-flow-state.js → use-hosted-flow-state.js} +3 -3
- package/lib/module/ui/hooks/use-hosted-flow-state.js.map +1 -0
- package/lib/module/ui/hosted/hosted-payment-page.js +175 -0
- package/lib/module/ui/hosted/hosted-payment-page.js.map +1 -0
- package/lib/module/ui/hosted/hosted-payment-webview.js +163 -0
- package/lib/module/ui/hosted/hosted-payment-webview.js.map +1 -0
- package/lib/module/ui/screens/index.js +1 -3
- package/lib/module/ui/screens/index.js.map +1 -1
- package/lib/module/ui/screens/page-unavailable-screen.js +97 -0
- package/lib/module/ui/screens/page-unavailable-screen.js.map +1 -0
- package/lib/module/ui/spare-link-host.js +221 -236
- package/lib/module/ui/spare-link-host.js.map +1 -1
- package/lib/module/ui/widgets/index.js +1 -2
- package/lib/module/ui/widgets/index.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/commonjs/core/models/index.d.ts +1 -123
- package/lib/typescript/commonjs/core/models/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/core/models/payment-return-params.d.ts +91 -8
- package/lib/typescript/commonjs/core/models/payment-return-params.d.ts.map +1 -1
- package/lib/typescript/commonjs/core/models/pending-session-record.d.ts +11 -0
- package/lib/typescript/commonjs/core/models/pending-session-record.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/services/hosted-flow-controller.d.ts +119 -0
- package/lib/typescript/commonjs/core/services/hosted-flow-controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/services/hosted-flow-state.d.ts +75 -0
- package/lib/typescript/commonjs/core/services/hosted-flow-state.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +5 -14
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/bank-redirect.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/hosted/bridge-message.d.ts +44 -0
- package/lib/typescript/commonjs/internal/hosted/bridge-message.d.ts.map +1 -0
- package/lib/typescript/commonjs/internal/hosted/hosted-url.d.ts +30 -0
- package/lib/typescript/commonjs/internal/hosted/hosted-url.d.ts.map +1 -0
- package/lib/typescript/commonjs/internal/index.d.ts +0 -1
- package/lib/typescript/commonjs/internal/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/redact-uri.d.ts +21 -1
- package/lib/typescript/commonjs/internal/redact-uri.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/secure-store-pending-session-store.d.ts +3 -2
- package/lib/typescript/commonjs/internal/secure-store-pending-session-store.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/url-parts.d.ts +46 -0
- package/lib/typescript/commonjs/internal/url-parts.d.ts.map +1 -0
- package/lib/typescript/commonjs/public/index.d.ts +4 -6
- package/lib/typescript/commonjs/public/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/payment-result.d.ts +50 -12
- package/lib/typescript/commonjs/public/payment-result.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/recovery-result.d.ts +11 -20
- package/lib/typescript/commonjs/public/recovery-result.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-config.d.ts +13 -31
- package/lib/typescript/commonjs/public/spare-link-config.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-event.d.ts +29 -31
- package/lib/typescript/commonjs/public/spare-link-event.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-host-api.d.ts +1 -12
- package/lib/typescript/commonjs/public/spare-link-host-api.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-instance.d.ts +26 -20
- package/lib/typescript/commonjs/public/spare-link-instance.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-session.d.ts +3 -8
- package/lib/typescript/commonjs/public/spare-link-session.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link.d.ts +1 -1
- package/lib/typescript/commonjs/public/spare-link.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/use-hosted-flow-state.d.ts +9 -0
- package/lib/typescript/commonjs/ui/hooks/use-hosted-flow-state.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-page.d.ts +17 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-page.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-webview.d.ts +43 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-webview.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/index.d.ts +1 -3
- package/lib/typescript/commonjs/ui/screens/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/page-unavailable-screen.d.ts +18 -0
- package/lib/typescript/commonjs/ui/screens/page-unavailable-screen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/spare-link-host.d.ts +4 -5
- package/lib/typescript/commonjs/ui/spare-link-host.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/widgets/index.d.ts +1 -2
- package/lib/typescript/commonjs/ui/widgets/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/commonjs/version.d.ts.map +1 -1
- package/lib/typescript/module/core/models/index.d.ts +1 -123
- package/lib/typescript/module/core/models/index.d.ts.map +1 -1
- package/lib/typescript/module/core/models/payment-return-params.d.ts +91 -8
- package/lib/typescript/module/core/models/payment-return-params.d.ts.map +1 -1
- package/lib/typescript/module/core/models/pending-session-record.d.ts +11 -0
- package/lib/typescript/module/core/models/pending-session-record.d.ts.map +1 -0
- package/lib/typescript/module/core/services/hosted-flow-controller.d.ts +119 -0
- package/lib/typescript/module/core/services/hosted-flow-controller.d.ts.map +1 -0
- package/lib/typescript/module/core/services/hosted-flow-state.d.ts +75 -0
- package/lib/typescript/module/core/services/hosted-flow-state.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +5 -14
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/internal/bank-redirect.d.ts.map +1 -1
- package/lib/typescript/module/internal/hosted/bridge-message.d.ts +44 -0
- package/lib/typescript/module/internal/hosted/bridge-message.d.ts.map +1 -0
- package/lib/typescript/module/internal/hosted/hosted-url.d.ts +30 -0
- package/lib/typescript/module/internal/hosted/hosted-url.d.ts.map +1 -0
- package/lib/typescript/module/internal/index.d.ts +0 -1
- package/lib/typescript/module/internal/index.d.ts.map +1 -1
- package/lib/typescript/module/internal/redact-uri.d.ts +21 -1
- package/lib/typescript/module/internal/redact-uri.d.ts.map +1 -1
- package/lib/typescript/module/internal/secure-store-pending-session-store.d.ts +3 -2
- package/lib/typescript/module/internal/secure-store-pending-session-store.d.ts.map +1 -1
- package/lib/typescript/module/internal/url-parts.d.ts +46 -0
- package/lib/typescript/module/internal/url-parts.d.ts.map +1 -0
- package/lib/typescript/module/public/index.d.ts +4 -6
- package/lib/typescript/module/public/index.d.ts.map +1 -1
- package/lib/typescript/module/public/payment-result.d.ts +50 -12
- package/lib/typescript/module/public/payment-result.d.ts.map +1 -1
- package/lib/typescript/module/public/recovery-result.d.ts +11 -20
- package/lib/typescript/module/public/recovery-result.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-config.d.ts +13 -31
- package/lib/typescript/module/public/spare-link-config.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-event.d.ts +29 -31
- package/lib/typescript/module/public/spare-link-event.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-host-api.d.ts +1 -12
- package/lib/typescript/module/public/spare-link-host-api.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-instance.d.ts +26 -20
- package/lib/typescript/module/public/spare-link-instance.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-session.d.ts +3 -8
- package/lib/typescript/module/public/spare-link-session.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link.d.ts +1 -1
- package/lib/typescript/module/public/spare-link.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/use-hosted-flow-state.d.ts +9 -0
- package/lib/typescript/module/ui/hooks/use-hosted-flow-state.d.ts.map +1 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-page.d.ts +17 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-page.d.ts.map +1 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-webview.d.ts +43 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-webview.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/index.d.ts +1 -3
- package/lib/typescript/module/ui/screens/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/page-unavailable-screen.d.ts +18 -0
- package/lib/typescript/module/ui/screens/page-unavailable-screen.d.ts.map +1 -0
- package/lib/typescript/module/ui/spare-link-host.d.ts +4 -5
- package/lib/typescript/module/ui/spare-link-host.d.ts.map +1 -1
- package/lib/typescript/module/ui/widgets/index.d.ts +1 -2
- package/lib/typescript/module/ui/widgets/index.d.ts.map +1 -1
- package/lib/typescript/module/version.d.ts +1 -1
- package/lib/typescript/module/version.d.ts.map +1 -1
- package/package.json +24 -22
- package/plugins/with-spare-link.js +6 -26
- package/src/core/models/index.ts +1 -139
- package/src/core/models/payment-return-params.ts +269 -21
- package/src/core/models/pending-session-record.ts +10 -0
- package/src/core/services/hosted-flow-controller.ts +374 -0
- package/src/core/services/hosted-flow-state.ts +123 -0
- package/src/index.ts +20 -89
- package/src/internal/bank-redirect.ts +23 -9
- package/src/internal/hosted/bridge-message.ts +106 -0
- package/src/internal/hosted/hosted-url.ts +33 -0
- package/src/internal/index.ts +0 -1
- package/src/internal/redact-uri.ts +69 -15
- package/src/internal/secure-store-pending-session-store.ts +28 -49
- package/src/internal/url-parts.ts +134 -0
- package/src/public/index.ts +2 -24
- package/src/public/payment-result.ts +50 -12
- package/src/public/recovery-result.ts +16 -25
- package/src/public/spare-link-config.ts +56 -43
- package/src/public/spare-link-event.ts +33 -42
- package/src/public/spare-link-host-api.ts +1 -14
- package/src/public/spare-link-instance.ts +57 -65
- package/src/public/spare-link-session.ts +4 -16
- package/src/public/spare-link.ts +1 -1
- package/src/ui/hooks/use-hosted-flow-state.ts +16 -0
- package/src/ui/hosted/hosted-payment-page.tsx +178 -0
- package/src/ui/hosted/hosted-payment-webview.tsx +164 -0
- package/src/ui/screens/index.ts +4 -6
- package/src/ui/screens/page-unavailable-screen.tsx +94 -0
- package/src/ui/spare-link-host.tsx +227 -247
- package/src/ui/widgets/index.ts +1 -2
- package/src/version.ts +1 -1
- package/CHANGELOG.md +0 -25
- package/lib/commonjs/core/client/link-api-client.js +0 -297
- package/lib/commonjs/core/client/link-api-client.js.map +0 -1
- package/lib/commonjs/core/errors/payment-api-error.js +0 -35
- package/lib/commonjs/core/errors/payment-api-error.js.map +0 -1
- package/lib/commonjs/core/models/link-session-status.js +0 -14
- package/lib/commonjs/core/models/link-session-status.js.map +0 -1
- package/lib/commonjs/core/models/payment-type.js +0 -45
- package/lib/commonjs/core/models/payment-type.js.map +0 -1
- package/lib/commonjs/core/models/wire-mappers.js +0 -277
- package/lib/commonjs/core/models/wire-mappers.js.map +0 -1
- package/lib/commonjs/core/services/consent-presenter.js +0 -150
- package/lib/commonjs/core/services/consent-presenter.js.map +0 -1
- package/lib/commonjs/core/services/execute-resume-if-needed.js +0 -216
- package/lib/commonjs/core/services/execute-resume-if-needed.js.map +0 -1
- package/lib/commonjs/core/services/multi-payment-rules-presenter.js +0 -151
- package/lib/commonjs/core/services/multi-payment-rules-presenter.js.map +0 -1
- package/lib/commonjs/core/services/payment-flow-controller.js +0 -547
- package/lib/commonjs/core/services/payment-flow-controller.js.map +0 -1
- package/lib/commonjs/core/services/payment-flow-state.js +0 -110
- package/lib/commonjs/core/services/payment-flow-state.js.map +0 -1
- package/lib/commonjs/core/services/payment-result-mapper.js +0 -49
- package/lib/commonjs/core/services/payment-result-mapper.js.map +0 -1
- package/lib/commonjs/core/services/presentation-utils.js +0 -11
- package/lib/commonjs/core/services/presentation-utils.js.map +0 -1
- package/lib/commonjs/core/services/redirect-buffer.js +0 -40
- package/lib/commonjs/core/services/redirect-buffer.js.map +0 -1
- package/lib/commonjs/core/services/user-friendly-messages.js +0 -46
- package/lib/commonjs/core/services/user-friendly-messages.js.map +0 -1
- package/lib/commonjs/internal/telemetry-collector.js +0 -80
- package/lib/commonjs/internal/telemetry-collector.js.map +0 -1
- package/lib/commonjs/public/constants.js +0 -21
- package/lib/commonjs/public/constants.js.map +0 -1
- package/lib/commonjs/public/spare-link-callbacks.js +0 -6
- package/lib/commonjs/public/spare-link-callbacks.js.map +0 -1
- package/lib/commonjs/ui/consent/charge-bearer-display.js +0 -99
- package/lib/commonjs/ui/consent/charge-bearer-display.js.map +0 -1
- package/lib/commonjs/ui/consent/consent-accordion.js +0 -94
- package/lib/commonjs/ui/consent/consent-accordion.js.map +0 -1
- package/lib/commonjs/ui/consent/consent-summary-section.js +0 -27
- package/lib/commonjs/ui/consent/consent-summary-section.js.map +0 -1
- package/lib/commonjs/ui/consent/cop-information.js +0 -168
- package/lib/commonjs/ui/consent/cop-information.js.map +0 -1
- package/lib/commonjs/ui/consent/international-payment-summary.js +0 -98
- package/lib/commonjs/ui/consent/international-payment-summary.js.map +0 -1
- package/lib/commonjs/ui/consent/label-value-rows.js +0 -59
- package/lib/commonjs/ui/consent/label-value-rows.js.map +0 -1
- package/lib/commonjs/ui/consent/multi-payment-rules-list.js +0 -130
- package/lib/commonjs/ui/consent/multi-payment-rules-list.js.map +0 -1
- package/lib/commonjs/ui/consent/multi-payment-summary.js +0 -99
- package/lib/commonjs/ui/consent/multi-payment-summary.js.map +0 -1
- package/lib/commonjs/ui/consent/single-payment-summary.js +0 -158
- package/lib/commonjs/ui/consent/single-payment-summary.js.map +0 -1
- package/lib/commonjs/ui/consent/terms-link.js +0 -35
- package/lib/commonjs/ui/consent/terms-link.js.map +0 -1
- package/lib/commonjs/ui/hooks/use-payment-flow-state.js.map +0 -1
- package/lib/commonjs/ui/payment-flow-page.js +0 -235
- package/lib/commonjs/ui/payment-flow-page.js.map +0 -1
- package/lib/commonjs/ui/screens/bank-selection-screen.js +0 -215
- package/lib/commonjs/ui/screens/bank-selection-screen.js.map +0 -1
- package/lib/commonjs/ui/screens/consent-details-screen.js +0 -124
- package/lib/commonjs/ui/screens/consent-details-screen.js.map +0 -1
- package/lib/commonjs/ui/screens/mandate-setup-success-screen.js +0 -79
- package/lib/commonjs/ui/screens/mandate-setup-success-screen.js.map +0 -1
- package/lib/commonjs/ui/widgets/layout-w-header.js +0 -106
- package/lib/commonjs/ui/widgets/layout-w-header.js.map +0 -1
- package/lib/commonjs/ui/widgets/stepper.js +0 -124
- package/lib/commonjs/ui/widgets/stepper.js.map +0 -1
- package/lib/module/core/client/link-api-client.js +0 -292
- package/lib/module/core/client/link-api-client.js.map +0 -1
- package/lib/module/core/errors/payment-api-error.js +0 -29
- package/lib/module/core/errors/payment-api-error.js.map +0 -1
- package/lib/module/core/models/link-session-status.js +0 -10
- package/lib/module/core/models/link-session-status.js.map +0 -1
- package/lib/module/core/models/payment-type.js +0 -36
- package/lib/module/core/models/payment-type.js.map +0 -1
- package/lib/module/core/models/wire-mappers.js +0 -263
- package/lib/module/core/models/wire-mappers.js.map +0 -1
- package/lib/module/core/services/consent-presenter.js +0 -140
- package/lib/module/core/services/consent-presenter.js.map +0 -1
- package/lib/module/core/services/execute-resume-if-needed.js +0 -211
- package/lib/module/core/services/execute-resume-if-needed.js.map +0 -1
- package/lib/module/core/services/multi-payment-rules-presenter.js +0 -146
- package/lib/module/core/services/multi-payment-rules-presenter.js.map +0 -1
- package/lib/module/core/services/payment-flow-controller.js +0 -544
- package/lib/module/core/services/payment-flow-controller.js.map +0 -1
- package/lib/module/core/services/payment-flow-state.js +0 -106
- package/lib/module/core/services/payment-flow-state.js.map +0 -1
- package/lib/module/core/services/payment-result-mapper.js +0 -45
- package/lib/module/core/services/payment-result-mapper.js.map +0 -1
- package/lib/module/core/services/presentation-utils.js +0 -7
- package/lib/module/core/services/presentation-utils.js.map +0 -1
- package/lib/module/core/services/redirect-buffer.js +0 -33
- package/lib/module/core/services/redirect-buffer.js.map +0 -1
- package/lib/module/core/services/user-friendly-messages.js +0 -42
- package/lib/module/core/services/user-friendly-messages.js.map +0 -1
- package/lib/module/internal/telemetry-collector.js +0 -75
- package/lib/module/internal/telemetry-collector.js.map +0 -1
- package/lib/module/public/constants.js +0 -17
- package/lib/module/public/constants.js.map +0 -1
- package/lib/module/public/spare-link-callbacks.js +0 -4
- package/lib/module/public/spare-link-callbacks.js.map +0 -1
- package/lib/module/ui/consent/charge-bearer-display.js +0 -95
- package/lib/module/ui/consent/charge-bearer-display.js.map +0 -1
- package/lib/module/ui/consent/consent-accordion.js +0 -90
- package/lib/module/ui/consent/consent-accordion.js.map +0 -1
- package/lib/module/ui/consent/consent-summary-section.js +0 -23
- package/lib/module/ui/consent/consent-summary-section.js.map +0 -1
- package/lib/module/ui/consent/cop-information.js +0 -165
- package/lib/module/ui/consent/cop-information.js.map +0 -1
- package/lib/module/ui/consent/international-payment-summary.js +0 -94
- package/lib/module/ui/consent/international-payment-summary.js.map +0 -1
- package/lib/module/ui/consent/label-value-rows.js +0 -55
- package/lib/module/ui/consent/label-value-rows.js.map +0 -1
- package/lib/module/ui/consent/multi-payment-rules-list.js +0 -125
- package/lib/module/ui/consent/multi-payment-rules-list.js.map +0 -1
- package/lib/module/ui/consent/multi-payment-summary.js +0 -95
- package/lib/module/ui/consent/multi-payment-summary.js.map +0 -1
- package/lib/module/ui/consent/single-payment-summary.js +0 -154
- package/lib/module/ui/consent/single-payment-summary.js.map +0 -1
- package/lib/module/ui/consent/terms-link.js +0 -31
- package/lib/module/ui/consent/terms-link.js.map +0 -1
- package/lib/module/ui/hooks/use-payment-flow-state.js.map +0 -1
- package/lib/module/ui/payment-flow-page.js +0 -232
- package/lib/module/ui/payment-flow-page.js.map +0 -1
- package/lib/module/ui/screens/bank-selection-screen.js +0 -211
- package/lib/module/ui/screens/bank-selection-screen.js.map +0 -1
- package/lib/module/ui/screens/consent-details-screen.js +0 -120
- package/lib/module/ui/screens/consent-details-screen.js.map +0 -1
- package/lib/module/ui/screens/mandate-setup-success-screen.js +0 -75
- package/lib/module/ui/screens/mandate-setup-success-screen.js.map +0 -1
- package/lib/module/ui/widgets/layout-w-header.js +0 -102
- package/lib/module/ui/widgets/layout-w-header.js.map +0 -1
- package/lib/module/ui/widgets/stepper.js +0 -120
- package/lib/module/ui/widgets/stepper.js.map +0 -1
- package/lib/typescript/commonjs/core/client/link-api-client.d.ts +0 -70
- package/lib/typescript/commonjs/core/client/link-api-client.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/errors/payment-api-error.d.ts +0 -15
- package/lib/typescript/commonjs/core/errors/payment-api-error.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/models/link-session-status.d.ts +0 -6
- package/lib/typescript/commonjs/core/models/link-session-status.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/models/payment-type.d.ts +0 -18
- package/lib/typescript/commonjs/core/models/payment-type.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/models/wire-mappers.d.ts +0 -19
- package/lib/typescript/commonjs/core/models/wire-mappers.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/consent-presenter.d.ts +0 -67
- package/lib/typescript/commonjs/core/services/consent-presenter.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/execute-resume-if-needed.d.ts +0 -32
- package/lib/typescript/commonjs/core/services/execute-resume-if-needed.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/multi-payment-rules-presenter.d.ts +0 -9
- package/lib/typescript/commonjs/core/services/multi-payment-rules-presenter.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/payment-flow-controller.d.ts +0 -146
- package/lib/typescript/commonjs/core/services/payment-flow-controller.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/payment-flow-state.d.ts +0 -64
- package/lib/typescript/commonjs/core/services/payment-flow-state.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/payment-result-mapper.d.ts +0 -5
- package/lib/typescript/commonjs/core/services/payment-result-mapper.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/presentation-utils.d.ts +0 -5
- package/lib/typescript/commonjs/core/services/presentation-utils.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/redirect-buffer.d.ts +0 -6
- package/lib/typescript/commonjs/core/services/redirect-buffer.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/user-friendly-messages.d.ts +0 -6
- package/lib/typescript/commonjs/core/services/user-friendly-messages.d.ts.map +0 -1
- package/lib/typescript/commonjs/internal/telemetry-collector.d.ts +0 -2
- package/lib/typescript/commonjs/internal/telemetry-collector.d.ts.map +0 -1
- package/lib/typescript/commonjs/public/constants.d.ts +0 -12
- package/lib/typescript/commonjs/public/constants.d.ts.map +0 -1
- package/lib/typescript/commonjs/public/spare-link-callbacks.d.ts +0 -14
- package/lib/typescript/commonjs/public/spare-link-callbacks.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/charge-bearer-display.d.ts +0 -5
- package/lib/typescript/commonjs/ui/consent/charge-bearer-display.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/consent-accordion.d.ts +0 -10
- package/lib/typescript/commonjs/ui/consent/consent-accordion.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/consent-summary-section.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/consent-summary-section.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/cop-information.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/cop-information.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/international-payment-summary.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/international-payment-summary.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/label-value-rows.d.ts +0 -10
- package/lib/typescript/commonjs/ui/consent/label-value-rows.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/multi-payment-rules-list.d.ts +0 -15
- package/lib/typescript/commonjs/ui/consent/multi-payment-rules-list.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/multi-payment-summary.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/multi-payment-summary.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/single-payment-summary.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/single-payment-summary.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/terms-link.d.ts +0 -2
- package/lib/typescript/commonjs/ui/consent/terms-link.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/use-payment-flow-state.d.ts +0 -9
- package/lib/typescript/commonjs/ui/hooks/use-payment-flow-state.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/payment-flow-page.d.ts +0 -20
- package/lib/typescript/commonjs/ui/payment-flow-page.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/bank-selection-screen.d.ts +0 -15
- package/lib/typescript/commonjs/ui/screens/bank-selection-screen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/consent-details-screen.d.ts +0 -13
- package/lib/typescript/commonjs/ui/screens/consent-details-screen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/mandate-setup-success-screen.d.ts +0 -10
- package/lib/typescript/commonjs/ui/screens/mandate-setup-success-screen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/widgets/layout-w-header.d.ts +0 -20
- package/lib/typescript/commonjs/ui/widgets/layout-w-header.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/widgets/stepper.d.ts +0 -15
- package/lib/typescript/commonjs/ui/widgets/stepper.d.ts.map +0 -1
- package/lib/typescript/module/core/client/link-api-client.d.ts +0 -70
- package/lib/typescript/module/core/client/link-api-client.d.ts.map +0 -1
- package/lib/typescript/module/core/errors/payment-api-error.d.ts +0 -15
- package/lib/typescript/module/core/errors/payment-api-error.d.ts.map +0 -1
- package/lib/typescript/module/core/models/link-session-status.d.ts +0 -6
- package/lib/typescript/module/core/models/link-session-status.d.ts.map +0 -1
- package/lib/typescript/module/core/models/payment-type.d.ts +0 -18
- package/lib/typescript/module/core/models/payment-type.d.ts.map +0 -1
- package/lib/typescript/module/core/models/wire-mappers.d.ts +0 -19
- package/lib/typescript/module/core/models/wire-mappers.d.ts.map +0 -1
- package/lib/typescript/module/core/services/consent-presenter.d.ts +0 -67
- package/lib/typescript/module/core/services/consent-presenter.d.ts.map +0 -1
- package/lib/typescript/module/core/services/execute-resume-if-needed.d.ts +0 -32
- package/lib/typescript/module/core/services/execute-resume-if-needed.d.ts.map +0 -1
- package/lib/typescript/module/core/services/multi-payment-rules-presenter.d.ts +0 -9
- package/lib/typescript/module/core/services/multi-payment-rules-presenter.d.ts.map +0 -1
- package/lib/typescript/module/core/services/payment-flow-controller.d.ts +0 -146
- package/lib/typescript/module/core/services/payment-flow-controller.d.ts.map +0 -1
- package/lib/typescript/module/core/services/payment-flow-state.d.ts +0 -64
- package/lib/typescript/module/core/services/payment-flow-state.d.ts.map +0 -1
- package/lib/typescript/module/core/services/payment-result-mapper.d.ts +0 -5
- package/lib/typescript/module/core/services/payment-result-mapper.d.ts.map +0 -1
- package/lib/typescript/module/core/services/presentation-utils.d.ts +0 -5
- package/lib/typescript/module/core/services/presentation-utils.d.ts.map +0 -1
- package/lib/typescript/module/core/services/redirect-buffer.d.ts +0 -6
- package/lib/typescript/module/core/services/redirect-buffer.d.ts.map +0 -1
- package/lib/typescript/module/core/services/user-friendly-messages.d.ts +0 -6
- package/lib/typescript/module/core/services/user-friendly-messages.d.ts.map +0 -1
- package/lib/typescript/module/internal/telemetry-collector.d.ts +0 -2
- package/lib/typescript/module/internal/telemetry-collector.d.ts.map +0 -1
- package/lib/typescript/module/public/constants.d.ts +0 -12
- package/lib/typescript/module/public/constants.d.ts.map +0 -1
- package/lib/typescript/module/public/spare-link-callbacks.d.ts +0 -14
- package/lib/typescript/module/public/spare-link-callbacks.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/charge-bearer-display.d.ts +0 -5
- package/lib/typescript/module/ui/consent/charge-bearer-display.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/consent-accordion.d.ts +0 -10
- package/lib/typescript/module/ui/consent/consent-accordion.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/consent-summary-section.d.ts +0 -6
- package/lib/typescript/module/ui/consent/consent-summary-section.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/cop-information.d.ts +0 -6
- package/lib/typescript/module/ui/consent/cop-information.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/international-payment-summary.d.ts +0 -6
- package/lib/typescript/module/ui/consent/international-payment-summary.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/label-value-rows.d.ts +0 -10
- package/lib/typescript/module/ui/consent/label-value-rows.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/multi-payment-rules-list.d.ts +0 -15
- package/lib/typescript/module/ui/consent/multi-payment-rules-list.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/multi-payment-summary.d.ts +0 -6
- package/lib/typescript/module/ui/consent/multi-payment-summary.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/single-payment-summary.d.ts +0 -6
- package/lib/typescript/module/ui/consent/single-payment-summary.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/terms-link.d.ts +0 -2
- package/lib/typescript/module/ui/consent/terms-link.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/use-payment-flow-state.d.ts +0 -9
- package/lib/typescript/module/ui/hooks/use-payment-flow-state.d.ts.map +0 -1
- package/lib/typescript/module/ui/payment-flow-page.d.ts +0 -20
- package/lib/typescript/module/ui/payment-flow-page.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/bank-selection-screen.d.ts +0 -15
- package/lib/typescript/module/ui/screens/bank-selection-screen.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/consent-details-screen.d.ts +0 -13
- package/lib/typescript/module/ui/screens/consent-details-screen.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/mandate-setup-success-screen.d.ts +0 -10
- package/lib/typescript/module/ui/screens/mandate-setup-success-screen.d.ts.map +0 -1
- package/lib/typescript/module/ui/widgets/layout-w-header.d.ts +0 -20
- package/lib/typescript/module/ui/widgets/layout-w-header.d.ts.map +0 -1
- package/lib/typescript/module/ui/widgets/stepper.d.ts +0 -15
- package/lib/typescript/module/ui/widgets/stepper.d.ts.map +0 -1
- package/src/core/client/link-api-client.ts +0 -414
- package/src/core/errors/payment-api-error.ts +0 -35
- package/src/core/models/link-session-status.ts +0 -7
- package/src/core/models/payment-type.ts +0 -54
- package/src/core/models/wire-mappers.ts +0 -315
- package/src/core/services/consent-presenter.ts +0 -213
- package/src/core/services/execute-resume-if-needed.ts +0 -243
- package/src/core/services/multi-payment-rules-presenter.ts +0 -158
- package/src/core/services/payment-flow-controller.ts +0 -607
- package/src/core/services/payment-flow-state.ts +0 -124
- package/src/core/services/payment-result-mapper.ts +0 -41
- package/src/core/services/presentation-utils.ts +0 -4
- package/src/core/services/redirect-buffer.ts +0 -34
- package/src/core/services/user-friendly-messages.ts +0 -39
- package/src/internal/telemetry-collector.ts +0 -90
- package/src/public/constants.ts +0 -14
- package/src/public/spare-link-callbacks.ts +0 -20
- package/src/ui/consent/charge-bearer-display.tsx +0 -68
- package/src/ui/consent/consent-accordion.tsx +0 -89
- package/src/ui/consent/consent-summary-section.tsx +0 -19
- package/src/ui/consent/cop-information.tsx +0 -121
- package/src/ui/consent/international-payment-summary.tsx +0 -83
- package/src/ui/consent/label-value-rows.tsx +0 -50
- package/src/ui/consent/multi-payment-rules-list.tsx +0 -138
- package/src/ui/consent/multi-payment-summary.tsx +0 -82
- package/src/ui/consent/single-payment-summary.tsx +0 -123
- package/src/ui/consent/terms-link.tsx +0 -27
- package/src/ui/hooks/use-payment-flow-state.ts +0 -16
- package/src/ui/payment-flow-page.tsx +0 -254
- package/src/ui/screens/bank-selection-screen.tsx +0 -209
- package/src/ui/screens/consent-details-screen.tsx +0 -106
- package/src/ui/screens/mandate-setup-success-screen.tsx +0 -72
- package/src/ui/widgets/layout-w-header.tsx +0 -89
- package/src/ui/widgets/stepper.tsx +0 -126
|
@@ -1,547 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PaymentFlowController = void 0;
|
|
7
|
-
var _logger = require("../../internal/logger.js");
|
|
8
|
-
var _redactUri = require("../../internal/redact-uri.js");
|
|
9
|
-
var _constants = require("../../public/constants.js");
|
|
10
|
-
var _paymentApiError = require("../errors/payment-api-error.js");
|
|
11
|
-
var _linkSessionStatus = require("../models/link-session-status.js");
|
|
12
|
-
var _paymentReturnParams = require("../models/payment-return-params.js");
|
|
13
|
-
var _paymentType = require("../models/payment-type.js");
|
|
14
|
-
var _paymentFlowState = require("./payment-flow-state.js");
|
|
15
|
-
/** Simple string tag for internal controller callbacks — not the public SpareLinkEvent. */
|
|
16
|
-
|
|
17
|
-
/** Minimum surface required from a `Clock` injected for testability. */
|
|
18
|
-
|
|
19
|
-
const REAL_CLOCK = {
|
|
20
|
-
now: () => Date.now()
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Number of consecutive `pollStatus` transport failures we tolerate before
|
|
25
|
-
* giving up and transitioning to `failed('network_error')`. Bounds the request
|
|
26
|
-
* volume against a flaky network during the 5-minute awaiting-callback window.
|
|
27
|
-
*/
|
|
28
|
-
const POLL_STATUS_MAX_CONSECUTIVE_FAILURES = 5;
|
|
29
|
-
const log = (0, _logger.createLogger)('PaymentFlowController');
|
|
30
|
-
const TERMINAL_PHASES = new Set(['succeeded', 'failed', 'cancelled']);
|
|
31
|
-
function isTerminal(phase) {
|
|
32
|
-
return TERMINAL_PHASES.has(phase);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Drives the payment flow state machine. Exposes a `subscribe`/`unsubscribe`
|
|
37
|
-
* API so React's `useSyncExternalStore` can bridge to a hook.
|
|
38
|
-
*
|
|
39
|
-
* `subscribe` fires the listener synchronously with the current state so new
|
|
40
|
-
* subscribers don't miss the initial snapshot.
|
|
41
|
-
*/
|
|
42
|
-
class PaymentFlowController {
|
|
43
|
-
_state = _paymentFlowState.PaymentFlowStates.idle();
|
|
44
|
-
_listeners = new Set();
|
|
45
|
-
|
|
46
|
-
/** Last provider the user selected — retained so success/awaiting states that
|
|
47
|
-
* arrive without it (poll/callback) can still report `bankId`. */
|
|
48
|
-
|
|
49
|
-
_disposed = false;
|
|
50
|
-
/** Re-entrance guard — second `hydrate()` returns the in-flight promise. */
|
|
51
|
-
|
|
52
|
-
/** Consecutive `pollStatus` transport failures since the last successful response. */
|
|
53
|
-
_pollStatusConsecutiveFailures = 0;
|
|
54
|
-
constructor(opts) {
|
|
55
|
-
this.sessionToken = opts.sessionToken;
|
|
56
|
-
this.apiClient = opts.apiClient;
|
|
57
|
-
if (opts.pendingSessionStore) this.pendingSessionStore = opts.pendingSessionStore;
|
|
58
|
-
this.awaitingCallbackTimeoutMs = opts.awaitingCallbackTimeoutMs ?? _constants.DEFAULT_AWAITING_CALLBACK_TIMEOUT_MS;
|
|
59
|
-
this.environment = opts.environment ?? 'production';
|
|
60
|
-
this.awaitingCallbackPollMs = opts.awaitingCallbackPollMs ?? _constants.DEFAULT_AWAITING_CALLBACK_POLL_MS;
|
|
61
|
-
this.clock = opts.clock ?? REAL_CLOCK;
|
|
62
|
-
if (opts.collectTelemetry) this.collectTelemetry = opts.collectTelemetry;
|
|
63
|
-
this.uuid = opts.uuid ?? fallbackUuid;
|
|
64
|
-
if (opts.onEvent) this.onEventCallback = opts.onEvent;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// ---- Subscription API ----------------------------------------------------
|
|
68
|
-
|
|
69
|
-
get state() {
|
|
70
|
-
return this._state;
|
|
71
|
-
}
|
|
72
|
-
get awaitingCallbackStartedAtMs() {
|
|
73
|
-
return this._awaitingCallbackStartedAtMs;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Register a listener. The listener is invoked synchronously with the
|
|
78
|
-
* current state so new subscribers have the initial snapshot, then again
|
|
79
|
-
* on every subsequent change.
|
|
80
|
-
*/
|
|
81
|
-
subscribe(listener) {
|
|
82
|
-
this._listeners.add(listener);
|
|
83
|
-
try {
|
|
84
|
-
listener(this._state);
|
|
85
|
-
} catch {
|
|
86
|
-
// swallow — listener bugs never break the controller
|
|
87
|
-
}
|
|
88
|
-
return () => {
|
|
89
|
-
this._listeners.delete(listener);
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
setState(next) {
|
|
93
|
-
if (this._disposed) return;
|
|
94
|
-
this._state = next;
|
|
95
|
-
if (isTerminal(next.phase)) {
|
|
96
|
-
this.cancelCallbackTimeout();
|
|
97
|
-
this._consentIdempotencyKey = undefined;
|
|
98
|
-
}
|
|
99
|
-
for (const l of this._listeners) {
|
|
100
|
-
try {
|
|
101
|
-
l(next);
|
|
102
|
-
} catch {
|
|
103
|
-
// listener exceptions never break the controller
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
fireEvent(event) {
|
|
108
|
-
try {
|
|
109
|
-
this.onEventCallback?.(event);
|
|
110
|
-
} catch {
|
|
111
|
-
// swallow integrator errors
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// ---- Timers --------------------------------------------------------------
|
|
116
|
-
|
|
117
|
-
cancelCallbackTimeout() {
|
|
118
|
-
if (this._callbackTimer) {
|
|
119
|
-
clearTimeout(this._callbackTimer);
|
|
120
|
-
this._callbackTimer = undefined;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
startCallbackTimeout() {
|
|
124
|
-
this.cancelCallbackTimeout();
|
|
125
|
-
this._callbackTimer = setTimeout(() => {
|
|
126
|
-
if (this._state.phase !== 'awaitingCallback') return;
|
|
127
|
-
void this.reportError('session_timeout');
|
|
128
|
-
}, this.awaitingCallbackTimeoutMs);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// ---- Phase transitions ---------------------------------------------------
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* `GET /link` + `GET /link/providers`, then transitions to bankSelection.
|
|
135
|
-
* Re-entrant: a second concurrent call returns the in-flight promise instead
|
|
136
|
-
* of firing duplicate requests.
|
|
137
|
-
*/
|
|
138
|
-
hydrate() {
|
|
139
|
-
if (this._disposed) return Promise.resolve();
|
|
140
|
-
if (this._hydratePromise) return this._hydratePromise;
|
|
141
|
-
this._hydratePromise = this._doHydrate().finally(() => {
|
|
142
|
-
this._hydratePromise = undefined;
|
|
143
|
-
});
|
|
144
|
-
return this._hydratePromise;
|
|
145
|
-
}
|
|
146
|
-
async _doHydrate() {
|
|
147
|
-
log.info('hydrate: starting session hydration');
|
|
148
|
-
this.setState(_paymentFlowState.PaymentFlowStates.hydrating());
|
|
149
|
-
try {
|
|
150
|
-
const [session, providers] = await Promise.all([this.apiClient.getSession(this.sessionToken), this.apiClient.getProviders(this.sessionToken)]);
|
|
151
|
-
log.info(`hydrate: loaded session with ${providers.length} provider(s)`);
|
|
152
|
-
this.setState(_paymentFlowState.PaymentFlowStates.bankSelection({
|
|
153
|
-
session,
|
|
154
|
-
providers
|
|
155
|
-
}));
|
|
156
|
-
this.fireEvent('sessionLoaded');
|
|
157
|
-
} catch (err) {
|
|
158
|
-
log.severe(`hydrate: failed — ${err instanceof Error ? err.message : String(err)}`);
|
|
159
|
-
const code = (0, _paymentApiError.isPaymentApiError)(err) ? err.code : 'hydration_error';
|
|
160
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
161
|
-
this.setState(_paymentFlowState.PaymentFlowStates.failed({
|
|
162
|
-
errorCode: code,
|
|
163
|
-
errorMessage: message
|
|
164
|
-
}));
|
|
165
|
-
throw err;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/** Move bankSelection → consentDetails. */
|
|
170
|
-
selectBank(bankId) {
|
|
171
|
-
log.info(`selectBank: bankId=${bankId}`);
|
|
172
|
-
const current = this._state;
|
|
173
|
-
const session = current.session;
|
|
174
|
-
if (!session) {
|
|
175
|
-
throw new Error('Cannot select bank before session is loaded.');
|
|
176
|
-
}
|
|
177
|
-
const provider = current.providers.find(p => p.id === bankId);
|
|
178
|
-
if (!provider) {
|
|
179
|
-
log.severe(`selectBank: unknown bankId=${bankId}`);
|
|
180
|
-
throw new Error(`Unknown bank id: ${bankId}`);
|
|
181
|
-
}
|
|
182
|
-
// Retained so success states reached via poll/callback (which don't carry
|
|
183
|
-
// the provider) still resolve a `bankId` in the PaymentResult.
|
|
184
|
-
this._selectedProvider = provider;
|
|
185
|
-
const willLoadCop = this.shouldPerformCop(session);
|
|
186
|
-
this.setState(_paymentFlowState.PaymentFlowStates.consentDetails({
|
|
187
|
-
session,
|
|
188
|
-
selectedProvider: provider,
|
|
189
|
-
isCopLoading: willLoadCop,
|
|
190
|
-
copApplicable: willLoadCop
|
|
191
|
-
}));
|
|
192
|
-
if (willLoadCop) {
|
|
193
|
-
this.loadCopInBackground(session, provider);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Best-effort Confirmation-of-Payee fetch — never blocks {@link selectBank}
|
|
199
|
-
* or fails the flow. Mirrors the Flutter controller: gated to UAE + un-verified
|
|
200
|
-
* sessions, and the result is merged into the consentDetails state only if the
|
|
201
|
-
* user is still on that screen for the same provider. Ported from
|
|
202
|
-
* `payment_flow_controller.dart:_loadCopInBackground`.
|
|
203
|
-
*/
|
|
204
|
-
loadCopInBackground(session, provider) {
|
|
205
|
-
void (async () => {
|
|
206
|
-
const cop = await this.getCoP(provider.id);
|
|
207
|
-
if (this._state.phase !== 'consentDetails') return;
|
|
208
|
-
if (this._state.selectedProvider?.id !== provider.id) return;
|
|
209
|
-
this.setState(_paymentFlowState.PaymentFlowStates.consentDetails({
|
|
210
|
-
session,
|
|
211
|
-
selectedProvider: provider,
|
|
212
|
-
...(cop ? {
|
|
213
|
-
copResponse: cop
|
|
214
|
-
} : {}),
|
|
215
|
-
isCopLoading: false,
|
|
216
|
-
copApplicable: true
|
|
217
|
-
}));
|
|
218
|
-
})();
|
|
219
|
-
}
|
|
220
|
-
shouldPerformCop(session) {
|
|
221
|
-
if (this.apiClient.tenantHeader !== 'UAE') return false;
|
|
222
|
-
if (session.request.isCopVerified === true) return false;
|
|
223
|
-
if (!(0, _paymentType.supportsConfirmationOfPayee)(session.request)) return false;
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/** `POST /link/consent`, persists pending record, transitions to redirecting. */
|
|
228
|
-
async confirmConsent() {
|
|
229
|
-
log.info('confirmConsent: posting consent');
|
|
230
|
-
const selectedProvider = this._state.selectedProvider;
|
|
231
|
-
if (!selectedProvider) {
|
|
232
|
-
log.severe('confirmConsent: no provider selected');
|
|
233
|
-
throw new Error('Cannot confirm consent without a selected provider.');
|
|
234
|
-
}
|
|
235
|
-
this.fireEvent('consentStarted');
|
|
236
|
-
if (!this._consentIdempotencyKey) {
|
|
237
|
-
this._consentIdempotencyKey = this.uuid();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// Best-effort telemetry before posting consent.
|
|
241
|
-
await this.postTelemetryAutomatic();
|
|
242
|
-
let consent;
|
|
243
|
-
try {
|
|
244
|
-
consent = await this.apiClient.postConsent({
|
|
245
|
-
linkToken: this.sessionToken,
|
|
246
|
-
bankId: selectedProvider.id,
|
|
247
|
-
idempotencyKey: this._consentIdempotencyKey
|
|
248
|
-
});
|
|
249
|
-
} catch (err) {
|
|
250
|
-
// Without this the flow would be stranded in `consentDetails` with no
|
|
251
|
-
// terminal state — the caller's catch assumes we already transitioned.
|
|
252
|
-
const code = (0, _paymentApiError.isPaymentApiError)(err) ? err.code : 'consent_failed';
|
|
253
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
254
|
-
this.setState(_paymentFlowState.PaymentFlowStates.failed({
|
|
255
|
-
errorCode: code,
|
|
256
|
-
errorMessage: message
|
|
257
|
-
}));
|
|
258
|
-
void this.patchTokenBestEffort('error', code);
|
|
259
|
-
throw err;
|
|
260
|
-
}
|
|
261
|
-
if (this.pendingSessionStore) {
|
|
262
|
-
try {
|
|
263
|
-
const merchantRef = this._state.session?.request?.merchantReference;
|
|
264
|
-
await this.pendingSessionStore.save({
|
|
265
|
-
sessionId: this.sessionToken,
|
|
266
|
-
selectedBankId: selectedProvider.id,
|
|
267
|
-
authorizationUrl: consent.redirectUrl,
|
|
268
|
-
consentAt: this.clock.now(),
|
|
269
|
-
recoveryAttempts: 0,
|
|
270
|
-
...(merchantRef ? {
|
|
271
|
-
merchantRef
|
|
272
|
-
} : {})
|
|
273
|
-
});
|
|
274
|
-
} catch {
|
|
275
|
-
log.warning('confirmConsent: store.save() failed — continuing');
|
|
276
|
-
// store failures should not block the flow
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
log.info('confirmConsent: → redirecting');
|
|
280
|
-
this.setState(_paymentFlowState.PaymentFlowStates.redirecting({
|
|
281
|
-
consent,
|
|
282
|
-
selectedProvider
|
|
283
|
-
}));
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Parses a callback URI and transitions to succeeded / failed. Accepts either
|
|
288
|
-
* a `URL` instance or a string. A malformed URI resolves to
|
|
289
|
-
* `failed('invalid_callback')` instead of throwing.
|
|
290
|
-
*/
|
|
291
|
-
handleCallback(uri) {
|
|
292
|
-
log.info(`handleCallback: received URI=${(0, _redactUri.redactPaymentReturnUri)(typeof uri === 'string' ? uri : uri.toString())}`);
|
|
293
|
-
// Deep-link callbacks are commonly re-delivered (cold start + warm
|
|
294
|
-
// foreground). Once the flow is terminal, ignore further callbacks so we
|
|
295
|
-
// never re-transition and re-fire terminal callbacks.
|
|
296
|
-
if (isTerminal(this._state.phase)) return;
|
|
297
|
-
let url;
|
|
298
|
-
if (typeof uri === 'string') {
|
|
299
|
-
try {
|
|
300
|
-
url = new URL(uri);
|
|
301
|
-
} catch {
|
|
302
|
-
this.setState(_paymentFlowState.PaymentFlowStates.failed({
|
|
303
|
-
errorCode: 'invalid_callback',
|
|
304
|
-
errorMessage: 'The callback URI could not be parsed.'
|
|
305
|
-
}));
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
} else {
|
|
309
|
-
url = uri;
|
|
310
|
-
}
|
|
311
|
-
this.fireEvent('bankCallbackReceived');
|
|
312
|
-
const params = url.searchParams;
|
|
313
|
-
|
|
314
|
-
// Prefer the new `error_code` query param over legacy `error`. Also accept
|
|
315
|
-
// `status=failure` with no other code as `authorize_failed`.
|
|
316
|
-
const error = (0, _paymentReturnParams.extractPaymentReturnErrorCode)(params);
|
|
317
|
-
if (error) {
|
|
318
|
-
const description = params.get('error_description') ?? undefined;
|
|
319
|
-
this.setState(_paymentFlowState.PaymentFlowStates.failed({
|
|
320
|
-
errorCode: error,
|
|
321
|
-
...(description ? {
|
|
322
|
-
errorMessage: description
|
|
323
|
-
} : {})
|
|
324
|
-
}));
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
const exchangeCode = params.get('exchange_code') ?? undefined;
|
|
328
|
-
const linkSessionId = params.get('session_id') ?? undefined;
|
|
329
|
-
const merchantRef = params.get('merchantRef') ?? undefined;
|
|
330
|
-
if (exchangeCode) {
|
|
331
|
-
this.setState(_paymentFlowState.PaymentFlowStates.succeeded({
|
|
332
|
-
exchangeCode,
|
|
333
|
-
...(linkSessionId ? {
|
|
334
|
-
linkSessionId
|
|
335
|
-
} : {}),
|
|
336
|
-
...(merchantRef ? {
|
|
337
|
-
merchantRef
|
|
338
|
-
} : {}),
|
|
339
|
-
...(this._selectedProvider ? {
|
|
340
|
-
selectedProvider: this._selectedProvider
|
|
341
|
-
} : {}),
|
|
342
|
-
...(this._state.session ? {
|
|
343
|
-
session: this._state.session
|
|
344
|
-
} : {})
|
|
345
|
-
}));
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
this.setState(_paymentFlowState.PaymentFlowStates.failed({
|
|
349
|
-
errorCode: 'invalid_callback',
|
|
350
|
-
errorMessage: 'The callback URI is missing required parameters.'
|
|
351
|
-
}));
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/** Best-effort cancel — PATCH /link with action=cancel, then transitions to cancelled. */
|
|
355
|
-
async cancel() {
|
|
356
|
-
log.info('cancel: user cancelled the payment flow');
|
|
357
|
-
await this.patchTokenBestEffort('cancel');
|
|
358
|
-
this.setState(_paymentFlowState.PaymentFlowStates.cancelled());
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/** Best-effort error report — sets failed state immediately, PATCH is fire-and-forget. */
|
|
362
|
-
async reportError(code) {
|
|
363
|
-
log.severe(`reportError: reporting error code=${code}`);
|
|
364
|
-
this.setState(_paymentFlowState.PaymentFlowStates.failed({
|
|
365
|
-
errorCode: code
|
|
366
|
-
}));
|
|
367
|
-
// Fire-and-forget; we already transitioned.
|
|
368
|
-
void this.patchTokenBestEffort('error', code);
|
|
369
|
-
}
|
|
370
|
-
async patchTokenBestEffort(action, errorCode) {
|
|
371
|
-
try {
|
|
372
|
-
await this.apiClient.patchToken({
|
|
373
|
-
linkToken: this.sessionToken,
|
|
374
|
-
action,
|
|
375
|
-
...(errorCode ? {
|
|
376
|
-
errorCode
|
|
377
|
-
} : {})
|
|
378
|
-
});
|
|
379
|
-
} catch {
|
|
380
|
-
// swallow — PATCH is best-effort
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* UI calls this after handing off to the bank — starts the 5-minute timeout
|
|
386
|
-
* and pins the awaiting-callback start time.
|
|
387
|
-
*/
|
|
388
|
-
setAwaitingCallbackState(args = {}) {
|
|
389
|
-
this._awaitingCallbackStartedAtMs ??= this.clock.now();
|
|
390
|
-
this.setState(_paymentFlowState.PaymentFlowStates.awaitingCallback({
|
|
391
|
-
...(args.providerName ? {
|
|
392
|
-
providerName: args.providerName
|
|
393
|
-
} : {}),
|
|
394
|
-
...(this._state.session ? {
|
|
395
|
-
session: this._state.session
|
|
396
|
-
} : {}),
|
|
397
|
-
...(this._selectedProvider ? {
|
|
398
|
-
selectedProvider: this._selectedProvider
|
|
399
|
-
} : {})
|
|
400
|
-
}));
|
|
401
|
-
this.startCallbackTimeout();
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* Best-effort status polling. Transitions to a terminal state on
|
|
406
|
-
* `completed | failed | cancelled | expired`; otherwise leaves the flow in
|
|
407
|
-
* the current phase. After {@link POLL_STATUS_MAX_CONSECUTIVE_FAILURES}
|
|
408
|
-
* consecutive transport failures the controller gives up with
|
|
409
|
-
* `failed('network_error')` to stop hammering an unreachable backend.
|
|
410
|
-
*/
|
|
411
|
-
async pollStatus() {
|
|
412
|
-
// A status response can land after a bank callback or the timeout has
|
|
413
|
-
// already resolved the flow; never overwrite a terminal state.
|
|
414
|
-
if (isTerminal(this._state.phase)) return;
|
|
415
|
-
try {
|
|
416
|
-
const status = await this.apiClient.getStatus(this.sessionToken);
|
|
417
|
-
this._pollStatusConsecutiveFailures = 0;
|
|
418
|
-
// Re-check: the await above yields, so a terminal callback may have
|
|
419
|
-
// arrived while the request was in flight.
|
|
420
|
-
if (isTerminal(this._state.phase)) return;
|
|
421
|
-
switch (status.status) {
|
|
422
|
-
case 'completed':
|
|
423
|
-
this.setState(_paymentFlowState.PaymentFlowStates.succeeded({
|
|
424
|
-
...(status.linkSessionId ? {
|
|
425
|
-
linkSessionId: status.linkSessionId
|
|
426
|
-
} : {}),
|
|
427
|
-
...(this._selectedProvider ? {
|
|
428
|
-
selectedProvider: this._selectedProvider
|
|
429
|
-
} : {}),
|
|
430
|
-
...(this._state.session ? {
|
|
431
|
-
session: this._state.session
|
|
432
|
-
} : {})
|
|
433
|
-
}));
|
|
434
|
-
return;
|
|
435
|
-
case 'failed':
|
|
436
|
-
this.setState(_paymentFlowState.PaymentFlowStates.failed({
|
|
437
|
-
errorCode: status.failureCode ?? 'session_failed'
|
|
438
|
-
}));
|
|
439
|
-
return;
|
|
440
|
-
case 'cancelled':
|
|
441
|
-
this.setState(_paymentFlowState.PaymentFlowStates.cancelled());
|
|
442
|
-
return;
|
|
443
|
-
case 'expired':
|
|
444
|
-
this.setState(_paymentFlowState.PaymentFlowStates.failed({
|
|
445
|
-
errorCode: 'session_expired'
|
|
446
|
-
}));
|
|
447
|
-
return;
|
|
448
|
-
default:
|
|
449
|
-
// Non-terminal. In sandbox, only treat `callback_received` as success —
|
|
450
|
-
// the bank has actually returned. `redirected` means consent was posted
|
|
451
|
-
// but the user may not have authorized yet; auto-success there caused
|
|
452
|
-
// false positives on cold-start recovery.
|
|
453
|
-
if (this.environment === 'sandbox' && this._state.phase === 'awaitingCallback' && (0, _linkSessionStatus.isBankCallbackReceivedStatus)(status.status)) {
|
|
454
|
-
this.setState(_paymentFlowState.PaymentFlowStates.succeeded({
|
|
455
|
-
...(status.linkSessionId ? {
|
|
456
|
-
linkSessionId: status.linkSessionId
|
|
457
|
-
} : {}),
|
|
458
|
-
...(this._selectedProvider ? {
|
|
459
|
-
selectedProvider: this._selectedProvider
|
|
460
|
-
} : {}),
|
|
461
|
-
...(this._state.session ? {
|
|
462
|
-
session: this._state.session
|
|
463
|
-
} : {})
|
|
464
|
-
}));
|
|
465
|
-
}
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
} catch {
|
|
469
|
-
this._pollStatusConsecutiveFailures += 1;
|
|
470
|
-
log.warning(`pollStatus: failed (${this._pollStatusConsecutiveFailures}/${POLL_STATUS_MAX_CONSECUTIVE_FAILURES})`);
|
|
471
|
-
if (this._pollStatusConsecutiveFailures >= POLL_STATUS_MAX_CONSECUTIVE_FAILURES) {
|
|
472
|
-
if (isTerminal(this._state.phase) || this._state.phase !== 'awaitingCallback') return;
|
|
473
|
-
this.setState(_paymentFlowState.PaymentFlowStates.failed({
|
|
474
|
-
errorCode: 'network_error',
|
|
475
|
-
errorMessage: 'Unable to reach the Spare backend after multiple attempts.'
|
|
476
|
-
}));
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/** Best-effort telemetry — never throws, never changes state. */
|
|
482
|
-
async postTelemetry(payload) {
|
|
483
|
-
try {
|
|
484
|
-
await this.apiClient.postTelemetry({
|
|
485
|
-
linkToken: this.sessionToken,
|
|
486
|
-
payload
|
|
487
|
-
});
|
|
488
|
-
} catch (err) {
|
|
489
|
-
log.warning(`postTelemetry: best-effort telemetry failed — ${err instanceof Error ? err.message : String(err)}`);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/** Best-effort CoP — returns result or null on failure. */
|
|
494
|
-
async getCoP(providerId) {
|
|
495
|
-
try {
|
|
496
|
-
return await this.apiClient.getConfirmPayee(this.sessionToken, providerId);
|
|
497
|
-
} catch {
|
|
498
|
-
return null;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
async postTelemetryAutomatic() {
|
|
502
|
-
if (!this.collectTelemetry) return;
|
|
503
|
-
log.fine('postTelemetryAutomatic: collecting and posting device telemetry');
|
|
504
|
-
try {
|
|
505
|
-
const payload = await this.collectTelemetry();
|
|
506
|
-
await this.apiClient.postTelemetry({
|
|
507
|
-
linkToken: this.sessionToken,
|
|
508
|
-
payload
|
|
509
|
-
});
|
|
510
|
-
} catch (err) {
|
|
511
|
-
log.warning(`postTelemetryAutomatic: failed — ${err instanceof Error ? err.message : String(err)}`);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
/** Returns the active providers list — convenience for the UI layer. */
|
|
516
|
-
get providers() {
|
|
517
|
-
return this._state.providers;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
/** Returns the active session, if any. */
|
|
521
|
-
get session() {
|
|
522
|
-
return this._state.session;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* Releases resources: cancels timers, clears listeners, and aborts the
|
|
527
|
-
* underlying API client's in-flight fetches. Idempotent.
|
|
528
|
-
*/
|
|
529
|
-
dispose() {
|
|
530
|
-
if (this._disposed) return;
|
|
531
|
-
log.info('dispose: releasing apiClient');
|
|
532
|
-
this._disposed = true;
|
|
533
|
-
this.cancelCallbackTimeout();
|
|
534
|
-
this._listeners.clear();
|
|
535
|
-
this.apiClient.dispose();
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
exports.PaymentFlowController = PaymentFlowController;
|
|
539
|
-
function fallbackUuid() {
|
|
540
|
-
const bytes = new Uint8Array(16);
|
|
541
|
-
for (let i = 0; i < 16; i += 1) bytes[i] = Math.floor(Math.random() * 256);
|
|
542
|
-
bytes[6] = (bytes[6] ?? 0) & 0x0f | 0x40;
|
|
543
|
-
bytes[8] = (bytes[8] ?? 0) & 0x3f | 0x80;
|
|
544
|
-
const hex = Array.from(bytes, b => b.toString(16).padStart(2, '0')).join('');
|
|
545
|
-
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
|
|
546
|
-
}
|
|
547
|
-
//# sourceMappingURL=payment-flow-controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_logger","require","_redactUri","_constants","_paymentApiError","_linkSessionStatus","_paymentReturnParams","_paymentType","_paymentFlowState","REAL_CLOCK","now","Date","POLL_STATUS_MAX_CONSECUTIVE_FAILURES","log","createLogger","TERMINAL_PHASES","Set","isTerminal","phase","has","PaymentFlowController","_state","PaymentFlowStates","idle","_listeners","_disposed","_pollStatusConsecutiveFailures","constructor","opts","sessionToken","apiClient","pendingSessionStore","awaitingCallbackTimeoutMs","DEFAULT_AWAITING_CALLBACK_TIMEOUT_MS","environment","awaitingCallbackPollMs","DEFAULT_AWAITING_CALLBACK_POLL_MS","clock","collectTelemetry","uuid","fallbackUuid","onEvent","onEventCallback","state","awaitingCallbackStartedAtMs","_awaitingCallbackStartedAtMs","subscribe","listener","add","delete","setState","next","cancelCallbackTimeout","_consentIdempotencyKey","undefined","l","fireEvent","event","_callbackTimer","clearTimeout","startCallbackTimeout","setTimeout","reportError","hydrate","Promise","resolve","_hydratePromise","_doHydrate","finally","info","hydrating","session","providers","all","getSession","getProviders","length","bankSelection","err","severe","Error","message","String","code","isPaymentApiError","failed","errorCode","errorMessage","selectBank","bankId","current","provider","find","p","id","_selectedProvider","willLoadCop","shouldPerformCop","consentDetails","selectedProvider","isCopLoading","copApplicable","loadCopInBackground","cop","getCoP","copResponse","tenantHeader","request","isCopVerified","supportsConfirmationOfPayee","confirmConsent","postTelemetryAutomatic","consent","postConsent","linkToken","idempotencyKey","patchTokenBestEffort","merchantRef","merchantReference","save","sessionId","selectedBankId","authorizationUrl","redirectUrl","consentAt","recoveryAttempts","warning","redirecting","handleCallback","uri","redactPaymentReturnUri","toString","url","URL","params","searchParams","error","extractPaymentReturnErrorCode","description","get","exchangeCode","linkSessionId","succeeded","cancel","cancelled","action","patchToken","setAwaitingCallbackState","args","awaitingCallback","providerName","pollStatus","status","getStatus","failureCode","isBankCallbackReceivedStatus","postTelemetry","payload","providerId","getConfirmPayee","fine","dispose","clear","exports","bytes","Uint8Array","i","Math","floor","random","hex","Array","from","b","padStart","join","slice"],"sourceRoot":"../../../../src","sources":["core/services/payment-flow-controller.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAiBA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AAjBA;;AAwBA;;AAKA,MAAMQ,UAAiB,GAAG;EAAEC,GAAG,EAAEA,CAAA,KAAMC,IAAI,CAACD,GAAG,CAAC;AAAE,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA,MAAME,oCAAoC,GAAG,CAAC;AAC9C,MAAMC,GAAG,GAAG,IAAAC,oBAAY,EAAC,uBAAuB,CAAC;AAgCjD,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAmB,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEvF,SAASC,UAAUA,CAACC,KAAuB,EAAW;EACpD,OAAOH,eAAe,CAACI,GAAG,CAACD,KAAK,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,qBAAqB,CAAC;EAazBC,MAAM,GAAqBC,mCAAiB,CAACC,IAAI,CAAC,CAAC;EACnDC,UAAU,GAAG,IAAIR,GAAG,CAAW,CAAC;;EAIxC;AACF;;EAEUS,SAAS,GAAG,KAAK;EACzB;;E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EAAE,EAAE,EAAE,CAAC,EAAE;AAChH","ignoreList":[]}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PaymentFlowStates = void 0;
|
|
7
|
-
/** Phases the payment flow controller transitions through. */
|
|
8
|
-
|
|
9
|
-
const EMPTY_PROVIDERS = [];
|
|
10
|
-
const PaymentFlowStates = exports.PaymentFlowStates = {
|
|
11
|
-
idle() {
|
|
12
|
-
return {
|
|
13
|
-
phase: 'idle',
|
|
14
|
-
providers: EMPTY_PROVIDERS
|
|
15
|
-
};
|
|
16
|
-
},
|
|
17
|
-
hydrating() {
|
|
18
|
-
return {
|
|
19
|
-
phase: 'hydrating',
|
|
20
|
-
providers: EMPTY_PROVIDERS
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
bankSelection(args) {
|
|
24
|
-
return {
|
|
25
|
-
phase: 'bankSelection',
|
|
26
|
-
session: args.session,
|
|
27
|
-
providers: args.providers
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
consentDetails(args) {
|
|
31
|
-
return {
|
|
32
|
-
phase: 'consentDetails',
|
|
33
|
-
session: args.session,
|
|
34
|
-
providers: EMPTY_PROVIDERS,
|
|
35
|
-
selectedProvider: args.selectedProvider,
|
|
36
|
-
...(args.copResponse ? {
|
|
37
|
-
copResponse: args.copResponse
|
|
38
|
-
} : {}),
|
|
39
|
-
...(args.isCopLoading !== undefined ? {
|
|
40
|
-
isCopLoading: args.isCopLoading
|
|
41
|
-
} : {}),
|
|
42
|
-
...(args.copApplicable !== undefined ? {
|
|
43
|
-
copApplicable: args.copApplicable
|
|
44
|
-
} : {})
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
redirecting(args) {
|
|
48
|
-
return {
|
|
49
|
-
phase: 'redirecting',
|
|
50
|
-
providers: EMPTY_PROVIDERS,
|
|
51
|
-
consent: args.consent,
|
|
52
|
-
...(args.selectedProvider ? {
|
|
53
|
-
selectedProvider: args.selectedProvider
|
|
54
|
-
} : {})
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
awaitingCallback(args) {
|
|
58
|
-
return {
|
|
59
|
-
phase: 'awaitingCallback',
|
|
60
|
-
providers: EMPTY_PROVIDERS,
|
|
61
|
-
...(args.providerName ? {
|
|
62
|
-
providerName: args.providerName
|
|
63
|
-
} : {}),
|
|
64
|
-
...(args.session ? {
|
|
65
|
-
session: args.session
|
|
66
|
-
} : {}),
|
|
67
|
-
...(args.selectedProvider ? {
|
|
68
|
-
selectedProvider: args.selectedProvider
|
|
69
|
-
} : {})
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
succeeded(args) {
|
|
73
|
-
return {
|
|
74
|
-
phase: 'succeeded',
|
|
75
|
-
providers: EMPTY_PROVIDERS,
|
|
76
|
-
...(args.exchangeCode ? {
|
|
77
|
-
exchangeCode: args.exchangeCode
|
|
78
|
-
} : {}),
|
|
79
|
-
...(args.linkSessionId ? {
|
|
80
|
-
linkSessionId: args.linkSessionId
|
|
81
|
-
} : {}),
|
|
82
|
-
...(args.merchantRef ? {
|
|
83
|
-
merchantRef: args.merchantRef
|
|
84
|
-
} : {}),
|
|
85
|
-
...(args.selectedProvider ? {
|
|
86
|
-
selectedProvider: args.selectedProvider
|
|
87
|
-
} : {}),
|
|
88
|
-
...(args.session ? {
|
|
89
|
-
session: args.session
|
|
90
|
-
} : {})
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
failed(args) {
|
|
94
|
-
return {
|
|
95
|
-
phase: 'failed',
|
|
96
|
-
providers: EMPTY_PROVIDERS,
|
|
97
|
-
errorCode: args.errorCode,
|
|
98
|
-
...(args.errorMessage ? {
|
|
99
|
-
errorMessage: args.errorMessage
|
|
100
|
-
} : {})
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
cancelled() {
|
|
104
|
-
return {
|
|
105
|
-
phase: 'cancelled',
|
|
106
|
-
providers: EMPTY_PROVIDERS
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
//# sourceMappingURL=payment-flow-state.js.map
|