@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
|
@@ -9,13 +9,10 @@
|
|
|
9
9
|
// Where the evidence stops: the check knows only the served version's parameters (the spec's, surface.version). A
|
|
10
10
|
// request pinning an earlier version with Stripe-Version is not checked, since the pack holds no earlier spec, beyond
|
|
11
11
|
// the values of the payment_method_types it still takes (PAYMENT_METHOD_TYPES below); nested parameters are not checked.
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
import { manifest } from "./manifest.js";
|
|
15
|
-
import { SERVED_VERSION } from "./stripe-version.js";
|
|
16
|
-
const OPS = new Map(surface.operations.map((o) => [o.id, o]));
|
|
12
|
+
import surface from '../generated/surface.gen.json' with { type: 'json' };
|
|
13
|
+
export const OPS = new Map(surface.operations.map((o) => [o.id, o]));
|
|
17
14
|
/** Parameters Stripe documents outside its published spec, each with the page that documents it. */
|
|
18
|
-
const DOCUMENTED = {
|
|
15
|
+
export const DOCUMENTED = {
|
|
19
16
|
// a top-up into the Issuing balance (docs.stripe.com/issuing/funding/balance: "destination_balance=issuing")
|
|
20
17
|
PostTopups: ['destination_balance'],
|
|
21
18
|
};
|
|
@@ -45,8 +42,8 @@ const DOCUMENTED = {
|
|
|
45
42
|
export const METHOD_TYPES_REMOVED_IN = '2026-08-26.preview';
|
|
46
43
|
/** Whether a pinned version is at or after the removal: versions order by their date (YYYY-MM-DD). */
|
|
47
44
|
export const methodTypesRemoved = (pinned) => pinned.slice(0, 10) >= METHOD_TYPES_REMOVED_IN.slice(0, 10);
|
|
48
|
-
const REMOVED_TYPES = new Set(['PostPaymentIntents', 'PostPaymentIntentsIntent', 'PostPaymentIntentsIntentConfirm', 'PostSetupIntents', 'PostSetupIntentsIntent']);
|
|
49
|
-
const TYPED = new Set([...REMOVED_TYPES, 'PostCheckoutSessions']);
|
|
45
|
+
export const REMOVED_TYPES = new Set(['PostPaymentIntents', 'PostPaymentIntentsIntent', 'PostPaymentIntentsIntentConfirm', 'PostSetupIntents', 'PostSetupIntentsIntent']);
|
|
46
|
+
export const TYPED = new Set([...REMOVED_TYPES, 'PostCheckoutSessions']);
|
|
50
47
|
/** The payment method types there are: the PaymentMethod object's `type` in the served spec. */
|
|
51
48
|
export const PAYMENT_METHOD_TYPES = surface.resources.find((r) => r.name === 'payment_method')?.fields.find((f) => f.name === 'type')?.enum ?? [];
|
|
52
49
|
/** The payment method types a Checkout Session takes: the vendored spec's (2026-09-30.endive) PostCheckoutSessions
|
|
@@ -55,59 +52,9 @@ export const PAYMENT_METHOD_TYPES = surface.resources.find((r) => r.name === 'pa
|
|
|
55
52
|
* interac_present) and no `custom`. The surface keeps no request enums, so it is copied here. */
|
|
56
53
|
export const CHECKOUT_METHOD_TYPES = ['acss_debit', 'affirm', 'afterpay_clearpay', 'alipay', 'alma', 'amazon_pay', 'au_becs_debit', 'bacs_debit', 'bancontact', 'billie', 'bizum', 'blik', 'boleto', 'card', 'cashapp', 'crypto', 'customer_balance', 'eps', 'fpx', 'giropay', 'grabpay', 'ideal', 'kakao_pay', 'klarna', 'konbini', 'kr_card', 'link', 'mb_way', 'mobilepay', 'multibanco', 'naver_pay', 'nz_bank_account', 'oxxo', 'p24', 'pay_by_bank', 'payco', 'paynow', 'paypal', 'paypay', 'payto', 'pix', 'promptpay', 'revolut_pay', 'samsung_pay', 'satispay', 'scalapay', 'sepa_debit', 'sequra', 'sofort', 'sunbit', 'swish', 'twint', 'upi', 'us_bank_account', 'wechat_pay', 'zip'];
|
|
57
54
|
/** The create page each intent's refusal links to. */
|
|
58
|
-
const TYPES_DOC = {
|
|
55
|
+
export const TYPES_DOC = {
|
|
59
56
|
payment_intents: 'https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_types',
|
|
60
57
|
setup_intents: 'https://stripe.com/docs/api/setup_intents/create#create_setup_intent-payment_method_types',
|
|
61
58
|
};
|
|
62
59
|
/** An enum's values as Stripe lists them in a refusal: "a, b, or c". */
|
|
63
|
-
const oneOf = (values) => (values.length > 1 ? `${values.slice(0, -1).join(', ')}, or ${values.at(-1)}` : values.join(''));
|
|
64
|
-
/** An earlier version's payment_method_types refused: the first value that names no payment method type the
|
|
65
|
-
* operation takes, in the intent's words or (a Checkout Session) the enum's. */
|
|
66
|
-
function unknownMethodType(opId, given) {
|
|
67
|
-
const values = Array.isArray(given) ? given : given && typeof given === 'object' ? Object.values(given) : [given];
|
|
68
|
-
const checkout = opId === 'PostCheckoutSessions';
|
|
69
|
-
const known = checkout ? CHECKOUT_METHOD_TYPES : PAYMENT_METHOD_TYPES;
|
|
70
|
-
const i = values.findIndex((v) => !known.includes(String(v)));
|
|
71
|
-
if (i < 0)
|
|
72
|
-
return undefined;
|
|
73
|
-
if (checkout) {
|
|
74
|
-
const param = `payment_method_types[${i}]`;
|
|
75
|
-
return vendorError(manifest, { status: 400, param, message: `Invalid ${param}: must be one of ${oneOf(known)}` });
|
|
76
|
-
}
|
|
77
|
-
const doc = TYPES_DOC[opId.startsWith('PostSetupIntents') ? 'setup_intents' : 'payment_intents'];
|
|
78
|
-
return vendorError(manifest, { status: 400, param: 'payment_method_types', message: `The payment method type "${String(values[i])}" is invalid. See ${doc} for the full list of supported payment method types.` });
|
|
79
|
-
}
|
|
80
|
-
/** payment_method_types refused where the caller's version removed it. */
|
|
81
|
-
const noLongerSupported = (version) => vendorError(manifest, { status: 400, code: 'payment_method_types_no_longer_supported', param: 'payment_method_types', message: `payment_method_types is no longer supported in API version ${version}. Use allowed_payment_method_types, or dynamic payment methods, instead.` });
|
|
82
|
-
/** Stripe's refusal of a request whose top-level parameters the operation does not take, or undefined. */
|
|
83
|
-
export async function refuseParameters(call) {
|
|
84
|
-
const op = OPS.get(call.operation.id);
|
|
85
|
-
if (!op)
|
|
86
|
-
return undefined;
|
|
87
|
-
const pinned = call.request.headers.get('stripe-version');
|
|
88
|
-
if (pinned && pinned < SERVED_VERSION) {
|
|
89
|
-
if (!TYPED.has(op.id))
|
|
90
|
-
return undefined;
|
|
91
|
-
const earlier = await readParams(manifest, call.request.clone(), call.operation);
|
|
92
|
-
if (earlier.payment_method_types === undefined)
|
|
93
|
-
return undefined;
|
|
94
|
-
if (REMOVED_TYPES.has(op.id) && methodTypesRemoved(pinned))
|
|
95
|
-
return noLongerSupported(pinned);
|
|
96
|
-
return unknownMethodType(op.id, earlier.payment_method_types);
|
|
97
|
-
}
|
|
98
|
-
const method = call.request.method.toUpperCase();
|
|
99
|
-
const known = new Set([...(op.query ?? []), ...(op.body ?? [])].map((p) => p.name).concat(DOCUMENTED[op.id] ?? []));
|
|
100
|
-
const params = await readParams(manifest, call.request.clone(), call.operation);
|
|
101
|
-
if (REMOVED_TYPES.has(op.id) && params.payment_method_types !== undefined)
|
|
102
|
-
return noLongerSupported(pinned ?? SERVED_VERSION);
|
|
103
|
-
for (const name of Object.keys(params)) {
|
|
104
|
-
if (!known.has(name))
|
|
105
|
-
return vendorError(manifest, { status: 400, code: 'parameter_unknown', param: name, message: `Received unknown parameter: ${name}` });
|
|
106
|
-
}
|
|
107
|
-
const required = method === 'GET' || method === 'DELETE' ? (op.query ?? []) : (op.body ?? []);
|
|
108
|
-
for (const p of required) {
|
|
109
|
-
if (p.required && params[p.name] === undefined)
|
|
110
|
-
return vendorError(manifest, { status: 400, code: 'parameter_missing', param: p.name, message: `Missing required param: ${p.name}.` });
|
|
111
|
-
}
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
60
|
+
export const oneOf = (values) => (values.length > 1 ? `${values.slice(0, -1).join(', ')}, or ${values.at(-1)}` : values.join(''));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Row } from './common.js';
|
|
2
|
+
export declare const PI = "payment_intent";
|
|
3
|
+
/** Bookkeeping: the intents whose caller named the methods (payment_method_types, allowed_payment_method_types) on
|
|
4
|
+
* create. The twin's default list (['card']) stands for Stripe's choice and restricts nothing, so only a named list
|
|
5
|
+
* refuses a confirm with a method of another type. Kept apart from the intent: a `_` subject is never pushed
|
|
6
|
+
* (world-core isTwinBookkeeping). */
|
|
7
|
+
export declare const TYPES_GIVEN = "_payment_intent_types_given";
|
|
8
|
+
/** What every charge an intent makes carries of it: its transfer_group, which "identifies the resulting payment as part
|
|
9
|
+
* of a group" (docs.stripe.com/api/payment_intents/object), its description and its metadata. */
|
|
10
|
+
export declare function intentCarries(pi: Row): Row;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const PI = 'payment_intent';
|
|
2
|
+
/** Bookkeeping: the intents whose caller named the methods (payment_method_types, allowed_payment_method_types) on
|
|
3
|
+
* create. The twin's default list (['card']) stands for Stripe's choice and restricts nothing, so only a named list
|
|
4
|
+
* refuses a confirm with a method of another type. Kept apart from the intent: a `_` subject is never pushed
|
|
5
|
+
* (world-core isTwinBookkeeping). */
|
|
6
|
+
export const TYPES_GIVEN = '_payment_intent_types_given';
|
|
7
|
+
// ── THE MONEY MODEL, continued: a succeeded intent has a Charge ──
|
|
8
|
+
//
|
|
9
|
+
// Real Stripe always materializes a Charge when a PaymentIntent succeeds and points the intent's
|
|
10
|
+
// `latest_charge` at it: the charge is what a refund lands on, so an intent that succeeds without
|
|
11
|
+
// one cannot answer "refund this payment" at all. Idempotent against a repeated confirm: an intent
|
|
12
|
+
// that already names a successful charge keeps it (a second one would double the money collected); a
|
|
13
|
+
// declined attempt's failed charge is history, and the payment that succeeds makes its own. The id is
|
|
14
|
+
// returned so the caller folds `latest_charge` into the same intent write (one write, one event). The
|
|
15
|
+
// charge is written as the event Stripe sends for it, `charge.succeeded` ("Occurs whenever a charge is
|
|
16
|
+
// successful", docs.stripe.com/api/events/types); Stripe has no `charge.created`.
|
|
17
|
+
/** What every charge an intent makes carries of it: its transfer_group, which "identifies the resulting payment as part
|
|
18
|
+
* of a group" (docs.stripe.com/api/payment_intents/object), its description and its metadata. */
|
|
19
|
+
export function intentCarries(pi) {
|
|
20
|
+
return {
|
|
21
|
+
...(typeof pi.transfer_group === 'string' ? { transfer_group: pi.transfer_group } : {}),
|
|
22
|
+
...(typeof pi.description === 'string' ? { description: pi.description } : {}),
|
|
23
|
+
// "When a PaymentIntent creates a Charge, the metadata copies to the Charge in a one-time snapshot"
|
|
24
|
+
// (docs.stripe.com/metadata, "Copy metadata to another object")
|
|
25
|
+
...(pi.metadata && typeof pi.metadata === 'object' ? { metadata: { ...pi.metadata } } : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Row } from './common.js';
|
|
2
|
+
export declare const PM = "payment_method";
|
|
3
|
+
export declare const noBilling: {
|
|
4
|
+
address: null;
|
|
5
|
+
email: null;
|
|
6
|
+
name: null;
|
|
7
|
+
phone: null;
|
|
8
|
+
};
|
|
9
|
+
export declare const TEST_PM_CARDS: Record<string, {
|
|
10
|
+
brand: string;
|
|
11
|
+
number: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** Attach a payment method to a customer (both known to exist or be attachable): a stored one moves to the
|
|
14
|
+
* customer; a test name mints a new PaymentMethod on the customer carrying that card's outcome. */
|
|
15
|
+
/** The card a test name (pm_card_*, tok_*) stands for, never stored as a PaymentMethod (docs.stripe.com/testing#cards). */
|
|
16
|
+
export declare function testCardOf(ref: string): Row | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// PaymentMethod semantics: a PaymentMethod is created detached, attached to a customer, and
|
|
2
|
+
// detached again. The list is the derived core's.
|
|
3
|
+
import { paymentMethodSubObject } from "./stripe.js";
|
|
4
|
+
import { AFTER_SUCCESS_CARDS } from "./after-payment.js";
|
|
5
|
+
export const PM = 'payment_method';
|
|
6
|
+
export const noBilling = { address: null, email: null, name: null, phone: null };
|
|
7
|
+
export const TEST_PM_CARDS = {
|
|
8
|
+
...AFTER_SUCCESS_CARDS,
|
|
9
|
+
pm_card_mastercard: { brand: 'mastercard', number: '5555555555554444' },
|
|
10
|
+
pm_card_amex: { brand: 'amex', number: '378282246310005' },
|
|
11
|
+
pm_card_discover: { brand: 'discover', number: '6011111111111117' },
|
|
12
|
+
};
|
|
13
|
+
/** Attach a payment method to a customer (both known to exist or be attachable): a stored one moves to the
|
|
14
|
+
* customer; a test name mints a new PaymentMethod on the customer carrying that card's outcome. */
|
|
15
|
+
/** The card a test name (pm_card_*, tok_*) stands for, never stored as a PaymentMethod (docs.stripe.com/testing#cards). */
|
|
16
|
+
export function testCardOf(ref) {
|
|
17
|
+
const name = ref.replace(/^tok_/, 'pm_card_');
|
|
18
|
+
if (!name.startsWith('pm_card_'))
|
|
19
|
+
return undefined;
|
|
20
|
+
const test = TEST_PM_CARDS[name] ?? { brand: 'visa', number: '4242424242424242' };
|
|
21
|
+
return { ...paymentMethodSubObject('card', { card: { number: test.number } }).card, brand: test.brand };
|
|
22
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Radar semantics: reviews of payments Radar held (approving closes one, the machine in
|
|
2
|
+
// ../manifest.ts) and the value lists custom rules reference, with their items. Review list and
|
|
3
|
+
// retrieve, value-list list and retrieve, and value-list-item retrieve are the derived core's.
|
|
4
|
+
export const VL = 'radar.value_list';
|
|
5
|
+
export const VLI = 'radar.value_list_item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const REFUND_REASONS: Set<string>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// The published refund reasons; expired_uncaptured_charge is Stripe's own, not a request reason.
|
|
2
|
+
// source: spec:/paths/~1v1~1refunds/post/requestBody/content/application~1x-www-form-urlencoded/schema/properties/reason "String indicating the reason for the refund."
|
|
3
|
+
export const REFUND_REASONS = new Set(['duplicate', 'fraudulent', 'requested_by_customer']);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Row } from './common.js';
|
|
2
|
+
export declare const SUB = "subscription";
|
|
3
|
+
export declare const INV = "invoice";
|
|
4
|
+
export declare const HOUR = 3600;
|
|
5
|
+
/** The statuses a subscription renews in. */
|
|
6
|
+
export declare const RENEWING: string[];
|
|
7
|
+
export declare const itemsOf: (sub: Row) => Row[];
|
|
8
|
+
/** An item's quantity as it bills: 1 when none is set, and 0 when 0 is (a quantity of 0 bills nothing). */
|
|
9
|
+
export declare function itemQuantity(it: Row): number;
|
|
10
|
+
/** The subscription's discounts with a `once` coupon's spent: "When a subscription uses a coupon with `duration=once`, the
|
|
11
|
+
* coupon is considered used after the invoice finalizes and is removed from the subscription's `discounts` array"
|
|
12
|
+
* (docs.stripe.com/billing/subscriptions/coupons#coupon-duration). */
|
|
13
|
+
export declare function unspentDiscounts(discounts: unknown): Row[];
|
|
14
|
+
/** The coupon ids an invoice's discounts name. */
|
|
15
|
+
export declare const couponsOf: (discounts: unknown) => Set<string>;
|
|
16
|
+
/** A subscription's discounts after `invoice` finalizes: less the `once` coupons it took. */
|
|
17
|
+
export declare function keptAfter(discounts: Row[], invoice: Row): Row[];
|
|
18
|
+
/** A Checkout session's one-time line items as lines of its subscription's first invoice, numbered after its `after` lines. */
|
|
19
|
+
export declare function oneTimeLines(invoiceId: string, sub: Row, items: Row[], after: number, at: number, currency: string): {
|
|
20
|
+
id: string;
|
|
21
|
+
object: string;
|
|
22
|
+
type: string;
|
|
23
|
+
amount: number;
|
|
24
|
+
currency: string;
|
|
25
|
+
quantity: number;
|
|
26
|
+
proration: boolean;
|
|
27
|
+
price: Row | null;
|
|
28
|
+
subscription: unknown;
|
|
29
|
+
subscription_item: null;
|
|
30
|
+
invoice_item: null;
|
|
31
|
+
period: {
|
|
32
|
+
start: number;
|
|
33
|
+
end: number;
|
|
34
|
+
};
|
|
35
|
+
description: string | null;
|
|
36
|
+
}[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// A subscription's invoices over time: the first one Checkout pays, and each renewal. Time's moves are made
|
|
2
|
+
// as the twin's trial end already made them: caught up to the customer's clock (the World's, or its test
|
|
3
|
+
// clock) whenever the twin is asked anything (./front.ts), each checked against the machines in
|
|
4
|
+
// ../manifest.ts.
|
|
5
|
+
//
|
|
6
|
+
// - Checkout's subscription session pays the first invoice with the card the customer entered, which becomes the
|
|
7
|
+
// subscription's default payment method (docs.stripe.com/payments/checkout/how-checkout-works); nothing is due
|
|
8
|
+
// on a trial's.
|
|
9
|
+
// - At each period's end Stripe drafts a `subscription_cycle` invoice for the next period and advances the
|
|
10
|
+
// period; a trial's end is the first such renewal, and the subscription is active from then
|
|
11
|
+
// (docs.stripe.com/billing/subscriptions/overview#how-payments-work-subscriptions,
|
|
12
|
+
// docs.stripe.com/billing/subscriptions/trials).
|
|
13
|
+
// - About an hour after, Stripe finalizes the draft and charges the subscription's default payment method,
|
|
14
|
+
// else the customer's (docs.stripe.com/invoicing/integration/workflow-transitions#finalized,
|
|
15
|
+
// docs.stripe.com/api/subscriptions/object#subscription_object-default_payment_method).
|
|
16
|
+
// - A declined renewal leaves the invoice open with its attempt counted and the subscription past_due
|
|
17
|
+
// (docs.stripe.com/billing/subscriptions/overview#payment-status); paying the invoice later, through the API
|
|
18
|
+
// (docs.stripe.com/api/invoices/pay) or on the customer portal (docs.stripe.com/customer-management), makes it
|
|
19
|
+
// active again.
|
|
20
|
+
//
|
|
21
|
+
// Where the documentation stops and the twin decides: Stripe retries a failed renewal on its Smart Retries
|
|
22
|
+
// schedule and may then cancel or mark the subscription unpaid; the twin makes no retry (next_payment_attempt
|
|
23
|
+
// is null) and leaves it past_due until the invoice is paid. A paused subscription (pause_collection) is not renewed.
|
|
24
|
+
// - One set to cancel at its period's end is canceled when the period ends, with no renewal
|
|
25
|
+
// (docs.stripe.com/billing/subscriptions/cancel#cancel-at-end-of-cycle).
|
|
26
|
+
import { priceAmount } from "./stripe.js";
|
|
27
|
+
export const SUB = 'subscription';
|
|
28
|
+
export const INV = 'invoice';
|
|
29
|
+
export const HOUR = 3600;
|
|
30
|
+
/** The statuses a subscription renews in. */
|
|
31
|
+
export const RENEWING = ['trialing', 'active', 'past_due'];
|
|
32
|
+
export const itemsOf = (sub) => (sub.items?.data) ?? [];
|
|
33
|
+
/** An item's quantity as it bills: 1 when none is set, and 0 when 0 is (a quantity of 0 bills nothing). */
|
|
34
|
+
export function itemQuantity(it) {
|
|
35
|
+
return it.quantity === undefined || it.quantity === null ? 1 : Math.max(0, Math.trunc(Number(it.quantity) || 0));
|
|
36
|
+
}
|
|
37
|
+
/** The subscription's discounts with a `once` coupon's spent: "When a subscription uses a coupon with `duration=once`, the
|
|
38
|
+
* coupon is considered used after the invoice finalizes and is removed from the subscription's `discounts` array"
|
|
39
|
+
* (docs.stripe.com/billing/subscriptions/coupons#coupon-duration). */
|
|
40
|
+
export function unspentDiscounts(discounts) {
|
|
41
|
+
return (discounts ?? []).filter((d) => !(d && typeof d === 'object' && d.coupon?.duration === 'once'));
|
|
42
|
+
}
|
|
43
|
+
/** The coupon ids an invoice's discounts name. */
|
|
44
|
+
export const couponsOf = (discounts) => new Set((discounts ?? []).map((d) => {
|
|
45
|
+
const c = d && typeof d === 'object' ? d.coupon : undefined;
|
|
46
|
+
return typeof c === 'string' ? c : c && typeof c === 'object' ? String(c.id ?? '') : '';
|
|
47
|
+
}).filter(Boolean));
|
|
48
|
+
/** A subscription's discounts after `invoice` finalizes: less the `once` coupons it took. */
|
|
49
|
+
export function keptAfter(discounts, invoice) {
|
|
50
|
+
const taken = couponsOf(invoice.discounts);
|
|
51
|
+
return discounts.filter((d) => !(unspentDiscounts([d]).length === 0 && [...couponsOf([d])].some((c) => taken.has(c))));
|
|
52
|
+
}
|
|
53
|
+
/** A Checkout session's one-time line items as lines of its subscription's first invoice, numbered after its `after` lines. */
|
|
54
|
+
export function oneTimeLines(invoiceId, sub, items, after, at, currency) {
|
|
55
|
+
return items.map((it, i) => {
|
|
56
|
+
const price = it.price && typeof it.price === 'object' ? it.price : null;
|
|
57
|
+
const quantity = itemQuantity(it);
|
|
58
|
+
return {
|
|
59
|
+
id: `il_twin_${invoiceId}_${after + i + 1}`, object: 'line_item', type: 'subscription',
|
|
60
|
+
amount: priceAmount(price ?? undefined, quantity), currency, quantity, proration: false,
|
|
61
|
+
price, subscription: sub.id, subscription_item: null, invoice_item: null,
|
|
62
|
+
period: { start: at, end: at }, description: typeof it.description === 'string' ? it.description : null,
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
method: string;
|
|
3
|
-
path: string;
|
|
4
|
-
body?: string;
|
|
5
|
-
occurredAt?: string;
|
|
6
|
-
root?: string;
|
|
7
|
-
readOnly?: boolean;
|
|
8
|
-
idempotencyKey?: string;
|
|
9
|
-
apiVersion?: string;
|
|
10
|
-
stripeAccount?: string;
|
|
11
|
-
};
|
|
1
|
+
import { type TwinResource } from '@volter/world-core';
|
|
12
2
|
export type StripeResponse = {
|
|
13
3
|
status: number;
|
|
14
4
|
body: unknown;
|
|
15
5
|
};
|
|
6
|
+
/** Stripe's error body: an invalid_request_error with the message, and the code when there is one. */
|
|
7
|
+
export declare function err(message: string, status?: number, code?: string): StripeResponse;
|
|
16
8
|
export declare const TWIN_API_VERSION: string;
|
|
17
9
|
export declare function isValidApiVersion(v: string): boolean;
|
|
18
10
|
export declare function validateMoney(params: Record<string, unknown>): StripeResponse | null;
|
|
@@ -23,14 +15,13 @@ type DeclineOutcome = {
|
|
|
23
15
|
};
|
|
24
16
|
export declare const TEST_TOKEN_DECLINES: Record<string, DeclineOutcome | null>;
|
|
25
17
|
/** A stored subject by stored type and id, in the pack's view (tombstones included): how the
|
|
26
|
-
* semantics hand these helpers the tree they read (
|
|
18
|
+
* semantics hand these helpers the tree they read (./common.ts `finder`). */
|
|
27
19
|
export type FindStored = (storedType: string, id: string) => Record<string, unknown> | undefined;
|
|
28
20
|
export declare function declineFor(find: FindStored, ...paramSets: Array<Record<string, unknown>>): DeclineOutcome | null | undefined;
|
|
29
21
|
export declare function requiresAuthentication(...paramSets: Array<Record<string, unknown>>): boolean;
|
|
30
22
|
export declare function threeDsNextAction(): Record<string, unknown>;
|
|
31
23
|
export declare function requiresMicrodeposits(...paramSets: Array<Record<string, unknown>>): boolean;
|
|
32
24
|
export declare function microdepositsNextAction(): Record<string, unknown>;
|
|
33
|
-
export declare function verifyMicrodeposits(params: Record<string, unknown>, _existing: Record<string, unknown>): StripeResponse | null;
|
|
34
25
|
/** A card error's body: `charge` "For card errors, the ID of the failed charge", and `payment_intent` "The PaymentIntent
|
|
35
26
|
* object for errors returned on a request involving a PaymentIntent" (docs.stripe.com/api/errors). */
|
|
36
27
|
export declare function cardError(outcome: DeclineOutcome, attach?: {
|
|
@@ -38,21 +29,17 @@ export declare function cardError(outcome: DeclineOutcome, attach?: {
|
|
|
38
29
|
payment_intent?: Record<string, unknown>;
|
|
39
30
|
}): StripeResponse;
|
|
40
31
|
export declare function nowUnix(occurredAt?: string): number;
|
|
41
|
-
|
|
32
|
+
/** An intent's client secret: its id, `_secret_`, and a secret the World holds for it (ctx.secret, passed in), so no one
|
|
33
|
+
* derives it from the intent's id; Stripe.js confirms an intent with it and the publishable key. */
|
|
34
|
+
export declare function mintClientSecret(id: string, secret: string): string;
|
|
42
35
|
export declare const OBJECT_NAME: Record<string, string>;
|
|
43
|
-
|
|
36
|
+
/** A stored row as Stripe answers it: its `object`, its own fields (the vendor's `type` among them, which the tree's
|
|
37
|
+
* shadows: world-core ownFields) without the twin's `_` bookkeeping, and its id. */
|
|
38
|
+
export declare function view(type: string, r: TwinResource): Record<string, unknown>;
|
|
44
39
|
export declare function paginate(items: Array<Record<string, unknown>>, params: Record<string, unknown>): {
|
|
45
40
|
page: Array<Record<string, unknown>>;
|
|
46
41
|
hasMore: boolean;
|
|
47
42
|
};
|
|
48
|
-
/** What follows every stored Stripe write: the webhook for the state change and the stored Event
|
|
49
|
-
* the Events API lists. The derived pack's write hook (manifest.ts) is this same function. */
|
|
50
|
-
export declare function afterStripeWrite(type: string, op: string, out: Record<string, unknown>, root?: string, occurredAt?: string, apiVersion?: string, stripeAccount?: string): Promise<void>;
|
|
51
|
-
/** The id the World's next event takes: its place in the World's events, so it is deterministic and never repeats
|
|
52
|
-
* within a World (a Balance has no id of its own, so nothing about the object can tell two events apart). The number
|
|
53
|
-
* is taken synchronously — the count of stored events, or the last number taken, whichever is higher. */
|
|
54
|
-
export declare function nextStripeEventId(root?: string): string;
|
|
55
|
-
export declare function persistStripeEvent(eventType: string, resource: Record<string, unknown>, root?: string, occurredAt?: string, apiVersion?: string, account?: string, id?: string): Promise<void>;
|
|
56
43
|
export declare function asBool(v: unknown): boolean;
|
|
57
44
|
export declare function searchOver(items: Array<Record<string, unknown>>, params: Record<string, unknown>, path: string): StripeResponse;
|
|
58
45
|
export declare function subscriptionHasPrice(sub: Record<string, unknown>, priceId: string): boolean;
|
|
@@ -63,10 +50,6 @@ export declare function subscriptionCouponParam(params: Record<string, unknown>)
|
|
|
63
50
|
export declare function buildDiscount(coupon: Record<string, unknown>, customer: string, at: number, on?: {
|
|
64
51
|
subscription?: string;
|
|
65
52
|
}): Record<string, unknown>;
|
|
66
|
-
export declare function subscriptionItemPairs(sub: Record<string, unknown>): Array<{
|
|
67
|
-
price: string;
|
|
68
|
-
quantity: number;
|
|
69
|
-
}>;
|
|
70
53
|
export declare function subscriptionItemEntries(value: unknown): Array<Record<string, unknown>>;
|
|
71
54
|
type BillingInterval = 'day' | 'week' | 'month' | 'year';
|
|
72
55
|
export declare function resolveSubscriptionBillingInterval(entries: Array<Record<string, unknown>>, find: FindStored): {
|
|
@@ -93,10 +76,8 @@ export declare function resolveTrial(params: Record<string, unknown>, at: number
|
|
|
93
76
|
start: number;
|
|
94
77
|
end: number;
|
|
95
78
|
} | undefined;
|
|
96
|
-
export declare function stashVendorType(_type: string, fields: Record<string, unknown>): Record<string, unknown>;
|
|
97
|
-
export declare function embedIssuingAuthorizationCard(body: Record<string, unknown>, root?: string): Record<string, unknown>;
|
|
98
79
|
export declare function emptySpendingControls(): Record<string, unknown>;
|
|
99
|
-
export declare function normalizeSpendingControls(raw: unknown, currency: string | null): {
|
|
80
|
+
export declare function normalizeSpendingControls(raw: unknown, currency: string | null, previous?: Record<string, unknown>): {
|
|
100
81
|
controls?: Record<string, unknown>;
|
|
101
82
|
error?: StripeResponse;
|
|
102
83
|
};
|
|
@@ -137,19 +118,5 @@ export declare function resolveLineItem(entry: Record<string, unknown>, index: n
|
|
|
137
118
|
};
|
|
138
119
|
export declare function lineItemEntries(params: Record<string, unknown>): Array<Record<string, unknown>>;
|
|
139
120
|
export declare function chargeDefaults(chargeId: string, amount: number, captured: boolean, occurredAt?: string): Record<string, unknown>;
|
|
140
|
-
|
|
141
|
-
* Public entry: honors the Idempotency-Key (replay → stored response, no re-write)
|
|
142
|
-
* then delegates to the router. Only POSTs are idempotent (matches Stripe; GET/DELETE
|
|
143
|
-
* pass straight through). A read-only twin never stores (it cannot write).
|
|
144
|
-
*/
|
|
145
|
-
/** Stripe's API as one call: the request goes through the pack's own dispatch (the derived dispatch over
|
|
146
|
-
* its semantics, its derived core and the hand-written routes below), so a caller that holds no
|
|
147
|
-
* HTTP server reaches exactly what an SDK does. `occurredAt` pins the World instant. */
|
|
148
|
-
export declare function handleStripeTwinRequest(req: StripeRequest): Promise<StripeResponse>;
|
|
149
|
-
/**
|
|
150
|
-
* The twin's doors: what stands in for an act Stripe's API does not have, each under `/_twin/`. The
|
|
151
|
-
* platform's own account settings (its payout schedule) change on Stripe's Dashboard, which has no API:
|
|
152
|
-
* POST /_twin/account stands in for that page. Answers nothing for any other path.
|
|
153
|
-
*/
|
|
154
|
-
export declare function handleStripeDoor(req: StripeRequest, params: Record<string, unknown>): Promise<StripeResponse | undefined>;
|
|
121
|
+
export declare function planView(price: Record<string, unknown>): Record<string, unknown>;
|
|
155
122
|
export {};
|