@fantastic.dev/better-stripe 0.72.3 → 0.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/client/products/catalogClient.d.ts +4 -0
- package/dist/client/products/catalogClient.d.ts.map +1 -1
- package/dist/client/products/catalogClient.js.map +1 -1
- package/dist/client/products/products.d.ts +6 -0
- package/dist/client/products/products.d.ts.map +1 -1
- package/dist/client/products/products.js +18 -10
- package/dist/client/products/products.js.map +1 -1
- package/docs/client-api.md +84 -1
- package/package.json +1 -1
- package/src/client/products/catalogClient.ts +4 -0
- package/src/client/products/product-descriptor-inheritance.test.ts +245 -0
- package/src/client/products/product-descriptors.test.ts +260 -0
- package/src/client/products/products.ts +27 -10
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,18 @@
|
|
|
26
26
|
- Remove internal tracker references from public documentation and add a
|
|
27
27
|
regression check that prevents their reintroduction.
|
|
28
28
|
|
|
29
|
+
## [0.74.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.73.0...v0.74.0) (2026-10-21)
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
- **products:** allow updates to disable descriptor inheritance ([#380](https://github.com/FantasticDevHQ/better-stripe/issues/380)) ([d98c880](https://github.com/FantasticDevHQ/better-stripe/commit/d98c880160eeb7c772fe0a4a12b976bee57aaabc))
|
|
34
|
+
|
|
35
|
+
## [0.73.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.72.3...v0.73.0) (2026-10-20)
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
- **products:** support explicit platform product descriptors ([#378](https://github.com/FantasticDevHQ/better-stripe/issues/378)) ([8cda57a](https://github.com/FantasticDevHQ/better-stripe/commit/8cda57a2bbcc16a898d2dd69601a6d4641fc1c18))
|
|
40
|
+
|
|
29
41
|
## [0.72.3](https://github.com/FantasticDevHQ/better-stripe/compare/v0.72.2...v0.72.3) (2026-10-20)
|
|
30
42
|
|
|
31
43
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ billing, and Connect marketplaces. It provides checkout, subscriptions, webhook
|
|
|
5
5
|
syncing, marketplace fees and splits, payouts, refunds, and disputes, with React
|
|
6
6
|
hooks and headless UI components.
|
|
7
7
|
|
|
8
|
-
**Version**: `0.
|
|
8
|
+
**Version**: `0.74.0` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
|
|
9
9
|
|
|
10
10
|
Connect platforms use the default GA API version. Non-Connect merchants using
|
|
11
11
|
customer-only Accounts v2 need preview access and an explicit preview version.
|
|
@@ -53,6 +53,10 @@ export declare abstract class CatalogClient extends BillingPortalClient {
|
|
|
53
53
|
active?: boolean;
|
|
54
54
|
defaultPrice?: string | null;
|
|
55
55
|
metadata?: Record<string, string>;
|
|
56
|
+
/** Explicit string overrides store defaults; null clears the descriptor. */
|
|
57
|
+
statementDescriptor?: string | null;
|
|
58
|
+
/** False disables inherited defaults; explicit string/null still apply. */
|
|
59
|
+
inheritStatementDescriptor?: boolean;
|
|
56
60
|
/** Reuse only for identical retries of the same provider SET. */
|
|
57
61
|
idempotencyKey?: string;
|
|
58
62
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogClient.d.ts","sourceRoot":"","sources":["../../../src/client/products/catalogClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,E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AAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,GAAW;QAC/B,OAAO,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
|
@@ -8,6 +8,8 @@ export type CreateProductOptions = {
|
|
|
8
8
|
accountId?: string;
|
|
9
9
|
metadata?: Record<string, string>;
|
|
10
10
|
idempotencyKey?: string;
|
|
11
|
+
/** Explicit string overrides store defaults; null suppresses inheritance on create. */
|
|
12
|
+
statementDescriptor?: string | null;
|
|
11
13
|
};
|
|
12
14
|
export declare function createProduct(stripe: Stripe, component: Component, ctx: RunCtx, opts: CreateProductOptions & {
|
|
13
15
|
defaultStatementDescriptorSuffix?: string;
|
|
@@ -24,6 +26,10 @@ export declare function updateProduct(stripe: Stripe, component: Component, ctx:
|
|
|
24
26
|
metadata?: Record<string, string>;
|
|
25
27
|
/** Platform default statement-descriptor suffix (BetterStripe option). */
|
|
26
28
|
defaultStatementDescriptorSuffix?: string;
|
|
29
|
+
/** String overrides store defaults; null clears without restoring a fallback. */
|
|
30
|
+
statementDescriptor?: string | null;
|
|
31
|
+
/** False disables inherited defaults; explicit string/null still apply. */
|
|
32
|
+
inheritStatementDescriptor?: boolean;
|
|
27
33
|
/** Caller-owned stable key for identical retries of this provider SET. */
|
|
28
34
|
idempotencyKey?: string;
|
|
29
35
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/client/products/products.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":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BAAkB,CACtC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,6BAiB5C;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,mDAGlC;AAMD,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM;;;;;GAiFZ"}
|
|
@@ -16,13 +16,18 @@ import { componentRef } from "../webhooks/helpers.js";
|
|
|
16
16
|
* charge-type default, so a product-level descriptor covers every cycle
|
|
17
17
|
* including the first, while the invoice-level path still wins when it applies.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* An explicit product value supports platform-owned products independently of
|
|
20
|
+
* payout accounts. Without an explicit value, resolution mirrors the account-level suffix logic (BTS-32) —
|
|
20
21
|
* the store's stored suffix, else the platform default. Products with no store
|
|
21
|
-
* (`accountId`)
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* (`accountId`) receive no inherited descriptor. Explicit invalid values fail
|
|
23
|
+
* before provider HTTP; invalid inherited values retain the legacy logged-skip
|
|
24
|
+
* behavior. Null suppresses inheritance without querying the account.
|
|
24
25
|
*/
|
|
25
|
-
async function resolveProductStatementDescriptor(component, ctx, accountId, defaultSuffix) {
|
|
26
|
+
async function resolveProductStatementDescriptor(component, ctx, accountId, defaultSuffix, explicit) {
|
|
27
|
+
if (explicit !== undefined)
|
|
28
|
+
return explicit === null
|
|
29
|
+
? undefined
|
|
30
|
+
: validateStatementDescriptorSuffix(explicit);
|
|
26
31
|
if (!accountId)
|
|
27
32
|
return undefined;
|
|
28
33
|
const account = (await ctx.runQuery(componentRef(component, "core/queries/getAccountByStripeId"), { stripeAccountId: accountId }));
|
|
@@ -38,7 +43,7 @@ async function resolveProductStatementDescriptor(component, ctx, accountId, defa
|
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
export async function createProduct(stripe, component, ctx, opts) {
|
|
41
|
-
const statementDescriptor = await resolveProductStatementDescriptor(component, ctx, opts.accountId, opts.defaultStatementDescriptorSuffix);
|
|
46
|
+
const statementDescriptor = await resolveProductStatementDescriptor(component, ctx, opts.accountId, opts.defaultStatementDescriptorSuffix, opts.statementDescriptor);
|
|
42
47
|
const params = {
|
|
43
48
|
name: opts.name,
|
|
44
49
|
description: opts.description ?? undefined,
|
|
@@ -83,11 +88,14 @@ export async function updateProduct(stripe, component, ctx, opts) {
|
|
|
83
88
|
// from the stored product record so a store that set/changed its descriptor
|
|
84
89
|
// propagates to its products' first-invoice charges. Re-set only when a value
|
|
85
90
|
// resolves (never clears an existing descriptor).
|
|
86
|
-
const stored =
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
const stored = opts.inheritStatementDescriptor === false
|
|
92
|
+
? null
|
|
93
|
+
: (await ctx.runQuery(componentRef(component, "products/queries/getProductByStripeId"), { stripeProductId: opts.stripeProductId }));
|
|
94
|
+
const statementDescriptor = await resolveProductStatementDescriptor(component, ctx, stored?.accountId, opts.defaultStatementDescriptorSuffix, opts.statementDescriptor);
|
|
95
|
+
if (opts.statementDescriptor === null)
|
|
96
|
+
updateParams.statement_descriptor = "";
|
|
97
|
+
else if (statementDescriptor)
|
|
89
98
|
updateParams.statement_descriptor = statementDescriptor;
|
|
90
|
-
}
|
|
91
99
|
if (opts.idempotencyKey !== undefined)
|
|
92
100
|
await stripe.products.update(opts.stripeProductId, updateParams, {
|
|
93
101
|
idempotencyKey: opts.idempotencyKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../src/client/products/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,kB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AAQ,IAAI,SAAS;gBAChD,aAAa,EAAE,KAAK,CAAC,SAAS,EAAE,cAAc,IAAI,SAAS;gBAC3D,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,SAAS;aACtC,CACF,CAAC;YACF,YAAY,EAAE,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CACT,SAAS,KAAK,CAAC,EAAE,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACjF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,cAAc,EAAE,MAAM;QACtB,YAAY;QACZ,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC"}
|
package/docs/client-api.md
CHANGED
|
@@ -67,7 +67,7 @@ Scope the idempotency key to one catalog operation and reuse it only with identi
|
|
|
67
67
|
|
|
68
68
|
| Method | Description |
|
|
69
69
|
| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
|
|
70
|
-
| `createProduct(ctx, { name, description?, active?, accountId?, metadata? })`
|
|
70
|
+
| `createProduct(ctx, { name, description?, active?, accountId?, metadata?, statementDescriptor?, idempotencyKey? })` | Create product in Stripe and component DB |
|
|
71
71
|
| `getProduct(ctx, { productId })` | Get product by component document ID |
|
|
72
72
|
| `getProductByStripeId(ctx, { stripeProductId })` | Get product by Stripe product ID |
|
|
73
73
|
| `listProducts(ctx, { accountId?, active?, limit? })` | List products with optional filters |
|
|
@@ -80,6 +80,89 @@ Scope the idempotency key to one catalog operation and reuse it only with identi
|
|
|
80
80
|
| `updatePrice(ctx, { stripePriceId, ...updates })` | Update price fields |
|
|
81
81
|
| `deactivatePrice(ctx, { stripePriceId })` | Deactivate price in Stripe and component DB |
|
|
82
82
|
|
|
83
|
+
### Product statement descriptors
|
|
84
|
+
|
|
85
|
+
`createProduct` and `updateProduct` accept `statementDescriptor?: string | null`,
|
|
86
|
+
including for platform-owned products without an `accountId`.
|
|
87
|
+
|
|
88
|
+
| Input | Create | Update |
|
|
89
|
+
| ---------------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
|
90
|
+
| Explicit string | Trim, validate and send `statement_descriptor` | Trim, validate and send `statement_descriptor` |
|
|
91
|
+
| Omitted or `undefined` | Keep legacy store/default resolution; a storeless product receives no descriptor | Keep legacy store/default refresh behavior |
|
|
92
|
+
| `null` | Suppress inheritance and omit the provider field | Send an empty provider field to clear it, without account/default fallback in this call |
|
|
93
|
+
|
|
94
|
+
Invalid explicit values reject before provider HTTP. An invalid inherited
|
|
95
|
+
store/default value retains the legacy logged-skip behavior. Null is an input
|
|
96
|
+
for this operation, not a persisted override: a later omitted-option update of
|
|
97
|
+
an account-associated product can restore its legacy account/default descriptor.
|
|
98
|
+
Use the same explicit input and stable `idempotencyKey` for an identical retry.
|
|
99
|
+
The SDK forwards provider errors and does not invent a new key or retry command.
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
await stripe.createProduct(ctx, {
|
|
103
|
+
name: "Community membership",
|
|
104
|
+
statementDescriptor: "COMMUNITY ONE",
|
|
105
|
+
idempotencyKey: "catalog:create:original",
|
|
106
|
+
});
|
|
107
|
+
await stripe.updateProduct(ctx, {
|
|
108
|
+
stripeProductId: originalProductId,
|
|
109
|
+
statementDescriptor: null,
|
|
110
|
+
idempotencyKey: "catalog:descriptor-clear:original",
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Omit inherited update descriptors
|
|
115
|
+
|
|
116
|
+
This additive option is not part of published 0.73.0. The update-only
|
|
117
|
+
`inheritStatementDescriptor?: boolean` defaults to the existing behavior.
|
|
118
|
+
With `false` and no explicit descriptor, the update omits
|
|
119
|
+
`statement_descriptor` without reading mutable Product or account defaults.
|
|
120
|
+
An explicit string still overrides with its validated value; explicit `null`
|
|
121
|
+
still clears the provider field. Null is not an omission workaround.
|
|
122
|
+
|
|
123
|
+
| Inheritance option | Explicit descriptor | Update behavior |
|
|
124
|
+
| ------------------ | ------------------- | --------------------------------------------------- |
|
|
125
|
+
| Omitted or `true` | Omitted | Existing store/platform fallback |
|
|
126
|
+
| `false` | Omitted | No descriptor field or ambient Product/account read |
|
|
127
|
+
| `false` | Valid string | Existing validated explicit value |
|
|
128
|
+
| `false` | `null` | Intentional empty-field clear |
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
await stripe.updateProduct(ctx, {
|
|
132
|
+
stripeProductId: originalProductId,
|
|
133
|
+
name: originalNormalizedName,
|
|
134
|
+
inheritStatementDescriptor: false,
|
|
135
|
+
idempotencyKey: originalOperationKey,
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The matching Vite update action validates and forwards the optional boolean;
|
|
140
|
+
create/deactivate operations and UI flows are unchanged. The host must retain
|
|
141
|
+
its authorized immutable command and stable key for an identical retry. This
|
|
142
|
+
option suppresses ambient inheritance; it adds no authorization, command
|
|
143
|
+
ledger, automatic retry, provider-cache or unknown-ACK guarantee. Tests use
|
|
144
|
+
controlled HTTP, not live provider verification. Public release, exact artifact
|
|
145
|
+
verification and accepted consumer adoption precede application consumption.
|
|
146
|
+
|
|
147
|
+
The matching Vite `example/convex/products/actions.ts` forwards the same optional
|
|
148
|
+
inputs. Its demo actions do not supply host authorization. A host must authorize
|
|
149
|
+
the operator, bind its community to the exact original product and reject shared
|
|
150
|
+
products that would need different descriptors. This API does not change payout
|
|
151
|
+
accounts, merchant routing or the host's saved community policy. Product updates
|
|
152
|
+
do not synchronously refresh the component mirror; retain the existing signed
|
|
153
|
+
mirror/read reconciliation contract.
|
|
154
|
+
|
|
155
|
+
[Stripe's subscription precedence](https://docs.stripe.com/connect/statement-descriptors#subscriptions-and-invoices)
|
|
156
|
+
is invoice, product, then the charge-type default. Product configuration can
|
|
157
|
+
cover the first automatic subscription invoice before an invoice webhook runs.
|
|
158
|
+
It does not configure a one-time card PaymentIntent suffix. The existing invoice
|
|
159
|
+
processor's timing and logged-failure limits remain unchanged. Respect the
|
|
160
|
+
[descriptor format and combined-length rules](https://docs.stripe.com/get-started/account/statement-descriptors)
|
|
161
|
+
and actual platform prefix. Issuers can render descriptors differently; synthetic
|
|
162
|
+
transport tests are not live first-invoice, renewal or bank-statement evidence.
|
|
163
|
+
Public release, artifact verification and accepted host adoption precede use of
|
|
164
|
+
this new option by a downstream app.
|
|
165
|
+
|
|
83
166
|
### Checkout and Subscription
|
|
84
167
|
|
|
85
168
|
| Method | Description |
|
package/package.json
CHANGED
|
@@ -119,6 +119,10 @@ export abstract class CatalogClient extends BillingPortalClient {
|
|
|
119
119
|
active?: boolean;
|
|
120
120
|
defaultPrice?: string | null;
|
|
121
121
|
metadata?: Record<string, string>;
|
|
122
|
+
/** Explicit string overrides store defaults; null clears the descriptor. */
|
|
123
|
+
statementDescriptor?: string | null;
|
|
124
|
+
/** False disables inherited defaults; explicit string/null still apply. */
|
|
125
|
+
inheritStatementDescriptor?: boolean;
|
|
122
126
|
/** Reuse only for identical retries of the same provider SET. */
|
|
123
127
|
idempotencyKey?: string;
|
|
124
128
|
},
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { componentsGeneric } from "convex/server";
|
|
2
|
+
import Stripe from "stripe";
|
|
3
|
+
import { expect, expectTypeOf, it, vi } from "vitest";
|
|
4
|
+
|
|
5
|
+
import { STRIPE_API_VERSION } from "../constants.js";
|
|
6
|
+
import type { Component, RunCtx } from "../helpers.js";
|
|
7
|
+
import { BetterStripe } from "../index.js";
|
|
8
|
+
|
|
9
|
+
function fixture(storeDescriptor: string | undefined = "ORIGINAL STORE") {
|
|
10
|
+
const requests: { path: string; key: string | null; form: string }[] = [];
|
|
11
|
+
const state: {
|
|
12
|
+
accountId: string;
|
|
13
|
+
storeDescriptor: string | undefined;
|
|
14
|
+
hasLostReply: boolean;
|
|
15
|
+
failure?: { status: number; type: string; code?: string };
|
|
16
|
+
} = { accountId: "acct_original", storeDescriptor, hasLostReply: false };
|
|
17
|
+
const provider = new Stripe("sk_test_descriptor_inheritance_synthetic", {
|
|
18
|
+
apiVersion: STRIPE_API_VERSION,
|
|
19
|
+
maxNetworkRetries: 0,
|
|
20
|
+
httpClient: Stripe.createFetchHttpClient(async (url, init) => {
|
|
21
|
+
expect(init?.method).toBe("POST");
|
|
22
|
+
expect(new URL(String(url)).origin).toBe("https://api.stripe.com");
|
|
23
|
+
requests.push({
|
|
24
|
+
path: new URL(String(url)).pathname,
|
|
25
|
+
key: new Headers(init?.headers).get("Idempotency-Key"),
|
|
26
|
+
form: String(init?.body ?? ""),
|
|
27
|
+
});
|
|
28
|
+
if (state.hasLostReply) throw new Error("Synthetic lost SET reply");
|
|
29
|
+
return new Response(
|
|
30
|
+
JSON.stringify(
|
|
31
|
+
state.failure
|
|
32
|
+
? { error: { ...state.failure, message: "Synthetic SET failure" } }
|
|
33
|
+
: { id: "prod_original", object: "product", active: true },
|
|
34
|
+
),
|
|
35
|
+
{
|
|
36
|
+
status: state.failure?.status ?? 200,
|
|
37
|
+
headers: { "content-type": "application/json" },
|
|
38
|
+
},
|
|
39
|
+
);
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
class Client extends BetterStripe {
|
|
43
|
+
protected override stripe() {
|
|
44
|
+
return provider;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const client = new Client(
|
|
48
|
+
componentsGeneric().betterStripe as unknown as Component,
|
|
49
|
+
{
|
|
50
|
+
STRIPE_SECRET_KEY: "sk_test_descriptor_inheritance_synthetic",
|
|
51
|
+
statementDescriptorSuffix: "PLATFORM",
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
const ctx: RunCtx = {
|
|
55
|
+
runQuery: vi
|
|
56
|
+
.fn()
|
|
57
|
+
.mockImplementation(async (_ref, args) =>
|
|
58
|
+
args.stripeProductId
|
|
59
|
+
? { accountId: state.accountId }
|
|
60
|
+
: { statementDescriptor: state.storeDescriptor },
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
return { client, ctx, requests, state };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
it("omits the inherited descriptor without reading ambient product or account defaults", async () => {
|
|
67
|
+
const f = fixture();
|
|
68
|
+
const input = {
|
|
69
|
+
stripeProductId: "prod_original",
|
|
70
|
+
name: "OriginalEdit",
|
|
71
|
+
inheritStatementDescriptor: false,
|
|
72
|
+
idempotencyKey: "descriptor-omission:original",
|
|
73
|
+
};
|
|
74
|
+
await f.client.updateProduct(f.ctx, input);
|
|
75
|
+
expect(
|
|
76
|
+
new URLSearchParams(f.requests[0]?.form).has("statement_descriptor"),
|
|
77
|
+
f.requests[0]?.form,
|
|
78
|
+
).toBe(false);
|
|
79
|
+
expect(f.ctx.runQuery).not.toHaveBeenCalled();
|
|
80
|
+
expect(f.requests).toEqual([
|
|
81
|
+
{
|
|
82
|
+
path: "/v1/products/prod_original",
|
|
83
|
+
key: "descriptor-omission:original",
|
|
84
|
+
form: "name=OriginalEdit",
|
|
85
|
+
},
|
|
86
|
+
]);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it.each([" EXPLICIT STORE ", null])(
|
|
90
|
+
"keeps explicit descriptor %j precedence with inheritance disabled",
|
|
91
|
+
async (statementDescriptor) => {
|
|
92
|
+
const f = fixture();
|
|
93
|
+
const input = {
|
|
94
|
+
stripeProductId: "prod_original",
|
|
95
|
+
inheritStatementDescriptor: false,
|
|
96
|
+
statementDescriptor,
|
|
97
|
+
};
|
|
98
|
+
await f.client.updateProduct(f.ctx, input);
|
|
99
|
+
expect(f.requests).toHaveLength(1);
|
|
100
|
+
expect(
|
|
101
|
+
new URLSearchParams(f.requests[0]?.form).get("statement_descriptor"),
|
|
102
|
+
).toBe(statementDescriptor === null ? "" : "EXPLICIT STORE");
|
|
103
|
+
expect(f.ctx.runQuery).not.toHaveBeenCalled();
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
it("rejects an invalid explicit descriptor before HTTP or ambient reads when inheritance is disabled", async () => {
|
|
108
|
+
const f = fixture();
|
|
109
|
+
const input = {
|
|
110
|
+
stripeProductId: "prod_original",
|
|
111
|
+
inheritStatementDescriptor: false,
|
|
112
|
+
statementDescriptor: "BAD*NAME",
|
|
113
|
+
};
|
|
114
|
+
await expect(f.client.updateProduct(f.ctx, input)).rejects.toThrow(
|
|
115
|
+
/statement descriptor/i,
|
|
116
|
+
);
|
|
117
|
+
expect(f.requests).toHaveLength(0);
|
|
118
|
+
expect(f.ctx.runQuery).not.toHaveBeenCalled();
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it.each(
|
|
122
|
+
[undefined, true].flatMap((inheritStatementDescriptor) =>
|
|
123
|
+
[undefined, "LEGACY STORE"].map((storeDescriptor) => ({
|
|
124
|
+
inheritStatementDescriptor,
|
|
125
|
+
storeDescriptor,
|
|
126
|
+
})),
|
|
127
|
+
),
|
|
128
|
+
)(
|
|
129
|
+
"keeps legacy inheritance $inheritStatementDescriptor and fallback $storeDescriptor",
|
|
130
|
+
async ({ inheritStatementDescriptor, storeDescriptor }) => {
|
|
131
|
+
const f = fixture();
|
|
132
|
+
f.state.storeDescriptor = storeDescriptor;
|
|
133
|
+
const input = {
|
|
134
|
+
stripeProductId: "prod_original",
|
|
135
|
+
...(inheritStatementDescriptor === undefined
|
|
136
|
+
? {}
|
|
137
|
+
: { inheritStatementDescriptor }),
|
|
138
|
+
};
|
|
139
|
+
await f.client.updateProduct(f.ctx, input);
|
|
140
|
+
expect(f.ctx.runQuery).toHaveBeenCalledTimes(2);
|
|
141
|
+
expect(
|
|
142
|
+
new URLSearchParams(f.requests[0]?.form).get("statement_descriptor"),
|
|
143
|
+
).toBe(storeDescriptor ?? "PLATFORM");
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
it("reuses identical immutable input and key after a lost reply despite ambient retargeting", async () => {
|
|
148
|
+
const f = fixture();
|
|
149
|
+
const input = Object.freeze({
|
|
150
|
+
stripeProductId: "prod_original",
|
|
151
|
+
name: "OriginalEdit",
|
|
152
|
+
metadata: Object.freeze({ communityId: "original" }),
|
|
153
|
+
inheritStatementDescriptor: false,
|
|
154
|
+
idempotencyKey: "descriptor-omission:original",
|
|
155
|
+
});
|
|
156
|
+
f.state.hasLostReply = true;
|
|
157
|
+
await expect(f.client.updateProduct(f.ctx, input)).rejects.toBeInstanceOf(
|
|
158
|
+
Stripe.errors.StripeConnectionError,
|
|
159
|
+
);
|
|
160
|
+
f.state.hasLostReply = false;
|
|
161
|
+
f.state.accountId = "acct_retargeted";
|
|
162
|
+
f.state.storeDescriptor = "RETARGETED STORE";
|
|
163
|
+
await f.client.updateProduct(f.ctx, input);
|
|
164
|
+
expect(f.requests).toHaveLength(2);
|
|
165
|
+
expect(f.requests[1]).toEqual(f.requests[0]);
|
|
166
|
+
expect(f.requests[0]?.key).toBe(input.idempotencyKey);
|
|
167
|
+
expect(
|
|
168
|
+
new URLSearchParams(f.requests[0]?.form).has("statement_descriptor"),
|
|
169
|
+
).toBe(false);
|
|
170
|
+
expect(
|
|
171
|
+
new URLSearchParams(f.requests[0]?.form).get("metadata[communityId]"),
|
|
172
|
+
).toBe("original");
|
|
173
|
+
expect(f.ctx.runQuery).not.toHaveBeenCalled();
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("keeps independent original products and caller keys separate", async () => {
|
|
177
|
+
const f = fixture();
|
|
178
|
+
for (const suffix of ["one", "two"]) {
|
|
179
|
+
const input = {
|
|
180
|
+
stripeProductId: `prod_${suffix}`,
|
|
181
|
+
name: `Plan${suffix}`,
|
|
182
|
+
inheritStatementDescriptor: false,
|
|
183
|
+
idempotencyKey: `descriptor-omission:${suffix}`,
|
|
184
|
+
};
|
|
185
|
+
await f.client.updateProduct(f.ctx, input);
|
|
186
|
+
}
|
|
187
|
+
expect(f.requests.map(({ path, key, form }) => [path, key, form])).toEqual([
|
|
188
|
+
["/v1/products/prod_one", "descriptor-omission:one", "name=Planone"],
|
|
189
|
+
["/v1/products/prod_two", "descriptor-omission:two", "name=Plantwo"],
|
|
190
|
+
]);
|
|
191
|
+
expect(f.ctx.runQuery).not.toHaveBeenCalled();
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it.each([400, 409, 500])(
|
|
195
|
+
"preserves HTTP%i and the original omission/key with one transport attempt",
|
|
196
|
+
async (status) => {
|
|
197
|
+
const f = fixture();
|
|
198
|
+
f.state.failure = {
|
|
199
|
+
status,
|
|
200
|
+
type: status === 500 ? "api_error" : "idempotency_error",
|
|
201
|
+
code: status === 409 ? "idempotency_key_in_use" : undefined,
|
|
202
|
+
};
|
|
203
|
+
const input = {
|
|
204
|
+
stripeProductId: "prod_original",
|
|
205
|
+
name: "OriginalEdit",
|
|
206
|
+
inheritStatementDescriptor: false,
|
|
207
|
+
idempotencyKey: "descriptor-omission:error",
|
|
208
|
+
};
|
|
209
|
+
const result = f.client.updateProduct(f.ctx, input);
|
|
210
|
+
await expect(result).rejects.toBeInstanceOf(
|
|
211
|
+
status === 400
|
|
212
|
+
? Stripe.errors.StripeIdempotencyError
|
|
213
|
+
: Stripe.errors.StripeAPIError,
|
|
214
|
+
);
|
|
215
|
+
await expect(result).rejects.toMatchObject({
|
|
216
|
+
statusCode: status,
|
|
217
|
+
code: status === 409 ? "idempotency_key_in_use" : undefined,
|
|
218
|
+
});
|
|
219
|
+
expect(f.requests).toEqual([
|
|
220
|
+
{
|
|
221
|
+
path: "/v1/products/prod_original",
|
|
222
|
+
key: "descriptor-omission:error",
|
|
223
|
+
form: "name=OriginalEdit",
|
|
224
|
+
},
|
|
225
|
+
]);
|
|
226
|
+
expect(f.ctx.runQuery).not.toHaveBeenCalled();
|
|
227
|
+
},
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
it("exposes only an optional boolean on the public update type", () => {
|
|
231
|
+
type Input = Parameters<BetterStripe["updateProduct"]>[1];
|
|
232
|
+
expectTypeOf<Input>()
|
|
233
|
+
.toHaveProperty("inheritStatementDescriptor")
|
|
234
|
+
.toEqualTypeOf<boolean | undefined>();
|
|
235
|
+
expectTypeOf<{
|
|
236
|
+
stripeProductId: string;
|
|
237
|
+
inheritStatementDescriptor: string;
|
|
238
|
+
}>().not.toExtend<Input>();
|
|
239
|
+
expectTypeOf<
|
|
240
|
+
Parameters<BetterStripe["createProduct"]>[1]
|
|
241
|
+
>().not.toHaveProperty("inheritStatementDescriptor");
|
|
242
|
+
expectTypeOf<
|
|
243
|
+
Parameters<BetterStripe["deactivateProduct"]>[1]
|
|
244
|
+
>().not.toHaveProperty("inheritStatementDescriptor");
|
|
245
|
+
});
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { componentsGeneric } from "convex/server";
|
|
2
|
+
import Stripe from "stripe";
|
|
3
|
+
import { expect, it, vi } from "vitest";
|
|
4
|
+
|
|
5
|
+
import { STRIPE_API_VERSION } from "../constants.js";
|
|
6
|
+
import type { Component, RunCtx } from "../helpers.js";
|
|
7
|
+
import { BetterStripe } from "../index.js";
|
|
8
|
+
|
|
9
|
+
function fixture(store?: string) {
|
|
10
|
+
const requests: {
|
|
11
|
+
path: string;
|
|
12
|
+
key: string | null;
|
|
13
|
+
form: URLSearchParams;
|
|
14
|
+
}[] = [];
|
|
15
|
+
let failure: { status: number; type: string; code?: string } | undefined;
|
|
16
|
+
const sdk = new Stripe("sk_test_product_descriptor_synthetic", {
|
|
17
|
+
apiVersion: STRIPE_API_VERSION,
|
|
18
|
+
maxNetworkRetries: 0,
|
|
19
|
+
httpClient: Stripe.createFetchHttpClient(async (url, init) => {
|
|
20
|
+
expect(init?.method).toBe("POST");
|
|
21
|
+
requests.push({
|
|
22
|
+
path: new URL(String(url)).pathname,
|
|
23
|
+
key: new Headers(init?.headers).get("Idempotency-Key"),
|
|
24
|
+
form: new URLSearchParams(String(init?.body ?? "")),
|
|
25
|
+
});
|
|
26
|
+
return new Response(
|
|
27
|
+
JSON.stringify(
|
|
28
|
+
failure
|
|
29
|
+
? { error: { ...failure, message: "Synthetic descriptor failure" } }
|
|
30
|
+
: {
|
|
31
|
+
id: "prod_original",
|
|
32
|
+
object: "product",
|
|
33
|
+
name: "Original",
|
|
34
|
+
active: true,
|
|
35
|
+
metadata: {},
|
|
36
|
+
},
|
|
37
|
+
),
|
|
38
|
+
{
|
|
39
|
+
status: failure?.status ?? 200,
|
|
40
|
+
headers: { "content-type": "application/json" },
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
class Client extends BetterStripe {
|
|
46
|
+
protected override stripe() {
|
|
47
|
+
return sdk;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const client = new Client(
|
|
51
|
+
componentsGeneric().betterStripe as unknown as Component,
|
|
52
|
+
{
|
|
53
|
+
STRIPE_SECRET_KEY: "sk_test_product_descriptor_synthetic",
|
|
54
|
+
statementDescriptorSuffix: "PLATFORM",
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
const ctx: RunCtx = {
|
|
58
|
+
runQuery: vi.fn().mockImplementation(async (_ref, args) =>
|
|
59
|
+
args.stripeAccountId
|
|
60
|
+
? { statementDescriptor: store }
|
|
61
|
+
: {
|
|
62
|
+
_id: "component_original",
|
|
63
|
+
accountId: store === undefined ? undefined : "acct_store",
|
|
64
|
+
},
|
|
65
|
+
),
|
|
66
|
+
runMutation: vi.fn().mockResolvedValue(null),
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
client,
|
|
70
|
+
ctx,
|
|
71
|
+
requests,
|
|
72
|
+
fail(status: number, type: string, code?: string) {
|
|
73
|
+
failure = { status, type, code };
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
it.each(["create", "update"] as const)(
|
|
79
|
+
"%s sends an explicit descriptor for a platform product",
|
|
80
|
+
async (method) => {
|
|
81
|
+
const f = fixture();
|
|
82
|
+
if (method === "create")
|
|
83
|
+
await f.client.createProduct(f.ctx, {
|
|
84
|
+
name: "Original",
|
|
85
|
+
statementDescriptor: " COMMUNITY ONE ",
|
|
86
|
+
metadata: { communityId: "one" },
|
|
87
|
+
idempotencyKey: "descriptor:original",
|
|
88
|
+
} satisfies Parameters<BetterStripe["createProduct"]>[1]);
|
|
89
|
+
else
|
|
90
|
+
await f.client.updateProduct(f.ctx, {
|
|
91
|
+
stripeProductId: "prod_original",
|
|
92
|
+
statementDescriptor: " COMMUNITY ONE ",
|
|
93
|
+
metadata: { communityId: "one" },
|
|
94
|
+
idempotencyKey: "descriptor:original",
|
|
95
|
+
} satisfies Parameters<BetterStripe["updateProduct"]>[1]);
|
|
96
|
+
expect(f.requests).toHaveLength(1);
|
|
97
|
+
expect(f.requests[0]?.form.get("statement_descriptor")).toBe(
|
|
98
|
+
"COMMUNITY ONE",
|
|
99
|
+
);
|
|
100
|
+
expect(f.requests[0]?.form.get("metadata[communityId]")).toBe("one");
|
|
101
|
+
expect(f.requests[0]?.form.has("accountId")).toBe(false);
|
|
102
|
+
expect(f.requests[0]?.key).toBe("descriptor:original");
|
|
103
|
+
expect(f.requests[0]?.path).toBe(
|
|
104
|
+
method === "create" ? "/v1/products" : "/v1/products/prod_original",
|
|
105
|
+
);
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
it("an explicit string overrides a store descriptor without changing the account", async () => {
|
|
110
|
+
const f = fixture("OLD STORE");
|
|
111
|
+
await f.client.createProduct(f.ctx, {
|
|
112
|
+
name: "Original",
|
|
113
|
+
accountId: "acct_store",
|
|
114
|
+
statementDescriptor: "COMMUNITY TWO",
|
|
115
|
+
});
|
|
116
|
+
await f.client.updateProduct(f.ctx, {
|
|
117
|
+
stripeProductId: "prod_original",
|
|
118
|
+
statementDescriptor: "COMMUNITY TWO",
|
|
119
|
+
});
|
|
120
|
+
expect(f.requests.map((r) => r.form.get("statement_descriptor"))).toEqual([
|
|
121
|
+
"COMMUNITY TWO",
|
|
122
|
+
"COMMUNITY TWO",
|
|
123
|
+
]);
|
|
124
|
+
expect(f.ctx.runMutation).toHaveBeenCalledTimes(1);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("update null clears exactly the selected product without restoring a store/default", async () => {
|
|
128
|
+
const f = fixture("OLD STORE");
|
|
129
|
+
await f.client.updateProduct(f.ctx, {
|
|
130
|
+
stripeProductId: "prod_original",
|
|
131
|
+
statementDescriptor: null,
|
|
132
|
+
idempotencyKey: "descriptor:clear",
|
|
133
|
+
});
|
|
134
|
+
expect(f.requests).toHaveLength(1);
|
|
135
|
+
expect(f.requests[0]?.path).toBe("/v1/products/prod_original");
|
|
136
|
+
expect(f.requests[0]?.form.has("statement_descriptor")).toBe(true);
|
|
137
|
+
expect(f.requests[0]?.form.get("statement_descriptor")).toBe("");
|
|
138
|
+
expect(f.requests[0]?.key).toBe("descriptor:clear");
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("create null suppresses inherited descriptors without sending an empty provider field", async () => {
|
|
142
|
+
const f = fixture("OLD STORE");
|
|
143
|
+
await f.client.createProduct(f.ctx, {
|
|
144
|
+
name: "Original",
|
|
145
|
+
accountId: "acct_store",
|
|
146
|
+
statementDescriptor: null,
|
|
147
|
+
});
|
|
148
|
+
expect(f.requests[0]?.form.has("statement_descriptor")).toBe(false);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("omission retains store/default resolution and leaves platform products unchanged", async () => {
|
|
152
|
+
const store = fixture("OLD STORE");
|
|
153
|
+
await store.client.createProduct(store.ctx, {
|
|
154
|
+
name: "Original",
|
|
155
|
+
accountId: "acct_store",
|
|
156
|
+
});
|
|
157
|
+
await store.client.updateProduct(store.ctx, {
|
|
158
|
+
stripeProductId: "prod_original",
|
|
159
|
+
});
|
|
160
|
+
expect(store.requests.map((r) => r.form.get("statement_descriptor"))).toEqual(
|
|
161
|
+
["OLD STORE", "OLD STORE"],
|
|
162
|
+
);
|
|
163
|
+
const platform = fixture();
|
|
164
|
+
await platform.client.createProduct(platform.ctx, { name: "Original" });
|
|
165
|
+
await platform.client.updateProduct(platform.ctx, {
|
|
166
|
+
stripeProductId: "prod_original",
|
|
167
|
+
});
|
|
168
|
+
expect(
|
|
169
|
+
platform.requests.every((r) => !r.form.has("statement_descriptor")),
|
|
170
|
+
).toBe(true);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it.each([
|
|
174
|
+
"",
|
|
175
|
+
" ",
|
|
176
|
+
"BAD*NAME",
|
|
177
|
+
"NO<NAME",
|
|
178
|
+
"1234",
|
|
179
|
+
"NONLATINé",
|
|
180
|
+
"THIS DESCRIPTOR IS FAR TOO LONG",
|
|
181
|
+
])(
|
|
182
|
+
"rejects explicit invalid %j before provider HTTP",
|
|
183
|
+
async (statementDescriptor) => {
|
|
184
|
+
const f = fixture();
|
|
185
|
+
await expect(
|
|
186
|
+
f.client.createProduct(f.ctx, { name: "Original", statementDescriptor }),
|
|
187
|
+
).rejects.toThrow(/statement descriptor/i);
|
|
188
|
+
await expect(
|
|
189
|
+
f.client.updateProduct(f.ctx, {
|
|
190
|
+
stripeProductId: "prod_original",
|
|
191
|
+
statementDescriptor,
|
|
192
|
+
}),
|
|
193
|
+
).rejects.toThrow(/statement descriptor/i);
|
|
194
|
+
expect(f.requests).toHaveLength(0);
|
|
195
|
+
expect(f.ctx.runMutation).not.toHaveBeenCalled();
|
|
196
|
+
},
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
it("does not inherit another explicit community descriptor or stable key", async () => {
|
|
200
|
+
const f = fixture();
|
|
201
|
+
for (const [stripeProductId, statementDescriptor, idempotencyKey] of [
|
|
202
|
+
["prod_original", "COMMUNITY ONE", "descriptor:one"],
|
|
203
|
+
["prod_other", "COMMUNITY TWO", "descriptor:two"],
|
|
204
|
+
["prod_original", "COMMUNITY ONE", "descriptor:one"],
|
|
205
|
+
])
|
|
206
|
+
await f.client.updateProduct(f.ctx, {
|
|
207
|
+
stripeProductId,
|
|
208
|
+
statementDescriptor,
|
|
209
|
+
idempotencyKey,
|
|
210
|
+
});
|
|
211
|
+
expect(
|
|
212
|
+
f.requests.map((r) => [r.path, r.key, r.form.get("statement_descriptor")]),
|
|
213
|
+
).toEqual([
|
|
214
|
+
["/v1/products/prod_original", "descriptor:one", "COMMUNITY ONE"],
|
|
215
|
+
["/v1/products/prod_other", "descriptor:two", "COMMUNITY TWO"],
|
|
216
|
+
["/v1/products/prod_original", "descriptor:one", "COMMUNITY ONE"],
|
|
217
|
+
]);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it.each(
|
|
221
|
+
(["create", "update"] as const).flatMap((method) =>
|
|
222
|
+
[400, 409, 500].map((status) => ({ method, status })),
|
|
223
|
+
),
|
|
224
|
+
)(
|
|
225
|
+
"preserves $method HTTP$status and original descriptor/key without another attempt",
|
|
226
|
+
async ({ method, status }) => {
|
|
227
|
+
const f = fixture();
|
|
228
|
+
f.fail(
|
|
229
|
+
status,
|
|
230
|
+
status === 500 ? "api_error" : "idempotency_error",
|
|
231
|
+
status === 409 ? "idempotency_key_in_use" : undefined,
|
|
232
|
+
);
|
|
233
|
+
const request =
|
|
234
|
+
method === "create"
|
|
235
|
+
? f.client.createProduct(f.ctx, {
|
|
236
|
+
name: "Original",
|
|
237
|
+
statementDescriptor: "COMMUNITY ONE",
|
|
238
|
+
idempotencyKey: "descriptor:failure",
|
|
239
|
+
})
|
|
240
|
+
: f.client.updateProduct(f.ctx, {
|
|
241
|
+
stripeProductId: "prod_original",
|
|
242
|
+
statementDescriptor: "COMMUNITY ONE",
|
|
243
|
+
idempotencyKey: "descriptor:failure",
|
|
244
|
+
});
|
|
245
|
+
await expect(request).rejects.toBeInstanceOf(
|
|
246
|
+
status === 400
|
|
247
|
+
? Stripe.errors.StripeIdempotencyError
|
|
248
|
+
: Stripe.errors.StripeAPIError,
|
|
249
|
+
);
|
|
250
|
+
await expect(request).rejects.toMatchObject({
|
|
251
|
+
statusCode: status,
|
|
252
|
+
code: status === 409 ? "idempotency_key_in_use" : undefined,
|
|
253
|
+
});
|
|
254
|
+
expect(f.requests).toHaveLength(1);
|
|
255
|
+
expect(f.requests[0]?.key).toBe("descriptor:failure");
|
|
256
|
+
expect(f.requests[0]?.form.get("statement_descriptor")).toBe(
|
|
257
|
+
"COMMUNITY ONE",
|
|
258
|
+
);
|
|
259
|
+
},
|
|
260
|
+
);
|
|
@@ -22,18 +22,24 @@ import { componentRef } from "../webhooks/helpers.js";
|
|
|
22
22
|
* charge-type default, so a product-level descriptor covers every cycle
|
|
23
23
|
* including the first, while the invoice-level path still wins when it applies.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
25
|
+
* An explicit product value supports platform-owned products independently of
|
|
26
|
+
* payout accounts. Without an explicit value, resolution mirrors the account-level suffix logic (BTS-32) —
|
|
26
27
|
* the store's stored suffix, else the platform default. Products with no store
|
|
27
|
-
* (`accountId`)
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* (`accountId`) receive no inherited descriptor. Explicit invalid values fail
|
|
29
|
+
* before provider HTTP; invalid inherited values retain the legacy logged-skip
|
|
30
|
+
* behavior. Null suppresses inheritance without querying the account.
|
|
30
31
|
*/
|
|
31
32
|
async function resolveProductStatementDescriptor(
|
|
32
33
|
component: Component,
|
|
33
34
|
ctx: RunCtx,
|
|
34
35
|
accountId: string | undefined,
|
|
35
36
|
defaultSuffix: string | undefined,
|
|
37
|
+
explicit?: string | null,
|
|
36
38
|
): Promise<string | undefined> {
|
|
39
|
+
if (explicit !== undefined)
|
|
40
|
+
return explicit === null
|
|
41
|
+
? undefined
|
|
42
|
+
: validateStatementDescriptorSuffix(explicit);
|
|
37
43
|
if (!accountId) return undefined;
|
|
38
44
|
const account = (await ctx.runQuery(
|
|
39
45
|
componentRef(component, "core/queries/getAccountByStripeId"),
|
|
@@ -62,6 +68,8 @@ export type CreateProductOptions = {
|
|
|
62
68
|
accountId?: string;
|
|
63
69
|
metadata?: Record<string, string>;
|
|
64
70
|
idempotencyKey?: string;
|
|
71
|
+
/** Explicit string overrides store defaults; null suppresses inheritance on create. */
|
|
72
|
+
statementDescriptor?: string | null;
|
|
65
73
|
};
|
|
66
74
|
|
|
67
75
|
export async function createProduct(
|
|
@@ -75,6 +83,7 @@ export async function createProduct(
|
|
|
75
83
|
ctx,
|
|
76
84
|
opts.accountId,
|
|
77
85
|
opts.defaultStatementDescriptorSuffix,
|
|
86
|
+
opts.statementDescriptor,
|
|
78
87
|
);
|
|
79
88
|
|
|
80
89
|
const params: Stripe.ProductCreateParams = {
|
|
@@ -128,6 +137,10 @@ export async function updateProduct(
|
|
|
128
137
|
metadata?: Record<string, string>;
|
|
129
138
|
/** Platform default statement-descriptor suffix (BetterStripe option). */
|
|
130
139
|
defaultStatementDescriptorSuffix?: string;
|
|
140
|
+
/** String overrides store defaults; null clears without restoring a fallback. */
|
|
141
|
+
statementDescriptor?: string | null;
|
|
142
|
+
/** False disables inherited defaults; explicit string/null still apply. */
|
|
143
|
+
inheritStatementDescriptor?: boolean;
|
|
131
144
|
/** Caller-owned stable key for identical retries of this provider SET. */
|
|
132
145
|
idempotencyKey?: string;
|
|
133
146
|
},
|
|
@@ -146,19 +159,23 @@ export async function updateProduct(
|
|
|
146
159
|
// from the stored product record so a store that set/changed its descriptor
|
|
147
160
|
// propagates to its products' first-invoice charges. Re-set only when a value
|
|
148
161
|
// resolves (never clears an existing descriptor).
|
|
149
|
-
const stored =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
const stored =
|
|
163
|
+
opts.inheritStatementDescriptor === false
|
|
164
|
+
? null
|
|
165
|
+
: ((await ctx.runQuery(
|
|
166
|
+
componentRef(component, "products/queries/getProductByStripeId"),
|
|
167
|
+
{ stripeProductId: opts.stripeProductId },
|
|
168
|
+
)) as { accountId?: string } | null);
|
|
153
169
|
const statementDescriptor = await resolveProductStatementDescriptor(
|
|
154
170
|
component,
|
|
155
171
|
ctx,
|
|
156
172
|
stored?.accountId,
|
|
157
173
|
opts.defaultStatementDescriptorSuffix,
|
|
174
|
+
opts.statementDescriptor,
|
|
158
175
|
);
|
|
159
|
-
if (statementDescriptor)
|
|
176
|
+
if (opts.statementDescriptor === null) updateParams.statement_descriptor = "";
|
|
177
|
+
else if (statementDescriptor)
|
|
160
178
|
updateParams.statement_descriptor = statementDescriptor;
|
|
161
|
-
}
|
|
162
179
|
|
|
163
180
|
if (opts.idempotencyKey !== undefined)
|
|
164
181
|
await stripe.products.update(opts.stripeProductId, updateParams, {
|