@fantastic.dev/better-stripe 0.83.1 → 0.85.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/billing/renewalV2/binding.d.ts +3 -0
- package/dist/client/billing/renewalV2/binding.d.ts.map +1 -0
- package/dist/client/billing/renewalV2/binding.js +18 -0
- package/dist/client/billing/renewalV2/binding.js.map +1 -0
- package/dist/client/billing/renewalV2/index.d.ts +63 -0
- package/dist/client/billing/renewalV2/index.d.ts.map +1 -0
- package/dist/client/billing/renewalV2/index.js +124 -0
- package/dist/client/billing/renewalV2/index.js.map +1 -0
- package/dist/client/billing/renewalV2/receipt.d.ts +36 -0
- package/dist/client/billing/renewalV2/receipt.d.ts.map +1 -0
- package/dist/client/billing/renewalV2/receipt.js +131 -0
- package/dist/client/billing/renewalV2/receipt.js.map +1 -0
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +16 -16
- package/dist/client/renewal.d.ts +2 -0
- package/dist/client/renewal.d.ts.map +1 -1
- package/dist/client/renewal.js +1 -0
- package/dist/client/renewal.js.map +1 -1
- package/dist/client/usage/observationClient.d.ts +2 -2
- package/dist/client/usage/observationClient.d.ts.map +1 -1
- package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
- package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
- package/dist/component/earnings/triggers.d.ts +16 -16
- package/dist/component/usageCredits/accounting.fixtures.d.ts +16 -16
- package/docs/renewal-context-reads.md +134 -0
- package/docs/renewal-phase-assembly.md +5 -0
- package/package.json +1 -1
- package/src/client/billing/renewalV2/binding.ts +25 -0
- package/src/client/billing/renewalV2/index.test.ts +414 -0
- package/src/client/billing/renewalV2/index.ts +214 -0
- package/src/client/billing/renewalV2/receipt.test.ts +289 -0
- package/src/client/billing/renewalV2/receipt.ts +163 -0
- package/src/client/renewal.ts +13 -0
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.85.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.84.0...v0.85.0) (2026-10-29)
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
- add V2 renewal attachment receipts ([#406](https://github.com/FantasticDevHQ/better-stripe/issues/406)) ([573aee1](https://github.com/FantasticDevHQ/better-stripe/commit/573aee18d5e4502a1a28a1e1fb0f33b105638773))
|
|
34
|
+
|
|
35
|
+
## [0.84.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.83.1...v0.84.0) (2026-10-28)
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
- add compact V2 renewal request bindings ([#404](https://github.com/FantasticDevHQ/better-stripe/issues/404)) ([a64a33c](https://github.com/FantasticDevHQ/better-stripe/commit/a64a33cabf0f0894d100ab72d5d7754643621df1))
|
|
40
|
+
|
|
29
41
|
## [0.83.1](https://github.com/FantasticDevHQ/better-stripe/compare/v0.83.0...v0.83.1) (2026-10-27)
|
|
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.85.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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/binding.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,GAAG,gBAAgB,GAAG,wBAAwB,EAC/D,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,MAAM,CAAC,CAkBjB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
|
|
2
|
+
/** Internal fixed-family encoding. This is consistency, not authorization. */
|
|
3
|
+
export async function renewalBindingV2(family, preimage) {
|
|
4
|
+
// Finish all input capture and canonical bytes before the first await.
|
|
5
|
+
const text = JSON.stringify(renewalSnapshot(["betterstripe-renewal-binding", 2, family, preimage]));
|
|
6
|
+
const bytes = new TextEncoder().encode(text);
|
|
7
|
+
if (bytes.byteLength > 500_000)
|
|
8
|
+
throw new Error("Renewal V2 binding exceeds its UTF-8 preimage budget.");
|
|
9
|
+
const subtle = globalThis.crypto?.subtle;
|
|
10
|
+
if (!subtle || typeof subtle.digest !== "function")
|
|
11
|
+
throw new Error("Renewal V2 requires Web Crypto SHA-256.");
|
|
12
|
+
const digest = await subtle.digest("SHA-256", bytes);
|
|
13
|
+
if (!(digest instanceof ArrayBuffer) || digest.byteLength !== 32)
|
|
14
|
+
throw new Error("Renewal V2 received an invalid SHA-256 result.");
|
|
15
|
+
const hex = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
16
|
+
return `${family}:v2:sha256:${hex}`;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/binding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAA+D,EAC/D,QAAiB;IAEjB,uEAAuE;IACvE,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CACzB,eAAe,CAAC,CAAC,8BAA8B,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CACvE,CAAC;IACF,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,KAAK,CAAC,UAAU,GAAG,OAAO;QAC5B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC;IACzC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU;QAChD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACrD,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,IAAI,MAAM,CAAC,UAAU,KAAK,EAAE;QAC9D,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CACtD,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CACnC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACX,OAAO,GAAG,MAAM,cAAc,GAAG,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type PrepareRenewalPriceReplacementOptions, type PreparedRenewalPriceReplacement } from "../renewalPriceReplacement.js";
|
|
2
|
+
export type PrepareRenewalPriceReplacementV2Options = PrepareRenewalPriceReplacementOptions;
|
|
3
|
+
export type PreparedRenewalPriceReplacementV2 = Omit<PreparedRenewalPriceReplacement, "version" | "requestIdentity"> & {
|
|
4
|
+
version: 2;
|
|
5
|
+
requestIdentity: {
|
|
6
|
+
key: string;
|
|
7
|
+
binding: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/** Pure preparation. Protect retained full records under host authorization. */
|
|
11
|
+
export declare function prepareRenewalPriceReplacementV2(options: PrepareRenewalPriceReplacementV2Options): Promise<PreparedRenewalPriceReplacementV2>;
|
|
12
|
+
export type PrepareRenewalScheduleAttachmentV2Options = {
|
|
13
|
+
prepared: unknown;
|
|
14
|
+
apiVersion: string;
|
|
15
|
+
attachKey: string;
|
|
16
|
+
firstDispatchedAt: number;
|
|
17
|
+
};
|
|
18
|
+
export type PreparedRenewalScheduleAttachmentV2 = {
|
|
19
|
+
version: 2;
|
|
20
|
+
stage: "attach";
|
|
21
|
+
scope: "platform";
|
|
22
|
+
apiVersion: string;
|
|
23
|
+
logicalBinding: string;
|
|
24
|
+
method: "POST";
|
|
25
|
+
path: "/v1/subscription_schedules";
|
|
26
|
+
payload: {
|
|
27
|
+
from_subscription: string;
|
|
28
|
+
};
|
|
29
|
+
key: string;
|
|
30
|
+
firstDispatchedAt: number;
|
|
31
|
+
requestIdentity: {
|
|
32
|
+
key: string;
|
|
33
|
+
binding: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/** Pure C2 request. No dispatch, receipt, provider qualification or V1 migration. */
|
|
37
|
+
export declare function prepareRenewalScheduleAttachmentV2(options: PrepareRenewalScheduleAttachmentV2Options): Promise<PreparedRenewalScheduleAttachmentV2>;
|
|
38
|
+
export type ConstructRenewalScheduleAttachmentReceiptV2Options = {
|
|
39
|
+
attachRequest: {
|
|
40
|
+
preparation: PrepareRenewalPriceReplacementV2Options;
|
|
41
|
+
apiVersion: string;
|
|
42
|
+
attachKey: string;
|
|
43
|
+
firstDispatchedAt: number;
|
|
44
|
+
};
|
|
45
|
+
actualDispatch: Pick<PreparedRenewalScheduleAttachmentV2, "scope" | "apiVersion" | "method" | "path" | "payload" | "key" | "firstDispatchedAt">;
|
|
46
|
+
providerSnapshot: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
export type RenewalScheduleAttachmentReceiptV2 = {
|
|
49
|
+
version: 2;
|
|
50
|
+
stage: "attached_unconfigured";
|
|
51
|
+
scope: "platform";
|
|
52
|
+
logicalBinding: string;
|
|
53
|
+
request: PreparedRenewalScheduleAttachmentV2;
|
|
54
|
+
scheduleId: string;
|
|
55
|
+
subscriptionId: string;
|
|
56
|
+
customerAccountId: string;
|
|
57
|
+
livemode: boolean;
|
|
58
|
+
providerSnapshot: Record<string, unknown>;
|
|
59
|
+
binding: string;
|
|
60
|
+
};
|
|
61
|
+
/** Pure unsigned consistency data. Does not authenticate or acknowledge a POST. */
|
|
62
|
+
export declare function constructRenewalScheduleAttachmentReceiptV2(options: ConstructRenewalScheduleAttachmentReceiptV2Options): Promise<RenewalScheduleAttachmentReceiptV2>;
|
|
63
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,qCAAqC,EAC1C,KAAK,+BAA+B,EACrC,MAAM,+BAA+B,CAAC;AAevC,MAAM,MAAM,uCAAuC,GACjD,qCAAqC,CAAC;AACxC,MAAM,MAAM,iCAAiC,GAAG,IAAI,CAClD,+BAA+B,EAC/B,SAAS,GAAG,iBAAiB,CAC9B,GAAG;IACF,OAAO,EAAE,CAAC,CAAC;IACX,eAAe,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD,CAAC;AAEF,gFAAgF;AAChF,wBAAsB,gCAAgC,CACpD,OAAO,EAAE,uCAAuC,GAC/C,OAAO,CAAC,iCAAiC,CAAC,CAY5C;AAED,MAAM,MAAM,yCAAyC,GAAG;IACtD,QAA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c,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,mCAAmC,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,mFAAmF;AACnF,wBAAsB,2CAA2C,CAC/D,OAAO,EAAE,kDAAkD,GAC1D,OAAO,CAAC,kCAAkC,CAAC,CAwD7C"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { prepareRenewalPriceReplacement, } from "../renewalPriceReplacement.js";
|
|
3
|
+
import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
|
|
4
|
+
import { supportedVersion, timestamp, resourceId, equal, } from "../renewalAggregate/shared.js";
|
|
5
|
+
import { idempotencyOptions } from "../../core/idempotency.js";
|
|
6
|
+
import { renewalBindingV2 } from "./binding.js";
|
|
7
|
+
import { captureAttachmentReceipt, assertAttachmentIdentity, } from "./receipt.js";
|
|
8
|
+
/** Pure preparation. Protect retained full records under host authorization. */
|
|
9
|
+
export async function prepareRenewalPriceReplacementV2(options) {
|
|
10
|
+
// Reuse the existing raw constructor's semantic checks, not a stored V1 claim.
|
|
11
|
+
const original = prepareRenewalPriceReplacement(renewalSnapshot(options));
|
|
12
|
+
const { status, preservation, requestIdentity, ...source } = original;
|
|
13
|
+
const bound = { ...source, version: 2 };
|
|
14
|
+
const binding = await renewalBindingV2("renewal", bound);
|
|
15
|
+
return {
|
|
16
|
+
...bound,
|
|
17
|
+
status,
|
|
18
|
+
preservation,
|
|
19
|
+
requestIdentity: { key: requestIdentity.key, binding },
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const attachInput = z
|
|
23
|
+
.object({
|
|
24
|
+
prepared: z.unknown(),
|
|
25
|
+
apiVersion: z.string(),
|
|
26
|
+
attachKey: z.string(),
|
|
27
|
+
firstDispatchedAt: timestamp,
|
|
28
|
+
})
|
|
29
|
+
.strict();
|
|
30
|
+
const record = z.record(z.string(), z.unknown());
|
|
31
|
+
/** Pure C2 request. No dispatch, receipt, provider qualification or V1 migration. */
|
|
32
|
+
export async function prepareRenewalScheduleAttachmentV2(options) {
|
|
33
|
+
// This detached capture includes every option and retained fact before await.
|
|
34
|
+
const args = attachInput.parse(renewalSnapshot(options));
|
|
35
|
+
supportedVersion(args.apiVersion);
|
|
36
|
+
const key = idempotencyOptions(args.attachKey)?.idempotencyKey;
|
|
37
|
+
if (!key)
|
|
38
|
+
throw new Error("Renewal V2 requires an explicit attachment key.");
|
|
39
|
+
const candidate = record.parse(args.prepared);
|
|
40
|
+
if (candidate.version !== 2)
|
|
41
|
+
throw new Error("Renewal V2 requires a V2 preparation.");
|
|
42
|
+
const source = record.parse(candidate.providerSnapshot);
|
|
43
|
+
const identity = record.parse(candidate.requestIdentity);
|
|
44
|
+
const rebuilt = await prepareRenewalPriceReplacementV2({
|
|
45
|
+
subscription: source.subscription,
|
|
46
|
+
targetPrice: source.targetPrice,
|
|
47
|
+
...(source.billingCustomer === undefined
|
|
48
|
+
? {}
|
|
49
|
+
: { billingCustomer: source.billingCustomer }),
|
|
50
|
+
expected: candidate.expected,
|
|
51
|
+
key: z.string().parse(identity.key),
|
|
52
|
+
});
|
|
53
|
+
if (JSON.stringify(renewalSnapshot(rebuilt)) !==
|
|
54
|
+
JSON.stringify(renewalSnapshot(candidate)))
|
|
55
|
+
throw new Error("Renewal V2 preparation does not match its full source.");
|
|
56
|
+
const request = {
|
|
57
|
+
version: 2,
|
|
58
|
+
stage: "attach",
|
|
59
|
+
scope: "platform",
|
|
60
|
+
apiVersion: args.apiVersion,
|
|
61
|
+
logicalBinding: rebuilt.requestIdentity.binding,
|
|
62
|
+
method: "POST",
|
|
63
|
+
path: "/v1/subscription_schedules",
|
|
64
|
+
payload: { from_subscription: rebuilt.expected.subscriptionId },
|
|
65
|
+
key,
|
|
66
|
+
firstDispatchedAt: args.firstDispatchedAt,
|
|
67
|
+
};
|
|
68
|
+
const binding = await renewalBindingV2("renewal-attach", request);
|
|
69
|
+
return { ...request, requestIdentity: { key, binding } };
|
|
70
|
+
}
|
|
71
|
+
/** Pure unsigned consistency data. Does not authenticate or acknowledge a POST. */
|
|
72
|
+
export async function constructRenewalScheduleAttachmentReceiptV2(options) {
|
|
73
|
+
const args = captureAttachmentReceipt(options);
|
|
74
|
+
const prepared = await prepareRenewalPriceReplacementV2({
|
|
75
|
+
...args.attachRequest.preparation,
|
|
76
|
+
expected: args.attachRequest.preparation
|
|
77
|
+
.expected,
|
|
78
|
+
});
|
|
79
|
+
const request = await prepareRenewalScheduleAttachmentV2({
|
|
80
|
+
prepared,
|
|
81
|
+
apiVersion: args.attachRequest.apiVersion,
|
|
82
|
+
attachKey: args.attachRequest.attachKey,
|
|
83
|
+
firstDispatchedAt: args.attachRequest.firstDispatchedAt,
|
|
84
|
+
});
|
|
85
|
+
const { scope, apiVersion, method, path, payload, key, firstDispatchedAt } = request;
|
|
86
|
+
if (!equal(args.actualDispatch, {
|
|
87
|
+
scope,
|
|
88
|
+
apiVersion,
|
|
89
|
+
method,
|
|
90
|
+
path,
|
|
91
|
+
payload,
|
|
92
|
+
key,
|
|
93
|
+
firstDispatchedAt,
|
|
94
|
+
}))
|
|
95
|
+
throw Error("Renewal attachment dispatch does not match its complete request.");
|
|
96
|
+
const billingCustomer = prepared.providerSnapshot.billingCustomer;
|
|
97
|
+
if (!billingCustomer)
|
|
98
|
+
throw Error("Renewal attachment requires its retained billing Customer.");
|
|
99
|
+
const scheduleId = resourceId("sub_sched").parse(args.providerSnapshot.id);
|
|
100
|
+
assertAttachmentIdentity(args.providerSnapshot, {
|
|
101
|
+
scheduleId,
|
|
102
|
+
subscriptionId: prepared.expected.subscriptionId,
|
|
103
|
+
billingCustomerId: billingCustomer.id,
|
|
104
|
+
customerAccountId: prepared.expected.customerAccountId,
|
|
105
|
+
livemode: prepared.expected.livemode,
|
|
106
|
+
});
|
|
107
|
+
const receipt = {
|
|
108
|
+
version: 2,
|
|
109
|
+
stage: "attached_unconfigured",
|
|
110
|
+
scope: "platform",
|
|
111
|
+
logicalBinding: prepared.requestIdentity.binding,
|
|
112
|
+
request,
|
|
113
|
+
scheduleId,
|
|
114
|
+
subscriptionId: prepared.expected.subscriptionId,
|
|
115
|
+
customerAccountId: prepared.expected.customerAccountId,
|
|
116
|
+
livemode: prepared.expected.livemode,
|
|
117
|
+
providerSnapshot: args.providerSnapshot,
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
...receipt,
|
|
121
|
+
binding: await renewalBindingV2("renewal-attach-receipt", receipt),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,8BAA8B,GAG/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,KAAK,GACN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAYtB,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,OAAgD;IAEhD,+EAA+E;IAC/E,MAAM,QAAQ,GAAG,8BAA8B,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1E,MAAM,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AC9C,UAAU;QACV,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,cAAc;QAChD,iBAAiB,EAAE,eAAe,CAAC,EAAE;QACrC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB;QACtD,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ;KACrC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,CAAU;QACnB,KAAK,EAAE,uBAAgC;QACvC,KAAK,EAAE,UAAmB;QAC1B,cAAc,EAAE,QAAQ,CAAC,eAAe,CAAC,OAAO;QAChD,OAAO;QACP,UAAU;QACV,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,cAAc;QAChD,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB;QACtD,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ;QACpC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;KACxC,CAAC;IACF,OAAO;QACL,GAAG,OAAO;QACV,OAAO,EAAE,MAAM,gBAAgB,CAAC,wBAAwB,EAAE,OAAO,CAAC;KACnE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ObjectData } from "../renewalAggregate/shared.js";
|
|
2
|
+
export declare function captureAttachmentReceipt(raw: unknown): {
|
|
3
|
+
attachRequest: {
|
|
4
|
+
preparation: {
|
|
5
|
+
subscription: unknown;
|
|
6
|
+
targetPrice: unknown;
|
|
7
|
+
billingCustomer?: unknown;
|
|
8
|
+
expected: unknown;
|
|
9
|
+
key: string;
|
|
10
|
+
};
|
|
11
|
+
apiVersion: string;
|
|
12
|
+
attachKey: string;
|
|
13
|
+
firstDispatchedAt: number;
|
|
14
|
+
};
|
|
15
|
+
actualDispatch: {
|
|
16
|
+
scope: "platform";
|
|
17
|
+
apiVersion: string;
|
|
18
|
+
method: "POST";
|
|
19
|
+
path: "/v1/subscription_schedules";
|
|
20
|
+
payload: {
|
|
21
|
+
from_subscription: string;
|
|
22
|
+
};
|
|
23
|
+
key: string;
|
|
24
|
+
firstDispatchedAt: number;
|
|
25
|
+
};
|
|
26
|
+
providerSnapshot: ObjectData;
|
|
27
|
+
};
|
|
28
|
+
/** Available identity facts only, never response provenance or financial proof. */
|
|
29
|
+
export declare function assertAttachmentIdentity(body: ObjectData, operation: {
|
|
30
|
+
scheduleId: string;
|
|
31
|
+
subscriptionId: string;
|
|
32
|
+
billingCustomerId: string;
|
|
33
|
+
customerAccountId: string;
|
|
34
|
+
livemode: boolean;
|
|
35
|
+
}): void;
|
|
36
|
+
//# sourceMappingURL=receipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/receipt.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,+BAA+B,CAAC;AA0FvC,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;EAMpD;AAED,mFAAmF;AACnF,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE;IACT,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,QAiDF"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
|
|
3
|
+
import { referenceId, timestamp, } from "../renewalAggregate/shared.js";
|
|
4
|
+
const preparation = z
|
|
5
|
+
.object({
|
|
6
|
+
subscription: z.unknown(),
|
|
7
|
+
targetPrice: z.unknown(),
|
|
8
|
+
billingCustomer: z.unknown().optional(),
|
|
9
|
+
expected: z.unknown(),
|
|
10
|
+
key: z.string(),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
const attachRequest = z
|
|
14
|
+
.object({
|
|
15
|
+
preparation,
|
|
16
|
+
apiVersion: z.string(),
|
|
17
|
+
attachKey: z.string(),
|
|
18
|
+
firstDispatchedAt: timestamp,
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
const dispatch = z
|
|
22
|
+
.object({
|
|
23
|
+
scope: z.literal("platform"),
|
|
24
|
+
apiVersion: z.string(),
|
|
25
|
+
method: z.literal("POST"),
|
|
26
|
+
path: z.literal("/v1/subscription_schedules"),
|
|
27
|
+
payload: z.object({ from_subscription: z.string() }).strict(),
|
|
28
|
+
key: z.string(),
|
|
29
|
+
firstDispatchedAt: timestamp,
|
|
30
|
+
})
|
|
31
|
+
.strict();
|
|
32
|
+
const input = z
|
|
33
|
+
.object({
|
|
34
|
+
attachRequest,
|
|
35
|
+
actualDispatch: dispatch,
|
|
36
|
+
// The bounded JSON capture already owns this plain object. A record parser
|
|
37
|
+
// can discard special own keys such as __proto__, changing the bound body.
|
|
38
|
+
providerSnapshot: z.custom((v) => v !== null && typeof v === "object" && !Array.isArray(v)),
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
41
|
+
function ownData(raw, required, optional = []) {
|
|
42
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
43
|
+
throw Error("Invalid renewal receipt input.");
|
|
44
|
+
const keys = Reflect.ownKeys(raw);
|
|
45
|
+
if (keys.some((k) => typeof k !== "string" || ![...required, ...optional].includes(k)) ||
|
|
46
|
+
required.some((k) => !keys.includes(k)))
|
|
47
|
+
throw Error("Invalid renewal receipt fields.");
|
|
48
|
+
const result = {};
|
|
49
|
+
for (const key of keys) {
|
|
50
|
+
const d = Object.getOwnPropertyDescriptor(raw, key);
|
|
51
|
+
if (!d || !d.enumerable || !("value" in d))
|
|
52
|
+
throw Error("Renewal receipt requires own JSON data.");
|
|
53
|
+
result[key] = d.value;
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
function closed(raw) {
|
|
58
|
+
const root = ownData(raw, [
|
|
59
|
+
"attachRequest",
|
|
60
|
+
"actualDispatch",
|
|
61
|
+
"providerSnapshot",
|
|
62
|
+
]);
|
|
63
|
+
const request = ownData(root.attachRequest, [
|
|
64
|
+
"preparation",
|
|
65
|
+
"apiVersion",
|
|
66
|
+
"attachKey",
|
|
67
|
+
"firstDispatchedAt",
|
|
68
|
+
]);
|
|
69
|
+
ownData(request.preparation, ["subscription", "targetPrice", "expected", "key"], ["billingCustomer"]);
|
|
70
|
+
const wire = ownData(root.actualDispatch, [
|
|
71
|
+
"scope",
|
|
72
|
+
"apiVersion",
|
|
73
|
+
"method",
|
|
74
|
+
"path",
|
|
75
|
+
"payload",
|
|
76
|
+
"key",
|
|
77
|
+
"firstDispatchedAt",
|
|
78
|
+
]);
|
|
79
|
+
ownData(wire.payload, ["from_subscription"]);
|
|
80
|
+
}
|
|
81
|
+
export function captureAttachmentReceipt(raw) {
|
|
82
|
+
closed(raw);
|
|
83
|
+
const captured = renewalSnapshot(raw);
|
|
84
|
+
// Recheck the detached object: hostile reflection can mutate the live source.
|
|
85
|
+
closed(captured);
|
|
86
|
+
return input.parse(captured);
|
|
87
|
+
}
|
|
88
|
+
/** Available identity facts only, never response provenance or financial proof. */
|
|
89
|
+
export function assertAttachmentIdentity(body, operation) {
|
|
90
|
+
const need = (v) => {
|
|
91
|
+
if (!v)
|
|
92
|
+
throw Error("Unverified renewal attachment identity.");
|
|
93
|
+
};
|
|
94
|
+
const context = {
|
|
95
|
+
customerAccountId: operation.customerAccountId,
|
|
96
|
+
livemode: operation.livemode,
|
|
97
|
+
};
|
|
98
|
+
const check = (value, kind, depth) => {
|
|
99
|
+
need(depth <= 40);
|
|
100
|
+
const prefix = kind === "customer"
|
|
101
|
+
? "cus"
|
|
102
|
+
: kind === "subscription"
|
|
103
|
+
? "sub"
|
|
104
|
+
: "sub_sched";
|
|
105
|
+
const expected = kind === "customer"
|
|
106
|
+
? operation.billingCustomerId
|
|
107
|
+
: kind === "subscription"
|
|
108
|
+
? operation.subscriptionId
|
|
109
|
+
: operation.scheduleId;
|
|
110
|
+
need(referenceId(value, prefix, kind, context) === expected);
|
|
111
|
+
if (typeof value === "string")
|
|
112
|
+
return;
|
|
113
|
+
const expanded = value;
|
|
114
|
+
need(expanded.deleted === undefined || expanded.deleted === false);
|
|
115
|
+
const owns = (key) => Object.prototype.hasOwnProperty.call(expanded, key);
|
|
116
|
+
if (kind !== "customer" && owns("customer"))
|
|
117
|
+
check(expanded.customer, "customer", depth + 1);
|
|
118
|
+
if (kind === "subscription" && owns("schedule"))
|
|
119
|
+
check(expanded.schedule, "subscription_schedule", depth + 1);
|
|
120
|
+
if (kind === "subscription_schedule" && owns("subscription"))
|
|
121
|
+
check(expanded.subscription, "subscription", depth + 1);
|
|
122
|
+
};
|
|
123
|
+
need(body.object === "subscription_schedule" &&
|
|
124
|
+
body.id === operation.scheduleId &&
|
|
125
|
+
(body.deleted === undefined || body.deleted === false) &&
|
|
126
|
+
body.customer_account === operation.customerAccountId &&
|
|
127
|
+
body.livemode === operation.livemode);
|
|
128
|
+
check(body.customer, "customer", 0);
|
|
129
|
+
check(body.subscription, "subscription", 0);
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=receipt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receipt.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EACL,WAAW,EACX,SAAS,GAEV,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,WAAW,EAAE,CAAC,CAAC,OAAO,EA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,SAAS,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC;QACtD,IAAI,CAAC,gBAAgB,KAAK,SAAS,CAAC,iBAAiB;QACrD,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,CACvC,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACpC,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -2351,14 +2351,6 @@ export declare function large(count?: number, amount?: number): Promise<{
|
|
|
2351
2351
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
2352
2352
|
requestKey: string;
|
|
2353
2353
|
result?: {
|
|
2354
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2355
|
-
retryable: false;
|
|
2356
|
-
status: "conflict";
|
|
2357
|
-
} | {
|
|
2358
|
-
reason: "policy_invalid";
|
|
2359
|
-
retryable: false;
|
|
2360
|
-
status: "rejected";
|
|
2361
|
-
} | {
|
|
2362
2354
|
operation: {
|
|
2363
2355
|
accountId: string;
|
|
2364
2356
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2369,6 +2361,14 @@ export declare function large(count?: number, amount?: number): Promise<{
|
|
|
2369
2361
|
} | {
|
|
2370
2362
|
enabled: boolean;
|
|
2371
2363
|
status: "unchanged";
|
|
2364
|
+
} | {
|
|
2365
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2366
|
+
retryable: false;
|
|
2367
|
+
status: "conflict";
|
|
2368
|
+
} | {
|
|
2369
|
+
reason: "policy_invalid";
|
|
2370
|
+
retryable: false;
|
|
2371
|
+
status: "rejected";
|
|
2372
2372
|
} | {
|
|
2373
2373
|
reason: "provider_pending";
|
|
2374
2374
|
retryable: true;
|
|
@@ -2379,14 +2379,6 @@ export declare function large(count?: number, amount?: number): Promise<{
|
|
|
2379
2379
|
payload: import("convex/values").VString<string, "required">;
|
|
2380
2380
|
preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
|
|
2381
2381
|
result: import("convex/values").VUnion<{
|
|
2382
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2383
|
-
retryable: false;
|
|
2384
|
-
status: "conflict";
|
|
2385
|
-
} | {
|
|
2386
|
-
reason: "policy_invalid";
|
|
2387
|
-
retryable: false;
|
|
2388
|
-
status: "rejected";
|
|
2389
|
-
} | {
|
|
2390
2382
|
operation: {
|
|
2391
2383
|
accountId: string;
|
|
2392
2384
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2397,6 +2389,14 @@ export declare function large(count?: number, amount?: number): Promise<{
|
|
|
2397
2389
|
} | {
|
|
2398
2390
|
enabled: boolean;
|
|
2399
2391
|
status: "unchanged";
|
|
2392
|
+
} | {
|
|
2393
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2394
|
+
retryable: false;
|
|
2395
|
+
status: "conflict";
|
|
2396
|
+
} | {
|
|
2397
|
+
reason: "policy_invalid";
|
|
2398
|
+
retryable: false;
|
|
2399
|
+
status: "rejected";
|
|
2400
2400
|
} | {
|
|
2401
2401
|
reason: "provider_pending";
|
|
2402
2402
|
retryable: true;
|
|
@@ -7207,14 +7207,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
|
|
|
7207
7207
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
7208
7208
|
requestKey: string;
|
|
7209
7209
|
result?: {
|
|
7210
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7211
|
-
retryable: false;
|
|
7212
|
-
status: "conflict";
|
|
7213
|
-
} | {
|
|
7214
|
-
reason: "policy_invalid";
|
|
7215
|
-
retryable: false;
|
|
7216
|
-
status: "rejected";
|
|
7217
|
-
} | {
|
|
7218
7210
|
operation: {
|
|
7219
7211
|
accountId: string;
|
|
7220
7212
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -7225,6 +7217,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
|
|
|
7225
7217
|
} | {
|
|
7226
7218
|
enabled: boolean;
|
|
7227
7219
|
status: "unchanged";
|
|
7220
|
+
} | {
|
|
7221
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7222
|
+
retryable: false;
|
|
7223
|
+
status: "conflict";
|
|
7224
|
+
} | {
|
|
7225
|
+
reason: "policy_invalid";
|
|
7226
|
+
retryable: false;
|
|
7227
|
+
status: "rejected";
|
|
7228
7228
|
} | {
|
|
7229
7229
|
reason: "provider_pending";
|
|
7230
7230
|
retryable: true;
|
|
@@ -7235,14 +7235,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
|
|
|
7235
7235
|
payload: import("convex/values").VString<string, "required">;
|
|
7236
7236
|
preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
|
|
7237
7237
|
result: import("convex/values").VUnion<{
|
|
7238
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7239
|
-
retryable: false;
|
|
7240
|
-
status: "conflict";
|
|
7241
|
-
} | {
|
|
7242
|
-
reason: "policy_invalid";
|
|
7243
|
-
retryable: false;
|
|
7244
|
-
status: "rejected";
|
|
7245
|
-
} | {
|
|
7246
7238
|
operation: {
|
|
7247
7239
|
accountId: string;
|
|
7248
7240
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -7253,6 +7245,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
|
|
|
7253
7245
|
} | {
|
|
7254
7246
|
enabled: boolean;
|
|
7255
7247
|
status: "unchanged";
|
|
7248
|
+
} | {
|
|
7249
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7250
|
+
retryable: false;
|
|
7251
|
+
status: "conflict";
|
|
7252
|
+
} | {
|
|
7253
|
+
reason: "policy_invalid";
|
|
7254
|
+
retryable: false;
|
|
7255
|
+
status: "rejected";
|
|
7256
7256
|
} | {
|
|
7257
7257
|
reason: "provider_pending";
|
|
7258
7258
|
retryable: true;
|
|
@@ -2365,6 +2365,14 @@ export declare function setup(scope?: Scope): Promise<{
|
|
|
2365
2365
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
2366
2366
|
requestKey: string;
|
|
2367
2367
|
result?: {
|
|
2368
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2369
|
+
retryable: false;
|
|
2370
|
+
status: "conflict";
|
|
2371
|
+
} | {
|
|
2372
|
+
reason: "policy_invalid";
|
|
2373
|
+
retryable: false;
|
|
2374
|
+
status: "rejected";
|
|
2375
|
+
} | {
|
|
2368
2376
|
operation: {
|
|
2369
2377
|
accountId: string;
|
|
2370
2378
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2375,14 +2383,6 @@ export declare function setup(scope?: Scope): Promise<{
|
|
|
2375
2383
|
} | {
|
|
2376
2384
|
enabled: boolean;
|
|
2377
2385
|
status: "unchanged";
|
|
2378
|
-
} | {
|
|
2379
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2380
|
-
retryable: false;
|
|
2381
|
-
status: "conflict";
|
|
2382
|
-
} | {
|
|
2383
|
-
reason: "policy_invalid";
|
|
2384
|
-
retryable: false;
|
|
2385
|
-
status: "rejected";
|
|
2386
2386
|
} | {
|
|
2387
2387
|
reason: "provider_pending";
|
|
2388
2388
|
retryable: true;
|
|
@@ -2393,6 +2393,14 @@ export declare function setup(scope?: Scope): Promise<{
|
|
|
2393
2393
|
payload: import("convex/values").VString<string, "required">;
|
|
2394
2394
|
preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
|
|
2395
2395
|
result: import("convex/values").VUnion<{
|
|
2396
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2397
|
+
retryable: false;
|
|
2398
|
+
status: "conflict";
|
|
2399
|
+
} | {
|
|
2400
|
+
reason: "policy_invalid";
|
|
2401
|
+
retryable: false;
|
|
2402
|
+
status: "rejected";
|
|
2403
|
+
} | {
|
|
2396
2404
|
operation: {
|
|
2397
2405
|
accountId: string;
|
|
2398
2406
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2403,14 +2411,6 @@ export declare function setup(scope?: Scope): Promise<{
|
|
|
2403
2411
|
} | {
|
|
2404
2412
|
enabled: boolean;
|
|
2405
2413
|
status: "unchanged";
|
|
2406
|
-
} | {
|
|
2407
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2408
|
-
retryable: false;
|
|
2409
|
-
status: "conflict";
|
|
2410
|
-
} | {
|
|
2411
|
-
reason: "policy_invalid";
|
|
2412
|
-
retryable: false;
|
|
2413
|
-
status: "rejected";
|
|
2414
2414
|
} | {
|
|
2415
2415
|
reason: "provider_pending";
|
|
2416
2416
|
retryable: true;
|
package/dist/client/renewal.d.ts
CHANGED
|
@@ -5,4 +5,6 @@ export type { RenewalPriceReplacementExpected } from "./billing/renewalReplaceme
|
|
|
5
5
|
export { prepareRenewalScheduleAttachment } from "./billing/renewalAttach/request.js";
|
|
6
6
|
export type { PrepareRenewalScheduleAttachmentOptions, PreparedRenewalScheduleAttachment, } from "./billing/renewalAttach/request.js";
|
|
7
7
|
export type { ReadRenewalPriceReplacementContextOptions } from "./billing/renewalAttach/reader.js";
|
|
8
|
+
export { prepareRenewalPriceReplacementV2, prepareRenewalScheduleAttachmentV2, constructRenewalScheduleAttachmentReceiptV2, } from "./billing/renewalV2/index.js";
|
|
9
|
+
export type { PrepareRenewalPriceReplacementV2Options, PreparedRenewalPriceReplacementV2, PrepareRenewalScheduleAttachmentV2Options, PreparedRenewalScheduleAttachmentV2, ConstructRenewalScheduleAttachmentReceiptV2Options, RenewalScheduleAttachmentReceiptV2, } from "./billing/renewalV2/index.js";
|
|
8
10
|
//# sourceMappingURL=renewal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renewal.d.ts","sourceRoot":"","sources":["../../src/client/renewal.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,YAAY,EACV,qCAAqC,EACrC,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,YAAY,EACV,uCAAuC,EACvC,iCAAiC,GAClC,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,yCAAyC,EAAE,MAAM,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"renewal.d.ts","sourceRoot":"","sources":["../../src/client/renewal.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,YAAY,EACV,qCAAqC,EACrC,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,YAAY,EACV,uCAAuC,EACvC,iCAAiC,GAClC,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,yCAAyC,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EACL,gCAAgC,EAChC,kCAAkC,EAClC,2CAA2C,GAC5C,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,uCAAuC,EACvC,iCAAiC,EACjC,yCAAyC,EACzC,mCAAmC,EACnC,kDAAkD,EAClD,kCAAkC,GACnC,MAAM,8BAA8B,CAAC"}
|
package/dist/client/renewal.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Public pure renewal preparation functions and their input/result types. */
|
|
2
2
|
export { prepareRenewalPriceReplacement } from "./billing/renewalPriceReplacement.js";
|
|
3
3
|
export { prepareRenewalScheduleAttachment } from "./billing/renewalAttach/request.js";
|
|
4
|
+
export { prepareRenewalPriceReplacementV2, prepareRenewalScheduleAttachmentV2, constructRenewalScheduleAttachmentReceiptV2, } from "./billing/renewalV2/index.js";
|
|
4
5
|
//# sourceMappingURL=renewal.js.map
|