@fantastic.dev/better-stripe 0.112.0 → 0.119.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/CHANGELOG.md +94 -0
- package/MIGRATION.md +50 -4
- package/README.md +69 -2
- package/dist/client/billing/renewalAggregate/phases.d.ts.map +1 -1
- package/dist/client/billing/renewalAggregate/phases.js +27 -13
- package/dist/client/billing/renewalAggregate/phases.js.map +1 -1
- package/dist/client/billing/renewalAggregate/preflight.d.ts +1 -0
- package/dist/client/billing/renewalAggregate/preflight.d.ts.map +1 -1
- package/dist/client/billing/renewalAggregate/readMaterial.d.ts +2 -1
- package/dist/client/billing/renewalAggregate/readMaterial.d.ts.map +1 -1
- package/dist/client/billing/renewalAggregate/readMaterial.js +28 -5
- package/dist/client/billing/renewalAggregate/readMaterial.js.map +1 -1
- package/dist/client/billing/renewalAggregate/sourceDiscounts.d.ts +1 -1
- package/dist/client/billing/renewalAggregate/sourceDiscounts.d.ts.map +1 -1
- package/dist/client/billing/renewalAggregate/sourceDiscounts.js +2 -2
- package/dist/client/billing/renewalAggregate/sourceDiscounts.js.map +1 -1
- package/dist/client/billing/renewalAttach/attachmentProfile.d.ts +13 -0
- package/dist/client/billing/renewalAttach/attachmentProfile.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/attachmentProfile.js +15 -0
- package/dist/client/billing/renewalAttach/attachmentProfile.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.js +1 -1
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/material/classifiers.d.ts +1 -1
- package/dist/client/billing/renewalAttach/internal/material/classifiers.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/material/classifiers.js +11 -10
- package/dist/client/billing/renewalAttach/internal/material/classifiers.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.d.ts +1 -1
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.js +20 -5
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js +7 -7
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js +5 -3
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.js +1 -1
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/attachAcknowledgement.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/attachAcknowledgement.js +4 -4
- package/dist/client/billing/renewalAttach/internal/producer/attachAcknowledgement.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/configureWriteFactory.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/configureWriteFactory.js +7 -6
- package/dist/client/billing/renewalAttach/internal/producer/configureWriteFactory.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.js +16 -1
- package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/nodeAttachmentProfile.d.ts +9 -0
- package/dist/client/billing/renewalAttach/internal/producer/nodeAttachmentProfile.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/nodeAttachmentProfile.js +83 -0
- package/dist/client/billing/renewalAttach/internal/producer/nodeAttachmentProfile.js.map +1 -0
- package/dist/client/billing/renewalAttach/liveAttachment.d.ts +12 -0
- package/dist/client/billing/renewalAttach/liveAttachment.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/liveAttachment.js +23 -0
- package/dist/client/billing/renewalAttach/liveAttachment.js.map +1 -0
- package/dist/client/billing/renewalAttach/nodeAttachment.d.ts +4 -0
- package/dist/client/billing/renewalAttach/nodeAttachment.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/nodeAttachment.js +154 -0
- package/dist/client/billing/renewalAttach/nodeAttachment.js.map +1 -0
- package/dist/client/billing/renewalAttach/nodeConfiguration.d.ts +3 -0
- package/dist/client/billing/renewalAttach/nodeConfiguration.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/nodeConfiguration.js +126 -0
- package/dist/client/billing/renewalAttach/nodeConfiguration.js.map +1 -0
- package/dist/client/billing/renewalV2/configureInput.d.ts +1 -0
- package/dist/client/billing/renewalV2/configureInput.d.ts.map +1 -1
- package/dist/client/billing/renewalV2/configureInput.js +2 -1
- package/dist/client/billing/renewalV2/configureInput.js.map +1 -1
- package/dist/client/billing/renewalV2/index.d.ts +3 -0
- package/dist/client/billing/renewalV2/index.d.ts.map +1 -1
- package/dist/client/billing/renewalV2/index.js +1 -1
- package/dist/client/billing/renewalV2/index.js.map +1 -1
- package/dist/client/billing/renewalV2/observationInput.d.ts +1 -0
- package/dist/client/billing/renewalV2/observationInput.d.ts.map +1 -1
- package/dist/client/index.d.ts +7 -14
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +10 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/node.d.ts +2 -0
- package/dist/client/node.d.ts.map +1 -0
- package/dist/client/node.js +9 -0
- package/dist/client/node.js.map +1 -0
- package/dist/client/renewal.d.ts +4 -0
- package/dist/client/renewal.d.ts.map +1 -1
- package/dist/client/renewal.js +2 -1
- package/dist/client/renewal.js.map +1 -1
- package/dist/client/renewalAttachmentPreparation.d.ts +23 -0
- package/dist/client/renewalAttachmentPreparation.d.ts.map +1 -0
- package/dist/client/renewalAttachmentPreparation.js +89 -0
- package/dist/client/renewalAttachmentPreparation.js.map +1 -0
- package/dist/client/renewalAttachmentRuntime.d.ts +6 -0
- package/dist/client/renewalAttachmentRuntime.d.ts.map +1 -0
- package/dist/client/renewalAttachmentRuntime.js +13 -0
- package/dist/client/renewalAttachmentRuntime.js.map +1 -0
- package/dist/client/renewalAttachmentTypes.d.ts +45 -0
- package/dist/client/renewalAttachmentTypes.d.ts.map +1 -0
- package/dist/client/renewalAttachmentTypes.js +2 -0
- package/dist/client/renewalAttachmentTypes.js.map +1 -0
- package/dist/client/renewalConfigurationPreparation.d.ts +27 -0
- package/dist/client/renewalConfigurationPreparation.d.ts.map +1 -0
- package/dist/client/renewalConfigurationPreparation.js +78 -0
- package/dist/client/renewalConfigurationPreparation.js.map +1 -0
- package/dist/client/renewalConfigurationRuntime.d.ts +6 -0
- package/dist/client/renewalConfigurationRuntime.d.ts.map +1 -0
- package/dist/client/renewalConfigurationRuntime.js +12 -0
- package/dist/client/renewalConfigurationRuntime.js.map +1 -0
- package/dist/client/renewalConfigurationTypes.d.ts +19 -0
- package/dist/client/renewalConfigurationTypes.d.ts.map +1 -0
- package/dist/client/renewalConfigurationTypes.js +2 -0
- package/dist/client/renewalConfigurationTypes.js.map +1 -0
- package/dist/client/renewalContextClient.d.ts +5 -0
- package/dist/client/renewalContextClient.d.ts.map +1 -1
- package/dist/client/renewalContextClient.js +9 -0
- package/dist/client/renewalContextClient.js.map +1 -1
- package/dist/client/types/documents.d.ts +2 -0
- package/dist/client/types/documents.d.ts.map +1 -1
- package/dist/client/webhooks/helpers.d.ts.map +1 -1
- package/dist/client/webhooks/helpers.js +1 -0
- package/dist/client/webhooks/helpers.js.map +1 -1
- package/dist/client/webhooks/ledger.d.ts +31 -0
- package/dist/client/webhooks/ledger.d.ts.map +1 -0
- package/dist/client/webhooks/ledger.js +13 -0
- package/dist/client/webhooks/ledger.js.map +1 -0
- package/dist/client/webhooks/processors.d.ts.map +1 -1
- package/dist/client/webhooks/processors.js +6 -3
- package/dist/client/webhooks/processors.js.map +1 -1
- package/dist/client/webhooks/subscriptionDeleted.d.ts.map +1 -1
- package/dist/client/webhooks/subscriptionDeleted.js +3 -2
- package/dist/client/webhooks/subscriptionDeleted.js.map +1 -1
- package/dist/component/_generated/api.d.ts +2 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +18 -1
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
- package/dist/component/billing/mutations.d.ts +2 -1
- package/dist/component/billing/mutations.d.ts.map +1 -1
- package/dist/component/billing/mutations.js +28 -3
- package/dist/component/billing/mutations.js.map +1 -1
- package/dist/component/billing/queries.d.ts +8 -0
- package/dist/component/billing/queries.d.ts.map +1 -1
- package/dist/component/billing/schema.d.ts +3 -1
- package/dist/component/billing/schema.d.ts.map +1 -1
- package/dist/component/billing/validators.d.ts +16 -1
- package/dist/component/billing/validators.d.ts.map +1 -1
- package/dist/component/billing/validators.js +8 -0
- package/dist/component/billing/validators.js.map +1 -1
- package/dist/component/billingHistory/queries.d.ts +1 -0
- package/dist/component/billingHistory/queries.d.ts.map +1 -1
- package/dist/component/core/mutations.d.ts +4 -0
- package/dist/component/core/mutations.d.ts.map +1 -1
- package/dist/component/core/mutations.js +6 -0
- package/dist/component/core/mutations.js.map +1 -1
- package/dist/component/core/stripeMode.d.ts +8 -0
- package/dist/component/core/stripeMode.d.ts.map +1 -0
- package/dist/component/core/stripeMode.js +23 -0
- package/dist/component/core/stripeMode.js.map +1 -0
- package/dist/component/earnings/triggers.d.ts +6 -4
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
- package/dist/component/schema.d.ts +4 -2
- package/dist/component/webhooks/mutations.d.ts +19 -0
- package/dist/component/webhooks/mutations.d.ts.map +1 -1
- package/dist/component/webhooks/mutations.js +56 -0
- package/dist/component/webhooks/mutations.js.map +1 -1
- package/dist/component/webhooks/schema.d.ts +1 -1
- package/dist/component/webhooks/schema.d.ts.map +1 -1
- package/dist/component/webhooks/schema.js +2 -1
- package/dist/component/webhooks/schema.js.map +1 -1
- package/docs/README.md +43 -8
- package/docs/billing-history.md +1 -1
- package/docs/client-api.md +63 -10
- package/docs/evidence/native-metering/mixed-settlement-2026-10-20.json +1 -1
- package/docs/evidence/native-metering/product-flows-2026-10-19.json +1 -1
- package/docs/example-routing.md +93 -0
- package/docs/pull-request-standard.md +142 -0
- package/docs/react-workflows-audit.md +1 -2
- package/docs/read-contracts.md +6 -5
- package/docs/releasing.md +27 -2
- package/docs/renewal-attachment.md +176 -0
- package/docs/renewal-configuration.md +127 -0
- package/docs/renewal-context-reads.md +9 -5
- package/docs/renewal-example-authorization.md +74 -0
- package/docs/settlement.md +2 -1
- package/docs/stripe-sandbox-worktrees.md +245 -0
- package/docs/webhooks.md +110 -1
- package/docs/worktrees.md +134 -0
- package/package.json +14 -2
- package/src/client/billing/renewalAggregate/phases.ts +31 -13
- package/src/client/billing/renewalAggregate/readMaterial.ts +36 -2
- package/src/client/billing/renewalAggregate/sourceDiscounts.ts +3 -1
- package/src/client/billing/renewalAttach/attachmentProfile.ts +22 -0
- package/src/client/billing/renewalAttach/internal/c10/eventCapture.ts +1 -1
- package/src/client/billing/renewalAttach/internal/material/classifiers.ts +26 -7
- package/src/client/billing/renewalAttach/internal/material/readMaterial.ts +26 -2
- package/src/client/billing/renewalAttach/internal/operations/configureReadTransport.ts +10 -9
- package/src/client/billing/renewalAttach/internal/operations/initialAttach.ts +5 -3
- package/src/client/billing/renewalAttach/internal/preflight/grammar.ts +1 -1
- package/src/client/billing/renewalAttach/internal/producer/attachAcknowledgement.ts +4 -6
- package/src/client/billing/renewalAttach/internal/producer/configureWriteFactory.ts +10 -8
- package/src/client/billing/renewalAttach/internal/producer/invocationProducer.ts +28 -1
- package/src/client/billing/renewalAttach/internal/producer/nodeAttachmentProfile.ts +108 -0
- package/src/client/billing/renewalAttach/liveAttachment.ts +43 -0
- package/src/client/billing/renewalAttach/nodeAttachment.ts +181 -0
- package/src/client/billing/renewalAttach/nodeConfiguration.ts +147 -0
- package/src/client/billing/renewalV2/configureInput.ts +2 -1
- package/src/client/billing/renewalV2/index.ts +7 -1
- package/src/client/index.ts +13 -15
- package/src/client/node.ts +8 -0
- package/src/client/renewal.ts +17 -0
- package/src/client/renewalAttachmentPreparation.ts +118 -0
- package/src/client/renewalAttachmentRuntime.ts +25 -0
- package/src/client/renewalAttachmentTypes.ts +51 -0
- package/src/client/renewalConfigurationPreparation.ts +92 -0
- package/src/client/renewalConfigurationRuntime.ts +24 -0
- package/src/client/renewalConfigurationTypes.ts +30 -0
- package/src/client/renewalContextClient.ts +22 -0
- package/src/client/types/documents.ts +2 -0
- package/src/client/webhooks/helpers.ts +1 -0
- package/src/client/webhooks/ledger.ts +48 -0
- package/src/client/webhooks/processors.ts +5 -0
- package/src/client/webhooks/subscriptionDeleted.ts +3 -2
- package/src/component/_generated/api.ts +2 -0
- package/src/component/_generated/component.ts +18 -1
- package/src/component/billing/mutations.ts +35 -2
- package/src/component/billing/validators.ts +12 -0
- package/src/component/core/mutations.ts +6 -0
- package/src/component/core/stripeMode.ts +30 -0
- package/src/component/webhooks/mutations.ts +66 -0
- package/src/component/webhooks/schema.ts +2 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.d.ts +0 -2
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.d.ts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.js +0 -61
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.js.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.d.ts +0 -2
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.d.ts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js +0 -18
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.d.ts +0 -2
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.d.ts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js +0 -67
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.d.ts +0 -2
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.d.ts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js +0 -372
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.d.ts +0 -2
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.d.ts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js +0 -126
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.d.mts +0 -627
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs +0 -488
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.d.mts +0 -214
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs +0 -63
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.d.mts +0 -75
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs +0 -145
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts +0 -7
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs +0 -26
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.d.mts +0 -3
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs +0 -4
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.d.mts +0 -26
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs +0 -42
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.d.mts +0 -7
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs +0 -60
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.d.mts +0 -335
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs +0 -122
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.d.mts +0 -46
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs +0 -87
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.d.mts +0 -35
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs +0 -90
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.d.mts +0 -132
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs +0 -82
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.d.mts +0 -4
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs +0 -23
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.d.mts +0 -16
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs +0 -41
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.d.mts +0 -43
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs +0 -132
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.d.mts +0 -200
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs +0 -150
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.d.mts +0 -124
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs +0 -127
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.d.mts +0 -3
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs +0 -69
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.d.mts +0 -2
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs +0 -152
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.d.mts +0 -2
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs +0 -2
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.d.mts +0 -5
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs +0 -243
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.d.mts +0 -17
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs +0 -75
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.d.mts +0 -2
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs +0 -173
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.d.mts +0 -4
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs +0 -4
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.d.mts +0 -7
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs +0 -30
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.d.mts +0 -29
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs +0 -33
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f19.json +0 -452
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.d.mts +0 -2
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs +0 -173
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.d.mts +0 -2
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs +0 -449
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.d.mts +0 -9
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs +0 -27
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.d.mts +0 -7
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs +0 -150
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.d.mts +0 -3
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs +0 -503
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.d.mts +0 -2
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs +0 -91
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.d.mts +0 -14
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs +0 -41
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.d.mts +0 -103
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs +0 -46
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.d.mts +0 -73
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs +0 -294
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.d.mts +0 -2
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs +0 -60
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.d.mts +0 -58
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.d.mts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs +0 -96
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.d.ts +0 -2
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.d.ts.map +0 -1
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.js +0 -40
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.js.map +0 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +0 -10349
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +0 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.js +0 -242
- package/dist/client/connect/payoutAdoptionTestHelpers.js.map +0 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +0 -5166
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +0 -1
- package/dist/client/connect/payoutExecutionTestHelpers.js +0 -208
- package/dist/client/connect/payoutExecutionTestHelpers.js.map +0 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +0 -10341
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +0 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.js +0 -55
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.js.map +0 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +0 -5098
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +0 -1
- package/dist/client/connect/payoutSyncTestHelpers.js +0 -62
- package/dist/client/connect/payoutSyncTestHelpers.js.map +0 -1
- package/dist/client/paymentSource/resolver.fixtures.d.ts +0 -220
- package/dist/client/paymentSource/resolver.fixtures.d.ts.map +0 -1
- package/dist/client/paymentSource/resolver.fixtures.js +0 -189
- package/dist/client/paymentSource/resolver.fixtures.js.map +0 -1
- package/dist/client/recoveryWorkflow/provider.fixture.d.ts +0 -21
- package/dist/client/recoveryWorkflow/provider.fixture.d.ts.map +0 -1
- package/dist/client/recoveryWorkflow/provider.fixture.js +0 -125
- package/dist/client/recoveryWorkflow/provider.fixture.js.map +0 -1
- package/dist/client/settlement/authorization.fixture.d.ts +0 -148
- package/dist/client/settlement/authorization.fixture.d.ts.map +0 -1
- package/dist/client/settlement/authorization.fixture.js +0 -178
- package/dist/client/settlement/authorization.fixture.js.map +0 -1
- package/dist/client/setup.test.d.ts +0 -18
- package/dist/client/setup.test.d.ts.map +0 -1
- package/dist/client/setup.test.js +0 -33
- package/dist/client/setup.test.js.map +0 -1
- package/dist/client/usage/correctionTransport.fixtures.d.ts +0 -37
- package/dist/client/usage/correctionTransport.fixtures.d.ts.map +0 -1
- package/dist/client/usage/correctionTransport.fixtures.js +0 -322
- package/dist/client/usage/correctionTransport.fixtures.js.map +0 -1
- package/dist/client/usage/creditSettlement.fixtures.d.ts +0 -216
- package/dist/client/usage/creditSettlement.fixtures.d.ts.map +0 -1
- package/dist/client/usage/creditSettlement.fixtures.js +0 -59
- package/dist/client/usage/creditSettlement.fixtures.js.map +0 -1
- package/dist/client/usage/creditTransport.fixtures.d.ts +0 -108
- package/dist/client/usage/creditTransport.fixtures.d.ts.map +0 -1
- package/dist/client/usage/creditTransport.fixtures.js +0 -293
- package/dist/client/usage/creditTransport.fixtures.js.map +0 -1
- package/dist/client/usage/invoiceSale.fixtures.d.ts +0 -285
- package/dist/client/usage/invoiceSale.fixtures.d.ts.map +0 -1
- package/dist/client/usage/invoiceSale.fixtures.js +0 -104
- package/dist/client/usage/invoiceSale.fixtures.js.map +0 -1
- package/dist/client/usage/mixedInvoice.fixtures.d.ts +0 -315
- package/dist/client/usage/mixedInvoice.fixtures.d.ts.map +0 -1
- package/dist/client/usage/mixedInvoice.fixtures.js +0 -55
- package/dist/client/usage/mixedInvoice.fixtures.js.map +0 -1
- package/dist/client/usage/subscription.fixtures.d.ts +0 -118
- package/dist/client/usage/subscription.fixtures.d.ts.map +0 -1
- package/dist/client/usage/subscription.fixtures.js +0 -84
- package/dist/client/usage/subscription.fixtures.js.map +0 -1
- package/dist/client/usage/subscriptionTransport.fixtures.d.ts +0 -25
- package/dist/client/usage/subscriptionTransport.fixtures.d.ts.map +0 -1
- package/dist/client/usage/subscriptionTransport.fixtures.js +0 -206
- package/dist/client/usage/subscriptionTransport.fixtures.js.map +0 -1
- package/dist/client/webhooks/payoutReconciliationTestHelpers.d.ts +0 -117
- package/dist/client/webhooks/payoutReconciliationTestHelpers.d.ts.map +0 -1
- package/dist/client/webhooks/payoutReconciliationTestHelpers.js +0 -105
- package/dist/client/webhooks/payoutReconciliationTestHelpers.js.map +0 -1
- package/dist/component/usage/allowance.fixtures.d.ts +0 -5088
- package/dist/component/usage/allowance.fixtures.d.ts.map +0 -1
- package/dist/component/usage/allowance.fixtures.js +0 -67
- package/dist/component/usage/allowance.fixtures.js.map +0 -1
- package/dist/component/usageCredits/accounting.fixtures.d.ts +0 -5111
- package/dist/component/usageCredits/accounting.fixtures.d.ts.map +0 -1
- package/dist/component/usageCredits/accounting.fixtures.js +0 -89
- package/dist/component/usageCredits/accounting.fixtures.js.map +0 -1
- package/dist/react/workflows/Usage.fixtures.d.ts +0 -17
- package/dist/react/workflows/Usage.fixtures.d.ts.map +0 -1
- package/dist/react/workflows/Usage.fixtures.js +0 -79
- package/dist/react/workflows/Usage.fixtures.js.map +0 -1
- package/dist/test.d.ts +0 -6
- package/dist/test.d.ts.map +0 -1
- package/dist/test.js +0 -15
- package/dist/test.js.map +0 -1
- package/dist/testing/component-db.d.ts +0 -3
- package/dist/testing/component-db.d.ts.map +0 -1
- package/dist/testing/component-db.js +0 -26
- package/dist/testing/component-db.js.map +0 -1
- package/src/client/balanceFundingWorkflow/capture.test.ts +0 -144
- package/src/client/billing/balanceFunding.test.ts +0 -257
- package/src/client/billing/balanceFundingTransport.test.ts +0 -89
- package/src/client/billing/captured-checkout-payment.test.ts +0 -272
- package/src/client/billing/checkout-idempotency.test.ts +0 -82
- package/src/client/billing/checkout-ui-modes.test.ts +0 -49
- package/src/client/billing/checkout.test.ts +0 -1282
- package/src/client/billing/checkoutPages.test.ts +0 -270
- package/src/client/billing/historyPages.test.ts +0 -58
- package/src/client/billing/intents.test.ts +0 -216
- package/src/client/billing/intentsTransport.test.ts +0 -94
- package/src/client/billing/invoicePages.test.ts +0 -174
- package/src/client/billing/invoicePaymentPages.test.ts +0 -354
- package/src/client/billing/invoicePaymentRead.test.ts +0 -233
- package/src/client/billing/invoicePaymentReadTransport.test.ts +0 -101
- package/src/client/billing/invoicePreview.test.ts +0 -123
- package/src/client/billing/invoicePreviewTransport.test.ts +0 -70
- package/src/client/billing/invoices.test.ts +0 -243
- package/src/client/billing/prepared-checkout.test.ts +0 -430
- package/src/client/billing/providerReads.test.ts +0 -60
- package/src/client/billing/renewal-discount-projection.test.ts +0 -207
- package/src/client/billing/renewal-item-settings-projection.test.ts +0 -79
- package/src/client/billing/renewal-price-replacement.test.ts +0 -503
- package/src/client/billing/renewal-settings-projection.test.ts +0 -300
- package/src/client/billing/renewalAggregate/configure.test.ts +0 -372
- package/src/client/billing/renewalAggregate/preflight.test.ts +0 -233
- package/src/client/billing/renewalAggregate/sourceAndTaxRetention.test.ts +0 -247
- package/src/client/billing/renewalAttach/couponEvidence.test.ts +0 -103
- package/src/client/billing/renewalAttach/internal/acquisition/array-order.test.js +0 -70
- package/src/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js +0 -23
- package/src/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js +0 -77
- package/src/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js +0 -418
- package/src/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js +0 -138
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs +0 -510
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs +0 -64
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs +0 -159
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs +0 -25
- package/src/client/billing/renewalAttach/internal/c10/appendAck.first.test.ts +0 -86
- package/src/client/billing/renewalAttach/internal/c10/appendCodec.test.ts +0 -186
- package/src/client/billing/renewalAttach/internal/c10/arrayOrder.test.ts +0 -47
- package/src/client/billing/renewalAttach/internal/c10/compiler.test.ts +0 -443
- package/src/client/billing/renewalAttach/internal/c10/hardening.test.ts +0 -175
- package/src/client/billing/renewalAttach/internal/c10/historicalClassifier.test.ts +0 -114
- package/src/client/billing/renewalAttach/internal/c10/ownerContinuations.test.ts +0 -283
- package/src/client/billing/renewalAttach/internal/c10/reflectionPrivacy.test.ts +0 -87
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs +0 -3
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs +0 -49
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs +0 -63
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs +0 -160
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs +0 -88
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs +0 -102
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs +0 -82
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs +0 -20
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs +0 -41
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs +0 -137
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs +0 -153
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs +0 -127
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs +0 -85
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs +0 -170
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs +0 -6
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs +0 -295
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs +0 -78
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs +0 -177
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs +0 -8
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs +0 -34
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs +0 -32
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f19.json +0 -452
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs +0 -177
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs +0 -466
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs +0 -29
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs +0 -165
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs +0 -507
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs +0 -89
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs +0 -38
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs +0 -45
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs +0 -309
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs +0 -58
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs +0 -104
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.ts +0 -43
- package/src/client/billing/renewalAttach/internal/configure/dispatch.integration.test.ts +0 -32
- package/src/client/billing/renewalAttach/internal/configure/limits.test.ts +0 -510
- package/src/client/billing/renewalAttach/internal/configure/order.integration.test.ts +0 -207
- package/src/client/billing/renewalAttach/internal/configure/ownership.integration.test.ts +0 -148
- package/src/client/billing/renewalAttach/internal/configure/replay.integration.test.ts +0 -173
- package/src/client/billing/renewalAttach/internal/configure/transport.integration.test.ts +0 -507
- package/src/client/billing/renewalAttach/internal/material/classifiers.test.ts +0 -510
- package/src/client/billing/renewalAttach/internal/observation/freshActor.integration.test.ts +0 -360
- package/src/client/billing/renewalAttach/internal/observation/freshActorControls.integration.test.ts +0 -442
- package/src/client/billing/renewalAttach/internal/observation/history.integration.test.ts +0 -79
- package/src/client/billing/renewalAttach/internal/observation/historyControls.integration.test.ts +0 -238
- package/src/client/billing/renewalAttach/internal/observation/invoiceActor.integration.test.ts +0 -142
- package/src/client/billing/renewalAttach/internal/observation/invoiceActorControls.integration.test.ts +0 -495
- package/src/client/billing/renewalAttach/internal/observation/observation.integration.test.ts +0 -220
- package/src/client/billing/renewalAttach/internal/observation/observationConfigureACK.integration.test.ts +0 -36
- package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKControls.integration.test.ts +0 -48
- package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKLifecycle.integration.test.ts +0 -44
- package/src/client/billing/renewalAttach/internal/observation/observationConfiguredHistory.integration.test.ts +0 -34
- package/src/client/billing/renewalAttach/internal/observation/observationRetirement.integration.test.ts +0 -60
- package/src/client/billing/renewalAttach/internal/observation/reader.integration.test.ts +0 -93
- package/src/client/billing/renewalAttach/internal/observation/readerControls.integration.test.ts +0 -553
- package/src/client/billing/renewalAttach/internal/observation/witnessAcquisition.integration.test.ts +0 -348
- package/src/client/billing/renewalAttach/internal/observation/witnessActor.integration.test.ts +0 -204
- package/src/client/billing/renewalAttach/internal/observation/witnessCapabilities.integration.test.ts +0 -231
- package/src/client/billing/renewalAttach/internal/observation/witnessHistorical.integration.test.ts +0 -98
- package/src/client/billing/renewalAttach/internal/observation/witnessImmutable.integration.test.ts +0 -78
- package/src/client/billing/renewalAttach/internal/observation/witnessInvoice.integration.test.ts +0 -85
- package/src/client/billing/renewalAttach/internal/observation/witnessLifecycle.integration.test.ts +0 -264
- package/src/client/billing/renewalAttach/internal/observation/witnessProfile.integration.test.ts +0 -93
- package/src/client/billing/renewalAttach/internal/observation/witnessRPCControls.integration.test.ts +0 -256
- package/src/client/billing/renewalAttach/internal/operationJournal.acknowledgement.integration.test.ts +0 -500
- package/src/client/billing/renewalAttach/internal/operationJournal.c10.integration.test.ts +0 -560
- package/src/client/billing/renewalAttach/internal/operationJournal.controls.integration.test.ts +0 -356
- package/src/client/billing/renewalAttach/internal/operationJournal.integration.test.ts +0 -560
- package/src/client/billing/renewalAttach/internal/operationJournal.methods.integration.test.ts +0 -534
- package/src/client/billing/renewalAttach/internal/operations/defaultBindings.test.ts +0 -69
- package/src/client/billing/renewalAttach/internal/operations/initialAttach.integration.test.ts +0 -34
- package/src/client/billing/renewalAttach/internal/operations/providerFailure.integration.test.ts +0 -61
- package/src/client/billing/renewalAttach/internal/operations/transport.integration.test.ts +0 -116
- package/src/client/billing/renewalAttach/internal/originalOwner.test.ts +0 -258
- package/src/client/billing/renewalAttach/internal/preflight/configurePreflight.integration.test.ts +0 -285
- package/src/client/billing/renewalAttach/internal/preflight/configureReads.integration.test.ts +0 -139
- package/src/client/billing/renewalAttach/internal/preflight/owner.integration.test.ts +0 -82
- package/src/client/billing/renewalAttach/internal/preflight/preflight.integration.test.ts +0 -354
- package/src/client/billing/renewalAttach/internal/producer/producerAcknowledgement.integration.test.ts +0 -320
- package/src/client/billing/renewalAttach/internal/producer/producerAcknowledgementControls.integration.test.ts +0 -411
- package/src/client/billing/renewalAttach/internal/producer/producerAcquisition.integration.test.ts +0 -240
- package/src/client/billing/renewalAttach/internal/producer/producerActor.integration.test.ts +0 -526
- package/src/client/billing/renewalAttach/internal/producer/producerChannels.integration.test.ts +0 -350
- package/src/client/billing/renewalAttach/internal/producer/producerClock.integration.test.ts +0 -175
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureAdmission.integration.test.ts +0 -203
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureChannelControls.integration.test.ts +0 -542
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureChannels.integration.test.ts +0 -321
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureControls.integration.test.ts +0 -566
- package/src/client/billing/renewalAttach/internal/producer/producerConfigurePreflight.integration.test.ts +0 -67
- package/src/client/billing/renewalAttach/internal/producer/producerConfigurePreflightControls.integration.test.ts +0 -475
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureRecovery.integration.test.ts +0 -99
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureRecoveryControls.integration.test.ts +0 -420
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureWrite.integration.test.ts +0 -158
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureWriteControls.integration.test.ts +0 -549
- package/src/client/billing/renewalAttach/internal/producer/producerGuards.integration.test.ts +0 -323
- package/src/client/billing/renewalAttach/internal/producer/producerInitial.integration.test.ts +0 -301
- package/src/client/billing/renewalAttach/internal/producer/producerIsolation.integration.test.ts +0 -531
- package/src/client/billing/renewalAttach/internal/producer/producerMaterial.integration.test.ts +0 -251
- package/src/client/billing/renewalAttach/internal/producer/producerOwner.integration.test.ts +0 -449
- package/src/client/billing/renewalAttach/internal/producer/producerRecovery.integration.test.ts +0 -394
- package/src/client/billing/renewalAttach/internal/producer/producerRecoveryControls.integration.test.ts +0 -437
- package/src/client/billing/renewalAttach/internal/producer/producerRecoveryIsolation.integration.test.ts +0 -332
- package/src/client/billing/renewalAttach/internal/producer/producerTransport.integration.test.ts +0 -440
- package/src/client/billing/renewalAttach/internal/recovery/recovery.integration.test.ts +0 -463
- package/src/client/billing/renewalAttach/internal/sourceBindings.test.ts +0 -13
- package/src/client/billing/renewalAttach/internal/stockRawDelegate.test.ts +0 -156
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachEntries.ts +0 -217
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachObservations.ts +0 -226
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenario.ts +0 -556
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioAssertions.ts +0 -180
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioBarriers.ts +0 -144
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightAssertions.ts +0 -122
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightBarriers.ts +0 -330
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightControls.ts +0 -139
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightOperation.ts +0 -513
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadNativeBaseline.ts +0 -344
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadOperation.ts +0 -278
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadPort.ts +0 -17
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteAssertions.ts +0 -537
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteBarriers.ts +0 -125
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDeclarations.ts +0 -325
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDelegate.ts +0 -38
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteHistory.ts +0 -471
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteObservations.ts +0 -515
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteOperation.ts +0 -587
- package/src/client/billing/renewalAttach/internal/test-fixtures/freshObservation.ts +0 -94
- package/src/client/billing/renewalAttach/internal/test-fixtures/historySnapshot.ts +0 -51
- package/src/client/billing/renewalAttach/internal/test-fixtures/invoiceObservation.ts +0 -160
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationAssertions.ts +0 -211
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKAssertions.ts +0 -115
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKDeclarations.ts +0 -141
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleAssertions.ts +0 -74
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleDeclarations.ts +0 -79
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleInstrumentation.ts +0 -207
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleOperation.ts +0 -494
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKOperation.ts +0 -452
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryAssertions.ts +0 -88
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryDeclarations.ts +0 -170
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryNative.ts +0 -99
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryOperation.ts +0 -411
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationDeclarations.ts +0 -192
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationHTTP.ts +0 -197
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationObservations.ts +0 -269
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationOperation.ts +0 -262
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationProbe.ts +0 -319
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationReader.ts +0 -101
- package/src/client/billing/renewalAttach/internal/test-fixtures/ownedOperations.ts +0 -94
- package/src/client/billing/renewalAttach/internal/test-fixtures/producerConfigureAdmission.ts +0 -538
- package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialDeclarations.ts +0 -5
- package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialOperation.ts +0 -329
- package/src/client/billing/renewalAttach/internal/test-fixtures/sourceOperationPort.ts +0 -16
- package/src/client/billing/renewalAttach/internal/test-fixtures/stockHttp.ts +0 -21
- package/src/client/billing/renewalAttach/internal/test-fixtures/witnessHistory.ts +0 -70
- package/src/client/billing/renewalAttach/internal/test-fixtures/witnessObservation.ts +0 -353
- package/src/client/billing/renewalAttach/reader.test.ts +0 -409
- package/src/client/billing/renewalAttach/wireJson.test.ts +0 -265
- package/src/client/billing/renewalObservation/evidence-admission.test.ts +0 -219
- package/src/client/billing/renewalObservation/evidence-history.test.ts +0 -187
- package/src/client/billing/renewalObservation/evidence-invoice-controls.test.ts +0 -293
- package/src/client/billing/renewalObservation/evidence-invoice-identity.test.ts +0 -61
- package/src/client/billing/renewalObservation/evidence-invoice.test.ts +0 -177
- package/src/client/billing/renewalObservation/evidence-material.test.ts +0 -289
- package/src/client/billing/renewalObservation/evidence-v1.test.ts +0 -371
- package/src/client/billing/renewalV2/configure.test.ts +0 -362
- package/src/client/billing/renewalV2/configureReceipt.test.ts +0 -558
- package/src/client/billing/renewalV2/index.test.ts +0 -414
- package/src/client/billing/renewalV2/observation.boundary-review.test.ts +0 -49
- package/src/client/billing/renewalV2/observation.test.ts +0 -334
- package/src/client/billing/renewalV2/rawRetention.test.ts +0 -293
- package/src/client/billing/renewalV2/receipt.test.ts +0 -289
- package/src/client/billing/setup-intent-read.test.ts +0 -324
- package/src/client/billing/subscription-payment-method.test.ts +0 -460
- package/src/client/billing/subscriptionCancellation.test.ts +0 -68
- package/src/client/billing/subscriptions.test.ts +0 -1049
- package/src/client/charge-currency.test.ts +0 -113
- package/src/client/component-api-types.test.ts +0 -137
- package/src/client/connect/commissionReceipts.test.ts +0 -157
- package/src/client/connect/dispute-upload.test.ts +0 -208
- package/src/client/connect/disputes.test.ts +0 -502
- package/src/client/connect/paymentMethodUtils.test.ts +0 -83
- package/src/client/connect/paymentMethods.test.ts +0 -68
- package/src/client/connect/payoutAdoption.test.ts +0 -186
- package/src/client/connect/payoutAdoptionAge.test.ts +0 -89
- package/src/client/connect/payoutAdoptionAllocation.test.ts +0 -132
- package/src/client/connect/payoutAdoptionConcurrency.test.ts +0 -266
- package/src/client/connect/payoutAdoptionTestHelpers.ts +0 -269
- package/src/client/connect/payoutAllocation.test.ts +0 -325
- package/src/client/connect/payoutCacheIdentity.test.ts +0 -93
- package/src/client/connect/payoutCollection.test.ts +0 -74
- package/src/client/connect/payoutDeadline.test.ts +0 -238
- package/src/client/connect/payoutExecution.test.ts +0 -294
- package/src/client/connect/payoutExecutionTestHelpers.ts +0 -244
- package/src/client/connect/payoutHistory.test.ts +0 -145
- package/src/client/connect/payoutLargeAdoption.test.ts +0 -541
- package/src/client/connect/payoutLargeAdoptionTestHelpers.ts +0 -74
- package/src/client/connect/payoutLargeHistory.test.ts +0 -222
- package/src/client/connect/payoutLiabilityVersion.test.ts +0 -221
- package/src/client/connect/payoutOutcomeBatches.test.ts +0 -40
- package/src/client/connect/payoutPreview.test.ts +0 -414
- package/src/client/connect/payoutQualificationFreshness.test.ts +0 -192
- package/src/client/connect/payoutReceipt.test.ts +0 -312
- package/src/client/connect/payoutReconciliation.test.ts +0 -414
- package/src/client/connect/payoutReturnedAdoption.test.ts +0 -157
- package/src/client/connect/payoutSnapshot.test.ts +0 -118
- package/src/client/connect/payoutSync.test.ts +0 -313
- package/src/client/connect/payoutSyncTestHelpers.ts +0 -82
- package/src/client/connect/payoutWorker.test.ts +0 -201
- package/src/client/connect/payouts.test.ts +0 -132
- package/src/client/connect/refundActor.test.ts +0 -121
- package/src/client/connect/refundPrincipal.test.ts +0 -46
- package/src/client/connect/refundSync.test.ts +0 -239
- package/src/client/connect/refundSync.transport.test.ts +0 -396
- package/src/client/connect/refunds.test.ts +0 -438
- package/src/client/connect/transferReceipt.pagination.test.ts +0 -209
- package/src/client/connect/transferReceipt.test.ts +0 -520
- package/src/client/connect/transferReceiptBaseline.test.ts +0 -55
- package/src/client/connect/transfers.test.ts +0 -557
- package/src/client/core/account-close-guard.test.ts +0 -349
- package/src/client/core/account-close-orchestration.test.ts +0 -131
- package/src/client/core/account-closure-preview.test.ts +0 -219
- package/src/client/core/account-closure.test.ts +0 -317
- package/src/client/core/account-idempotency.test.ts +0 -78
- package/src/client/core/account-session-client.test.ts +0 -74
- package/src/client/core/accountConfigurations.test.ts +0 -183
- package/src/client/core/accountLinks.test.ts +0 -389
- package/src/client/core/accountStatus.test.ts +0 -169
- package/src/client/core/accounts.test.ts +0 -1385
- package/src/client/core/billingPortal.test.ts +0 -249
- package/src/client/core/billingPortalFlow.test.ts +0 -349
- package/src/client/core/billingPortalIdentity.test.ts +0 -418
- package/src/client/core/config.test.ts +0 -69
- package/src/client/core/descriptors.test.ts +0 -70
- package/src/client/core/fees.test.ts +0 -369
- package/src/client/core/idempotency.test.ts +0 -10
- package/src/client/core/personal-account-mapping.test.ts +0 -71
- package/src/client/costRecovery-import.test.ts +0 -174
- package/src/client/costRecovery-invoiceReceipt.test.ts +0 -140
- package/src/client/costRecovery-invoices.test.ts +0 -470
- package/src/client/costRecovery-invoices.transport.test.ts +0 -107
- package/src/client/costRecovery.test.ts +0 -110
- package/src/client/customer-preview-thin.test.ts +0 -41
- package/src/client/customer-preview-webhooks.test.ts +0 -150
- package/src/client/customer-preview.test.ts +0 -366
- package/src/client/errors.test.ts +0 -66
- package/src/client/financialObservations.test.ts +0 -109
- package/src/client/financialOutcomes/outcomes.test.ts +0 -254
- package/src/client/financialOwnership.test.ts +0 -80
- package/src/client/helpers.test.ts +0 -74
- package/src/client/index.test.ts +0 -1784
- package/src/client/operationEvidence.test.ts +0 -110
- package/src/client/originalIdReadOptions.test.ts +0 -63
- package/src/client/paymentSource/resolver.fixtures.ts +0 -216
- package/src/client/paymentSource/resolver.test.ts +0 -386
- package/src/client/payoutPolicy.test.ts +0 -579
- package/src/client/payoutRevisionMigration.test.ts +0 -40
- package/src/client/processingCostDeficit/calculator.test.ts +0 -176
- package/src/client/processingCostReconciliation/invoiceProvider.test.ts +0 -353
- package/src/client/processingCostReconciliation/provider.test.ts +0 -324
- package/src/client/products/catalog-idempotency.test.ts +0 -116
- package/src/client/products/catalog.test.ts +0 -389
- package/src/client/products/fixedPrice.test.ts +0 -57
- package/src/client/products/identity.test.ts +0 -91
- package/src/client/products/prices.test.ts +0 -375
- package/src/client/products/product-descriptor-inheritance.test.ts +0 -245
- package/src/client/products/product-descriptors.test.ts +0 -260
- package/src/client/products/product-set-idempotency.test.ts +0 -188
- package/src/client/products/products.test.ts +0 -517
- package/src/client/readPagination.test.ts +0 -83
- package/src/client/recoveryWorkflow/client.test.ts +0 -37
- package/src/client/recoveryWorkflow/provider.fixture.ts +0 -143
- package/src/client/recoveryWorkflow/provider.test.ts +0 -509
- package/src/client/refund-command-evidence.test.ts +0 -68
- package/src/client/refund-command-normalization.test.ts +0 -61
- package/src/client/refund-context-shapes.test.ts +0 -127
- package/src/client/refund-context.test.ts +0 -404
- package/src/client/refund-history.test.ts +0 -67
- package/src/client/reversalObservations.test.ts +0 -69
- package/src/client/settlement/allocation.test.ts +0 -98
- package/src/client/settlement/authorization.fixture.ts +0 -199
- package/src/client/settlement/authorization.test.ts +0 -160
- package/src/client/settlement/commissions.test.ts +0 -103
- package/src/client/settlement/execution.test.ts +0 -191
- package/src/client/settlement/policy-context.test.ts +0 -277
- package/src/client/settlement/processingCosts.test.ts +0 -349
- package/src/client/settlement/processingCostsTransport.test.ts +0 -135
- package/src/client/settlement/verifiedSale.test.ts +0 -139
- package/src/client/setup.test.ts +0 -47
- package/src/client/singleAttemptHttpClient.test.ts +0 -70
- package/src/client/strictStripeTransport.test.ts +0 -73
- package/src/client/stripe-version.test.ts +0 -53
- package/src/client/transferContinuation.test.ts +0 -90
- package/src/client/transferObservations.test.ts +0 -98
- package/src/client/usage/allowanceClient.test.ts +0 -93
- package/src/client/usage/allowanceTerms.test.ts +0 -131
- package/src/client/usage/boundaries.test.ts +0 -136
- package/src/client/usage/catalog.test.ts +0 -464
- package/src/client/usage/catalogMath.test.ts +0 -13
- package/src/client/usage/contracts.test.ts +0 -145
- package/src/client/usage/correctionClient.test.ts +0 -153
- package/src/client/usage/correctionCredits.test.ts +0 -156
- package/src/client/usage/correctionInvoice.test.ts +0 -127
- package/src/client/usage/correctionRecovery.test.ts +0 -113
- package/src/client/usage/correctionTransport.fixtures.ts +0 -372
- package/src/client/usage/creditBackingIsolation.test.ts +0 -110
- package/src/client/usage/creditCapacity.test.ts +0 -162
- package/src/client/usage/creditClient.test.ts +0 -221
- package/src/client/usage/creditInvoice.test.ts +0 -149
- package/src/client/usage/creditObservation.test.ts +0 -150
- package/src/client/usage/creditProofBounds.test.ts +0 -187
- package/src/client/usage/creditProvider.test.ts +0 -276
- package/src/client/usage/creditRevenue.test.ts +0 -105
- package/src/client/usage/creditSettlement.fixtures.ts +0 -70
- package/src/client/usage/creditSettlement.test.ts +0 -66
- package/src/client/usage/creditSettlementRecovery.test.ts +0 -173
- package/src/client/usage/creditTerms.test.ts +0 -48
- package/src/client/usage/creditTransport.fixtures.ts +0 -308
- package/src/client/usage/deliveryProvider.test.ts +0 -316
- package/src/client/usage/invoiceObservation.test.ts +0 -195
- package/src/client/usage/invoiceSale.fixtures.ts +0 -103
- package/src/client/usage/invoiceSale.test.ts +0 -252
- package/src/client/usage/ledger-client.test.ts +0 -74
- package/src/client/usage/mixedInvoice.fixtures.ts +0 -54
- package/src/client/usage/mixedInvoiceSale.test.ts +0 -92
- package/src/client/usage/mixedSettlement.test.ts +0 -187
- package/src/client/usage/providerObservation.test.ts +0 -207
- package/src/client/usage/reconciliation.test.ts +0 -117
- package/src/client/usage/record-composition.test.ts +0 -195
- package/src/client/usage/settlement.test.ts +0 -179
- package/src/client/usage/subscription.fixtures.ts +0 -84
- package/src/client/usage/subscriptionAbandonment.test.ts +0 -124
- package/src/client/usage/subscriptionCheckout.test.ts +0 -44
- package/src/client/usage/subscriptionClient.test.ts +0 -375
- package/src/client/usage/subscriptionProvider.test.ts +0 -48
- package/src/client/usage/subscriptionTerms.test.ts +0 -158
- package/src/client/usage/subscriptionTransport.fixtures.ts +0 -247
- package/src/client/usage/summary.test.ts +0 -222
- package/src/client/utils/data.test.ts +0 -61
- package/src/client/utils/owner.test.ts +0 -38
- package/src/client/utils/stripeDashboardUrl.test.ts +0 -71
- package/src/client/utils/webhookEndpoints.test.ts +0 -459
- package/src/client/webhook-handlers.test.ts +0 -569
- package/src/client/webhooks/handler.test.ts +0 -601
- package/src/client/webhooks/helpers.test.ts +0 -343
- package/src/client/webhooks/hooks.test.ts +0 -119
- package/src/client/webhooks/meterErrors.test.ts +0 -164
- package/src/client/webhooks/payout-canceled.integration.test.ts +0 -230
- package/src/client/webhooks/payout-reconciliation.integration.test.ts +0 -168
- package/src/client/webhooks/payoutReconciliationTestHelpers.ts +0 -135
- package/src/client/webhooks/processors.test.ts +0 -2553
- package/src/client/webhooks/refund-delivery.test.ts +0 -512
- package/src/client/webhooks/refund-reconciliation.test.ts +0 -320
- package/src/client/webhooks/retry.integration.test.ts +0 -196
- package/src/client/webhooks/subscription-deleted-dispatch.test.ts +0 -61
- package/src/client/webhooks/subscription-deleted.integration.test.ts +0 -313
- package/src/client/webhooks/usageSubscriptions.test.ts +0 -162
- package/src/client/webhooks/v2.test.ts +0 -432
- package/src/client/webhooks.test.ts +0 -1681
- package/src/component/accountClosure/blockers.test.ts +0 -114
- package/src/component/affiliatePayouts/affiliate-direct-payout.test.ts +0 -159
- package/src/component/affiliateRecovery/affiliate-component-pagination.test.ts +0 -56
- package/src/component/affiliateRecovery/affiliate-recovery-lifecycle.test.ts +0 -586
- package/src/component/balanceFunding/failure.test.ts +0 -116
- package/src/component/balanceFunding/import.test.ts +0 -221
- package/src/component/balanceFunding/lookup.test.ts +0 -113
- package/src/component/balanceFunding/preparation.test.ts +0 -146
- package/src/component/balanceFunding/requestLookup.test.ts +0 -160
- package/src/component/balanceFunding/scopeLookup.test.ts +0 -94
- package/src/component/balanceFunding/state.test.ts +0 -352
- package/src/component/balanceFunding/validation.test.ts +0 -100
- package/src/component/balanceFunding/workflow.fixtures.ts +0 -366
- package/src/component/balanceFunding/workflow.test.ts +0 -552
- package/src/component/billing/checkout.test.ts +0 -89
- package/src/component/billing/invoices.test.ts +0 -294
- package/src/component/billing/store-subscriptions.test.ts +0 -31
- package/src/component/billing/subscription-scoping.test.ts +0 -120
- package/src/component/billing/subscriptions.test.ts +0 -477
- package/src/component/billingHistory/guards.test.ts +0 -235
- package/src/component/billingHistory/options.test.ts +0 -35
- package/src/component/billingHistory/pages.test.ts +0 -74
- package/src/component/connect/connect.test.ts +0 -715
- package/src/component/connect/fee-routing.test.ts +0 -122
- package/src/component/connect/payment-unique.test.ts +0 -195
- package/src/component/connect/payments.test.ts +0 -88
- package/src/component/connect/payouts.test.ts +0 -173
- package/src/component/connect/reversal-races.test.ts +0 -958
- package/src/component/connect/seller-case-ownership.test.ts +0 -60
- package/src/component/connect/transfers.test.ts +0 -517
- package/src/component/core/accounts.test.ts +0 -266
- package/src/component/core/config-queries.test.ts +0 -49
- package/src/component/core/original-id-unique.test.ts +0 -209
- package/src/component/core/payout-reset-safety.test.ts +0 -175
- package/src/component/core/personal-account-mapping.test.ts +0 -173
- package/src/component/core/reset.test.ts +0 -131
- package/src/component/costRecovery/cost-recovery.test.ts +0 -343
- package/src/component/costRecovery/preparation.test.ts +0 -355
- package/src/component/durableExecution/composition.test.ts +0 -568
- package/src/component/durableExecution/crossDomain.test.ts +0 -241
- package/src/component/durableExecution/crossDomainBoundaries.test.ts +0 -233
- package/src/component/durableExecution/crossDomainDisputes.test.ts +0 -108
- package/src/component/durableExecution/crossDomainMigration.test.ts +0 -192
- package/src/component/durableExecution/crossDomainWebhooks.test.ts +0 -122
- package/src/component/earnings/currency-migration.test.ts +0 -118
- package/src/component/earnings/currency-totals.test.ts +0 -94
- package/src/component/earnings/earnings-totals.test.ts +0 -237
- package/src/component/earnings/paired-adjustment.test.ts +0 -258
- package/src/component/earnings/summary-arithmetic.test.ts +0 -250
- package/src/component/financialObservations/continuation.test.ts +0 -445
- package/src/component/financialObservations/observation-boundaries.test.ts +0 -466
- package/src/component/financialObservations/settlement-observations.test.ts +0 -86
- package/src/component/financialObservations/transfer-batches.test.ts +0 -61
- package/src/component/financialObservations/transfer-boundaries.test.ts +0 -116
- package/src/component/financialObservations/transfer-continuation-guards.test.ts +0 -428
- package/src/component/financialObservations/transfer-continuation.test.ts +0 -154
- package/src/component/financialObservations/transfer-observations.test.ts +0 -212
- package/src/component/financialObservations/transfer-overflow.test.ts +0 -181
- package/src/component/financialObservations/transfer-writers.test.ts +0 -162
- package/src/component/financialOwnership/financial-ownership.test.ts +0 -102
- package/src/component/financialOwnership/ownership-boundaries.test.ts +0 -308
- package/src/component/lib/idempotency.test.ts +0 -37
- package/src/component/operationEvidence/integrity.test.ts +0 -257
- package/src/component/operationEvidence/maintenance.test.ts +0 -152
- package/src/component/operationEvidence/reads.test.ts +0 -140
- package/src/component/payoutPolicy/payout-policy-adoption.test.ts +0 -130
- package/src/component/payoutPolicy/payout-policy.test.ts +0 -247
- package/src/component/payoutRelease/payout-adoption.test.ts +0 -268
- package/src/component/payoutRelease/payout-fees.test.ts +0 -223
- package/src/component/payoutRelease/payout-recovery-integration.test.ts +0 -171
- package/src/component/payoutRelease/payout-release-snapshot.test.ts +0 -56
- package/src/component/payoutRelease/payout-release.test.ts +0 -587
- package/src/component/payoutRelease/progress.test.ts +0 -63
- package/src/component/payoutSnapshots/legacy-revisions.test.ts +0 -246
- package/src/component/payoutSnapshots/payout-revisions.test.ts +0 -124
- package/src/component/payoutSnapshots/payout-snapshots.test.ts +0 -438
- package/src/component/payoutSnapshots/revision-journal-callbacks.test.ts +0 -160
- package/src/component/payoutSnapshots/revision-journal-held.test.ts +0 -94
- package/src/component/payoutSnapshots/revision-journal.test.ts +0 -310
- package/src/component/payoutSnapshots/revision-migration.test.ts +0 -128
- package/src/component/payoutSync/payout-sync.test.ts +0 -116
- package/src/component/payoutWorker/payout-component-pagination.test.ts +0 -211
- package/src/component/payoutWorker/payout-worker.test.ts +0 -164
- package/src/component/processingCostReconciliation/adoption.test.ts +0 -206
- package/src/component/processingCostReconciliation/invoice.test.ts +0 -152
- package/src/component/processingCostReconciliation/state.test.ts +0 -407
- package/src/component/processingCostReconciliation/workflow.test.ts +0 -329
- package/src/component/products/identity.test.ts +0 -217
- package/src/component/products/products.test.ts +0 -239
- package/src/component/products/provider-price-pagination.test.ts +0 -174
- package/src/component/products/read-pagination.test.ts +0 -192
- package/src/component/recoveryWorkflow/bridge.test.ts +0 -481
- package/src/component/recoveryWorkflow/journal.test.ts +0 -104
- package/src/component/recoveryWorkflow/state.test.ts +0 -191
- package/src/component/refundHistory/command-evidence.test.ts +0 -288
- package/src/component/refundHistory/command-normalization-resource.test.ts +0 -77
- package/src/component/refundHistory/command-normalization.test.ts +0 -229
- package/src/component/refundHistory/command-provenance.test.ts +0 -59
- package/src/component/refundHistory/original-seller-boundaries.test.ts +0 -138
- package/src/component/refundHistory/original-seller.test.ts +0 -175
- package/src/component/refundHistory/refund-history.test.ts +0 -197
- package/src/component/refundSync/refund-sync.test.ts +0 -255
- package/src/component/renewalOperations/acknowledgement.fixtures.ts +0 -552
- package/src/component/renewalOperations/acknowledgement.test.ts +0 -573
- package/src/component/renewalOperations/acknowledgementReads.test.ts +0 -442
- package/src/component/renewalOperations/acknowledgementV2.test.ts +0 -493
- package/src/component/renewalOperations/acknowledgementV2Publication.test.ts +0 -373
- package/src/component/renewalOperations/basisBinding.test.ts +0 -567
- package/src/component/renewalOperations/basisLifecycle.test.ts +0 -569
- package/src/component/renewalOperations/boundHistory.test.ts +0 -474
- package/src/component/renewalOperations/configureAcknowledgement.test.ts +0 -30
- package/src/component/renewalOperations/configureAcknowledgementControls.test.ts +0 -96
- package/src/component/renewalOperations/configureBasis.test.ts +0 -77
- package/src/component/renewalOperations/configureCreation.test.ts +0 -75
- package/src/component/renewalOperations/configureJournal.fixtures.ts +0 -407
- package/src/component/renewalOperations/configurePolicy.test.ts +0 -105
- package/src/component/renewalOperations/configurePublication.test.ts +0 -85
- package/src/component/renewalOperations/configureReceiptBounds.test.ts +0 -39
- package/src/component/renewalOperations/configureSourceControls.test.ts +0 -65
- package/src/component/renewalOperations/historyReads.test.ts +0 -595
- package/src/component/renewalOperations/initialBasis.test.ts +0 -578
- package/src/component/renewalOperations/journal.test.ts +0 -567
- package/src/component/renewalOperations/payload.test.ts +0 -589
- package/src/component/renewalOperations/payloadEncoding.test.ts +0 -592
- package/src/component/renewalOperations/timingPolicy.fixtures.ts +0 -193
- package/src/component/renewalOperations/timingPolicy.test.ts +0 -523
- package/src/component/renewalWitnesses/bounds.test.ts +0 -204
- package/src/component/renewalWitnesses/codec.test.ts +0 -84
- package/src/component/renewalWitnesses/controls.test.ts +0 -250
- package/src/component/renewalWitnesses/protocol.test.ts +0 -63
- package/src/component/renewalWitnesses/routes.test.ts +0 -154
- package/src/component/reversalObservations/boundaries.test.ts +0 -62
- package/src/component/reversalObservations/capture-integrity.test.ts +0 -119
- package/src/component/reversalObservations/continuation.test.ts +0 -131
- package/src/component/reversalObservations/lifecycle.test.ts +0 -81
- package/src/component/reversalObservations/provenance.test.ts +0 -167
- package/src/component/settlement/affiliate-clawbacks.test.ts +0 -369
- package/src/component/settlement/settlement-claims.test.ts +0 -130
- package/src/component/usage/allowance.fixtures.ts +0 -77
- package/src/component/usage/allowance.test.ts +0 -372
- package/src/component/usage/allowanceBounds.test.ts +0 -79
- package/src/component/usage/historyIsolation.test.ts +0 -124
- package/src/component/usage/ledger.test.ts +0 -303
- package/src/component/usageCorrections/corrections.test.ts +0 -389
- package/src/component/usageCredits/accounting.fixtures.ts +0 -96
- package/src/component/usageCredits/accounting.test.ts +0 -483
- package/src/component/usageCredits/freshness.test.ts +0 -33
- package/src/component/usageCredits/quotas.test.ts +0 -63
- package/src/component/usageDelivery/concurrency.test.ts +0 -62
- package/src/component/usageDelivery/workflow.test.ts +0 -402
- package/src/component/usageObservations/history.test.ts +0 -87
- package/src/component/usageObservations/queries.test.ts +0 -162
- package/src/component/usageSubscriptions/acceptance.test.ts +0 -122
- package/src/component/usageSubscriptions/history.test.ts +0 -126
- package/src/component/usageSubscriptions/mutations.test.ts +0 -205
- package/src/component/webhooks/events.test.ts +0 -121
- package/src/component/webhooks/triggers.test.ts +0 -360
- package/src/react/components/AccountOnboardingCard.test.ts +0 -27
- package/src/react/components/BuyerBillingView.render.test.tsx +0 -212
- package/src/react/components/ConnectProvider.live.test.tsx +0 -61
- package/src/react/components/DisputeDetail.render.test.tsx +0 -147
- package/src/react/components/DisputesList.render.test.tsx +0 -265
- package/src/react/components/EarningsSummary.render.test.tsx +0 -149
- package/src/react/components/EmbeddedCheckout.render.test.tsx +0 -57
- package/src/react/components/EmbeddedCheckout.test.ts +0 -25
- package/src/react/components/EmbeddedDisputes.render.test.tsx +0 -144
- package/src/react/components/EvidenceForm.render.test.tsx +0 -208
- package/src/react/components/PayoutSchedule.render.test.tsx +0 -193
- package/src/react/components/PriceBadge.render.test.tsx +0 -134
- package/src/react/components/PriceCard.render.test.tsx +0 -172
- package/src/react/components/SplitBreakdown.render.test.tsx +0 -191
- package/src/react/components/StripeProvider.test.ts +0 -45
- package/src/react/components/TrialAlert.render.test.tsx +0 -132
- package/src/react/hooks/skipSentinel.test.ts +0 -85
- package/src/react/hooks/useAccountOnboarding.test.ts +0 -75
- package/src/react/hooks/useCheckoutSession.promotions.test.tsx +0 -303
- package/src/react/hooks/useConfirmPayment.test.tsx +0 -47
- package/src/react/hooks/useCurrencyEarnings.test.ts +0 -59
- package/src/react/hooks/useDisputeWithCountdown.test.ts +0 -90
- package/src/react/hooks/useDisputes.test.ts +0 -75
- package/src/react/hooks/useEarnings.test.ts +0 -194
- package/src/react/hooks/useInvoices.test.ts +0 -79
- package/src/react/hooks/useProducts.test.ts +0 -75
- package/src/react/hooks/useSplitBreakdown.test.ts +0 -151
- package/src/react/hooks/useStripeMode.test.ts +0 -46
- package/src/react/hooks/useStripePublishableKey.test.ts +0 -35
- package/src/react/index.payment-element.test.ts +0 -26
- package/src/react/index.test.ts +0 -172
- package/src/react/lib/connect-requirement-keys.test.ts +0 -73
- package/src/react/lib/price-helpers.test.ts +0 -212
- package/src/react/lib/stripe-element-styles.test.ts +0 -94
- package/src/react/lib/subscription-helpers.test.ts +0 -127
- package/src/react/read-contracts.render.test.tsx +0 -20
- package/src/react/workflows/Account.test.tsx +0 -31
- package/src/react/workflows/AffiliatePayoutEditor.test.tsx +0 -90
- package/src/react/workflows/AffiliateRateEditor.test.tsx +0 -36
- package/src/react/workflows/AffiliateRecovery.test.tsx +0 -106
- package/src/react/workflows/Billing.test.tsx +0 -45
- package/src/react/workflows/BillingPlans.test.tsx +0 -31
- package/src/react/workflows/BillingPortal.test.tsx +0 -101
- package/src/react/workflows/Checkout.test.tsx +0 -148
- package/src/react/workflows/CheckoutChooser.test.tsx +0 -44
- package/src/react/workflows/CheckoutForm.test.tsx +0 -66
- package/src/react/workflows/CheckoutForms.test.tsx +0 -163
- package/src/react/workflows/ClipboardButton.test.tsx +0 -34
- package/src/react/workflows/Collections.test.tsx +0 -122
- package/src/react/workflows/Connect.test.tsx +0 -50
- package/src/react/workflows/Costs.test.tsx +0 -62
- package/src/react/workflows/Disputes.test.tsx +0 -64
- package/src/react/workflows/Earnings.test.ts +0 -19
- package/src/react/workflows/EvidenceUpload.test.tsx +0 -56
- package/src/react/workflows/Financials.test.tsx +0 -35
- package/src/react/workflows/IntegrationSwitch.test.tsx +0 -61
- package/src/react/workflows/Onboarding.test.tsx +0 -148
- package/src/react/workflows/Overview.test.tsx +0 -57
- package/src/react/workflows/Pagination.test.tsx +0 -53
- package/src/react/workflows/PaymentMethods.test.tsx +0 -60
- package/src/react/workflows/PaymentReceipt.test.tsx +0 -24
- package/src/react/workflows/PayoutProgress.test.tsx +0 -356
- package/src/react/workflows/PayoutSettings.test.tsx +0 -139
- package/src/react/workflows/Payouts.test.tsx +0 -145
- package/src/react/workflows/PlanPricingEditor.currency.test.tsx +0 -164
- package/src/react/workflows/PlanPricingEditor.test.tsx +0 -79
- package/src/react/workflows/PlanPricingEditor.zero.test.tsx +0 -100
- package/src/react/workflows/Products.test.tsx +0 -282
- package/src/react/workflows/ReferralLinks.test.tsx +0 -39
- package/src/react/workflows/Refunds.currency.test.tsx +0 -290
- package/src/react/workflows/Refunds.test.tsx +0 -75
- package/src/react/workflows/SaveCard.test.tsx +0 -127
- package/src/react/workflows/Setup.test.tsx +0 -25
- package/src/react/workflows/Storefront.test.tsx +0 -82
- package/src/react/workflows/SubscriptionOverview.test.tsx +0 -27
- package/src/react/workflows/Subscriptions.test.tsx +0 -61
- package/src/react/workflows/Tasks.test.tsx +0 -23
- package/src/react/workflows/Usage.fixtures.ts +0 -88
- package/src/react/workflows/Usage.test.tsx +0 -388
- package/src/react/workflows/UsageConfiguration.test.tsx +0 -393
- package/src/react/workflows/UsageHistory.test.tsx +0 -206
- package/src/react/workflows/UsagePriceRow.test.tsx +0 -140
- package/src/react/workflows/current-subscription.test.ts +0 -29
- package/src/react/workflows/filters.test.ts +0 -12
- package/src/react/workflows/native-interactions.test.tsx +0 -73
- package/src/react/workflows/public-workflows.test.tsx +0 -216
- package/src/react/workflows/refund-preview.test.ts +0 -65
- package/src/react/workflows/usage-configuration-validation.test.ts +0 -107
- package/src/react/workflows/useWorkflowAction.commit.test.tsx +0 -194
- package/src/react/workflows/useWorkflowAction.ssr.test.tsx +0 -20
- package/src/react/workflows/useWorkflowAction.test.tsx +0 -54
- package/src/react/workflows/useWorkflowResource.test.tsx +0 -41
- package/src/test.ts +0 -21
- package/src/testing/assert-test-env.test.ts +0 -33
- package/src/testing/component-db.ts +0 -24
- package/src/testing/crossDomain/fixture.ts +0 -96
- package/src/testing/crossDomain/host.ts +0 -288
- package/src/testing/crossDomain/transport.ts +0 -293
- package/src/testing/mock-webhooks.test.ts +0 -97
|
@@ -1,1385 +0,0 @@
|
|
|
1
|
-
// @vitest-environment edge-runtime
|
|
2
|
-
/**
|
|
3
|
-
* Tests for the core Account methods. These functions span three boundaries:
|
|
4
|
-
* the Stripe V2 Accounts SDK (`stripe.v2.core.accounts.*` plus `accountLinks`),
|
|
5
|
-
* the component query/mutation layer (resolved via `componentRef`), and the
|
|
6
|
-
* `deriveAccountStatus` helper. The headline targets are the multi-step
|
|
7
|
-
* orchestrators — `createAccount`, `createAccountWithOnboarding` (with its
|
|
8
|
-
* rollback path), `getOrCreateAccount`, `closeAccount` (DB-vs-Stripe fallback),
|
|
9
|
-
* `listStripeAccounts`, and `syncAllAccounts` (SDK auto-pagination via
|
|
10
|
-
* `for await` + per-record error accumulation). We assert the exact params handed to each boundary, the
|
|
11
|
-
* shapes returned, every branch, and the error/rollback paths.
|
|
12
|
-
*
|
|
13
|
-
* Most of the suite mocks `ctx`/the component entirely (fast, boundary-focused
|
|
14
|
-
* unit tests). The `addRecipientConfiguration` idempotency test (BTS-78) is
|
|
15
|
-
* the exception: it runs against a REAL `convex-test` store — see the
|
|
16
|
-
* "addRecipientConfiguration (real convex-test store)" describe block below —
|
|
17
|
-
* because a genuine double-write/overwrite conflict needs a real row to
|
|
18
|
-
* conflict against; a fully-mocked `runMutation` can never fail that way.
|
|
19
|
-
*/
|
|
20
|
-
import { describe, expect, it, vi } from "vitest";
|
|
21
|
-
|
|
22
|
-
import type { Component, RunCtx } from "../helpers.js";
|
|
23
|
-
import { components, initConvexTest } from "../setup.test.js";
|
|
24
|
-
import schema from "../../component/schema.js";
|
|
25
|
-
import {
|
|
26
|
-
DEFAULT_ACCOUNT_CONFIGURATION,
|
|
27
|
-
DEFAULT_ACCOUNT_DEFAULTS,
|
|
28
|
-
DEFAULT_CUSTOMER_CONFIGURATION,
|
|
29
|
-
addCustomerConfiguration,
|
|
30
|
-
addRecipientConfiguration,
|
|
31
|
-
ensureCustomerAccount,
|
|
32
|
-
createAccount,
|
|
33
|
-
createAccountWithOnboarding,
|
|
34
|
-
getAccount,
|
|
35
|
-
getAccountByOrgId,
|
|
36
|
-
getAccountByStripeId,
|
|
37
|
-
getAccountByUserId,
|
|
38
|
-
getAccountOnboardingStatus,
|
|
39
|
-
getOrCreateAccount,
|
|
40
|
-
getV2Account,
|
|
41
|
-
listStripeAccounts,
|
|
42
|
-
setAccountStatementDescriptor,
|
|
43
|
-
syncAllAccounts,
|
|
44
|
-
updateAccount,
|
|
45
|
-
updateV2Account,
|
|
46
|
-
upsertAccount,
|
|
47
|
-
} from "./accounts.js";
|
|
48
|
-
|
|
49
|
-
const TO_REF = Symbol.for("toReferencePath");
|
|
50
|
-
|
|
51
|
-
/** A fake component whose nested refs carry the Symbol the resolver looks up. */
|
|
52
|
-
function makeComponent(): Component {
|
|
53
|
-
const ref = (path: string) => ({ [TO_REF]: `betterStripe/${path}` });
|
|
54
|
-
return {
|
|
55
|
-
core: {
|
|
56
|
-
queries: {
|
|
57
|
-
getAccount: ref("core/queries/getAccount"),
|
|
58
|
-
getAccountByStripeId: ref("core/queries/getAccountByStripeId"),
|
|
59
|
-
getAccountByUserId: ref("core/queries/getAccountByUserId"),
|
|
60
|
-
getAccountByOrgId: ref("core/queries/getAccountByOrgId"),
|
|
61
|
-
getAccountOnboardingStatus: ref(
|
|
62
|
-
"core/queries/getAccountOnboardingStatus",
|
|
63
|
-
),
|
|
64
|
-
},
|
|
65
|
-
mutations: {
|
|
66
|
-
upsertAccount: ref("core/mutations/upsertAccount"),
|
|
67
|
-
deleteAccountByStripeId: ref("core/mutations/deleteAccountByStripeId"),
|
|
68
|
-
setStatementDescriptor: ref("core/mutations/setStatementDescriptor"),
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
} as unknown as Component;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** The reference object the resolver returns for a given path. */
|
|
75
|
-
function refFor(path: string) {
|
|
76
|
-
return { [TO_REF]: `betterStripe/${path}` };
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** Build a mock Stripe instance exposing only the slice these helpers touch. */
|
|
80
|
-
function makeStripe() {
|
|
81
|
-
return {
|
|
82
|
-
v2: {
|
|
83
|
-
core: {
|
|
84
|
-
accounts: {
|
|
85
|
-
create: vi.fn(),
|
|
86
|
-
update: vi.fn(),
|
|
87
|
-
retrieve: vi.fn(),
|
|
88
|
-
list: vi.fn(),
|
|
89
|
-
close: vi.fn(),
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
accountLinks: { create: vi.fn() },
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
type MockStripe = ReturnType<typeof makeStripe>;
|
|
98
|
-
const asStripe = (s: MockStripe) =>
|
|
99
|
-
s as unknown as Parameters<typeof createAccount>[0];
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Real V2 list responses (`stripe.v2.core.accounts.list(...)`) are an
|
|
103
|
-
* `AsyncIterableIterator` that follows `next_page_url` internally — they do
|
|
104
|
-
* NOT resolve to a plain `{ data, has_more }` object a caller can inspect.
|
|
105
|
-
* This mirrors that shape so `for await` consumes it the same way it would
|
|
106
|
-
* consume the real SDK response.
|
|
107
|
-
*/
|
|
108
|
-
function asyncIterable<T>(items: T[]) {
|
|
109
|
-
return {
|
|
110
|
-
async *[Symbol.asyncIterator]() {
|
|
111
|
-
for (const item of items) yield item;
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// =============================================================================
|
|
117
|
-
// Real convex-test store helpers (BTS-78) — used only by the
|
|
118
|
-
// "addRecipientConfiguration (real convex-test store)" suite below. Registers
|
|
119
|
-
// the component as an actual CHILD COMPONENT named "betterStripe" (mirroring
|
|
120
|
-
// how an installing app wires it up in production, via
|
|
121
|
-
// `app.use(betterStripe, ...)`), so `components.betterStripe.*` — the same
|
|
122
|
-
// typed proxy `setup.test.ts` exports — resolves to REAL function references
|
|
123
|
-
// that `t.query`/`t.mutation` execute against a genuine in-memory backend,
|
|
124
|
-
// rather than a `vi.fn()`. (A flat `convexTest(componentSchema, componentModules)`
|
|
125
|
-
// with the component's own generated `api` doesn't work here: `componentRef`
|
|
126
|
-
// resolves via the childComponent `toReferencePath` symbol that only
|
|
127
|
-
// `componentsGeneric()`-based refs like `components.betterStripe.*` carry.)
|
|
128
|
-
// =============================================================================
|
|
129
|
-
const componentModules = import.meta.glob(
|
|
130
|
-
"../../component/**/*.{ts,js,tsx,jsx}",
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
/** A real convex-test instance with the component registered as child "betterStripe". */
|
|
134
|
-
function makeRealConvexTest() {
|
|
135
|
-
const t = initConvexTest();
|
|
136
|
-
t.registerComponent("betterStripe", schema, componentModules);
|
|
137
|
-
return t;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** A `RunCtx` backed by a real convex-test instance. */
|
|
141
|
-
function makeRealCtx(t: ReturnType<typeof makeRealConvexTest>): RunCtx {
|
|
142
|
-
return {
|
|
143
|
-
runQuery: (ref: any, args: any) => t.query(ref, args),
|
|
144
|
-
runMutation: (ref: any, args: any) => t.mutation(ref, args),
|
|
145
|
-
} as unknown as RunCtx;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const realComponent = components.betterStripe as unknown as Component;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* `runInComponent` (read/write the mock backend scoped to a registered child
|
|
152
|
-
* component) isn't part of convex-test's public `.d.ts` surface, only its
|
|
153
|
-
* runtime API — narrow the cast to just this one method instead of reaching
|
|
154
|
-
* for `any` on the whole test handle.
|
|
155
|
-
*/
|
|
156
|
-
type RunInComponent = (
|
|
157
|
-
componentPath: string,
|
|
158
|
-
handler: (ctx: {
|
|
159
|
-
db: {
|
|
160
|
-
query: (table: "accounts") => {
|
|
161
|
-
collect: () => Promise<
|
|
162
|
-
Array<{ stripeAccountId: string; userId: string }>
|
|
163
|
-
>;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
}) => Promise<Array<{ stripeAccountId: string; userId: string }>>,
|
|
167
|
-
) => Promise<Array<{ stripeAccountId: string; userId: string }>>;
|
|
168
|
-
|
|
169
|
-
describe("createAccount", () => {
|
|
170
|
-
it("creates the V2 account, upserts it, and returns the stored internal id", async () => {
|
|
171
|
-
const stripe = makeStripe();
|
|
172
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_1" });
|
|
173
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
174
|
-
const runQuery = vi.fn().mockResolvedValue({ _id: "internal_1" });
|
|
175
|
-
const ctx = { runMutation, runQuery } as unknown as RunCtx;
|
|
176
|
-
|
|
177
|
-
const result = await createAccount(asStripe(stripe), makeComponent(), ctx, {
|
|
178
|
-
userId: "user_1",
|
|
179
|
-
email: "a@b.com",
|
|
180
|
-
name: "Acme",
|
|
181
|
-
country: "US",
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
expect(result).toEqual({
|
|
185
|
-
accountId: "internal_1",
|
|
186
|
-
stripeAccountId: "acct_1",
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
// Stripe create params: contact_email + metadata (userId injected), identity from country
|
|
190
|
-
expect(stripe.v2.core.accounts.create).toHaveBeenCalledWith({
|
|
191
|
-
contact_email: "a@b.com",
|
|
192
|
-
metadata: { userId: "user_1" },
|
|
193
|
-
identity: { country: "US" },
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
// Upsert mutation carries the derived metadata and pending defaults
|
|
197
|
-
expect(runMutation).toHaveBeenCalledWith(
|
|
198
|
-
refFor("core/mutations/upsertAccount"),
|
|
199
|
-
{
|
|
200
|
-
stripeAccountId: "acct_1",
|
|
201
|
-
userId: "user_1",
|
|
202
|
-
orgId: undefined,
|
|
203
|
-
email: "a@b.com",
|
|
204
|
-
name: "Acme",
|
|
205
|
-
country: "US",
|
|
206
|
-
appliedConfigurations: [],
|
|
207
|
-
onboardingStatus: "pending",
|
|
208
|
-
metadata: { userId: "user_1" },
|
|
209
|
-
},
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
// Read-back query keyed by the new Stripe id
|
|
213
|
-
expect(runQuery).toHaveBeenCalledWith(
|
|
214
|
-
refFor("core/queries/getAccountByStripeId"),
|
|
215
|
-
{ stripeAccountId: "acct_1" },
|
|
216
|
-
);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it("merges orgId and caller metadata, and omits identity when no country", async () => {
|
|
220
|
-
const stripe = makeStripe();
|
|
221
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_2" });
|
|
222
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
223
|
-
const runQuery = vi.fn().mockResolvedValue({ _id: "internal_2" });
|
|
224
|
-
const ctx = { runMutation, runQuery } as unknown as RunCtx;
|
|
225
|
-
|
|
226
|
-
await createAccount(asStripe(stripe), makeComponent(), ctx, {
|
|
227
|
-
userId: "user_2",
|
|
228
|
-
orgId: "org_2",
|
|
229
|
-
metadata: { plan: "pro" },
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
const createArg = stripe.v2.core.accounts.create.mock.calls[0][0];
|
|
233
|
-
expect(createArg).toEqual({
|
|
234
|
-
contact_email: undefined,
|
|
235
|
-
metadata: { plan: "pro", userId: "user_2", orgId: "org_2" },
|
|
236
|
-
});
|
|
237
|
-
// no country → no identity key at all
|
|
238
|
-
expect("identity" in createArg).toBe(false);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it("returns null accountId when the stored row cannot be read back", async () => {
|
|
242
|
-
const stripe = makeStripe();
|
|
243
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_3" });
|
|
244
|
-
const ctx = {
|
|
245
|
-
runMutation: vi.fn().mockResolvedValue(undefined),
|
|
246
|
-
runQuery: vi.fn().mockResolvedValue(null),
|
|
247
|
-
} as unknown as RunCtx;
|
|
248
|
-
|
|
249
|
-
const result = await createAccount(asStripe(stripe), makeComponent(), ctx, {
|
|
250
|
-
userId: "user_3",
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
expect(result).toEqual({ accountId: null, stripeAccountId: "acct_3" });
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
it("throws when ctx has no runMutation", async () => {
|
|
257
|
-
const stripe = makeStripe();
|
|
258
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_4" });
|
|
259
|
-
const ctx = { runQuery: vi.fn() } as unknown as RunCtx;
|
|
260
|
-
|
|
261
|
-
await expect(
|
|
262
|
-
createAccount(asStripe(stripe), makeComponent(), ctx, { userId: "u" }),
|
|
263
|
-
).rejects.toThrow(/requires a Convex ctx with runMutation/);
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
describe("createAccountWithOnboarding", () => {
|
|
268
|
-
function happyCtx() {
|
|
269
|
-
return {
|
|
270
|
-
runMutation: vi.fn().mockResolvedValue(undefined),
|
|
271
|
-
runQuery: vi.fn().mockResolvedValue({ _id: "internal_x" }),
|
|
272
|
-
} as unknown as RunCtx & { runMutation: ReturnType<typeof vi.fn> };
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
it("applies default configuration, re-fetches applied configs, and returns the onboarding url", async () => {
|
|
276
|
-
const stripe = makeStripe();
|
|
277
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_ob" });
|
|
278
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
279
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
280
|
-
applied_configurations: ["merchant"],
|
|
281
|
-
});
|
|
282
|
-
stripe.accountLinks.create.mockResolvedValue({ url: "https://onboard" });
|
|
283
|
-
const ctx = happyCtx();
|
|
284
|
-
|
|
285
|
-
const result = await createAccountWithOnboarding(
|
|
286
|
-
asStripe(stripe),
|
|
287
|
-
makeComponent(),
|
|
288
|
-
ctx,
|
|
289
|
-
{
|
|
290
|
-
userId: "user_ob",
|
|
291
|
-
country: "US",
|
|
292
|
-
refreshUrl: "https://refresh",
|
|
293
|
-
returnUrl: "https://return",
|
|
294
|
-
},
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
expect(result).toEqual({
|
|
298
|
-
stripeAccountId: "acct_ob",
|
|
299
|
-
onboardingUrl: "https://onboard",
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
// defaults applied + dashboard defaults to "express"
|
|
303
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledWith("acct_ob", {
|
|
304
|
-
configuration: DEFAULT_ACCOUNT_CONFIGURATION,
|
|
305
|
-
dashboard: "express",
|
|
306
|
-
defaults: DEFAULT_ACCOUNT_DEFAULTS,
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
// second upsert records the applied configs + in_progress status
|
|
310
|
-
const secondUpsert = (
|
|
311
|
-
ctx.runMutation as ReturnType<typeof vi.fn>
|
|
312
|
-
).mock.calls.find(
|
|
313
|
-
(c) =>
|
|
314
|
-
c[1].onboardingStatus === "in_progress" &&
|
|
315
|
-
c[1].stripeAccountId === "acct_ob",
|
|
316
|
-
);
|
|
317
|
-
expect(secondUpsert?.[1]).toEqual({
|
|
318
|
-
stripeAccountId: "acct_ob",
|
|
319
|
-
userId: "user_ob",
|
|
320
|
-
appliedConfigurations: ["merchant"],
|
|
321
|
-
onboardingStatus: "in_progress",
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
// account link built with the right type + urls
|
|
325
|
-
expect(stripe.accountLinks.create).toHaveBeenCalledWith({
|
|
326
|
-
account: "acct_ob",
|
|
327
|
-
refresh_url: "https://refresh",
|
|
328
|
-
return_url: "https://return",
|
|
329
|
-
type: "account_onboarding",
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
it("honours caller-provided configuration, defaults, and dashboard", async () => {
|
|
334
|
-
const stripe = makeStripe();
|
|
335
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_cfg" });
|
|
336
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
337
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({});
|
|
338
|
-
stripe.accountLinks.create.mockResolvedValue({ url: "https://onboard" });
|
|
339
|
-
const ctx = happyCtx();
|
|
340
|
-
|
|
341
|
-
await createAccountWithOnboarding(asStripe(stripe), makeComponent(), ctx, {
|
|
342
|
-
userId: "user_cfg",
|
|
343
|
-
country: "GB",
|
|
344
|
-
refreshUrl: "https://refresh",
|
|
345
|
-
returnUrl: "https://return",
|
|
346
|
-
accountConfiguration: { recipient: {} },
|
|
347
|
-
accountDefaults: { locales: ["en"] },
|
|
348
|
-
dashboard: "none",
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledWith("acct_cfg", {
|
|
352
|
-
configuration: { recipient: {} },
|
|
353
|
-
dashboard: "none",
|
|
354
|
-
defaults: { locales: ["en"] },
|
|
355
|
-
});
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
it("defaults applied_configurations to [] when Stripe omits them", async () => {
|
|
359
|
-
const stripe = makeStripe();
|
|
360
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_empty" });
|
|
361
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
362
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({}); // no applied_configurations
|
|
363
|
-
stripe.accountLinks.create.mockResolvedValue({ url: "https://onboard" });
|
|
364
|
-
const ctx = happyCtx();
|
|
365
|
-
|
|
366
|
-
await createAccountWithOnboarding(asStripe(stripe), makeComponent(), ctx, {
|
|
367
|
-
userId: "user_empty",
|
|
368
|
-
country: "US",
|
|
369
|
-
refreshUrl: "https://refresh",
|
|
370
|
-
returnUrl: "https://return",
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
const inProgress = (
|
|
374
|
-
ctx.runMutation as ReturnType<typeof vi.fn>
|
|
375
|
-
).mock.calls.find((c) => c[1].onboardingStatus === "in_progress");
|
|
376
|
-
expect(inProgress?.[1].appliedConfigurations).toEqual([]);
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
it("rolls back the Convex account and throws ACCOUNT_CREATE_FAILED when config update fails", async () => {
|
|
380
|
-
const stripe = makeStripe();
|
|
381
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_fail" });
|
|
382
|
-
stripe.v2.core.accounts.update.mockRejectedValue(new Error("config boom"));
|
|
383
|
-
const ctx = happyCtx();
|
|
384
|
-
|
|
385
|
-
await expect(
|
|
386
|
-
createAccountWithOnboarding(asStripe(stripe), makeComponent(), ctx, {
|
|
387
|
-
userId: "user_fail",
|
|
388
|
-
country: "US",
|
|
389
|
-
refreshUrl: "https://refresh",
|
|
390
|
-
returnUrl: "https://return",
|
|
391
|
-
}),
|
|
392
|
-
).rejects.toMatchObject({ data: { code: "ACCOUNT_CREATE_FAILED" } });
|
|
393
|
-
|
|
394
|
-
// rollback deletes the half-created account
|
|
395
|
-
expect(ctx.runMutation).toHaveBeenCalledWith(
|
|
396
|
-
refFor("core/mutations/deleteAccountByStripeId"),
|
|
397
|
-
{ stripeAccountId: "acct_fail" },
|
|
398
|
-
);
|
|
399
|
-
// never reached the account-link creation
|
|
400
|
-
expect(stripe.accountLinks.create).not.toHaveBeenCalled();
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
it("still throws ACCOUNT_CREATE_FAILED even if the rollback delete also fails", async () => {
|
|
404
|
-
const stripe = makeStripe();
|
|
405
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_fail2" });
|
|
406
|
-
stripe.v2.core.accounts.update.mockRejectedValue(new Error("config boom"));
|
|
407
|
-
const runMutation = vi
|
|
408
|
-
.fn()
|
|
409
|
-
.mockResolvedValueOnce(undefined) // initial upsert in createAccount
|
|
410
|
-
.mockRejectedValueOnce(new Error("delete boom")); // rollback delete fails
|
|
411
|
-
const ctx = {
|
|
412
|
-
runMutation,
|
|
413
|
-
runQuery: vi.fn().mockResolvedValue({ _id: "internal_x" }),
|
|
414
|
-
} as unknown as RunCtx;
|
|
415
|
-
|
|
416
|
-
await expect(
|
|
417
|
-
createAccountWithOnboarding(asStripe(stripe), makeComponent(), ctx, {
|
|
418
|
-
userId: "user_fail2",
|
|
419
|
-
country: "US",
|
|
420
|
-
refreshUrl: "https://refresh",
|
|
421
|
-
returnUrl: "https://return",
|
|
422
|
-
}),
|
|
423
|
-
).rejects.toMatchObject({ data: { code: "ACCOUNT_CREATE_FAILED" } });
|
|
424
|
-
});
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
describe("getOrCreateAccount", () => {
|
|
428
|
-
it("returns an existing account looked up by orgId without creating", async () => {
|
|
429
|
-
const stripe = makeStripe();
|
|
430
|
-
const runQuery = vi.fn().mockResolvedValue({
|
|
431
|
-
_id: "internal_e",
|
|
432
|
-
stripeAccountId: "acct_existing",
|
|
433
|
-
});
|
|
434
|
-
const ctx = { runQuery, runMutation: vi.fn() } as unknown as RunCtx;
|
|
435
|
-
|
|
436
|
-
const result = await getOrCreateAccount(
|
|
437
|
-
asStripe(stripe),
|
|
438
|
-
makeComponent(),
|
|
439
|
-
ctx,
|
|
440
|
-
{ userId: "user_e", orgId: "org_e" },
|
|
441
|
-
);
|
|
442
|
-
|
|
443
|
-
expect(result).toEqual({
|
|
444
|
-
accountId: "internal_e",
|
|
445
|
-
stripeAccountId: "acct_existing",
|
|
446
|
-
isNew: false,
|
|
447
|
-
});
|
|
448
|
-
// orgId branch → getAccountByOrgId
|
|
449
|
-
expect(runQuery).toHaveBeenCalledWith(
|
|
450
|
-
refFor("core/queries/getAccountByOrgId"),
|
|
451
|
-
{ orgId: "org_e" },
|
|
452
|
-
);
|
|
453
|
-
expect(stripe.v2.core.accounts.create).not.toHaveBeenCalled();
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
it("looks up by userId when no orgId is supplied", async () => {
|
|
457
|
-
const stripe = makeStripe();
|
|
458
|
-
const runQuery = vi.fn().mockResolvedValue({
|
|
459
|
-
_id: "internal_u",
|
|
460
|
-
stripeAccountId: "acct_u",
|
|
461
|
-
});
|
|
462
|
-
const ctx = { runQuery, runMutation: vi.fn() } as unknown as RunCtx;
|
|
463
|
-
|
|
464
|
-
await getOrCreateAccount(asStripe(stripe), makeComponent(), ctx, {
|
|
465
|
-
userId: "user_u",
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
expect(runQuery).toHaveBeenCalledWith(
|
|
469
|
-
refFor("core/queries/getAccountByUserId"),
|
|
470
|
-
{ userId: "user_u" },
|
|
471
|
-
);
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
it("creates a new account and flags isNew when none exists", async () => {
|
|
475
|
-
const stripe = makeStripe();
|
|
476
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_new" });
|
|
477
|
-
// first query = existence check (null), second = read-back in createAccount
|
|
478
|
-
const runQuery = vi
|
|
479
|
-
.fn()
|
|
480
|
-
.mockResolvedValueOnce(null)
|
|
481
|
-
.mockResolvedValueOnce({ _id: "internal_new" });
|
|
482
|
-
const ctx = {
|
|
483
|
-
runQuery,
|
|
484
|
-
runMutation: vi.fn().mockResolvedValue(undefined),
|
|
485
|
-
} as unknown as RunCtx;
|
|
486
|
-
|
|
487
|
-
const result = await getOrCreateAccount(
|
|
488
|
-
asStripe(stripe),
|
|
489
|
-
makeComponent(),
|
|
490
|
-
ctx,
|
|
491
|
-
{ userId: "user_new" },
|
|
492
|
-
);
|
|
493
|
-
|
|
494
|
-
expect(result).toEqual({
|
|
495
|
-
accountId: "internal_new",
|
|
496
|
-
stripeAccountId: "acct_new",
|
|
497
|
-
isNew: true,
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
});
|
|
501
|
-
|
|
502
|
-
describe("read delegators", () => {
|
|
503
|
-
it("getAccount queries getAccount with the opts", async () => {
|
|
504
|
-
const runQuery = vi.fn().mockResolvedValue({ _id: "a" });
|
|
505
|
-
const ctx = { runQuery } as unknown as RunCtx;
|
|
506
|
-
const result = await getAccount(makeComponent(), ctx, { accountId: "a" });
|
|
507
|
-
expect(result).toEqual({ _id: "a" });
|
|
508
|
-
expect(runQuery).toHaveBeenCalledWith(refFor("core/queries/getAccount"), {
|
|
509
|
-
accountId: "a",
|
|
510
|
-
});
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
it("getAccountByUserId queries getAccountByUserId", async () => {
|
|
514
|
-
const runQuery = vi.fn().mockResolvedValue(null);
|
|
515
|
-
const ctx = { runQuery } as unknown as RunCtx;
|
|
516
|
-
const result = await getAccountByUserId(makeComponent(), ctx, {
|
|
517
|
-
userId: "u",
|
|
518
|
-
});
|
|
519
|
-
expect(result).toBeNull();
|
|
520
|
-
expect(runQuery).toHaveBeenCalledWith(
|
|
521
|
-
refFor("core/queries/getAccountByUserId"),
|
|
522
|
-
{ userId: "u" },
|
|
523
|
-
);
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
it("getAccountByOrgId queries getAccountByOrgId", async () => {
|
|
527
|
-
const runQuery = vi.fn().mockResolvedValue({ _id: "o" });
|
|
528
|
-
const ctx = { runQuery } as unknown as RunCtx;
|
|
529
|
-
await getAccountByOrgId(makeComponent(), ctx, { orgId: "o" });
|
|
530
|
-
expect(runQuery).toHaveBeenCalledWith(
|
|
531
|
-
refFor("core/queries/getAccountByOrgId"),
|
|
532
|
-
{ orgId: "o" },
|
|
533
|
-
);
|
|
534
|
-
});
|
|
535
|
-
|
|
536
|
-
it("getAccountByStripeId queries getAccountByStripeId", async () => {
|
|
537
|
-
const runQuery = vi.fn().mockResolvedValue({ _id: "s" });
|
|
538
|
-
const ctx = { runQuery } as unknown as RunCtx;
|
|
539
|
-
await getAccountByStripeId(makeComponent(), ctx, {
|
|
540
|
-
stripeAccountId: "acct_x",
|
|
541
|
-
});
|
|
542
|
-
expect(runQuery).toHaveBeenCalledWith(
|
|
543
|
-
refFor("core/queries/getAccountByStripeId"),
|
|
544
|
-
{ stripeAccountId: "acct_x" },
|
|
545
|
-
);
|
|
546
|
-
});
|
|
547
|
-
|
|
548
|
-
it("getAccountOnboardingStatus queries getAccountOnboardingStatus", async () => {
|
|
549
|
-
const runQuery = vi.fn().mockResolvedValue({ onboardingStatus: "pending" });
|
|
550
|
-
const ctx = { runQuery } as unknown as RunCtx;
|
|
551
|
-
const result = await getAccountOnboardingStatus(makeComponent(), ctx, {
|
|
552
|
-
accountId: "a",
|
|
553
|
-
});
|
|
554
|
-
expect(result).toEqual({ onboardingStatus: "pending" });
|
|
555
|
-
expect(runQuery).toHaveBeenCalledWith(
|
|
556
|
-
refFor("core/queries/getAccountOnboardingStatus"),
|
|
557
|
-
{ accountId: "a" },
|
|
558
|
-
);
|
|
559
|
-
});
|
|
560
|
-
});
|
|
561
|
-
|
|
562
|
-
describe("upsertAccount", () => {
|
|
563
|
-
it("runs the upsert mutation with the raw opts and returns null", async () => {
|
|
564
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
565
|
-
const ctx = { runMutation } as unknown as RunCtx;
|
|
566
|
-
const opts = {
|
|
567
|
-
stripeAccountId: "acct_up",
|
|
568
|
-
userId: "user_up",
|
|
569
|
-
onboardingStatus: "complete" as const,
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
const result = await upsertAccount(makeComponent(), ctx, opts);
|
|
573
|
-
|
|
574
|
-
expect(result).toBeNull();
|
|
575
|
-
expect(runMutation).toHaveBeenCalledWith(
|
|
576
|
-
refFor("core/mutations/upsertAccount"),
|
|
577
|
-
opts,
|
|
578
|
-
);
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
it("throws when ctx has no runMutation", async () => {
|
|
582
|
-
const ctx = {} as unknown as RunCtx;
|
|
583
|
-
await expect(
|
|
584
|
-
upsertAccount(makeComponent(), ctx, {
|
|
585
|
-
stripeAccountId: "acct_up",
|
|
586
|
-
userId: "user_up",
|
|
587
|
-
}),
|
|
588
|
-
).rejects.toThrow(/requires a Convex ctx with runMutation/);
|
|
589
|
-
});
|
|
590
|
-
});
|
|
591
|
-
|
|
592
|
-
describe("updateAccount", () => {
|
|
593
|
-
it("sends only the provided fields and returns success", async () => {
|
|
594
|
-
const stripe = makeStripe();
|
|
595
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
596
|
-
const ctx = {} as RunCtx;
|
|
597
|
-
|
|
598
|
-
const result = await updateAccount(asStripe(stripe), ctx, {
|
|
599
|
-
stripeAccountId: "acct_u1",
|
|
600
|
-
email: "new@b.com",
|
|
601
|
-
metadata: { tier: "gold" },
|
|
602
|
-
});
|
|
603
|
-
|
|
604
|
-
expect(result).toEqual({ success: true });
|
|
605
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledWith("acct_u1", {
|
|
606
|
-
contact_email: "new@b.com",
|
|
607
|
-
metadata: { tier: "gold" },
|
|
608
|
-
});
|
|
609
|
-
});
|
|
610
|
-
|
|
611
|
-
it("sends an empty update when neither email nor metadata is provided", async () => {
|
|
612
|
-
const stripe = makeStripe();
|
|
613
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
614
|
-
const ctx = {} as RunCtx;
|
|
615
|
-
|
|
616
|
-
await updateAccount(asStripe(stripe), ctx, { stripeAccountId: "acct_u2" });
|
|
617
|
-
|
|
618
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledWith("acct_u2", {});
|
|
619
|
-
});
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
describe("getV2Account / updateV2Account", () => {
|
|
623
|
-
it("getV2Account retrieves with the include array", async () => {
|
|
624
|
-
const stripe = makeStripe();
|
|
625
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({ id: "acct_g" });
|
|
626
|
-
const result = await getV2Account(asStripe(stripe), {} as RunCtx, {
|
|
627
|
-
stripeAccountId: "acct_g",
|
|
628
|
-
include: ["identity"] as never,
|
|
629
|
-
});
|
|
630
|
-
expect(result).toEqual({ id: "acct_g" });
|
|
631
|
-
expect(stripe.v2.core.accounts.retrieve).toHaveBeenCalledWith("acct_g", {
|
|
632
|
-
include: ["identity"],
|
|
633
|
-
});
|
|
634
|
-
});
|
|
635
|
-
|
|
636
|
-
it("updateV2Account passes through the raw update params", async () => {
|
|
637
|
-
const stripe = makeStripe();
|
|
638
|
-
stripe.v2.core.accounts.update.mockResolvedValue({ id: "acct_uv" });
|
|
639
|
-
const updateParams = { contact_email: "x@y.com" } as never;
|
|
640
|
-
const result = await updateV2Account(asStripe(stripe), {} as RunCtx, {
|
|
641
|
-
stripeAccountId: "acct_uv",
|
|
642
|
-
updateParams,
|
|
643
|
-
});
|
|
644
|
-
expect(result).toEqual({ id: "acct_uv" });
|
|
645
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledWith(
|
|
646
|
-
"acct_uv",
|
|
647
|
-
updateParams,
|
|
648
|
-
);
|
|
649
|
-
});
|
|
650
|
-
});
|
|
651
|
-
|
|
652
|
-
describe("addRecipientConfiguration", () => {
|
|
653
|
-
it("requests the recipient configuration and returns success", async () => {
|
|
654
|
-
const stripe = makeStripe();
|
|
655
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
656
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
657
|
-
applied_configurations: ["recipient"],
|
|
658
|
-
});
|
|
659
|
-
const runQuery = vi.fn().mockResolvedValue({ userId: "user_1" });
|
|
660
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
661
|
-
const ctx = { runQuery, runMutation } as unknown as RunCtx;
|
|
662
|
-
|
|
663
|
-
const result = await addRecipientConfiguration(
|
|
664
|
-
asStripe(stripe),
|
|
665
|
-
makeComponent(),
|
|
666
|
-
ctx,
|
|
667
|
-
{ stripeAccountId: "acct_r" },
|
|
668
|
-
);
|
|
669
|
-
expect(result).toEqual({
|
|
670
|
-
success: true,
|
|
671
|
-
appliedConfigurations: ["recipient"],
|
|
672
|
-
});
|
|
673
|
-
// V2 (API 2026-05-27.dahlia) requires the `capabilities` wrapper and an
|
|
674
|
-
// explicit `requested: true`; the bare `recipient.stripe_balance` shape is
|
|
675
|
-
// rejected with "Unknown field" (confirmed against the Stripe sandbox).
|
|
676
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledWith("acct_r", {
|
|
677
|
-
configuration: {
|
|
678
|
-
recipient: {
|
|
679
|
-
capabilities: {
|
|
680
|
-
stripe_balance: { stripe_transfers: { requested: true } },
|
|
681
|
-
},
|
|
682
|
-
},
|
|
683
|
-
},
|
|
684
|
-
});
|
|
685
|
-
});
|
|
686
|
-
|
|
687
|
-
it("records the Stripe-reported applied configurations on the component account", async () => {
|
|
688
|
-
const stripe = makeStripe();
|
|
689
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
690
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
691
|
-
applied_configurations: ["recipient"],
|
|
692
|
-
});
|
|
693
|
-
const runQuery = vi.fn().mockResolvedValue({ userId: "user_1" });
|
|
694
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
695
|
-
const ctx = { runQuery, runMutation } as unknown as RunCtx;
|
|
696
|
-
|
|
697
|
-
await addRecipientConfiguration(asStripe(stripe), makeComponent(), ctx, {
|
|
698
|
-
stripeAccountId: "acct_r",
|
|
699
|
-
});
|
|
700
|
-
|
|
701
|
-
// Read-back keyed by the Stripe id to recover the owning userId
|
|
702
|
-
expect(runQuery).toHaveBeenCalledWith(
|
|
703
|
-
refFor("core/queries/getAccountByStripeId"),
|
|
704
|
-
{ stripeAccountId: "acct_r" },
|
|
705
|
-
);
|
|
706
|
-
// Applied configs come from the re-fetched Stripe account (source of truth)
|
|
707
|
-
expect(runMutation).toHaveBeenCalledWith(
|
|
708
|
-
refFor("core/mutations/upsertAccount"),
|
|
709
|
-
{
|
|
710
|
-
stripeAccountId: "acct_r",
|
|
711
|
-
userId: "user_1",
|
|
712
|
-
appliedConfigurations: ["recipient"],
|
|
713
|
-
},
|
|
714
|
-
);
|
|
715
|
-
});
|
|
716
|
-
|
|
717
|
-
it("throws ACCOUNT_NOT_FOUND and never touches Stripe when the account is not in the component DB", async () => {
|
|
718
|
-
const stripe = makeStripe();
|
|
719
|
-
const runQuery = vi.fn().mockResolvedValue(null);
|
|
720
|
-
const runMutation = vi.fn();
|
|
721
|
-
const ctx = { runQuery, runMutation } as unknown as RunCtx;
|
|
722
|
-
|
|
723
|
-
await expect(
|
|
724
|
-
addRecipientConfiguration(asStripe(stripe), makeComponent(), ctx, {
|
|
725
|
-
stripeAccountId: "acct_missing",
|
|
726
|
-
}),
|
|
727
|
-
).rejects.toMatchObject({ data: { code: "ACCOUNT_NOT_FOUND" } });
|
|
728
|
-
|
|
729
|
-
expect(stripe.v2.core.accounts.update).not.toHaveBeenCalled();
|
|
730
|
-
expect(runMutation).not.toHaveBeenCalled();
|
|
731
|
-
});
|
|
732
|
-
|
|
733
|
-
it("surfaces the error and never calls upsertAccount when update() succeeds but the re-fetch retrieve() throws (BTS-78)", async () => {
|
|
734
|
-
// Partial-failure path: Stripe IS mutated (update() resolves), but the
|
|
735
|
-
// re-fetch that reads back applied_configurations fails. The component
|
|
736
|
-
// row must NOT be silently left stale — the error must propagate and
|
|
737
|
-
// upsertAccount must never fire, so a caller can't mistake this for
|
|
738
|
-
// success and no stale/absent row masks the real Stripe state.
|
|
739
|
-
const stripe = makeStripe();
|
|
740
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
741
|
-
stripe.v2.core.accounts.retrieve.mockRejectedValue(
|
|
742
|
-
new Error("Stripe retrieve failed: connection reset"),
|
|
743
|
-
);
|
|
744
|
-
const runQuery = vi.fn().mockResolvedValue({ userId: "user_1" });
|
|
745
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
746
|
-
const ctx = { runQuery, runMutation } as unknown as RunCtx;
|
|
747
|
-
|
|
748
|
-
await expect(
|
|
749
|
-
addRecipientConfiguration(asStripe(stripe), makeComponent(), ctx, {
|
|
750
|
-
stripeAccountId: "acct_r",
|
|
751
|
-
}),
|
|
752
|
-
).rejects.toThrow(/connection reset/);
|
|
753
|
-
|
|
754
|
-
// Stripe was mutated...
|
|
755
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledTimes(1);
|
|
756
|
-
// ...but the component row was never touched — no silent stale write.
|
|
757
|
-
expect(runMutation).not.toHaveBeenCalled();
|
|
758
|
-
});
|
|
759
|
-
});
|
|
760
|
-
|
|
761
|
-
describe("addRecipientConfiguration (real convex-test store, BTS-78)", () => {
|
|
762
|
-
it("persists exactly one account row reflecting the applied configuration — a real double-write/overwrite conflict would fail this", async () => {
|
|
763
|
-
const t = makeRealConvexTest();
|
|
764
|
-
const ctx = makeRealCtx(t);
|
|
765
|
-
|
|
766
|
-
// Seed the pre-existing component row addRecipientConfiguration requires.
|
|
767
|
-
await t.mutation(components.betterStripe.core.mutations.upsertAccount, {
|
|
768
|
-
stripeAccountId: "acct_r",
|
|
769
|
-
userId: "user_1",
|
|
770
|
-
appliedConfigurations: [],
|
|
771
|
-
onboardingStatus: "pending",
|
|
772
|
-
});
|
|
773
|
-
|
|
774
|
-
const stripe = makeStripe();
|
|
775
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
776
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
777
|
-
applied_configurations: ["recipient"],
|
|
778
|
-
});
|
|
779
|
-
|
|
780
|
-
const result = await addRecipientConfiguration(
|
|
781
|
-
asStripe(stripe),
|
|
782
|
-
realComponent,
|
|
783
|
-
ctx,
|
|
784
|
-
{ stripeAccountId: "acct_r" },
|
|
785
|
-
);
|
|
786
|
-
expect(result).toEqual({
|
|
787
|
-
success: true,
|
|
788
|
-
appliedConfigurations: ["recipient"],
|
|
789
|
-
});
|
|
790
|
-
|
|
791
|
-
// The REAL persisted row (not a mock return value) reflects the applied
|
|
792
|
-
// configuration and preserves the owning userId.
|
|
793
|
-
const stored = await t.query(
|
|
794
|
-
components.betterStripe.core.queries.getAccountByStripeId,
|
|
795
|
-
{
|
|
796
|
-
stripeAccountId: "acct_r",
|
|
797
|
-
},
|
|
798
|
-
);
|
|
799
|
-
expect(stored?.appliedConfigurations).toEqual(["recipient"]);
|
|
800
|
-
expect(stored?.userId).toBe("user_1");
|
|
801
|
-
|
|
802
|
-
// A subsequent full sync re-derives the same account from Stripe's list
|
|
803
|
-
// endpoint and must PATCH the same row, not create a duplicate — the
|
|
804
|
-
// double-sync regression this test guards against would show up here as
|
|
805
|
-
// more than one row for the same stripeAccountId.
|
|
806
|
-
stripe.v2.core.accounts.list.mockReturnValue(
|
|
807
|
-
asyncIterable([
|
|
808
|
-
{
|
|
809
|
-
id: "acct_r",
|
|
810
|
-
configuration: { recipient: {} },
|
|
811
|
-
metadata: { userId: "user_1" },
|
|
812
|
-
},
|
|
813
|
-
]),
|
|
814
|
-
);
|
|
815
|
-
|
|
816
|
-
await syncAllAccounts(asStripe(stripe), realComponent, ctx);
|
|
817
|
-
|
|
818
|
-
const allRows = await (
|
|
819
|
-
t as unknown as { runInComponent: RunInComponent }
|
|
820
|
-
).runInComponent("betterStripe", async (dbCtx) =>
|
|
821
|
-
dbCtx.db.query("accounts").collect(),
|
|
822
|
-
);
|
|
823
|
-
expect(allRows).toHaveLength(1);
|
|
824
|
-
expect(allRows[0]?.stripeAccountId).toBe("acct_r");
|
|
825
|
-
expect(allRows[0]?.userId).toBe("user_1");
|
|
826
|
-
});
|
|
827
|
-
});
|
|
828
|
-
|
|
829
|
-
describe("listStripeAccounts", () => {
|
|
830
|
-
it("collects every account the SDK's auto-pagination iterator yields", async () => {
|
|
831
|
-
const stripe = makeStripe();
|
|
832
|
-
stripe.v2.core.accounts.list.mockReturnValue(
|
|
833
|
-
asyncIterable([{ id: "acct_a" }, { id: "acct_b" }, { id: "acct_c" }]),
|
|
834
|
-
);
|
|
835
|
-
|
|
836
|
-
const result = await listStripeAccounts(asStripe(stripe), {} as RunCtx);
|
|
837
|
-
|
|
838
|
-
expect(result.map((a) => a.id)).toEqual(["acct_a", "acct_b", "acct_c"]);
|
|
839
|
-
expect(stripe.v2.core.accounts.list.mock.calls[0][0]).toEqual({
|
|
840
|
-
limit: 100,
|
|
841
|
-
});
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
it("honours an explicit limit", async () => {
|
|
845
|
-
const stripe = makeStripe();
|
|
846
|
-
stripe.v2.core.accounts.list.mockReturnValue(asyncIterable([]));
|
|
847
|
-
|
|
848
|
-
const result = await listStripeAccounts(asStripe(stripe), {} as RunCtx, {
|
|
849
|
-
limit: 5,
|
|
850
|
-
});
|
|
851
|
-
|
|
852
|
-
expect(result).toEqual([]);
|
|
853
|
-
expect(stripe.v2.core.accounts.list).toHaveBeenCalledTimes(1);
|
|
854
|
-
expect(stripe.v2.core.accounts.list.mock.calls[0][0]).toEqual({ limit: 5 });
|
|
855
|
-
});
|
|
856
|
-
|
|
857
|
-
it("returns accounts beyond a single page (BTS-109 regression)", async () => {
|
|
858
|
-
// Real V2 list responses never populate `has_more` — a manual
|
|
859
|
-
// has_more/starting_after loop reads it as `undefined` and silently
|
|
860
|
-
// stops after page 1. The SDK's own async iterator (driven by
|
|
861
|
-
// `next_page_url`, not exposed here) is what actually walks every page,
|
|
862
|
-
// so draining a result set far larger than one page's `limit` proves
|
|
863
|
-
// the fix relies on that iterator rather than a `has_more` flag.
|
|
864
|
-
const stripe = makeStripe();
|
|
865
|
-
const manyAccounts = Array.from({ length: 250 }, (_, i) => ({
|
|
866
|
-
id: `acct_${i}`,
|
|
867
|
-
}));
|
|
868
|
-
stripe.v2.core.accounts.list.mockReturnValue(asyncIterable(manyAccounts));
|
|
869
|
-
|
|
870
|
-
const result = await listStripeAccounts(asStripe(stripe), {} as RunCtx);
|
|
871
|
-
|
|
872
|
-
expect(result).toHaveLength(250);
|
|
873
|
-
expect(result.map((a) => a.id)).toEqual(manyAccounts.map((a) => a.id));
|
|
874
|
-
});
|
|
875
|
-
});
|
|
876
|
-
|
|
877
|
-
describe("syncAllAccounts", () => {
|
|
878
|
-
it("maps a business V2 account into an upsert and counts it synced", async () => {
|
|
879
|
-
const stripe = makeStripe();
|
|
880
|
-
stripe.v2.core.accounts.list.mockReturnValue(
|
|
881
|
-
asyncIterable([
|
|
882
|
-
{
|
|
883
|
-
id: "acct_biz",
|
|
884
|
-
contact_email: "biz@co.com",
|
|
885
|
-
metadata: { userId: "u_biz", orgId: "o_biz" },
|
|
886
|
-
identity: {
|
|
887
|
-
country: "US",
|
|
888
|
-
business_details: { registered_name: "Big Co" },
|
|
889
|
-
},
|
|
890
|
-
configuration: { merchant: { applied: true } },
|
|
891
|
-
requirements: { entries: [] },
|
|
892
|
-
},
|
|
893
|
-
]),
|
|
894
|
-
);
|
|
895
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
896
|
-
const ctx = { runMutation, runQuery: vi.fn() } as unknown as RunCtx;
|
|
897
|
-
|
|
898
|
-
const result = await syncAllAccounts(
|
|
899
|
-
asStripe(stripe),
|
|
900
|
-
makeComponent(),
|
|
901
|
-
ctx,
|
|
902
|
-
);
|
|
903
|
-
|
|
904
|
-
expect(result).toEqual({ synced: 1, errors: [], errorCount: 0 });
|
|
905
|
-
|
|
906
|
-
const upsertArg = runMutation.mock.calls[0][1];
|
|
907
|
-
expect(upsertArg).toMatchObject({
|
|
908
|
-
stripeAccountId: "acct_biz",
|
|
909
|
-
userId: "u_biz",
|
|
910
|
-
orgId: "o_biz",
|
|
911
|
-
email: "biz@co.com",
|
|
912
|
-
name: "Big Co",
|
|
913
|
-
country: "US",
|
|
914
|
-
onboardingStatus: "complete",
|
|
915
|
-
missingRequirements: [],
|
|
916
|
-
metadata: { userId: "u_biz", orgId: "o_biz" },
|
|
917
|
-
});
|
|
918
|
-
// list called with limit 20
|
|
919
|
-
expect(stripe.v2.core.accounts.list.mock.calls[0][0]).toEqual({
|
|
920
|
-
limit: 20,
|
|
921
|
-
});
|
|
922
|
-
});
|
|
923
|
-
|
|
924
|
-
it("derives an individual name, falls back to contact email, and accepts snake_case ids", async () => {
|
|
925
|
-
const stripe = makeStripe();
|
|
926
|
-
stripe.v2.core.accounts.list.mockReturnValue(
|
|
927
|
-
asyncIterable([
|
|
928
|
-
{
|
|
929
|
-
id: "acct_ind",
|
|
930
|
-
metadata: { user_id: "u_snake", org_id: "o_snake" },
|
|
931
|
-
identity: {
|
|
932
|
-
country: "CA",
|
|
933
|
-
individual: {
|
|
934
|
-
given_name: "Jane",
|
|
935
|
-
surname: "Doe",
|
|
936
|
-
email: "jane@x.com",
|
|
937
|
-
},
|
|
938
|
-
},
|
|
939
|
-
},
|
|
940
|
-
]),
|
|
941
|
-
);
|
|
942
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
943
|
-
const ctx = { runMutation, runQuery: vi.fn() } as unknown as RunCtx;
|
|
944
|
-
|
|
945
|
-
await syncAllAccounts(asStripe(stripe), makeComponent(), ctx);
|
|
946
|
-
|
|
947
|
-
const upsertArg = runMutation.mock.calls[0][1];
|
|
948
|
-
expect(upsertArg).toMatchObject({
|
|
949
|
-
userId: "u_snake",
|
|
950
|
-
orgId: "o_snake",
|
|
951
|
-
email: "jane@x.com", // individual.email fallback (no contact_email)
|
|
952
|
-
name: "Jane Doe", // given_name + surname
|
|
953
|
-
country: "CA",
|
|
954
|
-
});
|
|
955
|
-
});
|
|
956
|
-
|
|
957
|
-
it("falls back to the account id as userId when metadata has none", async () => {
|
|
958
|
-
const stripe = makeStripe();
|
|
959
|
-
stripe.v2.core.accounts.list.mockReturnValue(
|
|
960
|
-
asyncIterable([{ id: "acct_noid" }]),
|
|
961
|
-
);
|
|
962
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
963
|
-
const ctx = { runMutation, runQuery: vi.fn() } as unknown as RunCtx;
|
|
964
|
-
|
|
965
|
-
await syncAllAccounts(asStripe(stripe), makeComponent(), ctx);
|
|
966
|
-
|
|
967
|
-
const upsertArg = runMutation.mock.calls[0][1];
|
|
968
|
-
expect(upsertArg.userId).toBe("acct_noid");
|
|
969
|
-
expect(upsertArg.orgId).toBeUndefined();
|
|
970
|
-
expect(upsertArg.email).toBeUndefined();
|
|
971
|
-
expect(upsertArg.name).toBeUndefined();
|
|
972
|
-
});
|
|
973
|
-
|
|
974
|
-
it("accumulates a per-account error instead of aborting the sync", async () => {
|
|
975
|
-
const stripe = makeStripe();
|
|
976
|
-
stripe.v2.core.accounts.list.mockReturnValue(
|
|
977
|
-
asyncIterable([
|
|
978
|
-
{ id: "acct_ok", metadata: { userId: "ok" } },
|
|
979
|
-
{ id: "acct_bad", metadata: { userId: "bad" } },
|
|
980
|
-
]),
|
|
981
|
-
);
|
|
982
|
-
const runMutation = vi
|
|
983
|
-
.fn()
|
|
984
|
-
.mockResolvedValueOnce(undefined) // acct_ok
|
|
985
|
-
.mockRejectedValueOnce(new Error("db down")); // acct_bad
|
|
986
|
-
const ctx = { runMutation, runQuery: vi.fn() } as unknown as RunCtx;
|
|
987
|
-
|
|
988
|
-
const result = await syncAllAccounts(
|
|
989
|
-
asStripe(stripe),
|
|
990
|
-
makeComponent(),
|
|
991
|
-
ctx,
|
|
992
|
-
);
|
|
993
|
-
|
|
994
|
-
expect(result.synced).toBe(1);
|
|
995
|
-
expect(result.errorCount).toBe(1);
|
|
996
|
-
expect(result.errors[0]).toContain("acct_bad");
|
|
997
|
-
expect(result.errors[0]).toContain("db down");
|
|
998
|
-
});
|
|
999
|
-
|
|
1000
|
-
it("stringifies a non-Error thrown value as 'Unknown error'", async () => {
|
|
1001
|
-
const stripe = makeStripe();
|
|
1002
|
-
stripe.v2.core.accounts.list.mockReturnValue(
|
|
1003
|
-
asyncIterable([{ id: "acct_weird", metadata: { userId: "u" } }]),
|
|
1004
|
-
);
|
|
1005
|
-
const runMutation = vi.fn().mockRejectedValueOnce("not-an-error-object");
|
|
1006
|
-
const ctx = { runMutation, runQuery: vi.fn() } as unknown as RunCtx;
|
|
1007
|
-
|
|
1008
|
-
const result = await syncAllAccounts(
|
|
1009
|
-
asStripe(stripe),
|
|
1010
|
-
makeComponent(),
|
|
1011
|
-
ctx,
|
|
1012
|
-
);
|
|
1013
|
-
|
|
1014
|
-
expect(result.errorCount).toBe(1);
|
|
1015
|
-
expect(result.errors[0]).toBe("Account acct_weird: Unknown error");
|
|
1016
|
-
});
|
|
1017
|
-
|
|
1018
|
-
it("leaves name undefined for an individual with no given_name or surname", async () => {
|
|
1019
|
-
const stripe = makeStripe();
|
|
1020
|
-
stripe.v2.core.accounts.list.mockReturnValue(
|
|
1021
|
-
asyncIterable([
|
|
1022
|
-
{
|
|
1023
|
-
id: "acct_blank",
|
|
1024
|
-
metadata: { userId: "u" },
|
|
1025
|
-
identity: { individual: { email: "only@email.com" } },
|
|
1026
|
-
},
|
|
1027
|
-
]),
|
|
1028
|
-
);
|
|
1029
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
1030
|
-
const ctx = { runMutation, runQuery: vi.fn() } as unknown as RunCtx;
|
|
1031
|
-
|
|
1032
|
-
await syncAllAccounts(asStripe(stripe), makeComponent(), ctx);
|
|
1033
|
-
|
|
1034
|
-
const upsertArg = runMutation.mock.calls[0][1];
|
|
1035
|
-
expect(upsertArg.name).toBeUndefined();
|
|
1036
|
-
expect(upsertArg.email).toBe("only@email.com");
|
|
1037
|
-
});
|
|
1038
|
-
|
|
1039
|
-
it("handles an empty account list", async () => {
|
|
1040
|
-
const stripe = makeStripe();
|
|
1041
|
-
stripe.v2.core.accounts.list.mockReturnValue(asyncIterable([]));
|
|
1042
|
-
const ctx = {
|
|
1043
|
-
runMutation: vi.fn(),
|
|
1044
|
-
runQuery: vi.fn(),
|
|
1045
|
-
} as unknown as RunCtx;
|
|
1046
|
-
|
|
1047
|
-
const result = await syncAllAccounts(
|
|
1048
|
-
asStripe(stripe),
|
|
1049
|
-
makeComponent(),
|
|
1050
|
-
ctx,
|
|
1051
|
-
);
|
|
1052
|
-
|
|
1053
|
-
expect(result).toEqual({ synced: 0, errors: [], errorCount: 0 });
|
|
1054
|
-
expect(stripe.v2.core.accounts.list).toHaveBeenCalledTimes(1);
|
|
1055
|
-
});
|
|
1056
|
-
|
|
1057
|
-
it("syncs accounts beyond a single page (BTS-109 regression)", async () => {
|
|
1058
|
-
// Same rationale as the listStripeAccounts regression test: real V2
|
|
1059
|
-
// list responses never populate `has_more`, so a manual pagination loop
|
|
1060
|
-
// silently stops after page 1 while reporting `errors: []` (looking
|
|
1061
|
-
// fully synced). Draining a result set far larger than one page's
|
|
1062
|
-
// `limit` proves syncAllAccounts relies on the SDK's async iterator
|
|
1063
|
-
// instead.
|
|
1064
|
-
const stripe = makeStripe();
|
|
1065
|
-
const manyAccounts = Array.from({ length: 150 }, (_, i) => ({
|
|
1066
|
-
id: `acct_${i}`,
|
|
1067
|
-
metadata: { userId: `user_${i}` },
|
|
1068
|
-
}));
|
|
1069
|
-
stripe.v2.core.accounts.list.mockReturnValue(asyncIterable(manyAccounts));
|
|
1070
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
1071
|
-
const ctx = { runMutation, runQuery: vi.fn() } as unknown as RunCtx;
|
|
1072
|
-
|
|
1073
|
-
const result = await syncAllAccounts(
|
|
1074
|
-
asStripe(stripe),
|
|
1075
|
-
makeComponent(),
|
|
1076
|
-
ctx,
|
|
1077
|
-
);
|
|
1078
|
-
|
|
1079
|
-
expect(result).toEqual({ synced: 150, errors: [], errorCount: 0 });
|
|
1080
|
-
expect(runMutation).toHaveBeenCalledTimes(150);
|
|
1081
|
-
});
|
|
1082
|
-
});
|
|
1083
|
-
|
|
1084
|
-
describe("addCustomerConfiguration", () => {
|
|
1085
|
-
it("DEFAULT_CUSTOMER_CONFIGURATION requests the customer configuration", () => {
|
|
1086
|
-
expect(DEFAULT_CUSTOMER_CONFIGURATION).toEqual({ customer: {} });
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
|
-
it("applies the customer configuration to the Stripe account", async () => {
|
|
1090
|
-
const stripe = makeStripe();
|
|
1091
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
1092
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
1093
|
-
applied_configurations: ["customer"],
|
|
1094
|
-
});
|
|
1095
|
-
const runQuery = vi.fn().mockResolvedValue({ userId: "user_1" });
|
|
1096
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
1097
|
-
const ctx = { runQuery, runMutation } as unknown as RunCtx;
|
|
1098
|
-
|
|
1099
|
-
await addCustomerConfiguration(asStripe(stripe), makeComponent(), ctx, {
|
|
1100
|
-
stripeAccountId: "acct_1",
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledWith("acct_1", {
|
|
1104
|
-
configuration: { customer: {} },
|
|
1105
|
-
});
|
|
1106
|
-
});
|
|
1107
|
-
|
|
1108
|
-
it("never sends dashboard or defaults for a customer-only account", async () => {
|
|
1109
|
-
// A customer-only V2 account rejects `dashboard` and
|
|
1110
|
-
// `defaults.responsibilities` with `unsupported_field_for_configs`
|
|
1111
|
-
// (confirmed against the Stripe sandbox). Account config must be
|
|
1112
|
-
// configuration-aware: only recipient/merchant accounts set those.
|
|
1113
|
-
const stripe = makeStripe();
|
|
1114
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
1115
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
1116
|
-
applied_configurations: ["customer"],
|
|
1117
|
-
});
|
|
1118
|
-
const ctx = {
|
|
1119
|
-
runQuery: vi.fn().mockResolvedValue({ userId: "user_1" }),
|
|
1120
|
-
runMutation: vi.fn().mockResolvedValue(undefined),
|
|
1121
|
-
} as unknown as RunCtx;
|
|
1122
|
-
|
|
1123
|
-
await addCustomerConfiguration(asStripe(stripe), makeComponent(), ctx, {
|
|
1124
|
-
stripeAccountId: "acct_1",
|
|
1125
|
-
});
|
|
1126
|
-
|
|
1127
|
-
const [, payload] = stripe.v2.core.accounts.update.mock.calls[0];
|
|
1128
|
-
expect(payload).not.toHaveProperty("dashboard");
|
|
1129
|
-
expect(payload).not.toHaveProperty("defaults");
|
|
1130
|
-
// ...and not nested inside `configuration` either.
|
|
1131
|
-
expect(payload.configuration).not.toHaveProperty("dashboard");
|
|
1132
|
-
expect(payload.configuration).not.toHaveProperty("defaults");
|
|
1133
|
-
});
|
|
1134
|
-
|
|
1135
|
-
it("records the Stripe-reported applied configurations on the component account", async () => {
|
|
1136
|
-
const stripe = makeStripe();
|
|
1137
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
1138
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
1139
|
-
applied_configurations: ["customer"],
|
|
1140
|
-
});
|
|
1141
|
-
const runQuery = vi.fn().mockResolvedValue({ userId: "user_1" });
|
|
1142
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
1143
|
-
const ctx = { runQuery, runMutation } as unknown as RunCtx;
|
|
1144
|
-
|
|
1145
|
-
await addCustomerConfiguration(asStripe(stripe), makeComponent(), ctx, {
|
|
1146
|
-
stripeAccountId: "acct_1",
|
|
1147
|
-
});
|
|
1148
|
-
|
|
1149
|
-
// Read-back keyed by the Stripe id to recover the owning userId
|
|
1150
|
-
expect(runQuery).toHaveBeenCalledWith(
|
|
1151
|
-
refFor("core/queries/getAccountByStripeId"),
|
|
1152
|
-
{ stripeAccountId: "acct_1" },
|
|
1153
|
-
);
|
|
1154
|
-
// Applied configs come from the re-fetched Stripe account (source of truth)
|
|
1155
|
-
expect(runMutation).toHaveBeenCalledWith(
|
|
1156
|
-
refFor("core/mutations/upsertAccount"),
|
|
1157
|
-
{
|
|
1158
|
-
stripeAccountId: "acct_1",
|
|
1159
|
-
userId: "user_1",
|
|
1160
|
-
appliedConfigurations: ["customer"],
|
|
1161
|
-
},
|
|
1162
|
-
);
|
|
1163
|
-
});
|
|
1164
|
-
|
|
1165
|
-
it("returns success with the applied configurations", async () => {
|
|
1166
|
-
const stripe = makeStripe();
|
|
1167
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
1168
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
1169
|
-
applied_configurations: ["customer", "merchant"],
|
|
1170
|
-
});
|
|
1171
|
-
const runQuery = vi.fn().mockResolvedValue({ userId: "user_1" });
|
|
1172
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
1173
|
-
const ctx = { runQuery, runMutation } as unknown as RunCtx;
|
|
1174
|
-
|
|
1175
|
-
const result = await addCustomerConfiguration(
|
|
1176
|
-
asStripe(stripe),
|
|
1177
|
-
makeComponent(),
|
|
1178
|
-
ctx,
|
|
1179
|
-
{ stripeAccountId: "acct_1" },
|
|
1180
|
-
);
|
|
1181
|
-
|
|
1182
|
-
expect(result).toEqual({
|
|
1183
|
-
success: true,
|
|
1184
|
-
appliedConfigurations: ["customer", "merchant"],
|
|
1185
|
-
});
|
|
1186
|
-
});
|
|
1187
|
-
|
|
1188
|
-
it("throws ACCOUNT_NOT_FOUND and never touches Stripe when the account is not in the component DB", async () => {
|
|
1189
|
-
const stripe = makeStripe();
|
|
1190
|
-
const runQuery = vi.fn().mockResolvedValue(null);
|
|
1191
|
-
const runMutation = vi.fn();
|
|
1192
|
-
const ctx = { runQuery, runMutation } as unknown as RunCtx;
|
|
1193
|
-
|
|
1194
|
-
await expect(
|
|
1195
|
-
addCustomerConfiguration(asStripe(stripe), makeComponent(), ctx, {
|
|
1196
|
-
stripeAccountId: "acct_missing",
|
|
1197
|
-
}),
|
|
1198
|
-
).rejects.toMatchObject({ data: { code: "ACCOUNT_NOT_FOUND" } });
|
|
1199
|
-
|
|
1200
|
-
expect(stripe.v2.core.accounts.update).not.toHaveBeenCalled();
|
|
1201
|
-
expect(runMutation).not.toHaveBeenCalled();
|
|
1202
|
-
});
|
|
1203
|
-
});
|
|
1204
|
-
|
|
1205
|
-
describe("ensureCustomerAccount (BTS-18)", () => {
|
|
1206
|
-
/** Build a ctx whose runQuery routes by component ref path. */
|
|
1207
|
-
function routedCtx(routes: Record<string, unknown>) {
|
|
1208
|
-
const runQuery = vi.fn(async (ref: Record<symbol, string>) => {
|
|
1209
|
-
const path = ref[TO_REF].replace(/^betterStripe\//, "");
|
|
1210
|
-
return routes[path] ?? null;
|
|
1211
|
-
});
|
|
1212
|
-
const runMutation = vi.fn().mockResolvedValue(undefined);
|
|
1213
|
-
return { runQuery, runMutation } as unknown as RunCtx & {
|
|
1214
|
-
runQuery: ReturnType<typeof vi.fn>;
|
|
1215
|
-
runMutation: ReturnType<typeof vi.fn>;
|
|
1216
|
-
};
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
it("provisions a new buyer with the customer configuration", async () => {
|
|
1220
|
-
const stripe = makeStripe();
|
|
1221
|
-
stripe.v2.core.accounts.create.mockResolvedValue({ id: "acct_new" });
|
|
1222
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
1223
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
1224
|
-
applied_configurations: ["customer"],
|
|
1225
|
-
});
|
|
1226
|
-
const ctx = routedCtx({
|
|
1227
|
-
"core/queries/getAccountByUserId": null, // no existing account
|
|
1228
|
-
"core/queries/getAccountByStripeId": {
|
|
1229
|
-
_id: "doc1",
|
|
1230
|
-
stripeAccountId: "acct_new",
|
|
1231
|
-
userId: "u1",
|
|
1232
|
-
appliedConfigurations: [],
|
|
1233
|
-
},
|
|
1234
|
-
});
|
|
1235
|
-
|
|
1236
|
-
const result = await ensureCustomerAccount(
|
|
1237
|
-
asStripe(stripe),
|
|
1238
|
-
makeComponent(),
|
|
1239
|
-
ctx,
|
|
1240
|
-
{ userId: "u1", email: "buyer@test.com" },
|
|
1241
|
-
);
|
|
1242
|
-
|
|
1243
|
-
expect(stripe.v2.core.accounts.create).toHaveBeenCalled();
|
|
1244
|
-
// customer configuration applied
|
|
1245
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledWith("acct_new", {
|
|
1246
|
-
configuration: { customer: {} },
|
|
1247
|
-
});
|
|
1248
|
-
expect(result.stripeAccountId).toBe("acct_new");
|
|
1249
|
-
expect(result.isNew).toBe(true);
|
|
1250
|
-
expect(result.appliedConfigurations).toContain("customer");
|
|
1251
|
-
});
|
|
1252
|
-
|
|
1253
|
-
it("adds the customer configuration to an existing account that lacks it", async () => {
|
|
1254
|
-
const stripe = makeStripe();
|
|
1255
|
-
stripe.v2.core.accounts.update.mockResolvedValue({});
|
|
1256
|
-
stripe.v2.core.accounts.retrieve.mockResolvedValue({
|
|
1257
|
-
applied_configurations: ["customer"],
|
|
1258
|
-
});
|
|
1259
|
-
const ctx = routedCtx({
|
|
1260
|
-
"core/queries/getAccountByUserId": {
|
|
1261
|
-
_id: "doc1",
|
|
1262
|
-
stripeAccountId: "acct_x",
|
|
1263
|
-
},
|
|
1264
|
-
"core/queries/getAccountByStripeId": {
|
|
1265
|
-
_id: "doc1",
|
|
1266
|
-
stripeAccountId: "acct_x",
|
|
1267
|
-
userId: "u1",
|
|
1268
|
-
appliedConfigurations: [],
|
|
1269
|
-
},
|
|
1270
|
-
});
|
|
1271
|
-
|
|
1272
|
-
const result = await ensureCustomerAccount(
|
|
1273
|
-
asStripe(stripe),
|
|
1274
|
-
makeComponent(),
|
|
1275
|
-
ctx,
|
|
1276
|
-
{ userId: "u1" },
|
|
1277
|
-
);
|
|
1278
|
-
|
|
1279
|
-
expect(stripe.v2.core.accounts.create).not.toHaveBeenCalled();
|
|
1280
|
-
expect(stripe.v2.core.accounts.update).toHaveBeenCalledWith("acct_x", {
|
|
1281
|
-
configuration: { customer: {} },
|
|
1282
|
-
});
|
|
1283
|
-
expect(result.isNew).toBe(false);
|
|
1284
|
-
});
|
|
1285
|
-
|
|
1286
|
-
it("is idempotent: does not re-provision an account that already has customer config", async () => {
|
|
1287
|
-
const stripe = makeStripe();
|
|
1288
|
-
const ctx = routedCtx({
|
|
1289
|
-
"core/queries/getAccountByUserId": {
|
|
1290
|
-
_id: "doc1",
|
|
1291
|
-
stripeAccountId: "acct_x",
|
|
1292
|
-
},
|
|
1293
|
-
"core/queries/getAccountByStripeId": {
|
|
1294
|
-
_id: "doc1",
|
|
1295
|
-
stripeAccountId: "acct_x",
|
|
1296
|
-
userId: "u1",
|
|
1297
|
-
appliedConfigurations: ["customer"],
|
|
1298
|
-
},
|
|
1299
|
-
});
|
|
1300
|
-
|
|
1301
|
-
const result = await ensureCustomerAccount(
|
|
1302
|
-
asStripe(stripe),
|
|
1303
|
-
makeComponent(),
|
|
1304
|
-
ctx,
|
|
1305
|
-
{ userId: "u1" },
|
|
1306
|
-
);
|
|
1307
|
-
|
|
1308
|
-
expect(stripe.v2.core.accounts.create).not.toHaveBeenCalled();
|
|
1309
|
-
expect(stripe.v2.core.accounts.update).not.toHaveBeenCalled();
|
|
1310
|
-
expect(result.appliedConfigurations).toEqual(["customer"]);
|
|
1311
|
-
});
|
|
1312
|
-
|
|
1313
|
-
it("preserves other configs (customer + merchant) without re-provisioning", async () => {
|
|
1314
|
-
const stripe = makeStripe();
|
|
1315
|
-
const ctx = routedCtx({
|
|
1316
|
-
"core/queries/getAccountByUserId": {
|
|
1317
|
-
_id: "doc1",
|
|
1318
|
-
stripeAccountId: "acct_x",
|
|
1319
|
-
},
|
|
1320
|
-
"core/queries/getAccountByStripeId": {
|
|
1321
|
-
_id: "doc1",
|
|
1322
|
-
stripeAccountId: "acct_x",
|
|
1323
|
-
userId: "u1",
|
|
1324
|
-
appliedConfigurations: ["customer", "merchant"],
|
|
1325
|
-
},
|
|
1326
|
-
});
|
|
1327
|
-
|
|
1328
|
-
const result = await ensureCustomerAccount(
|
|
1329
|
-
asStripe(stripe),
|
|
1330
|
-
makeComponent(),
|
|
1331
|
-
ctx,
|
|
1332
|
-
{ userId: "u1" },
|
|
1333
|
-
);
|
|
1334
|
-
|
|
1335
|
-
expect(stripe.v2.core.accounts.update).not.toHaveBeenCalled();
|
|
1336
|
-
expect(result.appliedConfigurations).toEqual(["customer", "merchant"]);
|
|
1337
|
-
});
|
|
1338
|
-
});
|
|
1339
|
-
|
|
1340
|
-
describe("setAccountStatementDescriptor (BTS-32)", () => {
|
|
1341
|
-
it("validates, trims, and stores the per-store suffix on the account record", async () => {
|
|
1342
|
-
const runMutation = vi.fn().mockResolvedValue(null);
|
|
1343
|
-
const ctx = { runMutation } as unknown as RunCtx;
|
|
1344
|
-
|
|
1345
|
-
const result = await setAccountStatementDescriptor(makeComponent(), ctx, {
|
|
1346
|
-
stripeAccountId: "acct_store",
|
|
1347
|
-
statementDescriptor: " MAYAS FITNESS ",
|
|
1348
|
-
});
|
|
1349
|
-
|
|
1350
|
-
expect(result).toEqual({ success: true });
|
|
1351
|
-
expect(runMutation).toHaveBeenCalledWith(
|
|
1352
|
-
refFor("core/mutations/setStatementDescriptor"),
|
|
1353
|
-
{ stripeAccountId: "acct_store", statementDescriptor: "MAYAS FITNESS" },
|
|
1354
|
-
);
|
|
1355
|
-
});
|
|
1356
|
-
|
|
1357
|
-
it("rejects an invalid suffix WITHOUT touching the component DB", async () => {
|
|
1358
|
-
const runMutation = vi.fn();
|
|
1359
|
-
const ctx = { runMutation } as unknown as RunCtx;
|
|
1360
|
-
|
|
1361
|
-
await expect(
|
|
1362
|
-
setAccountStatementDescriptor(makeComponent(), ctx, {
|
|
1363
|
-
stripeAccountId: "acct_store",
|
|
1364
|
-
statementDescriptor: "BAD*NAME",
|
|
1365
|
-
}),
|
|
1366
|
-
).rejects.toThrow(/character/i);
|
|
1367
|
-
expect(runMutation).not.toHaveBeenCalled();
|
|
1368
|
-
});
|
|
1369
|
-
|
|
1370
|
-
it("clears the suffix when passed null", async () => {
|
|
1371
|
-
const runMutation = vi.fn().mockResolvedValue(null);
|
|
1372
|
-
const ctx = { runMutation } as unknown as RunCtx;
|
|
1373
|
-
|
|
1374
|
-
const result = await setAccountStatementDescriptor(makeComponent(), ctx, {
|
|
1375
|
-
stripeAccountId: "acct_store",
|
|
1376
|
-
statementDescriptor: null,
|
|
1377
|
-
});
|
|
1378
|
-
|
|
1379
|
-
expect(result).toEqual({ success: true });
|
|
1380
|
-
expect(runMutation).toHaveBeenCalledWith(
|
|
1381
|
-
refFor("core/mutations/setStatementDescriptor"),
|
|
1382
|
-
{ stripeAccountId: "acct_store", statementDescriptor: null },
|
|
1383
|
-
);
|
|
1384
|
-
});
|
|
1385
|
-
});
|