@volter/twin-stripe 2.0.38 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -207
- package/dist/generated/pack-facts.json +94 -0
- package/dist/journeys/coverage.json +596 -0
- package/dist/journeys/customer-life.json +6108 -0
- package/dist/journeys/customer-life.outline.md +371 -0
- package/dist/journeys/decisions.json +677 -0
- package/dist/journeys/demand.json +706 -0
- package/dist/journeys/score.json +853 -0
- package/dist/journeys/unreachable.json +102 -0
- package/dist/journeys/vendor-examples.json +8010 -0
- package/dist/spec/SOURCE.md +18 -0
- package/dist/spec/doc-examples.json +445 -0
- package/dist/spec/fixtures3.json.gz +0 -0
- package/dist/spec/openapi.json.gz +0 -0
- package/dist/spec/patches.json +34 -0
- package/dist/spec/sources.json +306 -0
- package/dist/src/cli.d.ts +0 -1
- package/dist/src/cli.js +11 -31
- package/dist/src/engine/after-payment.d.ts +8 -0
- package/dist/src/engine/after-payment.js +27 -0
- package/dist/src/engine/apps-secrets.d.ts +1 -0
- package/dist/src/engine/apps-secrets.js +3 -0
- package/dist/src/engine/balance.d.ts +5 -0
- package/dist/src/engine/balance.js +15 -0
- package/dist/src/engine/checkout.d.ts +24 -0
- package/dist/src/engine/checkout.js +30 -0
- package/dist/src/engine/common.d.ts +19 -0
- package/dist/src/engine/common.js +34 -0
- package/dist/src/engine/connect.d.ts +45 -0
- package/dist/src/engine/connect.js +108 -0
- package/dist/src/engine/customers.d.ts +4 -0
- package/dist/src/engine/customers.js +8 -0
- package/dist/src/engine/display.d.ts +11 -0
- package/dist/src/engine/display.js +13 -0
- package/dist/src/engine/files.d.ts +11 -0
- package/dist/src/engine/files.js +23 -0
- package/dist/src/engine/invoices.d.ts +21 -0
- package/dist/src/engine/invoices.js +84 -0
- package/dist/src/engine/issuing.d.ts +33 -0
- package/dist/src/engine/issuing.js +54 -0
- package/dist/src/engine/ledger.d.ts +8 -0
- package/dist/src/engine/ledger.js +8 -0
- package/dist/src/engine/oauth.d.ts +4 -0
- package/dist/src/engine/oauth.js +24 -0
- package/dist/src/engine/onboarding.d.ts +13 -0
- package/dist/src/engine/onboarding.js +42 -0
- package/dist/src/{stripe-params.d.ts → engine/params.d.ts} +20 -3
- package/dist/src/{stripe-params.js → engine/params.js} +7 -60
- package/dist/src/engine/payment-intents.d.ts +10 -0
- package/dist/src/engine/payment-intents.js +27 -0
- package/dist/src/engine/payment-methods.d.ts +16 -0
- package/dist/src/engine/payment-methods.js +22 -0
- package/dist/src/engine/radar.d.ts +2 -0
- package/dist/src/engine/radar.js +5 -0
- package/dist/src/engine/refunds.d.ts +1 -0
- package/dist/src/engine/refunds.js +3 -0
- package/dist/src/engine/renewals.d.ts +36 -0
- package/dist/src/engine/renewals.js +65 -0
- package/dist/src/{stripe-twin.d.ts → engine/stripe.d.ts} +12 -45
- package/dist/src/{stripe-twin.js → engine/stripe.js} +53 -387
- package/dist/src/engine/subscriptions.d.ts +11 -0
- package/dist/src/engine/subscriptions.js +30 -0
- package/dist/src/engine/transfers.d.ts +2 -0
- package/dist/src/engine/transfers.js +1 -0
- package/dist/src/{stripe-version.d.ts → engine/version.d.ts} +0 -2
- package/dist/src/{stripe-version.js → engine/version.js} +21 -9
- package/dist/src/engine/webhook-endpoints.d.ts +1 -0
- package/dist/src/engine/webhook-endpoints.js +12 -0
- package/dist/src/engine/webhooks.d.ts +31 -0
- package/dist/src/engine/webhooks.js +68 -0
- package/dist/src/fetch.d.ts +2 -0
- package/dist/src/fetch.js +26 -0
- package/dist/src/generated/surface.gen.json +1 -1
- package/dist/src/generated/ui.gen.json +1 -1
- package/dist/src/index.d.ts +5 -14
- package/dist/src/index.js +10 -75
- package/dist/src/manifest.js +478 -876
- package/dist/src/screens/billing-portal.d.ts +3 -0
- package/dist/src/screens/{portal.js → billing-portal.js} +32 -58
- package/dist/src/screens/checkout-js.d.ts +2 -0
- package/dist/src/screens/checkout-js.js +84 -0
- package/dist/src/screens/checkout.d.ts +2 -31
- package/dist/src/screens/checkout.js +32 -121
- package/dist/src/screens/connect-onboarding.d.ts +3 -0
- package/dist/src/screens/{onboarding.js → connect-onboarding.js} +38 -104
- package/dist/src/screens/dashboard.d.ts +3 -0
- package/dist/src/screens/dashboard.js +116 -0
- package/dist/src/screens/shared.d.ts +27 -0
- package/dist/src/screens/shared.js +87 -0
- package/dist/src/screens/stripe-js.d.ts +3 -0
- package/dist/src/screens/stripe-js.js +95 -0
- package/dist/src/semantics/account.d.ts +2 -0
- package/dist/src/semantics/account.js +8 -0
- package/dist/src/semantics/account_links.d.ts +2 -0
- package/dist/src/semantics/account_links.js +22 -0
- package/dist/src/semantics/accounts.d.ts +4 -0
- package/dist/src/semantics/accounts.js +40 -0
- package/dist/src/semantics/apps.d.ts +4 -0
- package/dist/src/semantics/{apps-secrets.js → apps.js} +14 -26
- package/dist/src/semantics/around.d.ts +2 -0
- package/dist/src/semantics/around.js +13 -0
- package/dist/src/semantics/balance.d.ts +2 -11
- package/dist/src/semantics/balance.js +3 -194
- package/dist/src/semantics/balance_transactions.d.ts +2 -0
- package/dist/src/semantics/balance_transactions.js +15 -0
- package/dist/src/semantics/billing_portal.d.ts +4 -0
- package/dist/src/semantics/billing_portal.js +36 -0
- package/dist/src/semantics/charges.d.ts +3 -28
- package/dist/src/semantics/charges.js +5 -202
- package/dist/src/semantics/checkout.d.ts +3 -20
- package/dist/src/semantics/checkout.js +21 -271
- package/dist/src/semantics/clock.d.ts +2 -0
- package/dist/src/semantics/clock.js +15 -0
- package/dist/src/semantics/coupons.d.ts +2 -6
- package/dist/src/semantics/coupons.js +2 -60
- package/dist/src/semantics/customers.d.ts +5 -6
- package/dist/src/semantics/customers.js +47 -413
- package/dist/src/semantics/doors.d.ts +23 -0
- package/dist/src/semantics/doors.js +73 -0
- package/dist/src/semantics/entitlements.d.ts +0 -2
- package/dist/src/semantics/entitlements.js +4 -95
- package/dist/src/semantics/events.d.ts +11 -0
- package/dist/src/semantics/events.js +31 -0
- package/dist/src/semantics/index.d.ts +2 -0
- package/dist/src/semantics/index.js +85 -0
- package/dist/src/semantics/invoice_payments.d.ts +2 -0
- package/dist/src/semantics/invoice_payments.js +12 -0
- package/dist/src/semantics/invoices.d.ts +11 -18
- package/dist/src/semantics/invoices.js +121 -440
- package/dist/src/semantics/issuing.d.ts +6 -13
- package/dist/src/semantics/issuing.js +58 -556
- package/dist/src/semantics/payment_intents.d.ts +3 -0
- package/dist/src/semantics/payment_intents.js +71 -0
- package/dist/src/semantics/payment_methods.d.ts +3 -0
- package/dist/src/semantics/payment_methods.js +15 -0
- package/dist/src/semantics/payouts.d.ts +3 -0
- package/dist/src/semantics/payouts.js +28 -0
- package/dist/src/semantics/prices.d.ts +4 -0
- package/dist/src/semantics/prices.js +37 -0
- package/dist/src/semantics/products.d.ts +4 -2
- package/dist/src/semantics/products.js +12 -138
- package/dist/src/semantics/promotion_codes.d.ts +3 -0
- package/dist/src/semantics/promotion_codes.js +35 -0
- package/dist/src/semantics/radar.d.ts +2 -2
- package/dist/src/semantics/radar.js +5 -74
- package/dist/src/semantics/refunds.d.ts +2 -9
- package/dist/src/semantics/refunds.js +3 -193
- package/dist/src/semantics/shared.d.ts +558 -55
- package/dist/src/semantics/shared.js +2070 -114
- package/dist/src/semantics/states.d.ts +462 -0
- package/dist/src/semantics/states.js +634 -0
- package/dist/src/semantics/subscriptions.d.ts +6 -11
- package/dist/src/semantics/subscriptions.js +37 -530
- package/dist/src/semantics/test_helpers.d.ts +3 -0
- package/dist/src/semantics/test_helpers.js +125 -0
- package/dist/src/semantics/transfers.d.ts +2 -2
- package/dist/src/semantics/transfers.js +6 -101
- package/dist/src/semantics/webhook_endpoints.d.ts +2 -0
- package/dist/src/semantics/webhook_endpoints.js +26 -0
- package/dist/src/server.d.ts +7 -0
- package/dist/src/server.js +7 -0
- package/generated/pack-facts.json +94 -0
- package/journeys/coverage.json +596 -0
- package/journeys/customer-life.json +6108 -0
- package/journeys/customer-life.outline.md +371 -0
- package/journeys/decisions.json +677 -0
- package/journeys/demand.json +706 -0
- package/journeys/score.json +853 -0
- package/journeys/unreachable.json +102 -0
- package/journeys/vendor-examples.json +8010 -0
- package/package.json +11 -20
- package/spec/SOURCE.md +18 -0
- package/spec/doc-examples.json +445 -0
- package/spec/fixtures3.json.gz +0 -0
- package/spec/openapi.json.gz +0 -0
- package/spec/patches.json +34 -0
- package/spec/sources.json +306 -0
- package/src/cli.ts +11 -28
- package/src/engine/after-payment.ts +29 -0
- package/src/engine/apps-secrets.ts +4 -0
- package/src/engine/balance.ts +32 -0
- package/src/engine/checkout.ts +39 -0
- package/src/engine/common.ts +49 -0
- package/src/engine/connect.ts +106 -0
- package/src/engine/customers.ts +10 -0
- package/src/engine/display.ts +18 -0
- package/src/engine/files.ts +28 -0
- package/src/engine/invoices.ts +102 -0
- package/src/engine/issuing.ts +66 -0
- package/src/engine/ledger.ts +48 -0
- package/src/engine/oauth.ts +18 -0
- package/src/engine/onboarding.ts +53 -0
- package/src/{stripe-params.ts → engine/params.ts} +7 -56
- package/src/engine/payment-intents.ts +32 -0
- package/src/engine/payment-methods.ts +24 -0
- package/src/engine/radar.ts +6 -0
- package/src/engine/refunds.ts +3 -0
- package/src/engine/renewals.ts +72 -0
- package/src/{stripe-twin.ts → engine/stripe.ts} +57 -400
- package/src/engine/subscriptions.ts +37 -0
- package/src/engine/transfers.ts +22 -0
- package/src/{stripe-version.ts → engine/version.ts} +19 -10
- package/src/engine/webhook-endpoints.ts +14 -0
- package/src/engine/webhooks.ts +70 -0
- package/src/fetch.ts +27 -0
- package/src/generated/surface.gen.json +1 -1
- package/src/generated/ui.gen.json +1 -1
- package/src/index.ts +10 -116
- package/src/manifest.ts +480 -904
- package/src/screens/{portal.tsx → billing-portal.tsx} +35 -42
- package/src/screens/checkout-js.ts +80 -0
- package/src/screens/checkout.tsx +32 -96
- package/src/screens/{onboarding.tsx → connect-onboarding.tsx} +39 -85
- package/src/screens/dashboard.tsx +178 -0
- package/src/screens/shared.tsx +84 -0
- package/src/screens/stripe-js.ts +102 -0
- package/src/semantics/account.ts +10 -0
- package/src/semantics/account_links.ts +20 -0
- package/src/semantics/accounts.ts +44 -0
- package/src/semantics/{apps-secrets.ts → apps.ts} +17 -33
- package/src/semantics/around.ts +17 -0
- package/src/semantics/balance.ts +6 -208
- package/src/semantics/balance_transactions.ts +18 -0
- package/src/semantics/billing_portal.ts +45 -0
- package/src/semantics/charges.ts +8 -212
- package/src/semantics/checkout.ts +25 -276
- package/src/semantics/clock.ts +19 -0
- package/src/semantics/coupons.ts +5 -68
- package/src/semantics/customers.ts +48 -414
- package/src/semantics/doors.ts +79 -0
- package/src/semantics/entitlements.ts +3 -94
- package/src/semantics/events.ts +37 -0
- package/src/semantics/index.ts +89 -0
- package/src/semantics/invoice_payments.ts +16 -0
- package/src/semantics/invoices.ts +112 -441
- package/src/semantics/issuing.ts +57 -573
- package/src/semantics/payment_intents.ts +76 -0
- package/src/semantics/payment_methods.ts +20 -0
- package/src/semantics/payouts.ts +29 -0
- package/src/semantics/prices.ts +41 -0
- package/src/semantics/products.ts +12 -146
- package/src/semantics/promotion_codes.ts +38 -0
- package/src/semantics/radar.ts +8 -79
- package/src/semantics/refunds.ts +4 -216
- package/src/semantics/shared.ts +2089 -135
- package/src/semantics/states.ts +662 -0
- package/src/semantics/subscriptions.ts +39 -542
- package/src/semantics/test_helpers.ts +119 -0
- package/src/semantics/transfers.ts +10 -132
- package/src/semantics/webhook_endpoints.ts +27 -0
- package/src/server.ts +7 -0
- package/client/dashboard-api.ts +0 -286
- package/client/stripe-mirror.css +0 -277
- package/client/stripe-mirror.tsx +0 -1559
- package/dist/client/dashboard-api.d.ts +0 -107
- package/dist/client/dashboard-api.js +0 -238
- package/dist/client/dashboard-api.ts +0 -286
- package/dist/client/stripe-mirror.bundle.js +0 -236
- package/dist/client/stripe-mirror.css +0 -277
- package/dist/client/stripe-mirror.d.ts +0 -134
- package/dist/client/stripe-mirror.js +0 -859
- package/dist/client/stripe-mirror.tsx +0 -1559
- package/dist/src/screens/connect-oauth.d.ts +0 -27
- package/dist/src/screens/connect-oauth.js +0 -414
- package/dist/src/screens/connect-settings.d.ts +0 -22
- package/dist/src/screens/connect-settings.js +0 -103
- package/dist/src/screens/consent-skin.d.ts +0 -4
- package/dist/src/screens/consent-skin.js +0 -18
- package/dist/src/screens/financial-connections.d.ts +0 -5
- package/dist/src/screens/financial-connections.js +0 -90
- package/dist/src/screens/identity.d.ts +0 -5
- package/dist/src/screens/identity.js +0 -86
- package/dist/src/screens/onboarding.d.ts +0 -13
- package/dist/src/screens/portal.d.ts +0 -5
- package/dist/src/screens/public-details.d.ts +0 -5
- package/dist/src/screens/public-details.js +0 -90
- package/dist/src/semantics/after-payment.d.ts +0 -22
- package/dist/src/semantics/after-payment.js +0 -99
- package/dist/src/semantics/apps-secrets.d.ts +0 -2
- package/dist/src/semantics/billing.d.ts +0 -2
- package/dist/src/semantics/billing.js +0 -220
- package/dist/src/semantics/connect.d.ts +0 -5
- package/dist/src/semantics/connect.js +0 -493
- package/dist/src/semantics/credit-notes.d.ts +0 -2
- package/dist/src/semantics/credit-notes.js +0 -172
- package/dist/src/semantics/disputes.d.ts +0 -2
- package/dist/src/semantics/disputes.js +0 -51
- package/dist/src/semantics/ephemeral-keys.d.ts +0 -2
- package/dist/src/semantics/ephemeral-keys.js +0 -34
- package/dist/src/semantics/files.d.ts +0 -2
- package/dist/src/semantics/files.js +0 -125
- package/dist/src/semantics/ledger.d.ts +0 -59
- package/dist/src/semantics/ledger.js +0 -200
- package/dist/src/semantics/payment-intents.d.ts +0 -18
- package/dist/src/semantics/payment-intents.js +0 -452
- package/dist/src/semantics/payment-links.d.ts +0 -2
- package/dist/src/semantics/payment-links.js +0 -133
- package/dist/src/semantics/payment-methods.d.ts +0 -20
- package/dist/src/semantics/payment-methods.js +0 -140
- package/dist/src/semantics/plans.d.ts +0 -5
- package/dist/src/semantics/plans.js +0 -121
- package/dist/src/semantics/platform.d.ts +0 -9
- package/dist/src/semantics/platform.js +0 -206
- package/dist/src/semantics/renewals.d.ts +0 -47
- package/dist/src/semantics/renewals.js +0 -281
- package/dist/src/semantics/setup-intents.d.ts +0 -2
- package/dist/src/semantics/setup-intents.js +0 -84
- package/dist/src/semantics/subscription-schedules.d.ts +0 -2
- package/dist/src/semantics/subscription-schedules.js +0 -119
- package/dist/src/semantics/tax.d.ts +0 -2
- package/dist/src/semantics/tax.js +0 -197
- package/dist/src/semantics/terminal.d.ts +0 -5
- package/dist/src/semantics/terminal.js +0 -182
- package/dist/src/semantics/test-clocks.d.ts +0 -6
- package/dist/src/semantics/test-clocks.js +0 -73
- package/dist/src/semantics/tokens.d.ts +0 -4
- package/dist/src/semantics/tokens.js +0 -44
- package/dist/src/semantics/treasury.d.ts +0 -2
- package/dist/src/semantics/treasury.js +0 -377
- package/dist/src/semantics/webhook-endpoints.d.ts +0 -3
- package/dist/src/semantics/webhook-endpoints.js +0 -85
- package/dist/src/stripe-budget.d.ts +0 -55
- package/dist/src/stripe-budget.js +0 -155
- package/dist/src/stripe-capabilities.d.ts +0 -3
- package/dist/src/stripe-capabilities.js +0 -5836
- package/dist/src/stripe-conformance.d.ts +0 -43
- package/dist/src/stripe-conformance.js +0 -105
- package/dist/src/stripe-connector.d.ts +0 -161
- package/dist/src/stripe-connector.js +0 -414
- package/dist/src/stripe-emit.d.ts +0 -2
- package/dist/src/stripe-emit.js +0 -145
- package/dist/src/stripe-events.d.ts +0 -93
- package/dist/src/stripe-events.js +0 -392
- package/dist/src/stripe-js.d.ts +0 -4
- package/dist/src/stripe-js.js +0 -70
- package/dist/src/stripe-mirror-ui.d.ts +0 -15
- package/dist/src/stripe-mirror-ui.js +0 -87
- package/dist/src/stripe-perform-harness.d.ts +0 -9
- package/dist/src/stripe-perform-harness.js +0 -26
- package/dist/src/stripe-server.d.ts +0 -33
- package/dist/src/stripe-server.js +0 -429
- package/dist/src/stripe-shared.d.ts +0 -109
- package/dist/src/stripe-shared.js +0 -276
- package/dist/src/stripe-ui-conformance.d.ts +0 -5
- package/dist/src/stripe-ui-conformance.js +0 -79
- package/dist/src/stripe-ui-structure.d.ts +0 -3
- package/dist/src/stripe-ui-structure.js +0 -168
- package/dist/test-fixtures/stripe-known-deviations.json +0 -110
- package/dist/test-fixtures/stripe-openapi-operations.SOURCE.md +0 -14
- package/dist/test-fixtures/stripe-openapi-operations.json +0 -4717
- package/dist/test-fixtures/stripe-schemas.SOURCE.md +0 -35
- package/dist/test-fixtures/stripe-schemas.json +0 -3813
- package/src/screens/connect-oauth.tsx +0 -400
- package/src/screens/connect-settings.tsx +0 -121
- package/src/screens/consent-skin.ts +0 -20
- package/src/screens/financial-connections.tsx +0 -101
- package/src/screens/identity.tsx +0 -96
- package/src/screens/public-details.tsx +0 -105
- package/src/semantics/after-payment.ts +0 -118
- package/src/semantics/billing.ts +0 -216
- package/src/semantics/connect.ts +0 -487
- package/src/semantics/credit-notes.ts +0 -168
- package/src/semantics/disputes.ts +0 -62
- package/src/semantics/ephemeral-keys.ts +0 -34
- package/src/semantics/files.ts +0 -143
- package/src/semantics/ledger.ts +0 -253
- package/src/semantics/payment-intents.ts +0 -463
- package/src/semantics/payment-links.ts +0 -148
- package/src/semantics/payment-methods.ts +0 -145
- package/src/semantics/plans.ts +0 -131
- package/src/semantics/platform.ts +0 -220
- package/src/semantics/renewals.ts +0 -279
- package/src/semantics/setup-intents.ts +0 -87
- package/src/semantics/subscription-schedules.ts +0 -129
- package/src/semantics/tax.ts +0 -220
- package/src/semantics/terminal.ts +0 -195
- package/src/semantics/test-clocks.ts +0 -77
- package/src/semantics/tokens.ts +0 -52
- package/src/semantics/treasury.ts +0 -383
- package/src/semantics/webhook-endpoints.ts +0 -87
- package/src/stripe-budget.ts +0 -181
- package/src/stripe-capabilities.ts +0 -5651
- package/src/stripe-conformance.ts +0 -124
- package/src/stripe-connector.ts +0 -462
- package/src/stripe-emit.ts +0 -157
- package/src/stripe-events.ts +0 -434
- package/src/stripe-js.ts +0 -70
- package/src/stripe-mirror-ui.ts +0 -90
- package/src/stripe-perform-harness.ts +0 -29
- package/src/stripe-server.ts +0 -393
- package/src/stripe-shared.ts +0 -297
- package/src/stripe-ui-conformance.ts +0 -88
- package/src/stripe-ui-structure.ts +0 -182
- package/test-fixtures/stripe-known-deviations.json +0 -110
- package/test-fixtures/stripe-openapi-operations.json +0 -4717
- package/test-fixtures/stripe-schemas.json +0 -3813
- /package/dist/src/{screens → engine}/industries.d.ts +0 -0
- /package/dist/src/{screens → engine}/industries.js +0 -0
- /package/dist/src/{semantics → engine}/test-cards.d.ts +0 -0
- /package/dist/src/{semantics → engine}/test-cards.js +0 -0
- /package/src/{screens → engine}/industries.ts +0 -0
- /package/src/{semantics → engine}/test-cards.ts +0 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
{
|
|
2
|
+
"archive:https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-8.6.0.tgz#sha256=13e61419e9076ab440cc636e34d3ea5df3fc62bbf2d6a80d3fd718e8cd47f0a2!/package/dist/stripe-js/checkout.d.ts": {
|
|
3
|
+
"status": 200,
|
|
4
|
+
"checked": "2026-10-03",
|
|
5
|
+
"sha256": "13e61419e9076ab440cc636e34d3ea5df3fc62bbf2d6a80d3fd718e8cd47f0a2",
|
|
6
|
+
"quotes": {
|
|
7
|
+
"export interface StripeCheckoutSession": true,
|
|
8
|
+
"loadActions: () => Promise<StripeCheckoutLoadActionsResult>": true
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"https://docs.stripe.com/api/authentication": {
|
|
12
|
+
"status": 200,
|
|
13
|
+
"checked": "2026-09-30",
|
|
14
|
+
"quotes": {
|
|
15
|
+
"API requests without authentication also fail.": true
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"https://docs.stripe.com/api/balance_transactions/object#balance_transaction_object-status": {
|
|
19
|
+
"status": 200,
|
|
20
|
+
"checked": "2026-09-30"
|
|
21
|
+
},
|
|
22
|
+
"https://docs.stripe.com/api/billing/meter/create": {
|
|
23
|
+
"status": 200,
|
|
24
|
+
"checked": "2026-10-03",
|
|
25
|
+
"quotes": {
|
|
26
|
+
"stripe_customer_id": true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"https://docs.stripe.com/api/charges/object#charge_object-refunded": {
|
|
30
|
+
"status": 200,
|
|
31
|
+
"checked": "2026-10-03"
|
|
32
|
+
},
|
|
33
|
+
"https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-payment_status": {
|
|
34
|
+
"status": 200,
|
|
35
|
+
"checked": "2026-09-30"
|
|
36
|
+
},
|
|
37
|
+
"https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-status": {
|
|
38
|
+
"status": 200,
|
|
39
|
+
"checked": "2026-09-30"
|
|
40
|
+
},
|
|
41
|
+
"https://docs.stripe.com/api/invoices/create_preview.md?query=subscription_details": {
|
|
42
|
+
"status": 200,
|
|
43
|
+
"checked": "2026-10-04",
|
|
44
|
+
"quotes": {
|
|
45
|
+
"The default value is": true,
|
|
46
|
+
"forces the proration to be calculated as though the update was done at the specified time.": true,
|
|
47
|
+
"The time given must be within the current subscription period": true,
|
|
48
|
+
"cannot be set to": true,
|
|
49
|
+
"Disable creating prorations in this request.": true,
|
|
50
|
+
"Always invoice immediately for prorations.": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"https://docs.stripe.com/api/invoices/pay": {
|
|
54
|
+
"status": 200,
|
|
55
|
+
"checked": "2026-09-30"
|
|
56
|
+
},
|
|
57
|
+
"https://docs.stripe.com/api/invoices/void": {
|
|
58
|
+
"status": 200,
|
|
59
|
+
"checked": "2026-09-30"
|
|
60
|
+
},
|
|
61
|
+
"https://docs.stripe.com/api/issuing/authorizations/decline": {
|
|
62
|
+
"status": 200,
|
|
63
|
+
"checked": "2026-09-30"
|
|
64
|
+
},
|
|
65
|
+
"https://docs.stripe.com/api/issuing/authorizations/test_mode_capture": {
|
|
66
|
+
"status": 200,
|
|
67
|
+
"checked": "2026-09-30"
|
|
68
|
+
},
|
|
69
|
+
"https://docs.stripe.com/api/issuing/cards/create": {
|
|
70
|
+
"status": 200,
|
|
71
|
+
"checked": "2026-10-03",
|
|
72
|
+
"quotes": {
|
|
73
|
+
"Whether authorizations can be approved on this card. May be blocked from activating cards depending on past-due Cardholder requirements. Defaults to inactive.": true,
|
|
74
|
+
"Defaults to inactive": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"https://docs.stripe.com/api/issuing/cards/update": {
|
|
78
|
+
"status": 200,
|
|
79
|
+
"checked": "2026-09-30"
|
|
80
|
+
},
|
|
81
|
+
"https://docs.stripe.com/api/payment_intents/cancel": {
|
|
82
|
+
"status": 200,
|
|
83
|
+
"checked": "2026-10-03"
|
|
84
|
+
},
|
|
85
|
+
"https://docs.stripe.com/api/payment_intents/confirm": {
|
|
86
|
+
"status": 200,
|
|
87
|
+
"checked": "2026-09-30"
|
|
88
|
+
},
|
|
89
|
+
"https://docs.stripe.com/api/plans/create": {
|
|
90
|
+
"status": 200,
|
|
91
|
+
"checked": "2026-10-03",
|
|
92
|
+
"quotes": {
|
|
93
|
+
"It replaces the Plans API and is backwards compatible to simplify your migration.": true
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"https://docs.stripe.com/api/promotion_codes/update": {
|
|
97
|
+
"status": 200,
|
|
98
|
+
"checked": "2026-09-30"
|
|
99
|
+
},
|
|
100
|
+
"https://docs.stripe.com/api/subscriptions/cancel": {
|
|
101
|
+
"status": 200,
|
|
102
|
+
"checked": "2026-09-30"
|
|
103
|
+
},
|
|
104
|
+
"https://docs.stripe.com/api/subscriptions/object": {
|
|
105
|
+
"status": 200,
|
|
106
|
+
"checked": "2026-10-03",
|
|
107
|
+
"quotes": {
|
|
108
|
+
"subscription_items?subscription=": true
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"https://docs.stripe.com/api/subscriptions/update#update_subscription-trial_end": {
|
|
112
|
+
"status": 200,
|
|
113
|
+
"checked": "2026-09-30"
|
|
114
|
+
},
|
|
115
|
+
"https://docs.stripe.com/billing/customer/balance": {
|
|
116
|
+
"status": 200,
|
|
117
|
+
"checked": "2026-10-03",
|
|
118
|
+
"quotes": {
|
|
119
|
+
"Represents the starting value of the customer invoice balance when a customer is created using the API with a non-zero invoice balance.": true,
|
|
120
|
+
"All modifications to the invoice balance are recorded as Transactions": true,
|
|
121
|
+
"All Transactions created with the API or in the Dashboard have a type value of adjustment": true
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"https://docs.stripe.com/billing/subscriptions/build-subscriptions": {
|
|
125
|
+
"status": 200,
|
|
126
|
+
"checked": "2026-09-30"
|
|
127
|
+
},
|
|
128
|
+
"https://docs.stripe.com/billing/subscriptions/cancel#cancel-at-end-of-cycle": {
|
|
129
|
+
"status": 200,
|
|
130
|
+
"checked": "2026-09-30"
|
|
131
|
+
},
|
|
132
|
+
"https://docs.stripe.com/billing/subscriptions/overview#payment-status": {
|
|
133
|
+
"status": 200,
|
|
134
|
+
"checked": "2026-09-30"
|
|
135
|
+
},
|
|
136
|
+
"https://docs.stripe.com/billing/subscriptions/prorations": {
|
|
137
|
+
"status": 200,
|
|
138
|
+
"checked": "2026-10-04",
|
|
139
|
+
"quotes": {
|
|
140
|
+
"Unused time on original 10 USD plan (credit)": true,
|
|
141
|
+
"Remaining time on new 20 USD plan (debit)": true,
|
|
142
|
+
"The current billing period’s start and end times are used to calculate the cost of the subscription before and after the change.": true,
|
|
143
|
+
"By default, Stripe calculates prorations down to the second.": true,
|
|
144
|
+
"When calculating proration credits or debits, Stripe uses the subscription’s discounted price, not the original price.": true,
|
|
145
|
+
"The prorated amount is calculated as soon as the API updates the subscription.": true,
|
|
146
|
+
"creates a non-proration debit, even when the debit covers a partial billing period.": true,
|
|
147
|
+
"no additional discounts are applied to the proration line items themselves": true
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"https://docs.stripe.com/billing/subscriptions/trials": {
|
|
151
|
+
"status": 200,
|
|
152
|
+
"checked": "2026-09-30"
|
|
153
|
+
},
|
|
154
|
+
"https://docs.stripe.com/billing/subscriptions/trials/free-trials#adding-a-new-trial-to-a-subscription-previously-in-a-trial": {
|
|
155
|
+
"status": 200,
|
|
156
|
+
"checked": "2026-09-30"
|
|
157
|
+
},
|
|
158
|
+
"https://docs.stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment": {
|
|
159
|
+
"status": 200,
|
|
160
|
+
"checked": "2026-09-30"
|
|
161
|
+
},
|
|
162
|
+
"https://docs.stripe.com/changelog/clover/2025-09-30/polymorphic-coupon": {
|
|
163
|
+
"status": 200,
|
|
164
|
+
"checked": "2026-10-03",
|
|
165
|
+
"quotes": {
|
|
166
|
+
"Moves the top-level coupon field on Promotion Codes to promotion.coupon": true,
|
|
167
|
+
"When you retrieve Promotion Codes, they don’t auto-expand the promotion.coupon field": true
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"https://docs.stripe.com/connect/account-capabilities": {
|
|
171
|
+
"status": 200,
|
|
172
|
+
"checked": "2026-10-03",
|
|
173
|
+
"quotes": {
|
|
174
|
+
"If a connected account has both card_payments and transfers": true
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"https://docs.stripe.com/connect/authentication": {
|
|
178
|
+
"status": 200,
|
|
179
|
+
"checked": "2026-10-03",
|
|
180
|
+
"quotes": {
|
|
181
|
+
"Stripe-Account header": true
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"https://docs.stripe.com/connect/destination-charges#issue-refunds": {
|
|
185
|
+
"status": 200,
|
|
186
|
+
"checked": "2026-10-03"
|
|
187
|
+
},
|
|
188
|
+
"https://docs.stripe.com/customer-management": {
|
|
189
|
+
"status": 200,
|
|
190
|
+
"checked": "2026-09-30"
|
|
191
|
+
},
|
|
192
|
+
"https://docs.stripe.com/invoicing/integration": {
|
|
193
|
+
"status": 200,
|
|
194
|
+
"checked": "2026-10-02",
|
|
195
|
+
"quotes": {
|
|
196
|
+
"To finalize a draft invoice, use the Dashboard, send it to the customer, or pay it.": true
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"https://docs.stripe.com/invoicing/integration/workflow-transitions#finalized": {
|
|
200
|
+
"status": 200,
|
|
201
|
+
"checked": "2026-09-30"
|
|
202
|
+
},
|
|
203
|
+
"https://docs.stripe.com/issuing/cards/physical/create-design.md?testing-method=with-code": {
|
|
204
|
+
"status": 200,
|
|
205
|
+
"checked": "2026-09-30",
|
|
206
|
+
"quotes": {
|
|
207
|
+
"Use the [Files API](https://docs.stripe.com/api/files/create.md) to upload a .PNG file of your card logo, and specify the purpose as `issuing_logo`.": true
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"https://docs.stripe.com/issuing/controls/real-time-authorizations": {
|
|
211
|
+
"status": 200,
|
|
212
|
+
"checked": "2026-09-30"
|
|
213
|
+
},
|
|
214
|
+
"https://docs.stripe.com/issuing/purchases/authorizations": {
|
|
215
|
+
"status": 200,
|
|
216
|
+
"checked": "2026-09-30"
|
|
217
|
+
},
|
|
218
|
+
"https://docs.stripe.com/issuing/testing": {
|
|
219
|
+
"status": 200,
|
|
220
|
+
"checked": "2026-10-03",
|
|
221
|
+
"quotes": {
|
|
222
|
+
"Before you create test transactions, you must add test funds to the Issuing balance on your account.": true,
|
|
223
|
+
"You can create test top-ups in the Dashboard, or with the Top-ups API": true
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"https://docs.stripe.com/keys": {
|
|
227
|
+
"status": 200,
|
|
228
|
+
"checked": "2026-09-30",
|
|
229
|
+
"quotes": {
|
|
230
|
+
"Publishable keys": true
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"https://docs.stripe.com/payments/ach-direct-debit/accept-a-payment?payment-ui=direct-api": {
|
|
234
|
+
"status": 200,
|
|
235
|
+
"checked": "2026-09-30"
|
|
236
|
+
},
|
|
237
|
+
"https://docs.stripe.com/payments/checkout/how-checkout-works": {
|
|
238
|
+
"status": 200,
|
|
239
|
+
"checked": "2026-09-30"
|
|
240
|
+
},
|
|
241
|
+
"https://docs.stripe.com/payments/paymentintents/lifecycle": {
|
|
242
|
+
"status": 200,
|
|
243
|
+
"checked": "2026-09-30"
|
|
244
|
+
},
|
|
245
|
+
"https://docs.stripe.com/payouts": {
|
|
246
|
+
"status": 200,
|
|
247
|
+
"checked": "2026-10-03",
|
|
248
|
+
"quotes": {
|
|
249
|
+
"paid": true
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"https://docs.stripe.com/payouts#payout-statuses": {
|
|
253
|
+
"status": 200,
|
|
254
|
+
"checked": "2026-09-30"
|
|
255
|
+
},
|
|
256
|
+
"https://docs.stripe.com/radar/lists": {
|
|
257
|
+
"status": 200,
|
|
258
|
+
"checked": "2026-10-03",
|
|
259
|
+
"quotes": {
|
|
260
|
+
"Use the Dashboard or the API to create lists.": true,
|
|
261
|
+
"Enter a name for the list": true,
|
|
262
|
+
"Select the type of list to create.": true,
|
|
263
|
+
"Click Add to save your new list.": true
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"https://docs.stripe.com/rate-limits": {
|
|
267
|
+
"status": 200,
|
|
268
|
+
"checked": "2026-10-01",
|
|
269
|
+
"quotes": {
|
|
270
|
+
"25 requests per second": true
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"https://docs.stripe.com/refunds": {
|
|
274
|
+
"status": 200,
|
|
275
|
+
"checked": "2026-09-30"
|
|
276
|
+
},
|
|
277
|
+
"https://docs.stripe.com/search": {
|
|
278
|
+
"status": 200,
|
|
279
|
+
"checked": "2026-10-03",
|
|
280
|
+
"quotes": {
|
|
281
|
+
"Substring match operator (substrings must be a minimum of 3 characters)": true
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"https://docs.stripe.com/testing": {
|
|
285
|
+
"status": 200,
|
|
286
|
+
"checked": "2026-10-02",
|
|
287
|
+
"quotes": {
|
|
288
|
+
"Generic decline 4000 0000 0000 0002": true,
|
|
289
|
+
"This card requires authentication on all transactions, regardless of how the card is set up.": true
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
"https://docs.stripe.com/webhooks": {
|
|
293
|
+
"status": 200,
|
|
294
|
+
"checked": "2026-09-30",
|
|
295
|
+
"quotes": {
|
|
296
|
+
"register a webhook endpoint, Stripe pushes real-time data to it when": true
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"https://github.com/stripe/stripe-mock/issues/31": {
|
|
300
|
+
"status": 200,
|
|
301
|
+
"checked": "2026-10-03",
|
|
302
|
+
"quotes": {
|
|
303
|
+
"Unrecognized request URL (GET: /v1/test).": true
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
package/src/cli.ts
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { keepProcessAlive } from '@volter/world-core/lifecycle';
|
|
3
|
-
// world-stripe CLI: serve the Stripe API twin, the mirror UI, or run conformance.
|
|
4
1
|
import { hasFlag, optionValue } from '@volter/world-core/args';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
2
|
+
import { keepProcessAlive } from '@volter/world-core/lifecycle';
|
|
3
|
+
import { createStripeTwinServer } from './server.ts';
|
|
8
4
|
const [cmd, ...rest] = process.argv.slice(2);
|
|
9
5
|
const port = Number(optionValue(rest, '--port', '0')) || undefined;
|
|
10
6
|
const root = optionValue(rest, '--root') || undefined;
|
|
11
|
-
const readOnly = hasFlag(rest, '--read-only');
|
|
7
|
+
const readOnly = hasFlag(rest, '--read-only');
|
|
8
|
+
// the World's managed Postgres, which the runtime binds a pack declaring managedDatabase to
|
|
9
|
+
const database = optionValue(rest, '--database') || undefined;
|
|
10
|
+
// the World's scenario file, for a model vendor's turns
|
|
11
|
+
const scenarioPath = optionValue(rest, '--scenario') || undefined;
|
|
12
12
|
|
|
13
|
-
if (cmd === 'serve') {
|
|
14
|
-
const s = await createStripeTwinServer({ readOnly, ...(root ? { root } : {}), ...(port ? { port } : {}) });
|
|
15
|
-
process.stdout.write(`stripe twin
|
|
16
|
-
await keepProcessAlive();
|
|
17
|
-
} else if (cmd === 'mirror') {
|
|
18
|
-
const s = await createStripeMirrorServer({ ...(root ? { root } : {}), ...(port ? { port } : {}) });
|
|
19
|
-
process.stdout.write(`stripe mirror UI (dashboard) at http://127.0.0.1:${s.port}\n`);
|
|
13
|
+
if (cmd === 'serve' || cmd === undefined) {
|
|
14
|
+
const s = await createStripeTwinServer({ readOnly, ...(root ? { root } : {}), ...(port ? { port } : {}), ...(database ? { database } : {}), ...(scenarioPath ? { scenarioPath } : {}) });
|
|
15
|
+
process.stdout.write(`stripe twin${readOnly ? ' [read-only]' : ''} at http://127.0.0.1:${s.port}\n`);
|
|
20
16
|
await keepProcessAlive();
|
|
21
|
-
} else if (cmd === 'emit') {
|
|
22
|
-
// DELIVER: fire a signed, vendor-shaped event synthesized from twin state at the app's
|
|
23
|
-
// registered webhook endpoint(s). `emit --list` shows what's emittable right now.
|
|
24
|
-
const { runEmitCli } = await import('@volter/world-core');
|
|
25
|
-
const { stripeEmitter } = await import('./stripe-emit.ts');
|
|
26
|
-
process.exit(await runEmitCli(stripeEmitter, rest));
|
|
27
|
-
} else if (cmd === 'conformance') {
|
|
28
|
-
// dev-only; lazy so the bin runs without @volter/world-tooling
|
|
29
|
-
const { checkStripeConformance, loadStripeKnownDeviations, loadStripeSchemas, stripeCoverage } = await import('./stripe-conformance.ts');
|
|
30
|
-
const [schemas, known] = await Promise.all([loadStripeSchemas(), loadStripeKnownDeviations()]);
|
|
31
|
-
const report = checkStripeConformance(schemas, { ...(root ? { root } : {}), known });
|
|
32
|
-
process.stdout.write(`${JSON.stringify({ ...report, coverage: stripeCoverage(schemas, { ...(root ? { root } : {}) }) }, null, 2)}\n`);
|
|
33
|
-
if (!report.ok) process.exitCode = 1;
|
|
34
17
|
} else {
|
|
35
|
-
process.stdout.write('Usage: world-stripe serve
|
|
18
|
+
process.stdout.write('Usage: world-stripe serve [--port N] [--root DIR] [--read-only] [--database URL] [--scenario FILE]\n');
|
|
36
19
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// What Stripe does itself once a payment succeeds, which no API call asks for:
|
|
2
|
+
// - a test card that is disputed opens a dispute on its charge (docs.stripe.com/testing#disputes: 4000000000000259
|
|
3
|
+
// "charge succeeds, then disputed as fraudulent", 4000000000002685 disputed as product not received,
|
|
4
|
+
// 4000000000001976 an inquiry), and Stripe debits the disputed
|
|
5
|
+
// amount and its dispute fee from the balance (docs.stripe.com/disputes/how-disputes-work);
|
|
6
|
+
// - a test card Radar scores as elevated risk opens a review of its charge (docs.stripe.com/testing#fraud-prevention:
|
|
7
|
+
// 4000000000009235, "elevated risk", which Radar places in review; docs.stripe.com/radar/reviews);
|
|
8
|
+
// - a charge a platform makes with `application_fee_amount` earns the platform an application fee, from the connected
|
|
9
|
+
// account it pays (a destination charge's `transfer_data.destination`, or the account a direct charge is made on;
|
|
10
|
+
// docs.stripe.com/connect/destination-charges, docs.stripe.com/connect/direct-charges);
|
|
11
|
+
// - a bank account verified by micro-deposits for a payment or a setup carries a mandate, the customer's acceptance
|
|
12
|
+
// of debits (docs.stripe.com/payments/ach-direct-debit/accept-a-payment, docs.stripe.com/api/mandates).
|
|
13
|
+
//
|
|
14
|
+
// Where the documentation stops and the twin decides: evidence is due seven days after a dispute opens (Stripe's
|
|
15
|
+
// deadline depends on the card network); the dispute fee is 1500 cents in any currency (Stripe's US fee is $15); an
|
|
16
|
+
// elevated-risk review's risk score is 67 (Radar's elevated band); the application is `ca_twin`.
|
|
17
|
+
import { BYPASS_PENDING_CARDS } from './test-cards.ts';
|
|
18
|
+
export type Outcome = 'dispute' | 'dispute_not_received' | 'inquiry' | 'review' | 'available';
|
|
19
|
+
|
|
20
|
+
/** The test cards whose success Stripe follows with its own act, by number and by their documented test names. */
|
|
21
|
+
export const AFTER_SUCCESS_CARDS: Record<string, { brand: string; number: string; outcome: Outcome }> = {
|
|
22
|
+
pm_card_createDispute: { brand: 'visa', number: '4000000000000259', outcome: 'dispute' },
|
|
23
|
+
pm_card_createDisputeProductNotReceived: { brand: 'visa', number: '4000000000002685', outcome: 'dispute_not_received' },
|
|
24
|
+
pm_card_createDisputeInquiry: { brand: 'visa', number: '4000000000001976', outcome: 'inquiry' },
|
|
25
|
+
pm_card_riskLevelElevated: { brand: 'visa', number: '4000000000009235', outcome: 'review' },
|
|
26
|
+
// its funds go straight to the available balance (ledger.ts reads it; no act follows here)
|
|
27
|
+
...Object.fromEntries(Object.entries(BYPASS_PENDING_CARDS).map(([name, c]) => [name, { ...c, outcome: 'available' as const }])),
|
|
28
|
+
};
|
|
29
|
+
export const BY_NUMBER: Record<string, Outcome> = Object.fromEntries(Object.values(AFTER_SUCCESS_CARDS).map((c) => [c.number, c.outcome]));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Balance and payout semantics. The balance is computed from the balance-transaction ledger (./ledger.ts), never
|
|
2
|
+
// stored: funds past their available_on are available, the rest pending, and Issuing funds their own section. The
|
|
3
|
+
// balance, the payouts and the ledger are the acting account's: the platform's, or a connected account's under the
|
|
4
|
+
// Stripe-Account header. A payout comes out of what that account has available and goes to its bank account, which a
|
|
5
|
+
// connected account must have (docs.stripe.com/connect/payouts-connected-accounts). A pending payout can be canceled,
|
|
6
|
+
// which returns its money; a connected account's paid payout can be reversed, which debits its bank account back
|
|
7
|
+
// into its balance (docs.stripe.com/api/payouts/reverse). The machine in ../manifest.ts says how a payout's status
|
|
8
|
+
// moves.
|
|
9
|
+
//
|
|
10
|
+
// Stripe also pays each account out on its own schedule (settings.payouts.schedule: daily by default, weekly or monthly
|
|
11
|
+
// on an anchor, or manual): an automatic payout takes what has become available since the last one, and the ledger
|
|
12
|
+
// lists the entries it paid (docs.stripe.com/payouts#payout-schedule, docs.stripe.com/connect/manage-payout-schedule).
|
|
13
|
+
// A connected account is paid out once it can be (payouts_enabled, with a bank account).
|
|
14
|
+
//
|
|
15
|
+
// Where the documentation stops and the twin decides: a payout arrives two days after it is made (Stripe's standard
|
|
16
|
+
// US schedule counts business days) and reads paid from then on; an automatic payout is made at midnight UTC on the
|
|
17
|
+
// first scheduled day on or after its funds become available, only when what it would pay is positive.
|
|
18
|
+
import type { Row } from './common.ts';
|
|
19
|
+
export const DAY = 86_400;
|
|
20
|
+
|
|
21
|
+
export const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
|
|
22
|
+
/** The first scheduled payout time on or after `from`: midnight UTC of a day the schedule pays out on. */
|
|
23
|
+
export function payoutDay(from: number, schedule: Row): number {
|
|
24
|
+
const first = Math.ceil(from / DAY) * DAY;
|
|
25
|
+
const pays = (day: number): boolean => {
|
|
26
|
+
const d = new Date(day * 1000);
|
|
27
|
+
if (schedule.interval === 'weekly') return DAYS[d.getUTCDay()] === String(schedule.weekly_anchor ?? 'monday');
|
|
28
|
+
if (schedule.interval === 'monthly') return d.getUTCDate() === Math.min(Number(schedule.monthly_anchor ?? 1), new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + 1, 0)).getUTCDate());
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
return Array.from({ length: 62 }, (_, i) => first + i * DAY).find(pays) ?? first;
|
|
32
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Checkout Session semantics. The machine in ../manifest.ts says an open session expires or
|
|
2
|
+
// completes and nothing else does. Stripe completes a session when the customer pays on its hosted
|
|
3
|
+
// page (src/screens/checkout.tsx, the session's url), which has no API verb; completing links what
|
|
4
|
+
// the payment made: a succeeded PaymentIntent, an active (or
|
|
5
|
+
// trialing) subscription, or a succeeded SetupIntent. List and retrieve are the derived core's.
|
|
6
|
+
import type { Row } from './common.ts';
|
|
7
|
+
export const CS = 'checkout.session';
|
|
8
|
+
|
|
9
|
+
/** The payment method types a session takes: the list a caller pinned to an earlier version gives as
|
|
10
|
+
* payment_method_types ("A list of the types of payment methods (e.g., `card`) this Checkout Session can accept", the
|
|
11
|
+
* parameter the served version's allowed_payment_method_types is described against: "Unlike `payment_method_types`,
|
|
12
|
+
* this acts as a filter on the dynamically computed set of eligible payment methods", docs.stripe.com/api/checkout/
|
|
13
|
+
* sessions/create), else the allowed_payment_method_types of the served one, else card. Where the documentation stops
|
|
14
|
+
* and the twin decides: an allowed list is answered whole (the twin does not compute eligibility), and without one the
|
|
15
|
+
* session takes card (the account's enabled methods are not modelled). */
|
|
16
|
+
export function sessionMethodTypes(params: Row): string[] {
|
|
17
|
+
const given = Array.isArray(params.payment_method_types) ? params.payment_method_types : params.allowed_payment_method_types;
|
|
18
|
+
return Array.isArray(given) && given.length ? given.map(String) : ['card'];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Metadata passed on to what a session makes (payment_intent_data[metadata], subscription_data[metadata]) as a
|
|
22
|
+
* create's own is kept: "Individual keys can be unset by posting an empty value to them. All keys can be unset by
|
|
23
|
+
* posting an empty value to `metadata`" (every metadata parameter, docs.stripe.com/api/metadata), so a key posted
|
|
24
|
+
* empty is not set, and metadata posted empty is {} (./front.ts createMetadata, the top-level case). */
|
|
25
|
+
export function nestedMetadata(given: unknown): Row | undefined {
|
|
26
|
+
if (given === '') return {};
|
|
27
|
+
if (!given || typeof given !== 'object' || Array.isArray(given)) return undefined;
|
|
28
|
+
return Object.fromEntries(Object.entries(given as Row).filter(([, v]) => v !== ''));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The card the customer entered on the page. */
|
|
32
|
+
export type EnteredCard = { number: string; exp_month: number; exp_year: number };
|
|
33
|
+
|
|
34
|
+
/** A line item of a one-time Price: a stored Price, or an inline `price_data`, without `recurring` ("Line items with
|
|
35
|
+
* one-time Prices will be on the initial invoice only", docs.stripe.com/api/checkout/sessions/create). */
|
|
36
|
+
export function isOneTime(item: Row, priceData?: Row | null): boolean {
|
|
37
|
+
if (priceData) return !priceData.recurring;
|
|
38
|
+
return !!item.price && typeof item.price === 'object' && !(item.price as Row).recurring;
|
|
39
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Stripe's shared computation over rows already read: the fields each object's spec gives, a row as Stripe answers it,
|
|
2
|
+
// and the list and refund shapes (the handlers' shared behaviour is ../semantics/shared.ts).
|
|
3
|
+
import surface from '../generated/surface.gen.json' with { type: 'json' };
|
|
4
|
+
|
|
5
|
+
export type Row = Record<string, unknown>;
|
|
6
|
+
|
|
7
|
+
/** Keep the rows whose field equals the request's parameter of the same name, for each name given. */
|
|
8
|
+
/** A list's range filter on a unix time (`created[gte]=…&created[lt]=…`, or one exact time). */
|
|
9
|
+
export function inRange(t: unknown, v: unknown): boolean {
|
|
10
|
+
const at = Number(t);
|
|
11
|
+
const r = (v && typeof v === 'object' ? v : { gte: v, lte: v }) as Row;
|
|
12
|
+
return (r.gt === undefined || at > Number(r.gt)) && (r.gte === undefined || at >= Number(r.gte)) && (r.lt === undefined || at < Number(r.lt)) && (r.lte === undefined || at <= Number(r.lte));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SPEC_FIELDS = new Map((surface.resources as Array<{ name: string; fields: Array<{ name: string }> }>).map((r) => [r.name, new Set(r.fields.map((f) => f.name))]));
|
|
16
|
+
|
|
17
|
+
/** A stored subject of any stored type, tombstones included, in the pack's view: what the pack's
|
|
18
|
+
* shared helpers look a price, a payment method or a card up by, read from the context's tree. */
|
|
19
|
+
export type Find = (storedType: string, id: string) => Row | undefined;
|
|
20
|
+
|
|
21
|
+
/** An account's external_accounts, "External accounts (bank accounts and debit cards) currently attached to this
|
|
22
|
+
* account" (docs.stripe.com/api/accounts/object), as the list its example answers. */
|
|
23
|
+
export const externalList = (account: string, data: Row[]): Row => ({ object: 'list', data, has_more: false, total_count: data.length, url: `/v1/accounts/${account}/external_accounts` });
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/** A removed discount as Stripe answers it: the discount, marked deleted (docs.stripe.com/api/discounts/delete). */
|
|
29
|
+
export function deletedDiscount(d: Row, now: unknown): Row {
|
|
30
|
+
const coupon = d.coupon && typeof d.coupon === 'object' ? String((d.coupon as Row).id) : typeof d.coupon === 'string' ? d.coupon : null;
|
|
31
|
+
return {
|
|
32
|
+
id: d.id ?? `di_${coupon ?? 'twin'}`, object: 'discount', deleted: true, checkout_session: d.checkout_session ?? null, customer: d.customer ?? null,
|
|
33
|
+
invoice: d.invoice ?? null, invoice_item: d.invoice_item ?? null, promotion_code: d.promotion_code ?? null, subscription: d.subscription ?? null,
|
|
34
|
+
subscription_item: d.subscription_item ?? null, source: d.source ?? { type: 'coupon', coupon }, start: d.start ?? now,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/** A refund's destination_details for a card charge: "If this is a `card` refund, this hash contains the transaction
|
|
41
|
+
* specific details" and its `type` "can be `refund`, `reversal`, or `pending`" — a reversal, where "The original charge
|
|
42
|
+
* will drop off the bank statement altogether", for an authorization released uncaptured, else a refund, "a credit entry
|
|
43
|
+
* on the bank statement" (docs.stripe.com/api/refunds/object). The network's reference number the twin never has. A
|
|
44
|
+
* charge not paid by card answers none. */
|
|
45
|
+
export function refundDestination(charge: Row, type: 'refund' | 'reversal'): Row {
|
|
46
|
+
const pmd = charge.payment_method_details as Row | null | undefined;
|
|
47
|
+
if (pmd && pmd.type !== 'card') return {};
|
|
48
|
+
return { destination_details: { type: 'card', card: { reference: null, reference_status: null, reference_type: null, type } } };
|
|
49
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Connect semantics: connected accounts (and the platform's own account), their persons,
|
|
2
|
+
// capabilities, external (payout) accounts, login links, onboarding links and embedded-component
|
|
3
|
+
// sessions. A new connected account is not yet active: charges and payouts are off and its
|
|
4
|
+
// requirements are outstanding, as on Stripe before onboarding. Account retrieve and delete and
|
|
5
|
+
// the person list are the derived core's.
|
|
6
|
+
import { accountRequirements, accountSettings, PLATFORM_ACCOUNT_ID } from './stripe.ts';
|
|
7
|
+
import { currentlyDue, kindOf } from './onboarding.ts';
|
|
8
|
+
import { externalList, type Row } from './common.ts';
|
|
9
|
+
// the platform's own account: stored once it is written, otherwise Stripe's default. It "controls itself" (controller
|
|
10
|
+
// type `account`, docs.stripe.com/api/accounts/object), is fully onboarded with nothing due, and takes card payments
|
|
11
|
+
// and transfers. Where the documentation stops and the twin decides: it was created as the World began (2026-01-01),
|
|
12
|
+
// and its bank account, which its automatic payouts reach, is not modelled, so it lists none.
|
|
13
|
+
export const PLATFORM_CREATED = 1_767_225_600;
|
|
14
|
+
/** The platform's own account as Stripe's default has it, before anything is written to it. */
|
|
15
|
+
export const platformAccountDefault = (): Row => ({
|
|
16
|
+
object: 'account', id: PLATFORM_ACCOUNT_ID, type: 'standard', country: 'US', default_currency: 'usd', created: PLATFORM_CREATED,
|
|
17
|
+
charges_enabled: true, payouts_enabled: true, details_submitted: true, email: null, metadata: {},
|
|
18
|
+
capabilities: { card_payments: 'active', transfers: 'active' }, controller: { type: 'account' },
|
|
19
|
+
requirements: { alternatives: [], current_deadline: null, currently_due: [], disabled_reason: null, errors: [], eventually_due: [], past_due: [], pending_verification: [] },
|
|
20
|
+
future_requirements: { alternatives: [], current_deadline: null, currently_due: [], disabled_reason: null, errors: [], eventually_due: [], past_due: [], pending_verification: [] },
|
|
21
|
+
external_accounts: externalList(PLATFORM_ACCOUNT_ID, []), tos_acceptance: { date: null, ip: null, user_agent: null }, business_profile: {},
|
|
22
|
+
settings: accountSettings(undefined), livemode: false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/** A new Express account owes what its hosted onboarding will ask for (screens/connect-onboarding.tsx; the US sets
|
|
26
|
+
* docs.stripe.com/connect/required-verification-information lists), or, where the twin does not model the set, the
|
|
27
|
+
* generic list. */
|
|
28
|
+
export function expressRequirements(params: Row): Row {
|
|
29
|
+
const kind = kindOf({ country: params.country ?? 'US', business_type: params.business_type ?? 'individual' });
|
|
30
|
+
const base = accountRequirements();
|
|
31
|
+
return kind ? { ...base, currently_due: currentlyDue(kind), eventually_due: currentlyDue(kind) } : base;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The controller an account made with a `type` has: "Each of the three account types maps to values in the
|
|
35
|
+
* `controller` hash", Standard to losses.payments `stripe`, fees.payer `account`, requirement_collection `stripe` and
|
|
36
|
+
* a `full` dashboard, Express to `application`, `application_express`, `stripe` and `express`, Custom to
|
|
37
|
+
* `application`, `application_custom`, `application` and `none`; each "type": "application", "is_controller": true
|
|
38
|
+
* (docs.stripe.com/connect/migrate-to-controller-properties). */
|
|
39
|
+
export function controllerOf(type: string): Row {
|
|
40
|
+
const [losses, payer, collection, dashboard] = type === 'express' ? ['application', 'application_express', 'stripe', 'express']
|
|
41
|
+
: type === 'custom' ? ['application', 'application_custom', 'application', 'none'] : ['stripe', 'account', 'stripe', 'full'];
|
|
42
|
+
return { type: 'application', is_controller: true, losses: { payments: losses }, fees: { payer }, requirement_collection: collection, stripe_dashboard: { type: dashboard } };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** What a Custom account still owes, from what the platform has given for it, as Stripe's requirements endpoint lists it
|
|
46
|
+
* for a US account with no Stripe Dashboard and the full service agreement
|
|
47
|
+
* (docs.stripe.com/_endpoint/get-requirements-for-setups, the data behind
|
|
48
|
+
* docs.stripe.com/connect/required-verification-information). With transfers alone, a company owes business_profile.url,
|
|
49
|
+
* company.name, an external account and tos_acceptance.date and .ip at once (capability_limit_amount -1: paused until
|
|
50
|
+
* given) and company.tax_id before $3,000 of payouts (payout_limit_amount 300000); an individual owes the url, its
|
|
51
|
+
* first and last name, the bank account and the terms at once, and its date of birth and ssn_last_4 before $3,000 of
|
|
52
|
+
* payouts. Requesting card_payments adds business_profile.mcc and the entity's address at once (and an individual's
|
|
53
|
+
* email and ssn_last_4). A company with card_payments owes, at once, business_profile.mcc, its address, that its owners
|
|
54
|
+
* are provided, each owner's name and email, and its representative's name, email, address, title and ssn_last_4; and
|
|
55
|
+
* in time its phone, its statement descriptor and its representative's date of birth and phone (the endpoint's answer
|
|
56
|
+
* for US / dashboard none / full terms / company / card_payments and transfers, saved in scratch as
|
|
57
|
+
* req-custom-company-cards-transfers.json: capability_limit_amount -1 for the first, none for the second). The
|
|
58
|
+
* representative and the owners are the account's persons (relationship.representative, relationship.owner).
|
|
59
|
+
* Where the documentation stops and the twin decides: what has no limit, or is owed before $3,000 of payouts, is
|
|
60
|
+
* eventually_due and blocks nothing (the twin keeps no payout total against it); an owner field is met when every
|
|
61
|
+
* person marked owner has it (none marked: met). */
|
|
62
|
+
export const at_path = (a: Row, path: string): unknown => path.split('.').reduce<unknown>((v, k) => (v && typeof v === 'object' ? (v as Row)[k] : undefined), a);
|
|
63
|
+
export const CARD_COMPANY_NOW = ['business_profile.mcc', 'company.address.line1', 'company.address.city', 'company.address.state', 'company.address.postal_code', 'company.owners_provided', 'owners.first_name', 'owners.last_name', 'owners.email', 'representative.first_name', 'representative.last_name', 'representative.email', 'representative.address.line1', 'representative.address.city', 'representative.address.state', 'representative.address.postal_code', 'representative.relationship.title', 'representative.ssn_last_4'];
|
|
64
|
+
export const CARD_COMPANY_LATER = ['company.phone', 'settings.payments.statement_descriptor', 'representative.dob.day', 'representative.dob.month', 'representative.dob.year', 'representative.phone'];
|
|
65
|
+
export const CARD_INDIVIDUAL_NOW = ['business_profile.mcc', 'individual.address.line1', 'individual.address.city', 'individual.address.state', 'individual.address.postal_code', 'individual.email', 'individual.ssn_last_4'];
|
|
66
|
+
export const personHas = (p: Row, field: string): boolean => {
|
|
67
|
+
if (field === 'ssn_last_4') return p.ssn_last_4_provided === true;
|
|
68
|
+
const v = at_path(p, field);
|
|
69
|
+
return v !== undefined && v !== null && v !== '';
|
|
70
|
+
};
|
|
71
|
+
export const met = (a: Row, bank: boolean, field: string, persons: Row[] = []): boolean => {
|
|
72
|
+
if (field === 'external_account') return bank;
|
|
73
|
+
if (field.startsWith('representative.')) {
|
|
74
|
+
const rep = persons.find((p) => (p.relationship as Row | undefined)?.representative === true);
|
|
75
|
+
return !!rep && personHas(rep, field.slice('representative.'.length));
|
|
76
|
+
}
|
|
77
|
+
if (field.startsWith('owners.')) return persons.filter((p) => (p.relationship as Row | undefined)?.owner === true).every((p) => personHas(p, field.slice('owners.'.length)));
|
|
78
|
+
if (field === 'company.tax_id') return at_path(a, 'company.tax_id_provided') === true;
|
|
79
|
+
if (field === 'individual.ssn_last_4') return at_path(a, 'individual.ssn_last_4_provided') === true;
|
|
80
|
+
const v = at_path(a, field);
|
|
81
|
+
return v !== undefined && v !== null && v !== '';
|
|
82
|
+
};
|
|
83
|
+
export function customRequirements(a: Row, bank: boolean, persons: Row[] = []): { now: string[]; later: string[] } {
|
|
84
|
+
const company = a.business_type === 'company';
|
|
85
|
+
const cards = Object.keys((a.capabilities as Row | undefined) ?? {}).includes('card_payments');
|
|
86
|
+
const now = ['business_profile.url', ...(company ? ['company.name'] : ['individual.first_name', 'individual.last_name']), 'external_account', 'tos_acceptance.date', 'tos_acceptance.ip'];
|
|
87
|
+
if (cards) now.push(...(company ? CARD_COMPANY_NOW : CARD_INDIVIDUAL_NOW));
|
|
88
|
+
const later = [...(company ? ['company.tax_id'] : ['individual.dob.day', 'individual.dob.month', 'individual.dob.year', 'individual.ssn_last_4']), ...(cards && company ? CARD_COMPANY_LATER : [])].filter((f) => !now.includes(f));
|
|
89
|
+
return { now: now.filter((f) => !met(a, bank, f, persons)), later: later.filter((f) => !met(a, bank, f, persons)) };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** A request's company or individual as Stripe keeps it: a tax id or SSN given is kept only as provided (the Account
|
|
93
|
+
* object answers company.tax_id_provided and individual.ssn_last_4_provided, never the numbers;
|
|
94
|
+
* docs.stripe.com/api/accounts/object). */
|
|
95
|
+
export function keptKyc(params: Row): Row {
|
|
96
|
+
const out: Row = { ...params };
|
|
97
|
+
if (params.company && typeof params.company === 'object') {
|
|
98
|
+
const { tax_id, ...company } = params.company as Row;
|
|
99
|
+
out.company = { ...company, ...(tax_id !== undefined && tax_id !== '' ? { tax_id_provided: true } : {}) };
|
|
100
|
+
}
|
|
101
|
+
if (params.individual && typeof params.individual === 'object') {
|
|
102
|
+
const { ssn_last_4, id_number, ...individual } = params.individual as Row;
|
|
103
|
+
out.individual = { ...individual, ...(ssn_last_4 !== undefined && ssn_last_4 !== '' ? { ssn_last_4_provided: true } : {}), ...(id_number !== undefined && id_number !== '' ? { id_number_provided: true } : {}) };
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Customer semantics: the customer and what hangs off it (tax ids, the credit-balance ledger, the
|
|
2
|
+
// cash balance, legacy sources, attached payment methods) and the top-level Source object. List,
|
|
3
|
+
// update and delete of a customer, retrieve of a Source and the flat tax-id list are the derived core's.
|
|
4
|
+
import { invoicePrefix } from './invoices.ts';
|
|
5
|
+
import type { Row } from './common.ts';
|
|
6
|
+
/** What a new customer answers before any invoice: its invoice_prefix and a next_invoice_sequence of 1, a zero balance,
|
|
7
|
+
* no metadata (docs.stripe.com/api/customers/object). */
|
|
8
|
+
export const newCustomer = (id: string): Row => ({ invoice_prefix: invoicePrefix(id), next_invoice_sequence: 1, balance: 0, metadata: {}, invoice_settings: {} });
|
|
9
|
+
|
|
10
|
+
// ── tax ids: a customer's, keyed under it; `type` and `value` are required ──
|