@owlmeans/server-payment 0.1.18-rc.11 → 0.1.18-rc.13

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.
Files changed (69) hide show
  1. package/README.md +1 -1
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/server-payment/SKILL.md +67 -7
  4. package/build/config.d.ts +15 -1
  5. package/build/config.d.ts.map +1 -1
  6. package/build/config.js +40 -2
  7. package/build/config.js.map +1 -1
  8. package/build/consts.d.ts +10 -0
  9. package/build/consts.d.ts.map +1 -1
  10. package/build/consts.js +10 -0
  11. package/build/consts.js.map +1 -1
  12. package/build/index.d.ts +2 -0
  13. package/build/index.d.ts.map +1 -1
  14. package/build/index.js +1 -0
  15. package/build/index.js.map +1 -1
  16. package/build/model.d.ts.map +1 -1
  17. package/build/model.js +2 -1
  18. package/build/model.js.map +1 -1
  19. package/build/plugins/estimate.d.ts +43 -0
  20. package/build/plugins/estimate.d.ts.map +1 -0
  21. package/build/plugins/estimate.js +235 -0
  22. package/build/plugins/estimate.js.map +1 -0
  23. package/build/plugins/events.d.ts.map +1 -1
  24. package/build/plugins/events.js +17 -4
  25. package/build/plugins/events.js.map +1 -1
  26. package/build/plugins/fx.d.ts +26 -0
  27. package/build/plugins/fx.d.ts.map +1 -0
  28. package/build/plugins/fx.js +56 -0
  29. package/build/plugins/fx.js.map +1 -0
  30. package/build/plugins/portal.d.ts.map +1 -1
  31. package/build/plugins/portal.js +6 -2
  32. package/build/plugins/portal.js.map +1 -1
  33. package/build/plugins/stripe.d.ts +2 -1
  34. package/build/plugins/stripe.d.ts.map +1 -1
  35. package/build/plugins/stripe.js +51 -19
  36. package/build/plugins/stripe.js.map +1 -1
  37. package/build/service.d.ts.map +1 -1
  38. package/build/service.js +6 -0
  39. package/build/service.js.map +1 -1
  40. package/build/sync.d.ts +5 -0
  41. package/build/sync.d.ts.map +1 -1
  42. package/build/sync.js +80 -14
  43. package/build/sync.js.map +1 -1
  44. package/build/types.d.ts +46 -1
  45. package/build/types.d.ts.map +1 -1
  46. package/build/utils.d.ts +3 -1
  47. package/build/utils.d.ts.map +1 -1
  48. package/build/utils.js +3 -1
  49. package/build/utils.js.map +1 -1
  50. package/package.json +16 -16
  51. package/src/config.ts +47 -5
  52. package/src/consts.ts +11 -0
  53. package/src/index.ts +2 -0
  54. package/src/model.ts +2 -1
  55. package/src/plugins/estimate.ts +299 -0
  56. package/src/plugins/events.ts +17 -4
  57. package/src/plugins/fx.ts +93 -0
  58. package/src/plugins/portal.ts +6 -2
  59. package/src/plugins/stripe.ts +55 -19
  60. package/src/service.ts +6 -0
  61. package/src/sync.ts +101 -13
  62. package/src/types.ts +49 -2
  63. package/src/utils.ts +6 -2
  64. package/tests/checkout.spec.ts +118 -2
  65. package/tests/estimate.spec.ts +240 -0
  66. package/tests/events.spec.ts +13 -0
  67. package/tests/fake-stripe.ts +130 -6
  68. package/tests/portal.spec.ts +19 -2
  69. package/tests/sync.spec.ts +114 -0
package/README.md CHANGED
@@ -130,7 +130,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
130
130
  your project's skill store (`.agents/skills/`):
131
131
 
132
132
  ```sh
133
- npx @owlmeans/agent-skills@^0.1.18-rc.28
133
+ npx @owlmeans/agent-skills@^0.1.18-rc.30
134
134
  ```
135
135
 
136
136
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/server-payment",
4
- "version": "0.1.18-rc.11",
5
- "generatedAt": "2026-09-16T17:32:31.941Z",
4
+ "version": "0.1.18-rc.13",
5
+ "generatedAt": "2026-09-19T13:42:56.261Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -7,7 +7,7 @@ user-invocable: false
7
7
 
8
8
  # @owlmeans/server-payment
9
9
 
10
- **Install:** `bun add @owlmeans/server-payment@^0.1.18-rc.11`
10
+ **Install:** `bun add @owlmeans/server-payment@^0.1.18-rc.13`
11
11
 
12
12
  Public MIT package. It embeds Stripe into an application backend and owns everything between
13
13
  Stripe and an entity's entitlements: the subscription store, one-time fulfillments, the usage
