@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,1282 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for the checkout-session methods. `createCheckoutSession` carries the
|
|
3
|
-
* real branching logic — embedded vs redirect ui_mode, the
|
|
4
|
-
* subscription/payment/setup mode-specific blocks, metadata + orgId assembly,
|
|
5
|
-
* the accountId-vs-customerEmail precedence, default quantity, sessionOverrides
|
|
6
|
-
* spreading, and the component upsert with its null-coalescing defaults — so it
|
|
7
|
-
* gets the most attention. The remaining functions are thin component/Stripe
|
|
8
|
-
* wrappers verified for param shape and pass-through.
|
|
9
|
-
*/
|
|
10
|
-
import { describe, expect, it, vi } from "vitest";
|
|
11
|
-
|
|
12
|
-
import type { Component, RunCtx } from "../helpers.js";
|
|
13
|
-
import {
|
|
14
|
-
createCheckoutSession,
|
|
15
|
-
getCheckoutSession,
|
|
16
|
-
getCheckoutSessionByStripeId,
|
|
17
|
-
listCheckoutSessionsByUser,
|
|
18
|
-
updateCheckoutSession,
|
|
19
|
-
upsertCheckoutSession,
|
|
20
|
-
} from "./checkout.js";
|
|
21
|
-
|
|
22
|
-
const TO_REF = Symbol.for("toReferencePath");
|
|
23
|
-
|
|
24
|
-
/** Component proxy exposing the billing refs these functions resolve. */
|
|
25
|
-
function makeComponent(): Component {
|
|
26
|
-
const ref = (path: string) => ({ [TO_REF]: `betterStripe/${path}` });
|
|
27
|
-
return {
|
|
28
|
-
billing: {
|
|
29
|
-
queries: {
|
|
30
|
-
getCheckoutSession: ref("billing/queries/getCheckoutSession"),
|
|
31
|
-
getCheckoutSessionByStripeId: ref(
|
|
32
|
-
"billing/queries/getCheckoutSessionByStripeId",
|
|
33
|
-
),
|
|
34
|
-
listCheckoutSessionsByUser: ref(
|
|
35
|
-
"billing/queries/listCheckoutSessionsByUser",
|
|
36
|
-
),
|
|
37
|
-
},
|
|
38
|
-
mutations: {
|
|
39
|
-
upsertCheckoutSession: ref("billing/mutations/upsertCheckoutSession"),
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
products: {
|
|
43
|
-
queries: {
|
|
44
|
-
getPriceByStripeId: ref("products/queries/getPriceByStripeId"),
|
|
45
|
-
getProductByStripeId: ref("products/queries/getProductByStripeId"),
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
core: {
|
|
49
|
-
queries: {
|
|
50
|
-
getAccountByStripeId: ref("core/queries/getAccountByStripeId"),
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
} as unknown as Component;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** Build a ctx whose runQuery routes by component ref path (for price validation). */
|
|
57
|
-
function routedCtx(routes: Record<string, unknown>) {
|
|
58
|
-
const runQuery = vi.fn(async (refObj: Record<symbol, string>) => {
|
|
59
|
-
const path = refObj[TO_REF].replace(/^betterStripe\//, "");
|
|
60
|
-
return routes[path] ?? null;
|
|
61
|
-
});
|
|
62
|
-
return {
|
|
63
|
-
runQuery,
|
|
64
|
-
runMutation: vi.fn().mockResolvedValue(undefined),
|
|
65
|
-
} as unknown as RunCtx & {
|
|
66
|
-
runQuery: ReturnType<typeof vi.fn>;
|
|
67
|
-
runMutation: ReturnType<typeof vi.fn>;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function makeCtx(queryResult?: unknown) {
|
|
72
|
-
return {
|
|
73
|
-
runQuery: vi.fn().mockResolvedValue(queryResult),
|
|
74
|
-
runMutation: vi.fn().mockResolvedValue(undefined),
|
|
75
|
-
} as unknown as RunCtx & {
|
|
76
|
-
runQuery: ReturnType<typeof vi.fn>;
|
|
77
|
-
runMutation: ReturnType<typeof vi.fn>;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function makeStripe() {
|
|
82
|
-
return {
|
|
83
|
-
prices: {
|
|
84
|
-
retrieve: vi.fn().mockRejectedValue({ code: "resource_missing" }),
|
|
85
|
-
},
|
|
86
|
-
checkout: {
|
|
87
|
-
sessions: {
|
|
88
|
-
create: vi.fn(),
|
|
89
|
-
update: vi.fn(),
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const asStripe = (s: ReturnType<typeof makeStripe>) =>
|
|
96
|
-
s as unknown as Parameters<typeof createCheckoutSession>[0];
|
|
97
|
-
|
|
98
|
-
/** Default Stripe session response used when a test does not care about it. */
|
|
99
|
-
function sessionResponse(overrides: Record<string, unknown> = {}) {
|
|
100
|
-
return {
|
|
101
|
-
id: "cs_test_1",
|
|
102
|
-
status: "open",
|
|
103
|
-
client_secret: "cs_secret_1",
|
|
104
|
-
url: null,
|
|
105
|
-
...overrides,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
describe("createCheckoutSession", () => {
|
|
110
|
-
it("builds a subscription embedded session and upserts the resulting row", async () => {
|
|
111
|
-
const stripe = makeStripe();
|
|
112
|
-
stripe.checkout.sessions.create.mockResolvedValue(
|
|
113
|
-
sessionResponse({ id: "cs_sub", client_secret: "secret_sub", url: null }),
|
|
114
|
-
);
|
|
115
|
-
const ctx = makeCtx();
|
|
116
|
-
|
|
117
|
-
const result = await createCheckoutSession(
|
|
118
|
-
asStripe(stripe),
|
|
119
|
-
makeComponent(),
|
|
120
|
-
ctx,
|
|
121
|
-
{
|
|
122
|
-
userId: "user_1",
|
|
123
|
-
orgId: "org_1",
|
|
124
|
-
stripePriceId: "price_1",
|
|
125
|
-
mode: "subscription",
|
|
126
|
-
returnUrl: "https://app.test/return",
|
|
127
|
-
},
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
131
|
-
// metadata includes userId + orgId; line_items default quantity 1
|
|
132
|
-
expect(createArg.metadata).toEqual({ userId: "user_1", orgId: "org_1" });
|
|
133
|
-
expect(createArg.line_items).toEqual([{ price: "price_1", quantity: 1 }]);
|
|
134
|
-
expect(createArg.mode).toBe("subscription");
|
|
135
|
-
// subscription mode → subscription_data carries the same metadata
|
|
136
|
-
expect(createArg.subscription_data).toEqual({
|
|
137
|
-
metadata: { userId: "user_1", orgId: "org_1" },
|
|
138
|
-
});
|
|
139
|
-
expect(createArg.subscription_data.trial_period_days).toBeUndefined();
|
|
140
|
-
// no payment_intent_data for subscription mode
|
|
141
|
-
expect(createArg.payment_intent_data).toBeUndefined();
|
|
142
|
-
// embedded ui_mode is the default
|
|
143
|
-
expect(createArg.ui_mode).toBe("embedded_page");
|
|
144
|
-
expect(createArg.return_url).toBe("https://app.test/return");
|
|
145
|
-
expect(createArg.success_url).toBeUndefined();
|
|
146
|
-
expect(createArg.cancel_url).toBeUndefined();
|
|
147
|
-
|
|
148
|
-
// upsert mutation carries derived row
|
|
149
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
150
|
-
expect(upsertArgs).toMatchObject({
|
|
151
|
-
stripeSessionId: "cs_sub",
|
|
152
|
-
userId: "user_1",
|
|
153
|
-
orgId: "org_1",
|
|
154
|
-
mode: "subscription",
|
|
155
|
-
status: "open",
|
|
156
|
-
clientSecret: "secret_sub",
|
|
157
|
-
metadata: { userId: "user_1", orgId: "org_1" },
|
|
158
|
-
});
|
|
159
|
-
expect(upsertArgs.url).toBeUndefined();
|
|
160
|
-
|
|
161
|
-
expect(result).toEqual({
|
|
162
|
-
stripeSessionId: "cs_sub",
|
|
163
|
-
clientSecret: "secret_sub",
|
|
164
|
-
url: undefined,
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it("adds trial_period_days to subscription_data when trialDays is set", async () => {
|
|
169
|
-
const stripe = makeStripe();
|
|
170
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
171
|
-
const ctx = makeCtx();
|
|
172
|
-
|
|
173
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
174
|
-
userId: "user_1",
|
|
175
|
-
stripePriceId: "price_1",
|
|
176
|
-
mode: "subscription",
|
|
177
|
-
returnUrl: "https://app.test/return",
|
|
178
|
-
trialDays: 14,
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
182
|
-
expect(createArg.subscription_data.trial_period_days).toBe(14);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it("omits orgId from metadata when not provided", async () => {
|
|
186
|
-
const stripe = makeStripe();
|
|
187
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
188
|
-
const ctx = makeCtx();
|
|
189
|
-
|
|
190
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
191
|
-
userId: "user_solo",
|
|
192
|
-
stripePriceId: "price_1",
|
|
193
|
-
mode: "subscription",
|
|
194
|
-
returnUrl: "https://app.test/return",
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
198
|
-
expect(createArg.metadata).toEqual({ userId: "user_solo" });
|
|
199
|
-
expect(createArg.metadata.orgId).toBeUndefined();
|
|
200
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
201
|
-
expect(upsertArgs.orgId).toBeUndefined();
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
it("merges caller metadata with the userId/orgId identifiers", async () => {
|
|
205
|
-
const stripe = makeStripe();
|
|
206
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
207
|
-
const ctx = makeCtx();
|
|
208
|
-
|
|
209
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
210
|
-
userId: "user_1",
|
|
211
|
-
orgId: "org_1",
|
|
212
|
-
stripePriceId: "price_1",
|
|
213
|
-
mode: "subscription",
|
|
214
|
-
returnUrl: "https://app.test/return",
|
|
215
|
-
metadata: { plan: "pro", source: "pricing-page" },
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
219
|
-
expect(createArg.metadata).toEqual({
|
|
220
|
-
plan: "pro",
|
|
221
|
-
source: "pricing-page",
|
|
222
|
-
userId: "user_1",
|
|
223
|
-
orgId: "org_1",
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
it("uses payment_intent_data and redirect urls for a payment redirect session", async () => {
|
|
228
|
-
const stripe = makeStripe();
|
|
229
|
-
stripe.checkout.sessions.create.mockResolvedValue(
|
|
230
|
-
sessionResponse({ id: "cs_pay" }),
|
|
231
|
-
);
|
|
232
|
-
const ctx = makeCtx();
|
|
233
|
-
|
|
234
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
235
|
-
userId: "user_1",
|
|
236
|
-
stripePriceId: "price_1",
|
|
237
|
-
mode: "payment",
|
|
238
|
-
uiMode: "redirect",
|
|
239
|
-
returnUrl: "https://app.test/done",
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
243
|
-
// payment mode → payment_intent_data; no subscription_data
|
|
244
|
-
expect(createArg.payment_intent_data).toEqual({
|
|
245
|
-
metadata: { userId: "user_1" },
|
|
246
|
-
});
|
|
247
|
-
expect(createArg.subscription_data).toBeUndefined();
|
|
248
|
-
// redirect ui_mode → success/cancel urls, no embedded fields
|
|
249
|
-
expect(createArg.ui_mode).toBeUndefined();
|
|
250
|
-
expect(createArg.return_url).toBeUndefined();
|
|
251
|
-
expect(createArg.success_url).toBe(
|
|
252
|
-
"https://app.test/done?session_id={CHECKOUT_SESSION_ID}",
|
|
253
|
-
);
|
|
254
|
-
expect(createArg.cancel_url).toBe("https://app.test/done");
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
it("emits neither subscription_data nor payment_intent_data for setup mode", async () => {
|
|
258
|
-
const stripe = makeStripe();
|
|
259
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
260
|
-
const ctx = makeCtx();
|
|
261
|
-
|
|
262
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
263
|
-
userId: "user_1",
|
|
264
|
-
stripePriceId: "price_1",
|
|
265
|
-
mode: "setup",
|
|
266
|
-
returnUrl: "https://app.test/return",
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
270
|
-
expect(createArg.subscription_data).toBeUndefined();
|
|
271
|
-
expect(createArg.payment_intent_data).toBeUndefined();
|
|
272
|
-
expect(createArg.mode).toBe("setup");
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it("forwards an explicit quantity to line_items", async () => {
|
|
276
|
-
const stripe = makeStripe();
|
|
277
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
278
|
-
const ctx = makeCtx();
|
|
279
|
-
|
|
280
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
281
|
-
userId: "user_1",
|
|
282
|
-
stripePriceId: "price_seat",
|
|
283
|
-
mode: "subscription",
|
|
284
|
-
returnUrl: "https://app.test/return",
|
|
285
|
-
quantity: 5,
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
289
|
-
expect(createArg.line_items).toEqual([
|
|
290
|
-
{ price: "price_seat", quantity: 5 },
|
|
291
|
-
]);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it("sets customer_account when accountId is provided", async () => {
|
|
295
|
-
const stripe = makeStripe();
|
|
296
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
297
|
-
const ctx = makeCtx();
|
|
298
|
-
|
|
299
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
300
|
-
userId: "user_1",
|
|
301
|
-
stripePriceId: "price_1",
|
|
302
|
-
mode: "subscription",
|
|
303
|
-
returnUrl: "https://app.test/return",
|
|
304
|
-
accountId: "acct_123",
|
|
305
|
-
customerEmail: "ignored@test.com",
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
309
|
-
// accountId takes precedence over customerEmail
|
|
310
|
-
expect(createArg.customer_account).toBe("acct_123");
|
|
311
|
-
expect(createArg.customer_email).toBeUndefined();
|
|
312
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
313
|
-
expect(upsertArgs.accountId).toBe("acct_123");
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
it("falls back to customer_email when no accountId is given", async () => {
|
|
317
|
-
const stripe = makeStripe();
|
|
318
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
319
|
-
const ctx = makeCtx();
|
|
320
|
-
|
|
321
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
322
|
-
userId: "user_1",
|
|
323
|
-
stripePriceId: "price_1",
|
|
324
|
-
mode: "subscription",
|
|
325
|
-
returnUrl: "https://app.test/return",
|
|
326
|
-
customerEmail: "buyer@test.com",
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
330
|
-
expect(createArg.customer_email).toBe("buyer@test.com");
|
|
331
|
-
expect(createArg.customer_account).toBeUndefined();
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
it("sets neither customer field when both accountId and email are absent", async () => {
|
|
335
|
-
const stripe = makeStripe();
|
|
336
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
337
|
-
const ctx = makeCtx();
|
|
338
|
-
|
|
339
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
340
|
-
userId: "user_1",
|
|
341
|
-
stripePriceId: "price_1",
|
|
342
|
-
mode: "subscription",
|
|
343
|
-
returnUrl: "https://app.test/return",
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
347
|
-
expect(createArg.customer_account).toBeUndefined();
|
|
348
|
-
expect(createArg.customer_email).toBeUndefined();
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
it("spreads sessionOverrides over the computed params", async () => {
|
|
352
|
-
const stripe = makeStripe();
|
|
353
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
354
|
-
const ctx = makeCtx();
|
|
355
|
-
|
|
356
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
357
|
-
userId: "user_1",
|
|
358
|
-
stripePriceId: "price_1",
|
|
359
|
-
mode: "subscription",
|
|
360
|
-
returnUrl: "https://app.test/return",
|
|
361
|
-
sessionOverrides: {
|
|
362
|
-
allow_promotion_codes: true,
|
|
363
|
-
mode: "payment", // override wins over computed mode
|
|
364
|
-
},
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
368
|
-
expect(createArg.allow_promotion_codes).toBe(true);
|
|
369
|
-
expect(createArg.mode).toBe("payment");
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
it("defaults status to 'open' and url/clientSecret to undefined when Stripe returns nullish values", async () => {
|
|
373
|
-
const stripe = makeStripe();
|
|
374
|
-
stripe.checkout.sessions.create.mockResolvedValue({
|
|
375
|
-
id: "cs_minimal",
|
|
376
|
-
status: null,
|
|
377
|
-
client_secret: null,
|
|
378
|
-
url: null,
|
|
379
|
-
});
|
|
380
|
-
const ctx = makeCtx();
|
|
381
|
-
|
|
382
|
-
const result = await createCheckoutSession(
|
|
383
|
-
asStripe(stripe),
|
|
384
|
-
makeComponent(),
|
|
385
|
-
ctx,
|
|
386
|
-
{
|
|
387
|
-
userId: "user_1",
|
|
388
|
-
stripePriceId: "price_1",
|
|
389
|
-
mode: "subscription",
|
|
390
|
-
returnUrl: "https://app.test/return",
|
|
391
|
-
},
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
395
|
-
expect(upsertArgs.status).toBe("open");
|
|
396
|
-
expect(upsertArgs.clientSecret).toBeUndefined();
|
|
397
|
-
expect(upsertArgs.url).toBeUndefined();
|
|
398
|
-
expect(result).toEqual({
|
|
399
|
-
stripeSessionId: "cs_minimal",
|
|
400
|
-
clientSecret: undefined,
|
|
401
|
-
url: undefined,
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
it("propagates the redirect url returned by Stripe into the upsert and result", async () => {
|
|
406
|
-
const stripe = makeStripe();
|
|
407
|
-
stripe.checkout.sessions.create.mockResolvedValue(
|
|
408
|
-
sessionResponse({
|
|
409
|
-
id: "cs_redir",
|
|
410
|
-
status: "complete",
|
|
411
|
-
client_secret: null,
|
|
412
|
-
url: "https://checkout.stripe.com/c/pay/cs_redir",
|
|
413
|
-
}),
|
|
414
|
-
);
|
|
415
|
-
const ctx = makeCtx();
|
|
416
|
-
|
|
417
|
-
const result = await createCheckoutSession(
|
|
418
|
-
asStripe(stripe),
|
|
419
|
-
makeComponent(),
|
|
420
|
-
ctx,
|
|
421
|
-
{
|
|
422
|
-
userId: "user_1",
|
|
423
|
-
stripePriceId: "price_1",
|
|
424
|
-
mode: "payment",
|
|
425
|
-
uiMode: "redirect",
|
|
426
|
-
returnUrl: "https://app.test/done",
|
|
427
|
-
},
|
|
428
|
-
);
|
|
429
|
-
|
|
430
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
431
|
-
expect(upsertArgs.status).toBe("complete");
|
|
432
|
-
expect(upsertArgs.url).toBe("https://checkout.stripe.com/c/pay/cs_redir");
|
|
433
|
-
expect(result.url).toBe("https://checkout.stripe.com/c/pay/cs_redir");
|
|
434
|
-
expect(result.clientSecret).toBeUndefined();
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
it("persists the price id on the upserted checkout-session row", async () => {
|
|
438
|
-
const stripe = makeStripe();
|
|
439
|
-
stripe.checkout.sessions.create.mockResolvedValue(
|
|
440
|
-
sessionResponse({ id: "cs_priced" }),
|
|
441
|
-
);
|
|
442
|
-
const ctx = makeCtx();
|
|
443
|
-
|
|
444
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
445
|
-
userId: "user_1",
|
|
446
|
-
stripePriceId: "price_pro_monthly",
|
|
447
|
-
mode: "subscription",
|
|
448
|
-
returnUrl: "https://app.test/return",
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
452
|
-
expect(upsertArgs.priceId).toBe("price_pro_monthly");
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
it("targets the upsertCheckoutSession component ref", async () => {
|
|
456
|
-
const stripe = makeStripe();
|
|
457
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
458
|
-
const ctx = makeCtx();
|
|
459
|
-
|
|
460
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
461
|
-
userId: "user_1",
|
|
462
|
-
stripePriceId: "price_1",
|
|
463
|
-
mode: "subscription",
|
|
464
|
-
returnUrl: "https://app.test/return",
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
const [ref] = ctx.runMutation.mock.calls[0];
|
|
468
|
-
expect(ref).toEqual({
|
|
469
|
-
[TO_REF]: "betterStripe/billing/mutations/upsertCheckoutSession",
|
|
470
|
-
});
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
it("throws when ctx has no runMutation (runMutationOrThrow guard)", async () => {
|
|
474
|
-
const stripe = makeStripe();
|
|
475
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
476
|
-
const ctx = { runQuery: vi.fn() } as unknown as RunCtx;
|
|
477
|
-
|
|
478
|
-
await expect(
|
|
479
|
-
createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
480
|
-
userId: "user_1",
|
|
481
|
-
stripePriceId: "price_1",
|
|
482
|
-
mode: "subscription",
|
|
483
|
-
returnUrl: "https://app.test/return",
|
|
484
|
-
}),
|
|
485
|
-
).rejects.toThrow(/requires a Convex ctx with runMutation/);
|
|
486
|
-
});
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
describe("createCheckoutSession — destination + fee (BTS-15, subscription)", () => {
|
|
490
|
-
it("routes a percent-only fee via transfer_data + application_fee_percent", async () => {
|
|
491
|
-
const stripe = makeStripe();
|
|
492
|
-
stripe.checkout.sessions.create.mockResolvedValue(
|
|
493
|
-
sessionResponse({ id: "cs_dest" }),
|
|
494
|
-
);
|
|
495
|
-
const ctx = makeCtx();
|
|
496
|
-
|
|
497
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
498
|
-
userId: "buyer_1",
|
|
499
|
-
stripePriceId: "price_1",
|
|
500
|
-
mode: "subscription",
|
|
501
|
-
returnUrl: "https://app.test/return",
|
|
502
|
-
accountId: "acct_buyer",
|
|
503
|
-
destinationAccountId: "acct_store",
|
|
504
|
-
feeConfig: { percent: 10 },
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
508
|
-
expect(createArg.subscription_data.transfer_data).toEqual({
|
|
509
|
-
destination: "acct_store",
|
|
510
|
-
});
|
|
511
|
-
expect(createArg.subscription_data.application_fee_percent).toBe(10);
|
|
512
|
-
expect(createArg.subscription_data.metadata.bsFeeMode).toBeUndefined();
|
|
513
|
-
expect(createArg.payment_method_types).toBeUndefined();
|
|
514
|
-
|
|
515
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
516
|
-
expect(upsertArgs).toMatchObject({
|
|
517
|
-
chargeType: "destination",
|
|
518
|
-
destinationAccountId: "acct_store",
|
|
519
|
-
applicationFeePercent: 10,
|
|
520
|
-
});
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
it("flags percent+fixed fees for per-invoice computation (no application_fee_percent)", async () => {
|
|
524
|
-
const stripe = makeStripe();
|
|
525
|
-
stripe.checkout.sessions.create.mockResolvedValue(
|
|
526
|
-
sessionResponse({ id: "cs_dest2" }),
|
|
527
|
-
);
|
|
528
|
-
const ctx = makeCtx();
|
|
529
|
-
|
|
530
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
531
|
-
userId: "buyer_1",
|
|
532
|
-
stripePriceId: "price_1",
|
|
533
|
-
mode: "subscription",
|
|
534
|
-
returnUrl: "https://app.test/return",
|
|
535
|
-
accountId: "acct_buyer",
|
|
536
|
-
destinationAccountId: "acct_store",
|
|
537
|
-
feeConfig: { percent: 2.9, fixed: 30 },
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
541
|
-
expect(createArg.subscription_data.transfer_data).toEqual({
|
|
542
|
-
destination: "acct_store",
|
|
543
|
-
});
|
|
544
|
-
expect(createArg.subscription_data.application_fee_percent).toBeUndefined();
|
|
545
|
-
expect(createArg.subscription_data.metadata.bsFeeMode).toBe("per_invoice");
|
|
546
|
-
|
|
547
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
548
|
-
expect(upsertArgs.chargeType).toBe("destination");
|
|
549
|
-
expect(upsertArgs.destinationAccountId).toBe("acct_store");
|
|
550
|
-
});
|
|
551
|
-
|
|
552
|
-
it("adds no transfer_data or fees without a destinationAccountId", async () => {
|
|
553
|
-
const stripe = makeStripe();
|
|
554
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
555
|
-
const ctx = makeCtx();
|
|
556
|
-
|
|
557
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
558
|
-
userId: "user_1",
|
|
559
|
-
stripePriceId: "price_1",
|
|
560
|
-
mode: "subscription",
|
|
561
|
-
returnUrl: "https://app.test/return",
|
|
562
|
-
feeConfig: { percent: 10 },
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
566
|
-
expect(createArg.subscription_data.transfer_data).toBeUndefined();
|
|
567
|
-
expect(createArg.subscription_data.application_fee_percent).toBeUndefined();
|
|
568
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
569
|
-
expect(upsertArgs.chargeType).toBeUndefined();
|
|
570
|
-
});
|
|
571
|
-
|
|
572
|
-
it("derives the persisted fee row from the FINAL request when sessionOverrides replace subscription_data", async () => {
|
|
573
|
-
const stripe = makeStripe();
|
|
574
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
575
|
-
const ctx = makeCtx();
|
|
576
|
-
|
|
577
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
578
|
-
userId: "buyer_1",
|
|
579
|
-
stripePriceId: "price_1",
|
|
580
|
-
mode: "subscription",
|
|
581
|
-
returnUrl: "https://app.test/return",
|
|
582
|
-
accountId: "acct_buyer",
|
|
583
|
-
destinationAccountId: "acct_store",
|
|
584
|
-
feeConfig: { percent: 10 },
|
|
585
|
-
// Override wholesale-replaces subscription_data, dropping transfer_data/fee.
|
|
586
|
-
sessionOverrides: { subscription_data: { metadata: {} } },
|
|
587
|
-
});
|
|
588
|
-
|
|
589
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
590
|
-
expect(createArg.subscription_data.transfer_data).toBeUndefined();
|
|
591
|
-
// Persisted row must reflect the actual request — no stale fee/routing.
|
|
592
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
593
|
-
expect(upsertArgs.chargeType).toBeUndefined();
|
|
594
|
-
expect(upsertArgs.destinationAccountId).toBeUndefined();
|
|
595
|
-
expect(upsertArgs.applicationFeePercent).toBeUndefined();
|
|
596
|
-
});
|
|
597
|
-
});
|
|
598
|
-
|
|
599
|
-
describe("createCheckoutSession — destination + fee (BTS-16, one-time payment)", () => {
|
|
600
|
-
it("computes application_fee_amount when the amount is known", async () => {
|
|
601
|
-
const stripe = makeStripe();
|
|
602
|
-
stripe.checkout.sessions.create.mockResolvedValue(
|
|
603
|
-
sessionResponse({ id: "cs_pay_fee" }),
|
|
604
|
-
);
|
|
605
|
-
const ctx = makeCtx();
|
|
606
|
-
|
|
607
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
608
|
-
userId: "buyer_1",
|
|
609
|
-
stripePriceId: "price_1",
|
|
610
|
-
mode: "payment",
|
|
611
|
-
returnUrl: "https://app.test/return",
|
|
612
|
-
accountId: "acct_buyer",
|
|
613
|
-
destinationAccountId: "acct_store",
|
|
614
|
-
feeConfig: { percent: 10, fixed: 30 },
|
|
615
|
-
amount: 10000, // round(10000*0.10) + 30 = 1030
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
619
|
-
expect(createArg.payment_intent_data.transfer_data).toEqual({
|
|
620
|
-
destination: "acct_store",
|
|
621
|
-
});
|
|
622
|
-
expect(createArg.payment_intent_data.application_fee_amount).toBe(1030);
|
|
623
|
-
expect(createArg.payment_intent_data.metadata.bsFeeMode).toBeUndefined();
|
|
624
|
-
|
|
625
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
626
|
-
expect(upsertArgs).toMatchObject({
|
|
627
|
-
chargeType: "destination",
|
|
628
|
-
destinationAccountId: "acct_store",
|
|
629
|
-
applicationFeeAmount: 1030,
|
|
630
|
-
});
|
|
631
|
-
});
|
|
632
|
-
|
|
633
|
-
it("defers to the webhook when the amount is unknown", async () => {
|
|
634
|
-
const stripe = makeStripe();
|
|
635
|
-
stripe.checkout.sessions.create.mockResolvedValue(
|
|
636
|
-
sessionResponse({ id: "cs_pay_defer" }),
|
|
637
|
-
);
|
|
638
|
-
const ctx = makeCtx();
|
|
639
|
-
|
|
640
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
641
|
-
userId: "buyer_1",
|
|
642
|
-
stripePriceId: "price_1",
|
|
643
|
-
mode: "payment",
|
|
644
|
-
returnUrl: "https://app.test/return",
|
|
645
|
-
accountId: "acct_buyer",
|
|
646
|
-
destinationAccountId: "acct_store",
|
|
647
|
-
feeConfig: { percent: 10 },
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
651
|
-
expect(createArg.payment_intent_data.transfer_data).toEqual({
|
|
652
|
-
destination: "acct_store",
|
|
653
|
-
});
|
|
654
|
-
expect(
|
|
655
|
-
createArg.payment_intent_data.application_fee_amount,
|
|
656
|
-
).toBeUndefined();
|
|
657
|
-
expect(createArg.payment_intent_data.metadata.bsFeeMode).toBe("per_charge");
|
|
658
|
-
});
|
|
659
|
-
|
|
660
|
-
it("adds no transfer_data or fees without a destinationAccountId", async () => {
|
|
661
|
-
const stripe = makeStripe();
|
|
662
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
663
|
-
const ctx = makeCtx();
|
|
664
|
-
|
|
665
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
666
|
-
userId: "user_1",
|
|
667
|
-
stripePriceId: "price_1",
|
|
668
|
-
mode: "payment",
|
|
669
|
-
returnUrl: "https://app.test/return",
|
|
670
|
-
feeConfig: { percent: 10 },
|
|
671
|
-
amount: 10000,
|
|
672
|
-
});
|
|
673
|
-
|
|
674
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
675
|
-
expect(createArg.payment_intent_data).toEqual({
|
|
676
|
-
metadata: { userId: "user_1" },
|
|
677
|
-
});
|
|
678
|
-
});
|
|
679
|
-
});
|
|
680
|
-
|
|
681
|
-
describe("createCheckoutSession — N-recipient split (BTS-21)", () => {
|
|
682
|
-
it("routes a >1 split (payment mode) via separate charges (no transfer_data/application_fee)", async () => {
|
|
683
|
-
const stripe = makeStripe();
|
|
684
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
685
|
-
const ctx = makeCtx();
|
|
686
|
-
const split = [
|
|
687
|
-
{
|
|
688
|
-
destinationAccountId: "acct_store",
|
|
689
|
-
role: "store" as const,
|
|
690
|
-
percent: 80,
|
|
691
|
-
},
|
|
692
|
-
{
|
|
693
|
-
destinationAccountId: "acct_aff",
|
|
694
|
-
role: "affiliate" as const,
|
|
695
|
-
percent: 5,
|
|
696
|
-
},
|
|
697
|
-
];
|
|
698
|
-
|
|
699
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
700
|
-
userId: "buyer_1",
|
|
701
|
-
stripePriceId: "price_1",
|
|
702
|
-
mode: "payment",
|
|
703
|
-
returnUrl: "https://app.test/return",
|
|
704
|
-
accountId: "acct_buyer",
|
|
705
|
-
split,
|
|
706
|
-
feeConfig: { percent: 10 },
|
|
707
|
-
});
|
|
708
|
-
|
|
709
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
710
|
-
expect(createArg.payment_intent_data.transfer_data).toBeUndefined();
|
|
711
|
-
expect(createArg.payment_intent_data.metadata.bsChargeType).toBe(
|
|
712
|
-
"separate",
|
|
713
|
-
);
|
|
714
|
-
expect(
|
|
715
|
-
JSON.parse(createArg.payment_intent_data.metadata.bsSplit),
|
|
716
|
-
).toHaveLength(2);
|
|
717
|
-
|
|
718
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
719
|
-
expect(upsertArgs.chargeType).toBe("separate");
|
|
720
|
-
expect(upsertArgs.splitRecipients).toHaveLength(2);
|
|
721
|
-
});
|
|
722
|
-
|
|
723
|
-
it("routes a >1 split on a subscription via separate charges (markers on subscription_data)", async () => {
|
|
724
|
-
const stripe = makeStripe();
|
|
725
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
726
|
-
const ctx = makeCtx();
|
|
727
|
-
|
|
728
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
729
|
-
userId: "buyer_1",
|
|
730
|
-
stripePriceId: "price_1",
|
|
731
|
-
mode: "subscription",
|
|
732
|
-
returnUrl: "https://app.test/return",
|
|
733
|
-
accountId: "acct_buyer",
|
|
734
|
-
split: [
|
|
735
|
-
{ destinationAccountId: "acct_store", role: "store", percent: 80 },
|
|
736
|
-
{ destinationAccountId: "acct_aff", role: "affiliate", percent: 5 },
|
|
737
|
-
],
|
|
738
|
-
feeConfig: { percent: 10 },
|
|
739
|
-
});
|
|
740
|
-
|
|
741
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
742
|
-
expect(createArg.subscription_data.transfer_data).toBeUndefined();
|
|
743
|
-
expect(createArg.subscription_data.application_fee_percent).toBeUndefined();
|
|
744
|
-
expect(createArg.subscription_data.metadata.bsChargeType).toBe("separate");
|
|
745
|
-
expect(
|
|
746
|
-
JSON.parse(createArg.subscription_data.metadata.bsSplit),
|
|
747
|
-
).toHaveLength(2);
|
|
748
|
-
|
|
749
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
750
|
-
expect(upsertArgs.chargeType).toBe("separate");
|
|
751
|
-
expect(upsertArgs.splitRecipients).toHaveLength(2);
|
|
752
|
-
});
|
|
753
|
-
|
|
754
|
-
it("treats a single-recipient split as a destination charge", async () => {
|
|
755
|
-
const stripe = makeStripe();
|
|
756
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
757
|
-
const ctx = makeCtx();
|
|
758
|
-
|
|
759
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
760
|
-
userId: "buyer_1",
|
|
761
|
-
stripePriceId: "price_1",
|
|
762
|
-
mode: "subscription",
|
|
763
|
-
returnUrl: "https://app.test/return",
|
|
764
|
-
accountId: "acct_buyer",
|
|
765
|
-
split: [
|
|
766
|
-
{ destinationAccountId: "acct_store", role: "store", percent: 90 },
|
|
767
|
-
],
|
|
768
|
-
feeConfig: { percent: 10 },
|
|
769
|
-
});
|
|
770
|
-
|
|
771
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
772
|
-
expect(createArg.subscription_data.transfer_data).toEqual({
|
|
773
|
-
destination: "acct_store",
|
|
774
|
-
});
|
|
775
|
-
expect(createArg.subscription_data.application_fee_percent).toBe(10);
|
|
776
|
-
const [, upsertArgs] = ctx.runMutation.mock.calls[0];
|
|
777
|
-
expect(upsertArgs.chargeType).toBe("destination");
|
|
778
|
-
});
|
|
779
|
-
|
|
780
|
-
it("routes a >1 split in payment mode via separate charges", async () => {
|
|
781
|
-
const stripe = makeStripe();
|
|
782
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
783
|
-
const ctx = makeCtx();
|
|
784
|
-
|
|
785
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
786
|
-
userId: "buyer_1",
|
|
787
|
-
stripePriceId: "price_1",
|
|
788
|
-
mode: "payment",
|
|
789
|
-
returnUrl: "https://app.test/return",
|
|
790
|
-
accountId: "acct_buyer",
|
|
791
|
-
split: [
|
|
792
|
-
{ destinationAccountId: "acct_store", role: "store", amount: 8000 },
|
|
793
|
-
{ destinationAccountId: "acct_aff", role: "affiliate", amount: 1000 },
|
|
794
|
-
],
|
|
795
|
-
});
|
|
796
|
-
|
|
797
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
798
|
-
expect(createArg.payment_intent_data.transfer_data).toBeUndefined();
|
|
799
|
-
expect(createArg.payment_intent_data.metadata.bsChargeType).toBe(
|
|
800
|
-
"separate",
|
|
801
|
-
);
|
|
802
|
-
});
|
|
803
|
-
|
|
804
|
-
it("rejects split/destination/fee in setup mode", async () => {
|
|
805
|
-
const stripe = makeStripe();
|
|
806
|
-
const ctx = makeCtx();
|
|
807
|
-
|
|
808
|
-
await expect(
|
|
809
|
-
createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
810
|
-
userId: "buyer_1",
|
|
811
|
-
stripePriceId: "price_1",
|
|
812
|
-
mode: "setup",
|
|
813
|
-
returnUrl: "https://app.test/return",
|
|
814
|
-
accountId: "acct_buyer",
|
|
815
|
-
split: [
|
|
816
|
-
{ destinationAccountId: "acct_store", role: "store", amount: 100 },
|
|
817
|
-
],
|
|
818
|
-
}),
|
|
819
|
-
).rejects.toThrow(/setup/i);
|
|
820
|
-
expect(stripe.checkout.sessions.create).not.toHaveBeenCalled();
|
|
821
|
-
});
|
|
822
|
-
|
|
823
|
-
it("strips reserved bs* keys from caller metadata so they can't forge split instructions", async () => {
|
|
824
|
-
const stripe = makeStripe();
|
|
825
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
826
|
-
const ctx = makeCtx();
|
|
827
|
-
|
|
828
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
829
|
-
userId: "buyer_1",
|
|
830
|
-
stripePriceId: "price_1",
|
|
831
|
-
mode: "payment",
|
|
832
|
-
returnUrl: "https://app.test/return",
|
|
833
|
-
accountId: "acct_buyer",
|
|
834
|
-
// A non-split caller trying to forge webhook instructions.
|
|
835
|
-
metadata: {
|
|
836
|
-
bsChargeType: "separate",
|
|
837
|
-
bsSplit:
|
|
838
|
-
'[{"destinationAccountId":"acct_evil","role":"store","amount":9999}]',
|
|
839
|
-
plan: "pro",
|
|
840
|
-
},
|
|
841
|
-
});
|
|
842
|
-
|
|
843
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
844
|
-
expect(createArg.metadata.bsChargeType).toBeUndefined();
|
|
845
|
-
expect(createArg.metadata.bsSplit).toBeUndefined();
|
|
846
|
-
expect(createArg.metadata.plan).toBe("pro"); // legit keys kept
|
|
847
|
-
expect(createArg.payment_intent_data.metadata.bsChargeType).toBeUndefined();
|
|
848
|
-
});
|
|
849
|
-
|
|
850
|
-
it("rejects a split whose percents exceed 100", async () => {
|
|
851
|
-
const stripe = makeStripe();
|
|
852
|
-
const ctx = makeCtx();
|
|
853
|
-
|
|
854
|
-
await expect(
|
|
855
|
-
createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
856
|
-
userId: "buyer_1",
|
|
857
|
-
stripePriceId: "price_1",
|
|
858
|
-
mode: "subscription",
|
|
859
|
-
returnUrl: "https://app.test/return",
|
|
860
|
-
accountId: "acct_buyer",
|
|
861
|
-
split: [
|
|
862
|
-
{ destinationAccountId: "acct_store", role: "store", percent: 70 },
|
|
863
|
-
{ destinationAccountId: "acct_aff", role: "affiliate", percent: 40 },
|
|
864
|
-
],
|
|
865
|
-
}),
|
|
866
|
-
).rejects.toThrow();
|
|
867
|
-
expect(stripe.checkout.sessions.create).not.toHaveBeenCalled();
|
|
868
|
-
});
|
|
869
|
-
});
|
|
870
|
-
|
|
871
|
-
describe("createCheckoutSession — price-on-platform validation (BTS-15)", () => {
|
|
872
|
-
it("rejects a destination charge whose price belongs to a connected account", async () => {
|
|
873
|
-
const stripe = makeStripe();
|
|
874
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
875
|
-
const ctx = routedCtx({
|
|
876
|
-
"products/queries/getPriceByStripeId": {
|
|
877
|
-
stripePriceId: "price_1",
|
|
878
|
-
stripeProductId: "prod_1",
|
|
879
|
-
},
|
|
880
|
-
"products/queries/getProductByStripeId": {
|
|
881
|
-
stripeProductId: "prod_1",
|
|
882
|
-
accountId: "acct_seller", // connected-account-owned → invalid
|
|
883
|
-
},
|
|
884
|
-
});
|
|
885
|
-
|
|
886
|
-
await expect(
|
|
887
|
-
createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
888
|
-
userId: "buyer_1",
|
|
889
|
-
stripePriceId: "price_1",
|
|
890
|
-
mode: "subscription",
|
|
891
|
-
returnUrl: "https://app.test/return",
|
|
892
|
-
accountId: "acct_buyer",
|
|
893
|
-
destinationAccountId: "acct_store",
|
|
894
|
-
feeConfig: { percent: 10 },
|
|
895
|
-
}),
|
|
896
|
-
).rejects.toThrow(/platform/i);
|
|
897
|
-
expect(stripe.checkout.sessions.create).not.toHaveBeenCalled();
|
|
898
|
-
// The catalog lookups use the right ids (price → its product).
|
|
899
|
-
// The catalog lookups use the right ids (price → its product). Positions
|
|
900
|
-
// are not asserted: the BTS-32 statement-descriptor account lookup also
|
|
901
|
-
// runs during session creation.
|
|
902
|
-
expect(ctx.runQuery).toHaveBeenCalledWith(expect.any(Object), {
|
|
903
|
-
stripePriceId: "price_1",
|
|
904
|
-
});
|
|
905
|
-
expect(ctx.runQuery).toHaveBeenCalledWith(expect.any(Object), {
|
|
906
|
-
stripeProductId: "prod_1",
|
|
907
|
-
});
|
|
908
|
-
});
|
|
909
|
-
|
|
910
|
-
it("allows a platform price tagged to a store in the component catalog", async () => {
|
|
911
|
-
const stripe = makeStripe();
|
|
912
|
-
stripe.prices.retrieve.mockResolvedValue({ id: "price_1" });
|
|
913
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
914
|
-
const ctx = routedCtx({
|
|
915
|
-
"products/queries/getPriceByStripeId": { stripeProductId: "prod_1" },
|
|
916
|
-
"products/queries/getProductByStripeId": { accountId: "acct_store" },
|
|
917
|
-
});
|
|
918
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
919
|
-
userId: "buyer_1",
|
|
920
|
-
stripePriceId: "price_1",
|
|
921
|
-
mode: "payment",
|
|
922
|
-
returnUrl: "https://app.test/return",
|
|
923
|
-
destinationAccountId: "acct_store",
|
|
924
|
-
});
|
|
925
|
-
expect(stripe.prices.retrieve).toHaveBeenCalledWith("price_1");
|
|
926
|
-
expect(stripe.checkout.sessions.create).toHaveBeenCalled();
|
|
927
|
-
});
|
|
928
|
-
|
|
929
|
-
it("allows a destination charge for a platform-owned price", async () => {
|
|
930
|
-
const stripe = makeStripe();
|
|
931
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
932
|
-
const ctx = routedCtx({
|
|
933
|
-
"products/queries/getPriceByStripeId": {
|
|
934
|
-
stripePriceId: "price_1",
|
|
935
|
-
stripeProductId: "prod_1",
|
|
936
|
-
},
|
|
937
|
-
"products/queries/getProductByStripeId": {
|
|
938
|
-
stripeProductId: "prod_1",
|
|
939
|
-
// no accountId → platform-owned
|
|
940
|
-
},
|
|
941
|
-
});
|
|
942
|
-
|
|
943
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
944
|
-
userId: "buyer_1",
|
|
945
|
-
stripePriceId: "price_1",
|
|
946
|
-
mode: "subscription",
|
|
947
|
-
returnUrl: "https://app.test/return",
|
|
948
|
-
accountId: "acct_buyer",
|
|
949
|
-
destinationAccountId: "acct_store",
|
|
950
|
-
feeConfig: { percent: 10 },
|
|
951
|
-
});
|
|
952
|
-
// The catalog lookups use the right ids (price → its product). Positions
|
|
953
|
-
// are not asserted: the BTS-32 statement-descriptor account lookup also
|
|
954
|
-
// runs during session creation.
|
|
955
|
-
expect(ctx.runQuery).toHaveBeenCalledWith(expect.any(Object), {
|
|
956
|
-
stripePriceId: "price_1",
|
|
957
|
-
});
|
|
958
|
-
expect(ctx.runQuery).toHaveBeenCalledWith(expect.any(Object), {
|
|
959
|
-
stripeProductId: "prod_1",
|
|
960
|
-
});
|
|
961
|
-
expect(stripe.checkout.sessions.create).toHaveBeenCalled();
|
|
962
|
-
});
|
|
963
|
-
|
|
964
|
-
it("validates the FINAL request — sessionOverrides can't inject a destination to bypass the check", async () => {
|
|
965
|
-
const stripe = makeStripe();
|
|
966
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
967
|
-
const ctx = routedCtx({
|
|
968
|
-
"products/queries/getPriceByStripeId": {
|
|
969
|
-
stripePriceId: "price_1",
|
|
970
|
-
stripeProductId: "prod_1",
|
|
971
|
-
},
|
|
972
|
-
"products/queries/getProductByStripeId": {
|
|
973
|
-
stripeProductId: "prod_1",
|
|
974
|
-
accountId: "acct_seller", // connected-account-owned → invalid
|
|
975
|
-
},
|
|
976
|
-
});
|
|
977
|
-
|
|
978
|
-
await expect(
|
|
979
|
-
createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
980
|
-
userId: "buyer_1",
|
|
981
|
-
stripePriceId: "price_1",
|
|
982
|
-
mode: "subscription",
|
|
983
|
-
returnUrl: "https://app.test/return",
|
|
984
|
-
accountId: "acct_buyer",
|
|
985
|
-
// No destinationAccountId on opts — but overrides inject one.
|
|
986
|
-
sessionOverrides: {
|
|
987
|
-
subscription_data: { transfer_data: { destination: "acct_store" } },
|
|
988
|
-
},
|
|
989
|
-
}),
|
|
990
|
-
).rejects.toThrow(/platform/i);
|
|
991
|
-
expect(stripe.checkout.sessions.create).not.toHaveBeenCalled();
|
|
992
|
-
});
|
|
993
|
-
|
|
994
|
-
it("skips validation when there is no destination (plain checkout)", async () => {
|
|
995
|
-
const stripe = makeStripe();
|
|
996
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
997
|
-
const ctx = makeCtx();
|
|
998
|
-
|
|
999
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
1000
|
-
userId: "user_1",
|
|
1001
|
-
stripePriceId: "price_1",
|
|
1002
|
-
mode: "subscription",
|
|
1003
|
-
returnUrl: "https://app.test/return",
|
|
1004
|
-
});
|
|
1005
|
-
// No price lookup performed for a non-destination checkout.
|
|
1006
|
-
expect(ctx.runQuery).not.toHaveBeenCalled();
|
|
1007
|
-
expect(stripe.checkout.sessions.create).toHaveBeenCalled();
|
|
1008
|
-
});
|
|
1009
|
-
});
|
|
1010
|
-
|
|
1011
|
-
describe("getCheckoutSession", () => {
|
|
1012
|
-
it("queries by internal session id and returns the row", async () => {
|
|
1013
|
-
const ctx = makeCtx({ stripeSessionId: "cs_1" });
|
|
1014
|
-
const result = await getCheckoutSession(makeComponent(), ctx, {
|
|
1015
|
-
sessionId: "internal_1",
|
|
1016
|
-
});
|
|
1017
|
-
|
|
1018
|
-
expect(result).toEqual({ stripeSessionId: "cs_1" });
|
|
1019
|
-
const [ref, args] = ctx.runQuery.mock.calls[0];
|
|
1020
|
-
expect(ref).toEqual({
|
|
1021
|
-
[TO_REF]: "betterStripe/billing/queries/getCheckoutSession",
|
|
1022
|
-
});
|
|
1023
|
-
expect(args).toEqual({ sessionId: "internal_1" });
|
|
1024
|
-
});
|
|
1025
|
-
|
|
1026
|
-
it("returns null when the session does not exist", async () => {
|
|
1027
|
-
const ctx = makeCtx(null);
|
|
1028
|
-
const result = await getCheckoutSession(makeComponent(), ctx, {
|
|
1029
|
-
sessionId: "missing",
|
|
1030
|
-
});
|
|
1031
|
-
expect(result).toBeNull();
|
|
1032
|
-
});
|
|
1033
|
-
});
|
|
1034
|
-
|
|
1035
|
-
describe("getCheckoutSessionByStripeId", () => {
|
|
1036
|
-
it("queries by stripe session id and returns the row", async () => {
|
|
1037
|
-
const ctx = makeCtx({ stripeSessionId: "cs_abc" });
|
|
1038
|
-
const result = await getCheckoutSessionByStripeId(makeComponent(), ctx, {
|
|
1039
|
-
stripeSessionId: "cs_abc",
|
|
1040
|
-
});
|
|
1041
|
-
|
|
1042
|
-
expect(result).toEqual({ stripeSessionId: "cs_abc" });
|
|
1043
|
-
const [ref, args] = ctx.runQuery.mock.calls[0];
|
|
1044
|
-
expect(ref).toEqual({
|
|
1045
|
-
[TO_REF]: "betterStripe/billing/queries/getCheckoutSessionByStripeId",
|
|
1046
|
-
});
|
|
1047
|
-
expect(args).toEqual({ stripeSessionId: "cs_abc" });
|
|
1048
|
-
});
|
|
1049
|
-
});
|
|
1050
|
-
|
|
1051
|
-
describe("listCheckoutSessionsByUser", () => {
|
|
1052
|
-
it("forwards userId and optional status filter and returns the rows", async () => {
|
|
1053
|
-
const ctx = makeCtx([
|
|
1054
|
-
{ stripeSessionId: "cs_a" },
|
|
1055
|
-
{ stripeSessionId: "cs_b" },
|
|
1056
|
-
]);
|
|
1057
|
-
const result = await listCheckoutSessionsByUser(makeComponent(), ctx, {
|
|
1058
|
-
userId: "user_1",
|
|
1059
|
-
status: "complete",
|
|
1060
|
-
});
|
|
1061
|
-
|
|
1062
|
-
expect(result).toHaveLength(2);
|
|
1063
|
-
const [ref, args] = ctx.runQuery.mock.calls[0];
|
|
1064
|
-
expect(ref).toEqual({
|
|
1065
|
-
[TO_REF]: "betterStripe/billing/queries/listCheckoutSessionsByUser",
|
|
1066
|
-
});
|
|
1067
|
-
expect(args).toEqual({ userId: "user_1", status: "complete" });
|
|
1068
|
-
});
|
|
1069
|
-
});
|
|
1070
|
-
|
|
1071
|
-
describe("upsertCheckoutSession", () => {
|
|
1072
|
-
it("runs the upsert mutation with the given opts and returns null", async () => {
|
|
1073
|
-
const ctx = makeCtx();
|
|
1074
|
-
const result = await upsertCheckoutSession(makeComponent(), ctx, {
|
|
1075
|
-
stripeSessionId: "cs_up",
|
|
1076
|
-
userId: "user_1",
|
|
1077
|
-
mode: "payment",
|
|
1078
|
-
status: "complete",
|
|
1079
|
-
});
|
|
1080
|
-
|
|
1081
|
-
expect(result).toBeNull();
|
|
1082
|
-
const [ref, args] = ctx.runMutation.mock.calls[0];
|
|
1083
|
-
expect(ref).toEqual({
|
|
1084
|
-
[TO_REF]: "betterStripe/billing/mutations/upsertCheckoutSession",
|
|
1085
|
-
});
|
|
1086
|
-
expect(args).toEqual({
|
|
1087
|
-
stripeSessionId: "cs_up",
|
|
1088
|
-
userId: "user_1",
|
|
1089
|
-
mode: "payment",
|
|
1090
|
-
status: "complete",
|
|
1091
|
-
});
|
|
1092
|
-
});
|
|
1093
|
-
|
|
1094
|
-
it("throws when ctx has no runMutation", async () => {
|
|
1095
|
-
const ctx = { runQuery: vi.fn() } as unknown as RunCtx;
|
|
1096
|
-
await expect(
|
|
1097
|
-
upsertCheckoutSession(makeComponent(), ctx, {
|
|
1098
|
-
stripeSessionId: "cs_up",
|
|
1099
|
-
userId: "user_1",
|
|
1100
|
-
mode: "payment",
|
|
1101
|
-
status: "complete",
|
|
1102
|
-
}),
|
|
1103
|
-
).rejects.toThrow(/requires a Convex ctx with runMutation/);
|
|
1104
|
-
});
|
|
1105
|
-
});
|
|
1106
|
-
|
|
1107
|
-
describe("updateCheckoutSession", () => {
|
|
1108
|
-
it("updates the Stripe session metadata and returns the session", async () => {
|
|
1109
|
-
const stripe = makeStripe();
|
|
1110
|
-
const updated = { id: "cs_u", metadata: { plan: "pro" } };
|
|
1111
|
-
stripe.checkout.sessions.update.mockResolvedValue(updated);
|
|
1112
|
-
const ctx = makeCtx();
|
|
1113
|
-
|
|
1114
|
-
const result = await updateCheckoutSession(asStripe(stripe), ctx, {
|
|
1115
|
-
stripeSessionId: "cs_u",
|
|
1116
|
-
metadata: { plan: "pro" },
|
|
1117
|
-
});
|
|
1118
|
-
|
|
1119
|
-
expect(stripe.checkout.sessions.update).toHaveBeenCalledWith("cs_u", {
|
|
1120
|
-
metadata: { plan: "pro" },
|
|
1121
|
-
});
|
|
1122
|
-
expect(result).toBe(updated);
|
|
1123
|
-
});
|
|
1124
|
-
|
|
1125
|
-
it("passes undefined metadata through when none is provided", async () => {
|
|
1126
|
-
const stripe = makeStripe();
|
|
1127
|
-
stripe.checkout.sessions.update.mockResolvedValue({ id: "cs_u2" });
|
|
1128
|
-
const ctx = makeCtx();
|
|
1129
|
-
|
|
1130
|
-
await updateCheckoutSession(asStripe(stripe), ctx, {
|
|
1131
|
-
stripeSessionId: "cs_u2",
|
|
1132
|
-
});
|
|
1133
|
-
|
|
1134
|
-
expect(stripe.checkout.sessions.update).toHaveBeenCalledWith("cs_u2", {
|
|
1135
|
-
metadata: undefined,
|
|
1136
|
-
});
|
|
1137
|
-
});
|
|
1138
|
-
});
|
|
1139
|
-
|
|
1140
|
-
describe("createCheckoutSession — per-store statement descriptor (BTS-32)", () => {
|
|
1141
|
-
const storeAccount = (statementDescriptor?: string) => ({
|
|
1142
|
-
_id: "doc_acct",
|
|
1143
|
-
stripeAccountId: "acct_store",
|
|
1144
|
-
userId: "seller_1",
|
|
1145
|
-
...(statementDescriptor ? { statementDescriptor } : {}),
|
|
1146
|
-
});
|
|
1147
|
-
|
|
1148
|
-
it("payment mode: sets statement_descriptor_suffix from the store's account record", async () => {
|
|
1149
|
-
const stripe = makeStripe();
|
|
1150
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
1151
|
-
const ctx = routedCtx({
|
|
1152
|
-
"core/queries/getAccountByStripeId": storeAccount("MAYAS FITNESS"),
|
|
1153
|
-
});
|
|
1154
|
-
|
|
1155
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
1156
|
-
userId: "buyer_1",
|
|
1157
|
-
stripePriceId: "price_1",
|
|
1158
|
-
mode: "payment",
|
|
1159
|
-
returnUrl: "https://app.test/return",
|
|
1160
|
-
destinationAccountId: "acct_store",
|
|
1161
|
-
defaultStatementDescriptorSuffix: "PLATFORM DEF",
|
|
1162
|
-
});
|
|
1163
|
-
|
|
1164
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
1165
|
-
expect(createArg.payment_intent_data.statement_descriptor_suffix).toBe(
|
|
1166
|
-
"MAYAS FITNESS",
|
|
1167
|
-
);
|
|
1168
|
-
});
|
|
1169
|
-
|
|
1170
|
-
it("payment mode: falls back to the configured default when the store has no suffix", async () => {
|
|
1171
|
-
const stripe = makeStripe();
|
|
1172
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
1173
|
-
const ctx = routedCtx({
|
|
1174
|
-
"core/queries/getAccountByStripeId": storeAccount(undefined),
|
|
1175
|
-
});
|
|
1176
|
-
|
|
1177
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
1178
|
-
userId: "buyer_1",
|
|
1179
|
-
stripePriceId: "price_1",
|
|
1180
|
-
mode: "payment",
|
|
1181
|
-
returnUrl: "https://app.test/return",
|
|
1182
|
-
destinationAccountId: "acct_store",
|
|
1183
|
-
defaultStatementDescriptorSuffix: "PLATFORM DEF",
|
|
1184
|
-
});
|
|
1185
|
-
|
|
1186
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
1187
|
-
expect(createArg.payment_intent_data.statement_descriptor_suffix).toBe(
|
|
1188
|
-
"PLATFORM DEF",
|
|
1189
|
-
);
|
|
1190
|
-
});
|
|
1191
|
-
|
|
1192
|
-
it("payment mode: omits the suffix when neither store nor default has one", async () => {
|
|
1193
|
-
const stripe = makeStripe();
|
|
1194
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
1195
|
-
const ctx = routedCtx({
|
|
1196
|
-
"core/queries/getAccountByStripeId": storeAccount(undefined),
|
|
1197
|
-
});
|
|
1198
|
-
|
|
1199
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
1200
|
-
userId: "buyer_1",
|
|
1201
|
-
stripePriceId: "price_1",
|
|
1202
|
-
mode: "payment",
|
|
1203
|
-
returnUrl: "https://app.test/return",
|
|
1204
|
-
destinationAccountId: "acct_store",
|
|
1205
|
-
});
|
|
1206
|
-
|
|
1207
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
1208
|
-
expect("statement_descriptor_suffix" in createArg.payment_intent_data).toBe(
|
|
1209
|
-
false,
|
|
1210
|
-
);
|
|
1211
|
-
});
|
|
1212
|
-
|
|
1213
|
-
it("subscription mode: stashes bsStatementDescriptor for the invoice.created processor without clobbering fee markers", async () => {
|
|
1214
|
-
const stripe = makeStripe();
|
|
1215
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
1216
|
-
const ctx = routedCtx({
|
|
1217
|
-
"core/queries/getAccountByStripeId": storeAccount("MAYAS FITNESS"),
|
|
1218
|
-
});
|
|
1219
|
-
|
|
1220
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
1221
|
-
userId: "buyer_1",
|
|
1222
|
-
stripePriceId: "price_1",
|
|
1223
|
-
mode: "subscription",
|
|
1224
|
-
returnUrl: "https://app.test/return",
|
|
1225
|
-
destinationAccountId: "acct_store",
|
|
1226
|
-
feeConfig: { percent: 2.9, fixed: 30 },
|
|
1227
|
-
});
|
|
1228
|
-
|
|
1229
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
1230
|
-
// Both markers coexist: the per-invoice fee flag AND the descriptor stash.
|
|
1231
|
-
expect(createArg.subscription_data.metadata.bsFeeMode).toBe("per_invoice");
|
|
1232
|
-
expect(createArg.subscription_data.metadata.bsStatementDescriptor).toBe(
|
|
1233
|
-
"MAYAS FITNESS",
|
|
1234
|
-
);
|
|
1235
|
-
// Not a session/PI-level field in subscription mode.
|
|
1236
|
-
expect(createArg.payment_intent_data).toBeUndefined();
|
|
1237
|
-
});
|
|
1238
|
-
|
|
1239
|
-
it("does not look up accounts or set a suffix for non-destination sales", async () => {
|
|
1240
|
-
const stripe = makeStripe();
|
|
1241
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
1242
|
-
const ctx = routedCtx({});
|
|
1243
|
-
|
|
1244
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
1245
|
-
userId: "buyer_1",
|
|
1246
|
-
stripePriceId: "price_1",
|
|
1247
|
-
mode: "payment",
|
|
1248
|
-
returnUrl: "https://app.test/return",
|
|
1249
|
-
defaultStatementDescriptorSuffix: "PLATFORM DEF",
|
|
1250
|
-
});
|
|
1251
|
-
|
|
1252
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
1253
|
-
expect(
|
|
1254
|
-
createArg.payment_intent_data.statement_descriptor_suffix,
|
|
1255
|
-
).toBeUndefined();
|
|
1256
|
-
const accountLookups = ctx.runQuery.mock.calls.filter((call: unknown[]) =>
|
|
1257
|
-
String((call[0] as Record<symbol, string>)[TO_REF]).includes(
|
|
1258
|
-
"getAccountByStripeId",
|
|
1259
|
-
),
|
|
1260
|
-
);
|
|
1261
|
-
expect(accountLookups).toHaveLength(0);
|
|
1262
|
-
});
|
|
1263
|
-
|
|
1264
|
-
it("callers cannot forge bsStatementDescriptor via metadata (reserved namespace stripped)", async () => {
|
|
1265
|
-
const stripe = makeStripe();
|
|
1266
|
-
stripe.checkout.sessions.create.mockResolvedValue(sessionResponse());
|
|
1267
|
-
const ctx = routedCtx({});
|
|
1268
|
-
|
|
1269
|
-
await createCheckoutSession(asStripe(stripe), makeComponent(), ctx, {
|
|
1270
|
-
userId: "buyer_1",
|
|
1271
|
-
stripePriceId: "price_1",
|
|
1272
|
-
mode: "subscription",
|
|
1273
|
-
returnUrl: "https://app.test/return",
|
|
1274
|
-
metadata: { bsStatementDescriptor: "FORGED" },
|
|
1275
|
-
});
|
|
1276
|
-
|
|
1277
|
-
const createArg = stripe.checkout.sessions.create.mock.calls[0][0];
|
|
1278
|
-
expect(
|
|
1279
|
-
createArg.subscription_data.metadata.bsStatementDescriptor,
|
|
1280
|
-
).toBeUndefined();
|
|
1281
|
-
});
|
|
1282
|
-
});
|