@@ -22,6 +22,14 @@ the `entitlements` skill.
22
22
  ```typescript
23
23
  stripeSecrets(cfg, { api: '/secrets/stripe-key' }) // webhook secret: optional override
24
24
  portalBranding(cfg, { returnUrl: 'https://app.example.com/billing', headline: 'Example' })
25
+ declarePaymentPricing(cfg, { // absent entirely: today's fixed behaviour, unchanged
26
+ tax: { automatic: true, behavior: TaxBehavior.Exclusive, collectTaxId: true, estimate: true },
27
+ currency: { adaptive: true, estimate: true },
28
+ stripe: {
29
+ settlementCurrency: 'eur', // optional: catalogue USD → settlement EUR
30
+ subscriptionPaymentMethodTypes: ['card', 'link', 'klarna'], // optional; absent = Stripe dynamic selection
31
+ },
32
+ })
25
33
  declarePaymentProduct(cfg, { sku: 'app-plans', type: ProductType.Service, services: ['app'], name: 'Plans' })
26
34
  declarePaymentPlan(cfg, { productSku: 'app-plans', sku: 'free', rank: 0, free: true, price: 0, … })
27
35
  declarePaymentPlan(cfg, { productSku: 'app-plans', sku: 'pro-monthly', rank: 10, price: 20,
@@ -82,19 +90,63 @@ does not know as a string, and the collection validator rejects it.
82
90
 
83
91
  ## Checkout and fulfillment
84
92
 
85
- - `Amount`: one inline `price_data` item for the synchronized product, quantity 1, tax-exclusive,
86
- no promotion codes; the net `amountMinor` and the grossed-up `chargeAmountMinor` travel in the
87
- session metadata. `Quantity`: the reusable price under the plan lookup key, adjustable quantity.
88
- Subscription: `planSku` (else the product's first recurring plan), quantity 1.
93
+ - `Amount`: one inline `price_data` item for the synchronized product, quantity 1, its `tax_behavior`
94
+ the declared `PricingPolicy.tax.behavior` (default `'exclusive'`), no promotion codes. With
95
+ `stripe.settlementCurrency`, the catalogue `amountMinor` and grossed-up `sourceChargeAmountMinor`
96
+ stay in `amountCurrency`, while a fresh Stripe FX reference rate produces `chargeAmountMinor` in
97
+ the settlement `currency`. Without it, source and charge amounts/currencies are identical. `Quantity`:
98
+ the reusable price under the plan lookup key, adjustable quantity. Subscription: `planSku` (else
99
+ the product's first recurring plan), quantity 1.
89
100
  - A plan the paygate does not sell — a free plan, another gateway's plan — is refused
90
- (`ProductError`). Every session enables automatic tax, billing address and tax id collection.
101
+ (`ProductError`). `checkoutOptions(policy, promotions)` puts automatic tax, billing address
102
+ collection, tax-id collection and Adaptive Pricing (`adaptive_pricing`) on the session, each
103
+ independently, exactly as `PricingPolicy` declares them — an undeclared policy reproduces the
104
+ fixed pre-policy session (automatic tax + tax-id collection on, no Adaptive Pricing).
105
+ - `stripe.subscriptionPaymentMethodTypes` explicitly sets `payment_method_types` on subscription
106
+ Sessions only; absent keeps Stripe's dynamic selection. Declare only recurring-capable methods:
107
+ Stripe rejects single-use methods such as BLIK in `subscription` mode. Account availability,
108
+ customer country, currency and each method's own restrictions still apply.
91
109
  - `checkout.session.completed` and `…async_payment_succeeded` fulfill only a `payment`-mode session
92
110
  with `payment_status === 'paid'`; an amount session must match its metadata currency and subtotal.
111
+ Adaptive Pricing never disturbs this: Session/webhook amounts stay in the settlement/integration
112
+ currency whatever currency the buyer paid in. Fulfillment validates that subtotal separately
113
+ from the source amount and preserves both currency pairs in its row and observer event.
93
114
  - A pending `payment-fulfillment` row (with `paymentIntentId` and `invoiceId`) is written before
94
115
  observers run; `fulfilledAt` is stamped after they succeed. An observer throw escapes so Stripe
95
116
  redelivers, and the observer must stay idempotent by `externalId` — a crash after its side effect
96
117
  and before the stamp redelivers the same session.
97
118
 
119
+ ## Price sync and the tax estimate
120
+
121
+ - `syncStripeProducts` gives a matching, still-`unspecified` price the declared `tax.behavior` IN
122
+ PLACE (`prices.update`; Stripe forbids changing a price already `exclusive`/`inclusive`) and a
123
+ fresh one on creation; a price already carrying the OPPOSITE behavior is deactivated and replaced,
124
+ the same as any other catalogue mismatch. Before an in-place update it checks the account's own
125
+ tax-settings default (`stripe.tax.settings.retrieve`) and skips the update — logging why — when
126
+ that default would make the price behave the other way for existing renewals, unless
127
+ `declarePaymentPricing({ stripe: { migrateUnspecifiedPrices: true } })` opts in. The behavior is
128
+ part of the sync fingerprint, so declaring or changing it re-syncs every product exactly once.
129
+ - When `stripe.settlementCurrency` differs from a plan's catalogue currency, each product sync gets
130
+ an unlocked Stripe FX Quote and converts recurring Prices with `rate_details.reference_rate`,
131
+ rounding minor units up. The resolved amount and currency are fingerprinted: an unchanged rounded
132
+ amount makes no product/price calls, while a changed amount deactivates the old Price and creates
133
+ a replacement. Existing subscriptions keep their accepted Price and settlement amount.
134
+ - `GatewayService.estimatePrice(ctx, { entityId, productSku, planSku?, country? })` (`estimatePrice`
135
+ in `plugins/estimate.ts`) is a Stripe Tax calculation (plus, with `currency.estimate` and
136
+ `currency.adaptive` both on, an FX Quotes lookup) for one product/plan's reference amount, at a
137
+ billing country the request names or the entity's paygate customer's. **$0.05 per distinct**
138
+ (currency, country, amount, tax code, behavior, matching tax ids) **combination** — cached per
139
+ gateway-service instance (never module-level: several instances in one process, as in tests, must
140
+ never share hits) for 24h; a rate-limit or connection error is never cached. Its status
141
+ (`TaxEstimateStatus`) covers a resolved rate, EU/GB reverse charge (a saved tax id whose OWN
142
+ country matches the one being estimated), no tax, "compute at checkout" (an unsupported
143
+ jurisdiction, or an invalid-request error such as a US address with no postal code), and
144
+ "choose a country" (neither the request nor the customer names one — zero Stripe calls). The FX
145
+ Quotes call is a Stripe PREVIEW endpoint (`STRIPE_FX_QUOTES_API_VERSION`, `stripe.rawRequest`),
146
+ and its failure only drops the estimate's `local` field, never the tax half. With a distinct
147
+ settlement currency, the local estimate composes catalogue→settlement `reference_rate` with the
148
+ fee-inclusive local→settlement `exchange_rate`, matching the Checkout conversion chain.
149
+
98
150
  ## The subscription store
99
151
 
100
152
  - **The effective plan** is the highest-ranked row in `ENTITLING_STATUSES` (catalogue rank; the
@@ -183,7 +235,9 @@ and logged when it fails.
183
235
  price switching between every product's active recurring prices with prorations — both
184
236
  subscription features off when nothing recurring is sold. `portalBranding` supplies the business
185
237
  profile and default return URL; fingerprint `portal:<service>` holds its id, and its hash covers
186
- the catalogue, the branding and the deployment key, so an unchanged declaration makes no call.
238
+ the catalogue (including the declared tax behavior — a price `sync.ts` replaces refreshes the
239
+ portal's `products[].prices` too), the branding and the deployment key, so an unchanged
240
+ declaration makes no call.
187
241
  - **Each deployment owns its own portal configuration**, tagged
188
242
  `{ owlmeans: 'payment', service, deployment: webhookUrlOf(ctx) }` (`STRIPE_DEPLOYMENT_KEY`) — the
189
243
  webhook URL keys it even when undeliverable (local). The configuration the fingerprint row names
@@ -286,6 +340,12 @@ database.
286
340
  - https://docs.stripe.com/api/subscriptions/object — statuses `incomplete|incomplete_expired|trialing|active|past_due|canceled|unpaid|paused`; `pause_collection` pauses collection without changing the status; `paused` only after a trial without a payment method; on `2025-02-24.acacia` (stripe-node 17) `current_period_start/end` and `invoice.subscription` are top-level and move in later versions.
287
341
  - https://docs.stripe.com/customer-management/portal-deep-links and https://docs.stripe.com/api/customer_portal/sessions/create — `flow_data.type` ∈ `payment_method_update|subscription_cancel|subscription_update|subscription_update_confirm`; `subscription_update_confirm.items` holds exactly one `{ id: <subscription item id>, price, quantity }`; `after_completion` is `redirect|hosted_confirmation|portal_homepage`; the configuration must enable `subscription_update` (with `products[{product, prices[]}]`) and `subscription_cancel`.
288
342
  - https://docs.stripe.com/api/customer_portal/configurations/create — `features.{customer_update, invoice_history, payment_method_update, subscription_cancel{enabled, mode, proration_behavior}, subscription_update{enabled, default_allowed_updates, products, proration_behavior}}`, `business_profile`, `default_return_url`, `metadata`; updatable by id, retrievable and listable (`active`, paginated), and never deletable — a configuration can only be deactivated.
343
+ - https://docs.stripe.com/api/tax/calculations/create — `line_items[].tax_behavior` (default `exclusive`), `tax_code`; `customer_details.address_source` ∈ `billing|shipping`; `tax_ids[]` shifts liability (a valid id is never validated for correctness); the response's `tax_breakdown[].tax_rate_details.percentage_decimal` is a STRING (parse it exactly, never `Number(x) * 10_000`) and `.rate_type` ∈ `flat_amount|percentage` (a flat rate never scales with the amount).
344
+ - https://docs.stripe.com/tax/products-prices-tax-codes-tax-behavior — a price's `tax_behavior` can be set only from `unspecified`; once `exclusive`/`inclusive` it cannot change, and `inferred_by_currency` (an account tax-settings default) resolves to exclusive for USD/CAD, inclusive otherwise.
345
+ - https://docs.stripe.com/payments/currencies/localize-prices/adaptive-pricing — `adaptive_pricing.enabled` on a Checkout Session; requires the price currency to be a settlement currency; Session/PaymentIntent/webhook amounts stay in the integration currency, with `presentment_details.{presentment_amount, presentment_currency}` alongside them when the buyer paid differently.
346
+ - https://docs.stripe.com/billing/subscriptions/klarna — Checkout can save Klarna for recurring subscription charges when the account and buyer are eligible.
347
+ - https://docs.stripe.com/payments/blik — BLIK is single-use and does not support recurring payments.
348
+ - https://docs.stripe.com/api/fx_quotes/create — a **preview** endpoint (needs a preview `Stripe-Version`, called via `stripe.rawRequest`); `to_currency`/`from_currencies[]`; `lock_duration: 'none'` is free, `five_minutes|hour|day` add a fee (`rate_details.duration_premium`) baked into `exchange_rate`; settlement conversion uses `rate_details.reference_rate`, while local-presentment estimates use fee-inclusive `exchange_rate`.
289
349
 
290
350
  ## Related
291
351
 
package/build/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Config, PaymentPlan, PaymentPlanDef, PaymentProductDef, PortalBrandingDef, StripeSecretsDef } from './types.js';
1
+ import type { Config, PaymentPlan, PaymentPlanDef, PaymentProductDef, PortalBrandingDef, PricingDef, StripeSecretsDef } from './types.js';
2
2
  export declare const declarePaymentProduct: (cfg: Config, def: PaymentProductDef) => void;
3
3
  /**
4
4
  * Declare a plan into the configuration catalogue.
@@ -32,4 +32,18 @@ export declare const assertPlanDeclarations: (cfg: Config) => void;
32
32
  export declare const stripeSecrets: (cfg: Config, paths: StripeSecretsDef) => void;
33
33
  /** Branding and the default return URL of the managed customer portal configuration. */
34
34
  export declare const portalBranding: (cfg: Config, def: PortalBrandingDef) => void;
35
+ /**
36
+ * Declare the pricing policy: whether checkout collects tax and a VAT/GST id, what `tax_behavior`
37
+ * synced prices are given, Adaptive Pricing, and whether the estimate endpoints are served. A
38
+ * config never carries more than one — a second call replaces the first, so re-declaring (a test, a
39
+ * config module re-run) is safe rather than silently ignored (a config resource resolves an id to
40
+ * its FIRST match).
41
+ *
42
+ * `def.stripe` (the FX Quotes preview version, the unspecified-price migration switch) is
43
+ * Stripe-only and goes to a backend plugin, never the advertised `PricingPolicy` record.
44
+ *
45
+ * @throws PaymentError (`assertPricingPolicy`) when an estimate is declared without the tax or
46
+ * currency capability it requires.
47
+ */
48
+ export declare const declarePaymentPricing: (cfg: Config, def: PricingDef) => void;
35
49
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,MAAM,EAAE,WAAW,EAAE,cAAc,EAAkB,iBAAiB,EAAE,iBAAiB,EACzF,gBAAgB,EACjB,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,qBAAqB,QAAS,MAAM,OAAO,iBAAiB,KAAG,IAS3E,CAAA;AA8BD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,QAAS,MAAM,OAAO,cAAc,KAAG,IA2CrE,CAAA;AAED,gDAAgD;AAChD,eAAO,MAAM,eAAe,QAAS,MAAM,KAAG,WAAW,EACiD,CAAA;AAE1G;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,QAAS,MAAM,KAAG,IAmBpD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM,SAAS,gBAAgB,KAAG,IAIpE,CAAA;AAED,wFAAwF;AACxF,eAAO,MAAM,cAAc,QAAS,MAAM,OAAO,iBAAiB,KAAG,IAOpE,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,MAAM,EAAE,WAAW,EAAE,cAAc,EAAkB,iBAAiB,EAAE,iBAAiB,EACzF,UAAU,EAAE,gBAAgB,EAC7B,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,qBAAqB,QAAS,MAAM,OAAO,iBAAiB,KAAG,IAS3E,CAAA;AA8BD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,QAAS,MAAM,OAAO,cAAc,KAAG,IA2CrE,CAAA;AAED,gDAAgD;AAChD,eAAO,MAAM,eAAe,QAAS,MAAM,KAAG,WAAW,EACiD,CAAA;AAE1G;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,QAAS,MAAM,KAAG,IAmBpD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM,SAAS,gBAAgB,KAAG,IAIpE,CAAA;AAED,wFAAwF;AACxF,eAAO,MAAM,cAAc,QAAS,MAAM,OAAO,iBAAiB,KAAG,IAOpE,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,QAAS,MAAM,OAAO,UAAU,KAAG,IAwBpE,CAAA"}
package/build/config.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { toConfigRecord } from '@owlmeans/server-app';
2
2
  import { plugin } from '@owlmeans/config';
3
- import { assertAmountCheckoutPolicy, assertQuantityCheckoutPolicy, CAPABILITY_LIMIT_SCOPE, CheckoutPricingMode, LimitKind, LimitMisdeclared, LimitWindow, PLAN_RECORD_PREFIX, PLAN_RECORD_TYPE, PlanDuration, PlanRankConflict, PlanStatus, PRODUCT_RECORD_PREFIX, PRODUCT_RECORD_TYPE, } from '@owlmeans/payment';
4
- import { STRIPE_PAYGATE_ALIAS, STRIPE_PLUGIN_CONFIG, STRIPE_PORTAL_PLUGIN_CONFIG } from './consts.js';
3
+ import { assertAmountCheckoutPolicy, assertPricingPolicy, assertQuantityCheckoutPolicy, CAPABILITY_LIMIT_SCOPE, CheckoutPricingMode, LimitKind, LimitMisdeclared, LimitWindow, PLAN_RECORD_PREFIX, PLAN_RECORD_TYPE, PaymentError, PlanDuration, PlanRankConflict, PlanStatus, PRICING_POLICY_RECORD_ID, PRICING_POLICY_RECORD_TYPE, PRODUCT_RECORD_PREFIX, PRODUCT_RECORD_TYPE, } from '@owlmeans/payment';
4
+ import { STRIPE_PAYGATE_ALIAS, STRIPE_PLUGIN_CONFIG, STRIPE_PORTAL_PLUGIN_CONFIG, STRIPE_PRICING_PLUGIN_CONFIG, } from './consts.js';
5
5
  export const declarePaymentProduct = (cfg, def) => {
6
6
  cfg.records = cfg.records ?? [];
7
7
  const product = {
@@ -141,4 +141,42 @@ export const portalBranding = (cfg, def) => {
141
141
  ...(def.termsOfServiceUrl != null ? { termsOfServiceUrl: def.termsOfServiceUrl } : {}),
142
142
  }, STRIPE_PORTAL_PLUGIN_CONFIG);
143
143
  };
144
+ /**
145
+ * Declare the pricing policy: whether checkout collects tax and a VAT/GST id, what `tax_behavior`
146
+ * synced prices are given, Adaptive Pricing, and whether the estimate endpoints are served. A
147
+ * config never carries more than one — a second call replaces the first, so re-declaring (a test, a
148
+ * config module re-run) is safe rather than silently ignored (a config resource resolves an id to
149
+ * its FIRST match).
150
+ *
151
+ * `def.stripe` (the FX Quotes preview version, the unspecified-price migration switch) is
152
+ * Stripe-only and goes to a backend plugin, never the advertised `PricingPolicy` record.
153
+ *
154
+ * @throws PaymentError (`assertPricingPolicy`) when an estimate is declared without the tax or
155
+ * currency capability it requires.
156
+ */
157
+ export const declarePaymentPricing = (cfg, def) => {
158
+ const { stripe, ...policy } = def;
159
+ assertPricingPolicy(policy);
160
+ cfg.records = (cfg.records ?? []).filter(record => record.id !== PRICING_POLICY_RECORD_ID);
161
+ cfg.records.push({
162
+ ...toConfigRecord(policy), recordType: PRICING_POLICY_RECORD_TYPE, id: PRICING_POLICY_RECORD_ID,
163
+ });
164
+ if (stripe != null) {
165
+ const settlementCurrency = stripe.settlementCurrency?.toLowerCase();
166
+ if (settlementCurrency != null && !/^[a-z]{3}$/.test(settlementCurrency)) {
167
+ throw new PaymentError('pricing-policy:settlement-currency');
168
+ }
169
+ const subscriptionPaymentMethodTypes = stripe.subscriptionPaymentMethodTypes?.map(type => type.toLowerCase());
170
+ if (subscriptionPaymentMethodTypes != null && (subscriptionPaymentMethodTypes.length === 0
171
+ || subscriptionPaymentMethodTypes.some(type => !/^[a-z][a-z0-9_]*$/.test(type))
172
+ || new Set(subscriptionPaymentMethodTypes).size !== subscriptionPaymentMethodTypes.length)) {
173
+ throw new PaymentError('pricing-policy:subscription-payment-methods');
174
+ }
175
+ plugin(cfg, {
176
+ ...stripe,
177
+ ...(settlementCurrency != null ? { settlementCurrency } : {}),
178
+ ...(subscriptionPaymentMethodTypes != null ? { subscriptionPaymentMethodTypes } : {}),
179
+ }, STRIPE_PRICING_PLUGIN_CONFIG);
180
+ }
181
+ };
144
182
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EACL,0BAA0B,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,mBAAmB,EACrG,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAC5F,gBAAgB,EAAE,UAAU,EAAE,qBAAqB,EAAE,mBAAmB,GACzE,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAMrG,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAW,EAAE,GAAsB,EAAQ,EAAE;IACjF,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,EAAE,CAAA;IAC/B,MAAM,OAAO,GAAmB;QAC9B,IAAI,EAAE,GAAG,CAAC,IA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AAI,IAAI,EAAE,CAAC;QACnB,MAAM,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,EAAE,WAAW,EAAE,CAAA;QACnE,IAAI,kBAAkB,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACzE,MAAM,IAAI,YAAY,CAAC,oCAAoC,CAAC,CAAA;QAC9D,CAAC;QACD,MAAM,8BAA8B,GAAG,MAAM,CAAC,8BAA8B,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;QAC7G,IAAI,8BAA8B,IAAI,IAAI,IAAI,CAAC,8BAA8B,CAAC,MAAM,KAAK,CAAC;eACrF,8BAA8B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;eAC5E,IAAI,GAAG,CAAC,8BAA8B,CAAC,CAAC,IAAI,KAAK,8BAA8B,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7F,MAAM,IAAI,YAAY,CAAC,6CAA6C,CAAC,CAAA;QACvE,CAAC;QACD,MAAM,CAAC,GAAG,EAAE;YACV,GAAG,MAAM;YACT,GAAG,CAAC,kBAAkB,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7D,GAAG,CAAC,8BAA8B,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,8BAA8B,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtF,EAAE,4BAA4B,CAAC,CAAA;IAClC,CAAC;AACH,CAAC,CAAA"}
package/build/consts.d.ts CHANGED
@@ -3,7 +3,17 @@ export { INTERNAL_PAYGATE, LIMIT_GATE };
3
3
  export declare const STRIPE_PAYGATE_ALIAS = "stripe";
4
4
  export declare const STRIPE_PLUGIN_CONFIG = "_external:stripe";
5
5
  export declare const STRIPE_PORTAL_PLUGIN_CONFIG = "_external:stripe-portal";
6
+ /** Stripe-only pricing settings (FX Quotes API version, the unspecified-price migration switch) — never advertised to the browser, unlike the `PricingPolicy` record itself. */
7
+ export declare const STRIPE_PRICING_PLUGIN_CONFIG = "_external:stripe-pricing";
6
8
  export declare const STRIPE_SIGNATURE = "Stripe-Signature";
9
+ /**
10
+ * The FX Quotes API is a Stripe PREVIEW endpoint as of this writing: it answers only a
11
+ * `Stripe-Version` header naming a preview version, never the SDK's pinned stable one. Verify this
12
+ * string against https://docs.stripe.com/api/fx_quotes/create before relying on it, and override it
13
+ * with `declarePaymentPricing({ stripe: { fxApiVersion } })` once Stripe moves the API or renames
14
+ * the preview.
15
+ */
16
+ export declare const STRIPE_FX_QUOTES_API_VERSION = "2025-07-30.preview";
7
17
  export declare const GATEWAY_SERVICE = "payment-gateway";
8
18
  export declare const PAYMENT_OBSERVER = "payment-observer";
9
19
  export declare const ENTITLEMENT_SERVICE = "payment-entitlement";
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGhE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAA;AAEvC,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAC5C,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AACtD,eAAO,MAAM,2BAA2B,4BAA4B,CAAA;AACpE,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,eAAO,MAAM,eAAe,oBAAoB,CAAA;AAChD,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,eAAO,MAAM,mBAAmB,wBAAwB,CAAA;AAExD,eAAO,MAAM,oBAAoB,6BAA6B,CAAA;AAC9D,eAAO,MAAM,wBAAwB,yBAAyB,CAAA;AAC9D,eAAO,MAAM,uBAAuB,wBAAwB,CAAA;AAC5D,eAAO,MAAM,mBAAmB,o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AA;AAChD,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,eAAO,MAAM,mBAAmB,wBAAwB,CAAA;AAExD,eAAO,MAAM,oBAAoB,6BAA6B,CAAA;AAC9D,eAAO,MAAM,wBAAwB,yBAAyB,CAAA;AAC9D,eAAO,MAAM,uBAAuB,wBAAwB,CAAA;AAC5D,eAAO,MAAM,mBAAmB,oBAAoB,CAAA;AACpD,eAAO,MAAM,iBAAiB,kBAAkB,CAAA;AAChD,eAAO,MAAM,yBAAyB,0BAA0B,CAAA;AAChE,eAAO,MAAM,uBAAuB,wBAAwB,CAAA;AAE5D,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,WAAW,CAAA;AAE1C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,aAAa,CAAA;AAC1C,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAE3C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,eAAe,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAY1C,CAAA;AAEF,MAAM,WAAW,aAAa;IAAG,OAAO,EAAE,MAAM,CAAA;CAAE;AAClD,MAAM,WAAW,YAAY;IAAG,EAAE,EAAE,OAAO,CAAA;CAAE;AAC7C,MAAM,WAAW,yBAAyB;IAAG,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAyB/E,qFAAqF;AACrF,eAAO,MAAM,WAAW;;IAEtB,yFAAyF;;;;IAKzF,mFAAmF;;IAMnF,+EAA+E;;CAMvE,CAAA"}
package/build/consts.js CHANGED
@@ -6,7 +6,17 @@ export { INTERNAL_PAYGATE, LIMIT_GATE };
6
6
  export const STRIPE_PAYGATE_ALIAS = 'stripe';
7
7
  export const STRIPE_PLUGIN_CONFIG = '_external:stripe';
8
8
  export const STRIPE_PORTAL_PLUGIN_CONFIG = '_external:stripe-portal';
9
+ /** Stripe-only pricing settings (FX Quotes API version, the unspecified-price migration switch) — never advertised to the browser, unlike the `PricingPolicy` record itself. */
10
+ export const STRIPE_PRICING_PLUGIN_CONFIG = '_external:stripe-pricing';
9
11
  export const STRIPE_SIGNATURE = 'Stripe-Signature';
12
+ /**
13
+ * The FX Quotes API is a Stripe PREVIEW endpoint as of this writing: it answers only a
14
+ * `Stripe-Version` header naming a preview version, never the SDK's pinned stable one. Verify this
15
+ * string against https://docs.stripe.com/api/fx_quotes/create before relying on it, and override it
16
+ * with `declarePaymentPricing({ stripe: { fxApiVersion } })` once Stripe moves the API or renames
17
+ * the preview.
18
+ */
19
+ export const STRIPE_FX_QUOTES_API_VERSION = '2025-07-30.preview';
10
20
  export const GATEWAY_SERVICE = 'payment-gateway';
11
21
  export const PAYMENT_OBSERVER = 'payment-observer';
12
22
  export const ENTITLEMENT_SERVICE = 'payment-entitlement';
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGhE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAA;AAEvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAA;AAC5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAA;AACtD,MAAM,CAAC,MAAM,2BAA2B,GAAG,yBAAyB,CAAA;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA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IACzB,IAAI;IACJ,yFAAyF;IACzF,OAAO,EAAE,QAAQ,CACf,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,EAChG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,KAAK,EAAa,CAAC,CACtE;IACD,mFAAmF;IACnF,MAAM,EAAE,QAAQ,CACd,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,EACrF,QAAQ,CAAC,kBAAkB,CAAC,EAC5B,EAAE,MAAM,EAAE,aAAa,EAAE,CAC1B;IACD,+EAA+E;IAC/E,mBAAmB,EAAE,QAAQ,CAC3B,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,EAChH,QAAQ,CAAC,+BAA+B,CAAC,EACzC,EAAE,MAAM,EAAE,aAAa,EAAE,CAC1B;CACO,CAAA"}
package/build/index.d.ts CHANGED
@@ -15,6 +15,8 @@ export { classifySubscriptionChange, commitSubscription, propagatedStateOf, subs
15
15
  export type { CommitOptions, CommitResult } from './subscription.js';
16
16
  export { planLookupKey, syncPaymentProducts, syncStripeProducts } from './sync.js';
17
17
  export { amountCheckoutLineItem, quantityCheckoutLineItem } from './plugins/stripe.js';
18
+ export { makeEstimateCache, estimateStripePrice } from './plugins/estimate.js';
19
+ export type { EstimateCache } from './plugins/estimate.js';
18
20
  export { applySubscription, createEventHandler, mapStatus } from './plugins/events.js';
19
21
  export type { ApplyOptions } from './plugins/events.js';
20
22
  export { ensureWebhookEndpoint, stripeWebhookSecret, stripeWebhookSecrets, webhookUrlOf, } from './plugins/webhook-manager.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAC7F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACvJ,OAAO,EACL,0BAA0B,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,oBAAoB,GACxF,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAClF,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACtF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACtF,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EACL,qBAAqB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,YAAY,GAC/E,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC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OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACtF,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EACL,qBAAqB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,YAAY,GAC/E,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EACL,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAC7F,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EACpG,WAAW,GACZ,MAAM,YAAY,CAAA"}
package/build/index.js CHANGED
@@ -13,6 +13,7 @@ export { consumeLimit, consumptionByRefOf, consumptionOf, limitStateOf, reconcil
13
13
  export { classifySubscriptionChange, commitSubscription, propagatedStateOf, subscriptionEventKey, } from './subscription.js';
14
14
  export { planLookupKey, syncPaymentProducts, syncStripeProducts } from './sync.js';
15
15
  export { amountCheckoutLineItem, quantityCheckoutLineItem } from './plugins/stripe.js';
16
+ export { makeEstimateCache, estimateStripePrice } from './plugins/estimate.js';
16
17
  export { applySubscription, createEventHandler, mapStatus } from './plugins/events.js';
17
18
  export { ensureWebhookEndpoint, stripeWebhookSecret, stripeWebhookSecrets, webhookUrlOf, } from './plugins/webhook-manager.js';
18
19
  export { ensurePortalConfiguration } from './plugins/portal.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;A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AAA;AAEzD,eAAO,MAAM,iBAAiB,EAOd,cAAc,CAAC,iBAAiB,CAAC,CAAA"}
package/build/model.js CHANGED
@@ -53,7 +53,8 @@ export const PaymentFulfillmentSchema = {
53
53
  properties: {
54
54
  id, entityId: str, productSku: str, planSku: optStr, service: str, paygate: str, externalId: str,
55
55
  paymentIntentId: optStr, chargeId: optStr, invoiceId: optStr, mode: CheckoutPricingModeSchema,
56
- units: optNum, amountMinor: optNum, chargeAmountMinor: optNum, currency: optStr, createdAt: date,
56
+ units: optNum, amountMinor: optNum, sourceChargeAmountMinor: optNum, amountCurrency: optStr,
57
+ chargeAmountMinor: optNum, currency: optStr, createdAt: date,
57
58
  fulfilledAt: optDate, failedAt: optDate, refundedMinor: optNum, refundedAt: optDate,
58
59
  disputedAt: optDate, disputeStatus: optStr,
59
60
  },
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAMvF;;;;;GAKG;AAEH,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAW,CAAA;AACvC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAW,CAAA;AAC1D,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAW,CAAA;AACvC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAW,CAAA;AAC1D,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAW,CAAA;AAC5D,MAAM,IAAI,GAAG,UAAU,CAAA;AACvB,MAAM,OAAO,GAAG,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;AACjD,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EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC;IAC9E,oBAAoB,EAAE,KAAK;CACqB,CAAA;AAElD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;QACrF,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO;KAC3D;IACD,QAAQ,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC;IAC1E,oBAAoB,EAAE,KAAK;CAC4B,CAAA;AAEzD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI;KAChF;IACD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC;IACtC,oBAAoB,EAAE,KAAK;CACoB,CAAA"}
@@ -0,0 +1,43 @@
1
+ import type Stripe from 'stripe';
2
+ import type { PriceEstimate } from '@owlmeans/payment';
3
+ import type { Context as ApiContext } from '@owlmeans/server-api';
4
+ import type { PriceEstimateParams } from '../types.js';
5
+ interface CacheEntry<T> {
6
+ value: T;
7
+ expiresAt: number;
8
+ }
9
+ export interface EstimateCache {
10
+ taxTtlMs: number;
11
+ fxTtlMs: number;
12
+ customerTtlMs: number;
13
+ tax: Map<string, CacheEntry<TaxOutcome>>;
14
+ fx: Map<string, CacheEntry<FxOutcome>>;
15
+ customer: Map<string, CacheEntry<Stripe.Customer | null>>;
16
+ inflight: Map<string, Promise<unknown>>;
17
+ }
18
+ /** @param taxTtlMs default 24h; @param fxTtlMs default 1h; @param customerTtlMs default 5min. */
19
+ export declare const makeEstimateCache: (taxTtlMs?: number, fxTtlMs?: number, customerTtlMs?: number) => EstimateCache;
20
+ type TaxOutcome = {
21
+ ok: true;
22
+ calculation: Stripe.Tax.Calculation;
23
+ } | {
24
+ ok: false;
25
+ code?: string;
26
+ };
27
+ type FxOutcome = {
28
+ currency: string;
29
+ exchangeRate: number;
30
+ fxFeeRate?: number;
31
+ } | null;
32
+ /**
33
+ * A Stripe Tax estimate (and, when the pricing policy asks for it, a local-currency conversion) for
34
+ * one product/plan, at a billing country the request names or the entity's paygate customer does.
35
+ *
36
+ * Costs one Tax Calculation API call ($0.05) per distinct (currency, country, amount, tax code,
37
+ * behavior, matching tax ids) within `cache`'s TTL, and one free FX Quotes call per distinct
38
+ * (currency, local currency) — never more, and never for a rate-limit or connection error, which is
39
+ * never cached.
40
+ */
41
+ export declare const estimateStripePrice: (ctx: ApiContext, stripe: Stripe, params: PriceEstimateParams, cache: EstimateCache) => Promise<PriceEstimate>;
42
+ export {};
43
+ //# sourceMappingURL=estimate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate.d.ts","sourceRoot":"","sources":["../../src/plugins/estimate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAKhC,OAAO,KAAK,EAAE,aAAa,EAAgC,MAAM,mBAAmB,CAAA;AACpF,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAKjE,OAAO,KAAK,EAA+B,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAQnF,UAAU,UAAU,CAAC,CAAC;IAAI,KAAK,EAAE,CAAC,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AAEvD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAA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