@paygentic/sdk 0.9.13 → 0.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/dist/commonjs/funcs/revenueGet.js +1 -0
- package/dist/commonjs/funcs/revenueGet.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsEditSubscriptionIntervals.d.ts +19 -0
- package/dist/commonjs/funcs/subscriptionsEditSubscriptionIntervals.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsEditSubscriptionIntervals.js +127 -0
- package/dist/commonjs/funcs/subscriptionsEditSubscriptionIntervals.js.map +1 -0
- package/dist/commonjs/funcs/subscriptionsGetSubscriptionIntervals.d.ts +19 -0
- package/dist/commonjs/funcs/subscriptionsGetSubscriptionIntervals.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsGetSubscriptionIntervals.js +124 -0
- package/dist/commonjs/funcs/subscriptionsGetSubscriptionIntervals.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/editsubscriptionintervalsrequest.d.ts +31 -0
- package/dist/commonjs/models/editsubscriptionintervalsrequest.d.ts.map +1 -0
- package/dist/commonjs/models/editsubscriptionintervalsrequest.js +54 -0
- package/dist/commonjs/models/editsubscriptionintervalsrequest.js.map +1 -0
- package/dist/commonjs/models/editsubscriptionintervalsresponse.d.ts +36 -0
- package/dist/commonjs/models/editsubscriptionintervalsresponse.d.ts.map +1 -0
- package/dist/commonjs/models/editsubscriptionintervalsresponse.js +63 -0
- package/dist/commonjs/models/editsubscriptionintervalsresponse.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +8 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +8 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/operations/createsubscription.d.ts +5 -0
- package/dist/commonjs/models/operations/createsubscription.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createsubscription.js +1 -0
- package/dist/commonjs/models/operations/createsubscription.js.map +1 -1
- package/dist/commonjs/models/operations/editsubscriptionintervals.d.ts +18 -0
- package/dist/commonjs/models/operations/editsubscriptionintervals.d.ts.map +1 -0
- package/dist/commonjs/models/operations/editsubscriptionintervals.js +56 -0
- package/dist/commonjs/models/operations/editsubscriptionintervals.js.map +1 -0
- package/dist/commonjs/models/operations/getrevenue.d.ts +18 -0
- package/dist/commonjs/models/operations/getrevenue.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getrevenue.js +12 -1
- package/dist/commonjs/models/operations/getrevenue.js.map +1 -1
- package/dist/commonjs/models/operations/getsubscriptionintervals.d.ts +15 -0
- package/dist/commonjs/models/operations/getsubscriptionintervals.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getsubscriptionintervals.js +49 -0
- package/dist/commonjs/models/operations/getsubscriptionintervals.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/updatesubscription.d.ts +6 -0
- package/dist/commonjs/models/operations/updatesubscription.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updatesubscription.js +2 -0
- package/dist/commonjs/models/operations/updatesubscription.js.map +1 -1
- package/dist/commonjs/models/subscription.d.ts +5 -0
- package/dist/commonjs/models/subscription.d.ts.map +1 -1
- package/dist/commonjs/models/subscription.js +2 -0
- package/dist/commonjs/models/subscription.js.map +1 -1
- package/dist/commonjs/models/subscriptioninterval.d.ts +80 -0
- package/dist/commonjs/models/subscriptioninterval.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptioninterval.js +86 -0
- package/dist/commonjs/models/subscriptioninterval.js.map +1 -0
- package/dist/commonjs/models/subscriptionintervaladdop.d.ts +85 -0
- package/dist/commonjs/models/subscriptionintervaladdop.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionintervaladdop.js +74 -0
- package/dist/commonjs/models/subscriptionintervaladdop.js.map +1 -0
- package/dist/commonjs/models/subscriptionintervaleditop.d.ts +102 -0
- package/dist/commonjs/models/subscriptionintervaleditop.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionintervaleditop.js +78 -0
- package/dist/commonjs/models/subscriptionintervaleditop.js.map +1 -0
- package/dist/commonjs/models/subscriptionintervalremoveop.d.ts +15 -0
- package/dist/commonjs/models/subscriptionintervalremoveop.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionintervalremoveop.js +49 -0
- package/dist/commonjs/models/subscriptionintervalremoveop.js.map +1 -0
- package/dist/commonjs/models/subscriptionintervalsresponse.d.ts +14 -0
- package/dist/commonjs/models/subscriptionintervalsresponse.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionintervalsresponse.js +51 -0
- package/dist/commonjs/models/subscriptionintervalsresponse.js.map +1 -0
- package/dist/commonjs/models/subscriptionversionpolicy.d.ts +18 -0
- package/dist/commonjs/models/subscriptionversionpolicy.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionversionpolicy.js +52 -0
- package/dist/commonjs/models/subscriptionversionpolicy.js.map +1 -0
- package/dist/commonjs/sdk/subscriptions.d.ts +14 -0
- package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
- package/dist/commonjs/sdk/subscriptions.js +20 -0
- package/dist/commonjs/sdk/subscriptions.js.map +1 -1
- package/dist/esm/funcs/revenueGet.js +1 -0
- package/dist/esm/funcs/revenueGet.js.map +1 -1
- package/dist/esm/funcs/subscriptionsEditSubscriptionIntervals.d.ts +19 -0
- package/dist/esm/funcs/subscriptionsEditSubscriptionIntervals.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsEditSubscriptionIntervals.js +91 -0
- package/dist/esm/funcs/subscriptionsEditSubscriptionIntervals.js.map +1 -0
- package/dist/esm/funcs/subscriptionsGetSubscriptionIntervals.d.ts +19 -0
- package/dist/esm/funcs/subscriptionsGetSubscriptionIntervals.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsGetSubscriptionIntervals.js +88 -0
- package/dist/esm/funcs/subscriptionsGetSubscriptionIntervals.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/editsubscriptionintervalsrequest.d.ts +31 -0
- package/dist/esm/models/editsubscriptionintervalsrequest.d.ts.map +1 -0
- package/dist/esm/models/editsubscriptionintervalsrequest.js +17 -0
- package/dist/esm/models/editsubscriptionintervalsrequest.js.map +1 -0
- package/dist/esm/models/editsubscriptionintervalsresponse.d.ts +36 -0
- package/dist/esm/models/editsubscriptionintervalsresponse.d.ts.map +1 -0
- package/dist/esm/models/editsubscriptionintervalsresponse.js +25 -0
- package/dist/esm/models/editsubscriptionintervalsresponse.js.map +1 -0
- package/dist/esm/models/index.d.ts +8 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +8 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/operations/createsubscription.d.ts +5 -0
- package/dist/esm/models/operations/createsubscription.d.ts.map +1 -1
- package/dist/esm/models/operations/createsubscription.js +1 -0
- package/dist/esm/models/operations/createsubscription.js.map +1 -1
- package/dist/esm/models/operations/editsubscriptionintervals.d.ts +18 -0
- package/dist/esm/models/operations/editsubscriptionintervals.d.ts.map +1 -0
- package/dist/esm/models/operations/editsubscriptionintervals.js +19 -0
- package/dist/esm/models/operations/editsubscriptionintervals.js.map +1 -0
- package/dist/esm/models/operations/getrevenue.d.ts +18 -0
- package/dist/esm/models/operations/getrevenue.d.ts.map +1 -1
- package/dist/esm/models/operations/getrevenue.js +11 -0
- package/dist/esm/models/operations/getrevenue.js.map +1 -1
- package/dist/esm/models/operations/getsubscriptionintervals.d.ts +15 -0
- package/dist/esm/models/operations/getsubscriptionintervals.d.ts.map +1 -0
- package/dist/esm/models/operations/getsubscriptionintervals.js +12 -0
- package/dist/esm/models/operations/getsubscriptionintervals.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/updatesubscription.d.ts +6 -0
- package/dist/esm/models/operations/updatesubscription.d.ts.map +1 -1
- package/dist/esm/models/operations/updatesubscription.js +2 -0
- package/dist/esm/models/operations/updatesubscription.js.map +1 -1
- package/dist/esm/models/subscription.d.ts +5 -0
- package/dist/esm/models/subscription.d.ts.map +1 -1
- package/dist/esm/models/subscription.js +2 -0
- package/dist/esm/models/subscription.js.map +1 -1
- package/dist/esm/models/subscriptioninterval.d.ts +80 -0
- package/dist/esm/models/subscriptioninterval.d.ts.map +1 -0
- package/dist/esm/models/subscriptioninterval.js +48 -0
- package/dist/esm/models/subscriptioninterval.js.map +1 -0
- package/dist/esm/models/subscriptionintervaladdop.d.ts +85 -0
- package/dist/esm/models/subscriptionintervaladdop.d.ts.map +1 -0
- package/dist/esm/models/subscriptionintervaladdop.js +36 -0
- package/dist/esm/models/subscriptionintervaladdop.js.map +1 -0
- package/dist/esm/models/subscriptionintervaleditop.d.ts +102 -0
- package/dist/esm/models/subscriptionintervaleditop.d.ts.map +1 -0
- package/dist/esm/models/subscriptionintervaleditop.js +40 -0
- package/dist/esm/models/subscriptionintervaleditop.js.map +1 -0
- package/dist/esm/models/subscriptionintervalremoveop.d.ts +15 -0
- package/dist/esm/models/subscriptionintervalremoveop.d.ts.map +1 -0
- package/dist/esm/models/subscriptionintervalremoveop.js +12 -0
- package/dist/esm/models/subscriptionintervalremoveop.js.map +1 -0
- package/dist/esm/models/subscriptionintervalsresponse.d.ts +14 -0
- package/dist/esm/models/subscriptionintervalsresponse.d.ts.map +1 -0
- package/dist/esm/models/subscriptionintervalsresponse.js +14 -0
- package/dist/esm/models/subscriptionintervalsresponse.js.map +1 -0
- package/dist/esm/models/subscriptionversionpolicy.d.ts +18 -0
- package/dist/esm/models/subscriptionversionpolicy.d.ts.map +1 -0
- package/dist/esm/models/subscriptionversionpolicy.js +16 -0
- package/dist/esm/models/subscriptionversionpolicy.js.map +1 -0
- package/dist/esm/sdk/subscriptions.d.ts +14 -0
- package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
- package/dist/esm/sdk/subscriptions.js +20 -0
- package/dist/esm/sdk/subscriptions.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/revenueGet.ts +1 -0
- package/src/funcs/subscriptionsEditSubscriptionIntervals.ts +184 -0
- package/src/funcs/subscriptionsGetSubscriptionIntervals.ts +177 -0
- package/src/lib/config.ts +2 -2
- package/src/models/editsubscriptionintervalsrequest.ts +66 -0
- package/src/models/editsubscriptionintervalsresponse.ts +87 -0
- package/src/models/index.ts +8 -0
- package/src/models/operations/createsubscription.ts +6 -0
- package/src/models/operations/editsubscriptionintervals.ts +47 -0
- package/src/models/operations/getrevenue.ts +22 -0
- package/src/models/operations/getsubscriptionintervals.ts +36 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/updatesubscription.ts +7 -0
- package/src/models/subscription.ts +9 -0
- package/src/models/subscriptioninterval.ts +152 -0
- package/src/models/subscriptionintervaladdop.ts +148 -0
- package/src/models/subscriptionintervaleditop.ts +166 -0
- package/src/models/subscriptionintervalremoveop.ts +36 -0
- package/src/models/subscriptionintervalsresponse.ts +38 -0
- package/src/models/subscriptionversionpolicy.ts +29 -0
- package/src/sdk/subscriptions.ts +36 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
SubscriptionInterval,
|
|
11
|
+
SubscriptionInterval$inboundSchema,
|
|
12
|
+
} from "./subscriptioninterval.js";
|
|
13
|
+
|
|
14
|
+
export type EditSubscriptionIntervalsResponseLineItems = {
|
|
15
|
+
/**
|
|
16
|
+
* Number of distinct prices that gained a line item as this timeline edit was re-derived into billing.
|
|
17
|
+
*/
|
|
18
|
+
created: number;
|
|
19
|
+
/**
|
|
20
|
+
* Number of distinct prices whose future/uninvoiced line items were removed as this timeline edit was re-derived into billing.
|
|
21
|
+
*/
|
|
22
|
+
removed: number;
|
|
23
|
+
/**
|
|
24
|
+
* True when the timeline edit was saved but the line-item re-derive failed. The edit is not rolled back, and the re-derive is retried automatically. Resubmitting the same request retries it sooner.
|
|
25
|
+
*/
|
|
26
|
+
syncFailed?: boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type EditSubscriptionIntervalsResponse = {
|
|
30
|
+
/**
|
|
31
|
+
* The timeline's effective price intervals after applying the op set, ordered by start date.
|
|
32
|
+
*/
|
|
33
|
+
intervals: Array<SubscriptionInterval>;
|
|
34
|
+
/**
|
|
35
|
+
* True when the op set resolved to no change and nothing was written.
|
|
36
|
+
*/
|
|
37
|
+
unchanged: boolean;
|
|
38
|
+
lineItems: EditSubscriptionIntervalsResponseLineItems;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** @internal */
|
|
42
|
+
export const EditSubscriptionIntervalsResponseLineItems$inboundSchema:
|
|
43
|
+
z.ZodType<EditSubscriptionIntervalsResponseLineItems, z.ZodTypeDef, unknown> =
|
|
44
|
+
z.object({
|
|
45
|
+
created: z.number().int(),
|
|
46
|
+
removed: z.number().int(),
|
|
47
|
+
syncFailed: z.boolean().optional(),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export function editSubscriptionIntervalsResponseLineItemsFromJSON(
|
|
51
|
+
jsonString: string,
|
|
52
|
+
): SafeParseResult<
|
|
53
|
+
EditSubscriptionIntervalsResponseLineItems,
|
|
54
|
+
SDKValidationError
|
|
55
|
+
> {
|
|
56
|
+
return safeParse(
|
|
57
|
+
jsonString,
|
|
58
|
+
(x) =>
|
|
59
|
+
EditSubscriptionIntervalsResponseLineItems$inboundSchema.parse(
|
|
60
|
+
JSON.parse(x),
|
|
61
|
+
),
|
|
62
|
+
`Failed to parse 'EditSubscriptionIntervalsResponseLineItems' from JSON`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** @internal */
|
|
67
|
+
export const EditSubscriptionIntervalsResponse$inboundSchema: z.ZodType<
|
|
68
|
+
EditSubscriptionIntervalsResponse,
|
|
69
|
+
z.ZodTypeDef,
|
|
70
|
+
unknown
|
|
71
|
+
> = z.object({
|
|
72
|
+
intervals: z.array(SubscriptionInterval$inboundSchema),
|
|
73
|
+
unchanged: z.boolean(),
|
|
74
|
+
lineItems: z.lazy(() =>
|
|
75
|
+
EditSubscriptionIntervalsResponseLineItems$inboundSchema
|
|
76
|
+
),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export function editSubscriptionIntervalsResponseFromJSON(
|
|
80
|
+
jsonString: string,
|
|
81
|
+
): SafeParseResult<EditSubscriptionIntervalsResponse, SDKValidationError> {
|
|
82
|
+
return safeParse(
|
|
83
|
+
jsonString,
|
|
84
|
+
(x) => EditSubscriptionIntervalsResponse$inboundSchema.parse(JSON.parse(x)),
|
|
85
|
+
`Failed to parse 'EditSubscriptionIntervalsResponse' from JSON`,
|
|
86
|
+
);
|
|
87
|
+
}
|
package/src/models/index.ts
CHANGED
|
@@ -30,6 +30,8 @@ export * from "./createusagediscountadjustment.js";
|
|
|
30
30
|
export * from "./currencybreakdownentry.js";
|
|
31
31
|
export * from "./customer.js";
|
|
32
32
|
export * from "./customerpaymentsession.js";
|
|
33
|
+
export * from "./editsubscriptionintervalsrequest.js";
|
|
34
|
+
export * from "./editsubscriptionintervalsresponse.js";
|
|
33
35
|
export * from "./entitlementdetail.js";
|
|
34
36
|
export * from "./entitlementlistitem.js";
|
|
35
37
|
export * from "./entitlementstatus.js";
|
|
@@ -117,9 +119,15 @@ export * from "./staticentitlementlistitem.js";
|
|
|
117
119
|
export * from "./subscription.js";
|
|
118
120
|
export * from "./subscriptionadjustment.js";
|
|
119
121
|
export * from "./subscriptionadjustmentsresponse.js";
|
|
122
|
+
export * from "./subscriptioninterval.js";
|
|
123
|
+
export * from "./subscriptionintervaladdop.js";
|
|
124
|
+
export * from "./subscriptionintervaleditop.js";
|
|
125
|
+
export * from "./subscriptionintervalremoveop.js";
|
|
126
|
+
export * from "./subscriptionintervalsresponse.js";
|
|
120
127
|
export * from "./subscriptionmetadata.js";
|
|
121
128
|
export * from "./subscriptionportal.js";
|
|
122
129
|
export * from "./subscriptionreconciliation.js";
|
|
130
|
+
export * from "./subscriptionversionpolicy.js";
|
|
123
131
|
export * from "./testclock.js";
|
|
124
132
|
export * from "./transitionplanversionrequest.js";
|
|
125
133
|
export * from "./updateapprovalrequest.js";
|
|
@@ -117,6 +117,10 @@ export type CreateSubscriptionRequest = {
|
|
|
117
117
|
* Number of minutes until the payment session expires. Defaults to 240 minutes (4 hours) if not provided.
|
|
118
118
|
*/
|
|
119
119
|
sessionExpiryMinutes?: number | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* How the subscription follows new versions of its plan. `floating` follows the plan's default version: when the default changes, the subscription bills from the new default from its next billing period. `pinned` keeps the plan version that the subscription holds. A subscription created without a value is `floating`. A change to this value does not change a billing period that has already started.
|
|
122
|
+
*/
|
|
123
|
+
versionPolicy?: models.SubscriptionVersionPolicy | undefined;
|
|
120
124
|
/**
|
|
121
125
|
* Free-form merchant metadata to attach to the subscription. Values must be strings, numbers, or booleans.
|
|
122
126
|
*/
|
|
@@ -215,6 +219,7 @@ export type CreateSubscriptionRequest$Outbound = {
|
|
|
215
219
|
renewalReminderDays?: number | null | undefined;
|
|
216
220
|
paymentTermDays?: number | undefined;
|
|
217
221
|
sessionExpiryMinutes?: number | undefined;
|
|
222
|
+
versionPolicy?: string | undefined;
|
|
218
223
|
metadata?: { [k: string]: models.SubscriptionMetadata$Outbound } | undefined;
|
|
219
224
|
};
|
|
220
225
|
|
|
@@ -240,6 +245,7 @@ export const CreateSubscriptionRequest$outboundSchema: z.ZodType<
|
|
|
240
245
|
renewalReminderDays: z.nullable(z.number().int()).optional(),
|
|
241
246
|
paymentTermDays: z.number().int().optional(),
|
|
242
247
|
sessionExpiryMinutes: z.number().optional(),
|
|
248
|
+
versionPolicy: models.SubscriptionVersionPolicy$outboundSchema.optional(),
|
|
243
249
|
metadata: z.record(models.SubscriptionMetadata$outboundSchema).optional(),
|
|
244
250
|
});
|
|
245
251
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import * as models from "../index.js";
|
|
8
|
+
|
|
9
|
+
export type EditSubscriptionIntervalsRequest = {
|
|
10
|
+
/**
|
|
11
|
+
* The subscription ID
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
editSubscriptionIntervalsRequest: models.EditSubscriptionIntervalsRequest;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export type EditSubscriptionIntervalsRequest$Outbound = {
|
|
19
|
+
id: string;
|
|
20
|
+
EditSubscriptionIntervalsRequest:
|
|
21
|
+
models.EditSubscriptionIntervalsRequest$Outbound;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const EditSubscriptionIntervalsRequest$outboundSchema: z.ZodType<
|
|
26
|
+
EditSubscriptionIntervalsRequest$Outbound,
|
|
27
|
+
z.ZodTypeDef,
|
|
28
|
+
EditSubscriptionIntervalsRequest
|
|
29
|
+
> = z.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
editSubscriptionIntervalsRequest:
|
|
32
|
+
models.EditSubscriptionIntervalsRequest$outboundSchema,
|
|
33
|
+
}).transform((v) => {
|
|
34
|
+
return remap$(v, {
|
|
35
|
+
editSubscriptionIntervalsRequest: "EditSubscriptionIntervalsRequest",
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export function editSubscriptionIntervalsRequestToJSON(
|
|
40
|
+
editSubscriptionIntervalsRequest: EditSubscriptionIntervalsRequest,
|
|
41
|
+
): string {
|
|
42
|
+
return JSON.stringify(
|
|
43
|
+
EditSubscriptionIntervalsRequest$outboundSchema.parse(
|
|
44
|
+
editSubscriptionIntervalsRequest,
|
|
45
|
+
),
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -31,6 +31,18 @@ export const GroupBy = {
|
|
|
31
31
|
*/
|
|
32
32
|
export type GroupBy = ClosedEnum<typeof GroupBy>;
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Which date places revenue inside the window. 'issued' (default) counts whole invoices by their issue date, the basis revenue is recognised on. 'billingPeriod' counts invoice lines by the start of the period each line bills, so a window covering one billing period returns that period's charges, whichever invoices carry them: this month's advance fee and this month's arrears usage. Paid, outstanding and written-off follow each line's invoice; a refund splits across its invoice's lines by subtotal; payments not tied to an invoice are excluded because they bill no period.
|
|
36
|
+
*/
|
|
37
|
+
export const PeriodBasis = {
|
|
38
|
+
Issued: "issued",
|
|
39
|
+
BillingPeriod: "billingPeriod",
|
|
40
|
+
} as const;
|
|
41
|
+
/**
|
|
42
|
+
* Which date places revenue inside the window. 'issued' (default) counts whole invoices by their issue date, the basis revenue is recognised on. 'billingPeriod' counts invoice lines by the start of the period each line bills, so a window covering one billing period returns that period's charges, whichever invoices carry them: this month's advance fee and this month's arrears usage. Paid, outstanding and written-off follow each line's invoice; a refund splits across its invoice's lines by subtotal; payments not tied to an invoice are excluded because they bill no period.
|
|
43
|
+
*/
|
|
44
|
+
export type PeriodBasis = ClosedEnum<typeof PeriodBasis>;
|
|
45
|
+
|
|
34
46
|
export type GetRevenueRequest = {
|
|
35
47
|
/**
|
|
36
48
|
* Start of the time range (ISO 8601 format)
|
|
@@ -64,6 +76,10 @@ export type GetRevenueRequest = {
|
|
|
64
76
|
* Group invoice data by dimension. Allowed values: 'plan' (max 5 groups, top 4 + 'other' when exceeding), 'customer' (max 25 groups, top 24 + 'other' when exceeding, sorted by revenue descending), 'currency' (one entry per currency, primary currency first then alphabetical). Note: groupBy values are mutually exclusive — combining them returns a 400 error. When groupBy=currency is active, top-level netRevenue, invoices, and payments fields are omitted; currencyBreakdown is the sole data source.
|
|
65
77
|
*/
|
|
66
78
|
groupBy?: GroupBy | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Which date places revenue inside the window. 'issued' (default) counts whole invoices by their issue date, the basis revenue is recognised on. 'billingPeriod' counts invoice lines by the start of the period each line bills, so a window covering one billing period returns that period's charges, whichever invoices carry them: this month's advance fee and this month's arrears usage. Paid, outstanding and written-off follow each line's invoice; a refund splits across its invoice's lines by subtotal; payments not tied to an invoice are excluded because they bill no period.
|
|
81
|
+
*/
|
|
82
|
+
periodBasis?: PeriodBasis | undefined;
|
|
67
83
|
};
|
|
68
84
|
|
|
69
85
|
/** @internal */
|
|
@@ -75,6 +91,10 @@ export const GetRevenueBucketWidth$outboundSchema: z.ZodNativeEnum<
|
|
|
75
91
|
export const GroupBy$outboundSchema: z.ZodNativeEnum<typeof GroupBy> = z
|
|
76
92
|
.nativeEnum(GroupBy);
|
|
77
93
|
|
|
94
|
+
/** @internal */
|
|
95
|
+
export const PeriodBasis$outboundSchema: z.ZodNativeEnum<typeof PeriodBasis> = z
|
|
96
|
+
.nativeEnum(PeriodBasis);
|
|
97
|
+
|
|
78
98
|
/** @internal */
|
|
79
99
|
export type GetRevenueRequest$Outbound = {
|
|
80
100
|
startTime: string;
|
|
@@ -85,6 +105,7 @@ export type GetRevenueRequest$Outbound = {
|
|
|
85
105
|
subscriptionIds?: Array<string> | undefined;
|
|
86
106
|
currency?: string | undefined;
|
|
87
107
|
groupBy?: string | undefined;
|
|
108
|
+
periodBasis: string;
|
|
88
109
|
};
|
|
89
110
|
|
|
90
111
|
/** @internal */
|
|
@@ -101,6 +122,7 @@ export const GetRevenueRequest$outboundSchema: z.ZodType<
|
|
|
101
122
|
subscriptionIds: z.array(z.string()).optional(),
|
|
102
123
|
currency: z.string().optional(),
|
|
103
124
|
groupBy: GroupBy$outboundSchema.optional(),
|
|
125
|
+
periodBasis: PeriodBasis$outboundSchema.default("issued"),
|
|
104
126
|
});
|
|
105
127
|
|
|
106
128
|
export function getRevenueRequestToJSON(
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type GetSubscriptionIntervalsRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* The subscription ID
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export type GetSubscriptionIntervalsRequest$Outbound = {
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const GetSubscriptionIntervalsRequest$outboundSchema: z.ZodType<
|
|
21
|
+
GetSubscriptionIntervalsRequest$Outbound,
|
|
22
|
+
z.ZodTypeDef,
|
|
23
|
+
GetSubscriptionIntervalsRequest
|
|
24
|
+
> = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export function getSubscriptionIntervalsRequestToJSON(
|
|
29
|
+
getSubscriptionIntervalsRequest: GetSubscriptionIntervalsRequest,
|
|
30
|
+
): string {
|
|
31
|
+
return JSON.stringify(
|
|
32
|
+
GetSubscriptionIntervalsRequest$outboundSchema.parse(
|
|
33
|
+
getSubscriptionIntervalsRequest,
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -41,6 +41,7 @@ export * from "./deletesubscriptionadjustment.js";
|
|
|
41
41
|
export * from "./deletetestclock.js";
|
|
42
42
|
export * from "./disconnectmerchantintegration.js";
|
|
43
43
|
export * from "./downloadinvoicepdf.js";
|
|
44
|
+
export * from "./editsubscriptionintervals.js";
|
|
44
45
|
export * from "./generateportallink.js";
|
|
45
46
|
export * from "./generatescheduleinvoices.js";
|
|
46
47
|
export * from "./getapproval.js";
|
|
@@ -71,6 +72,7 @@ export * from "./getrevenue.js";
|
|
|
71
72
|
export * from "./getsource.js";
|
|
72
73
|
export * from "./getsourcerule.js";
|
|
73
74
|
export * from "./getsubscription.js";
|
|
75
|
+
export * from "./getsubscriptionintervals.js";
|
|
74
76
|
export * from "./gettestclock.js";
|
|
75
77
|
export * from "./getuser.js";
|
|
76
78
|
export * from "./ingestevent.js";
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import * as models from "../index.js";
|
|
8
9
|
|
|
9
10
|
export const UpdateSubscriptionStatus = {
|
|
10
11
|
Active: "active",
|
|
@@ -55,6 +56,10 @@ export type UpdateSubscriptionRequestBody = {
|
|
|
55
56
|
* Payment term in days ("Net X") applied to subsequently generated invoices: invoice dueAt = invoice issue date + paymentTermDays. A non-zero value is only valid alongside bankTransferOnly=true. Set 0 for "due on issue". Already-issued invoices keep their snapshotted dueAt.
|
|
56
57
|
*/
|
|
57
58
|
paymentTermDays?: number | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* How the subscription follows new versions of its plan. `floating` follows the plan's default version: when the default changes, the subscription bills from the new default from its next billing period. `pinned` keeps the plan version that the subscription holds. A subscription created without a value is `floating`. A change to this value does not change a billing period that has already started.
|
|
61
|
+
*/
|
|
62
|
+
versionPolicy?: models.SubscriptionVersionPolicy | undefined;
|
|
58
63
|
};
|
|
59
64
|
|
|
60
65
|
export type UpdateSubscriptionRequest = {
|
|
@@ -80,6 +85,7 @@ export type UpdateSubscriptionRequestBody$Outbound = {
|
|
|
80
85
|
renewalReminderEnabled?: boolean | null | undefined;
|
|
81
86
|
renewalReminderDays?: number | null | undefined;
|
|
82
87
|
paymentTermDays?: number | undefined;
|
|
88
|
+
versionPolicy?: string | undefined;
|
|
83
89
|
};
|
|
84
90
|
|
|
85
91
|
/** @internal */
|
|
@@ -99,6 +105,7 @@ export const UpdateSubscriptionRequestBody$outboundSchema: z.ZodType<
|
|
|
99
105
|
renewalReminderEnabled: z.nullable(z.boolean()).optional(),
|
|
100
106
|
renewalReminderDays: z.nullable(z.number().int()).optional(),
|
|
101
107
|
paymentTermDays: z.number().int().optional(),
|
|
108
|
+
versionPolicy: models.SubscriptionVersionPolicy$outboundSchema.optional(),
|
|
102
109
|
});
|
|
103
110
|
|
|
104
111
|
export function updateSubscriptionRequestBodyToJSON(
|
|
@@ -11,6 +11,10 @@ import {
|
|
|
11
11
|
SubscriptionMetadata,
|
|
12
12
|
SubscriptionMetadata$inboundSchema,
|
|
13
13
|
} from "./subscriptionmetadata.js";
|
|
14
|
+
import {
|
|
15
|
+
SubscriptionVersionPolicy,
|
|
16
|
+
SubscriptionVersionPolicy$inboundSchema,
|
|
17
|
+
} from "./subscriptionversionpolicy.js";
|
|
14
18
|
|
|
15
19
|
export const SubscriptionObject = {
|
|
16
20
|
Subscription: "subscription",
|
|
@@ -173,6 +177,10 @@ export type Subscription = {
|
|
|
173
177
|
* The version number of the plan version referenced by planVersionId, as of subscription creation.
|
|
174
178
|
*/
|
|
175
179
|
versionNumber?: number | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* How the subscription follows new versions of its plan. `floating` follows the plan's default version: when the default changes, the subscription bills from the new default from its next billing period. `pinned` keeps the plan version that the subscription holds. A subscription created without a value is `floating`. A change to this value does not change a billing period that has already started.
|
|
182
|
+
*/
|
|
183
|
+
versionPolicy: SubscriptionVersionPolicy;
|
|
176
184
|
/**
|
|
177
185
|
* Deprecated. Legacy-only, not populated for new subscriptions.
|
|
178
186
|
*
|
|
@@ -439,6 +447,7 @@ export const Subscription$inboundSchema: z.ZodType<
|
|
|
439
447
|
planId: z.string(),
|
|
440
448
|
planVersionId: z.string().optional(),
|
|
441
449
|
versionNumber: z.number().int().optional(),
|
|
450
|
+
versionPolicy: SubscriptionVersionPolicy$inboundSchema,
|
|
442
451
|
prefundAmount: z.string().optional(),
|
|
443
452
|
minimumAccountBalance: z.string().optional(),
|
|
444
453
|
startedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* plan_line if the plan version has a line with this priceKey. subscription_owned if it does not, so the interval belongs to this subscription only. After an add, check the kind. A mistyped priceKey creates a subscription_owned interval.
|
|
13
|
+
*/
|
|
14
|
+
export const SubscriptionIntervalKind = {
|
|
15
|
+
PlanLine: "plan_line",
|
|
16
|
+
SubscriptionOwned: "subscription_owned",
|
|
17
|
+
} as const;
|
|
18
|
+
/**
|
|
19
|
+
* plan_line if the plan version has a line with this priceKey. subscription_owned if it does not, so the interval belongs to this subscription only. After an add, check the kind. A mistyped priceKey creates a subscription_owned interval.
|
|
20
|
+
*/
|
|
21
|
+
export type SubscriptionIntervalKind = ClosedEnum<
|
|
22
|
+
typeof SubscriptionIntervalKind
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export type SubscriptionIntervalQuantityTransition = {
|
|
26
|
+
effectiveDate: Date;
|
|
27
|
+
quantity: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const SubscriptionIntervalBillingMode = {
|
|
31
|
+
Advance: "advance",
|
|
32
|
+
Arrears: "arrears",
|
|
33
|
+
} as const;
|
|
34
|
+
export type SubscriptionIntervalBillingMode = ClosedEnum<
|
|
35
|
+
typeof SubscriptionIntervalBillingMode
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A price interval of the subscription.
|
|
40
|
+
*/
|
|
41
|
+
export type SubscriptionInterval = {
|
|
42
|
+
id: string;
|
|
43
|
+
/**
|
|
44
|
+
* The catalog price this interval bills.
|
|
45
|
+
*/
|
|
46
|
+
priceId: string;
|
|
47
|
+
/**
|
|
48
|
+
* Identifies the price line. An override keeps the key of the plan price that it replaces.
|
|
49
|
+
*/
|
|
50
|
+
priceKey: string;
|
|
51
|
+
/**
|
|
52
|
+
* plan_line if the plan version has a line with this priceKey. subscription_owned if it does not, so the interval belongs to this subscription only. After an add, check the kind. A mistyped priceKey creates a subscription_owned interval.
|
|
53
|
+
*/
|
|
54
|
+
kind: SubscriptionIntervalKind;
|
|
55
|
+
/**
|
|
56
|
+
* The plan version of this interval.
|
|
57
|
+
*/
|
|
58
|
+
planVersionId: string;
|
|
59
|
+
/**
|
|
60
|
+
* Signed net unit price for each period, as a decimal string. Null means the interval bills the catalog price.
|
|
61
|
+
*/
|
|
62
|
+
unitPrice: string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Quantity at interval start, as a decimal string.
|
|
65
|
+
*/
|
|
66
|
+
baseQuantity: string;
|
|
67
|
+
quantityTransitions: Array<SubscriptionIntervalQuantityTransition>;
|
|
68
|
+
/**
|
|
69
|
+
* ISO-8601 duration or 'one_off'
|
|
70
|
+
*/
|
|
71
|
+
billingCadence: string;
|
|
72
|
+
billingMode: SubscriptionIntervalBillingMode;
|
|
73
|
+
/**
|
|
74
|
+
* The one-time date this interval bills on. Set iff billingCadence is 'one_off'; null for a recurring interval.
|
|
75
|
+
*/
|
|
76
|
+
billDate: Date | null;
|
|
77
|
+
startDate: Date;
|
|
78
|
+
/**
|
|
79
|
+
* Null for an open-ended interval.
|
|
80
|
+
*/
|
|
81
|
+
endDate: Date | null;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/** @internal */
|
|
85
|
+
export const SubscriptionIntervalKind$inboundSchema: z.ZodNativeEnum<
|
|
86
|
+
typeof SubscriptionIntervalKind
|
|
87
|
+
> = z.nativeEnum(SubscriptionIntervalKind);
|
|
88
|
+
|
|
89
|
+
/** @internal */
|
|
90
|
+
export const SubscriptionIntervalQuantityTransition$inboundSchema: z.ZodType<
|
|
91
|
+
SubscriptionIntervalQuantityTransition,
|
|
92
|
+
z.ZodTypeDef,
|
|
93
|
+
unknown
|
|
94
|
+
> = z.object({
|
|
95
|
+
effectiveDate: z.string().datetime({ offset: true }).transform(v =>
|
|
96
|
+
new Date(v)
|
|
97
|
+
),
|
|
98
|
+
quantity: z.string(),
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export function subscriptionIntervalQuantityTransitionFromJSON(
|
|
102
|
+
jsonString: string,
|
|
103
|
+
): SafeParseResult<SubscriptionIntervalQuantityTransition, SDKValidationError> {
|
|
104
|
+
return safeParse(
|
|
105
|
+
jsonString,
|
|
106
|
+
(x) =>
|
|
107
|
+
SubscriptionIntervalQuantityTransition$inboundSchema.parse(JSON.parse(x)),
|
|
108
|
+
`Failed to parse 'SubscriptionIntervalQuantityTransition' from JSON`,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** @internal */
|
|
113
|
+
export const SubscriptionIntervalBillingMode$inboundSchema: z.ZodNativeEnum<
|
|
114
|
+
typeof SubscriptionIntervalBillingMode
|
|
115
|
+
> = z.nativeEnum(SubscriptionIntervalBillingMode);
|
|
116
|
+
|
|
117
|
+
/** @internal */
|
|
118
|
+
export const SubscriptionInterval$inboundSchema: z.ZodType<
|
|
119
|
+
SubscriptionInterval,
|
|
120
|
+
z.ZodTypeDef,
|
|
121
|
+
unknown
|
|
122
|
+
> = z.object({
|
|
123
|
+
id: z.string(),
|
|
124
|
+
priceId: z.string(),
|
|
125
|
+
priceKey: z.string(),
|
|
126
|
+
kind: SubscriptionIntervalKind$inboundSchema,
|
|
127
|
+
planVersionId: z.string(),
|
|
128
|
+
unitPrice: z.nullable(z.string()),
|
|
129
|
+
baseQuantity: z.string(),
|
|
130
|
+
quantityTransitions: z.array(
|
|
131
|
+
z.lazy(() => SubscriptionIntervalQuantityTransition$inboundSchema),
|
|
132
|
+
),
|
|
133
|
+
billingCadence: z.string(),
|
|
134
|
+
billingMode: SubscriptionIntervalBillingMode$inboundSchema,
|
|
135
|
+
billDate: z.nullable(
|
|
136
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
137
|
+
),
|
|
138
|
+
startDate: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
139
|
+
endDate: z.nullable(
|
|
140
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
141
|
+
),
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export function subscriptionIntervalFromJSON(
|
|
145
|
+
jsonString: string,
|
|
146
|
+
): SafeParseResult<SubscriptionInterval, SDKValidationError> {
|
|
147
|
+
return safeParse(
|
|
148
|
+
jsonString,
|
|
149
|
+
(x) => SubscriptionInterval$inboundSchema.parse(JSON.parse(x)),
|
|
150
|
+
`Failed to parse 'SubscriptionInterval' from JSON`,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
7
|
+
|
|
8
|
+
export type SubscriptionIntervalAddOpQuantityTransition = {
|
|
9
|
+
effectiveDate: Date;
|
|
10
|
+
/**
|
|
11
|
+
* Non-negative decimal string.
|
|
12
|
+
*/
|
|
13
|
+
quantity: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const SubscriptionIntervalAddOpBillingMode = {
|
|
17
|
+
Advance: "advance",
|
|
18
|
+
Arrears: "arrears",
|
|
19
|
+
} as const;
|
|
20
|
+
export type SubscriptionIntervalAddOpBillingMode = ClosedEnum<
|
|
21
|
+
typeof SubscriptionIntervalAddOpBillingMode
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Adds an interval. If the plan version has a line with this priceKey, the interval overrides that line. If not, send priceId. The interval then belongs to this subscription only and keeps the rate that you write. A plan version change does not carry it forward, so it stops billing at the version boundary. If a later plan version adds the same priceKey, the change is refused until the plan drops the key or the interval ends on or before the boundary.
|
|
26
|
+
*/
|
|
27
|
+
export type SubscriptionIntervalAddOp = {
|
|
28
|
+
/**
|
|
29
|
+
* The price line that this interval bills. Use a priceKey from the plan version. A new key must start with a lowercase letter or a digit, use only lowercase letters, digits, hyphens, and underscores, and have 64 characters or fewer.
|
|
30
|
+
*/
|
|
31
|
+
priceKey: string;
|
|
32
|
+
/**
|
|
33
|
+
* The catalog price to bill. Required if priceKey is not on the plan version. If it is on the plan, omit this field or send the price of that line. The price must belong to your merchant account.
|
|
34
|
+
*/
|
|
35
|
+
priceId?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Optional. If the subscription is on a different plan version, the request fails with 409.
|
|
38
|
+
*/
|
|
39
|
+
planVersionId?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Signed net unit price for each period, as a decimal string. Null bills the catalog price. For a subscription-only interval, null saves the current catalog price.
|
|
42
|
+
*/
|
|
43
|
+
unitPrice: string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Quantity at interval start, as a non-negative decimal string.
|
|
46
|
+
*/
|
|
47
|
+
baseQuantity: string;
|
|
48
|
+
/**
|
|
49
|
+
* Step changes in quantity partway through the interval.
|
|
50
|
+
*/
|
|
51
|
+
quantityTransitions?:
|
|
52
|
+
| Array<SubscriptionIntervalAddOpQuantityTransition>
|
|
53
|
+
| undefined;
|
|
54
|
+
/**
|
|
55
|
+
* ISO-8601 duration or 'one_off'
|
|
56
|
+
*/
|
|
57
|
+
billingCadence: string;
|
|
58
|
+
billingMode: SubscriptionIntervalAddOpBillingMode;
|
|
59
|
+
/**
|
|
60
|
+
* Required when billingCadence is 'one_off'; must be absent otherwise.
|
|
61
|
+
*/
|
|
62
|
+
billDate?: Date | null | undefined;
|
|
63
|
+
startDate: Date;
|
|
64
|
+
/**
|
|
65
|
+
* Null for an open-ended interval; when set, must be strictly after startDate.
|
|
66
|
+
*/
|
|
67
|
+
endDate?: Date | null | undefined;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** @internal */
|
|
71
|
+
export type SubscriptionIntervalAddOpQuantityTransition$Outbound = {
|
|
72
|
+
effectiveDate: string;
|
|
73
|
+
quantity: string;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** @internal */
|
|
77
|
+
export const SubscriptionIntervalAddOpQuantityTransition$outboundSchema:
|
|
78
|
+
z.ZodType<
|
|
79
|
+
SubscriptionIntervalAddOpQuantityTransition$Outbound,
|
|
80
|
+
z.ZodTypeDef,
|
|
81
|
+
SubscriptionIntervalAddOpQuantityTransition
|
|
82
|
+
> = z.object({
|
|
83
|
+
effectiveDate: z.date().transform(v => v.toISOString()),
|
|
84
|
+
quantity: z.string(),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export function subscriptionIntervalAddOpQuantityTransitionToJSON(
|
|
88
|
+
subscriptionIntervalAddOpQuantityTransition:
|
|
89
|
+
SubscriptionIntervalAddOpQuantityTransition,
|
|
90
|
+
): string {
|
|
91
|
+
return JSON.stringify(
|
|
92
|
+
SubscriptionIntervalAddOpQuantityTransition$outboundSchema.parse(
|
|
93
|
+
subscriptionIntervalAddOpQuantityTransition,
|
|
94
|
+
),
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** @internal */
|
|
99
|
+
export const SubscriptionIntervalAddOpBillingMode$outboundSchema:
|
|
100
|
+
z.ZodNativeEnum<typeof SubscriptionIntervalAddOpBillingMode> = z.nativeEnum(
|
|
101
|
+
SubscriptionIntervalAddOpBillingMode,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
/** @internal */
|
|
105
|
+
export type SubscriptionIntervalAddOp$Outbound = {
|
|
106
|
+
priceKey: string;
|
|
107
|
+
priceId?: string | undefined;
|
|
108
|
+
planVersionId?: string | undefined;
|
|
109
|
+
unitPrice: string | null;
|
|
110
|
+
baseQuantity: string;
|
|
111
|
+
quantityTransitions?:
|
|
112
|
+
| Array<SubscriptionIntervalAddOpQuantityTransition$Outbound>
|
|
113
|
+
| undefined;
|
|
114
|
+
billingCadence: string;
|
|
115
|
+
billingMode: string;
|
|
116
|
+
billDate?: string | null | undefined;
|
|
117
|
+
startDate: string;
|
|
118
|
+
endDate?: string | null | undefined;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** @internal */
|
|
122
|
+
export const SubscriptionIntervalAddOp$outboundSchema: z.ZodType<
|
|
123
|
+
SubscriptionIntervalAddOp$Outbound,
|
|
124
|
+
z.ZodTypeDef,
|
|
125
|
+
SubscriptionIntervalAddOp
|
|
126
|
+
> = z.object({
|
|
127
|
+
priceKey: z.string(),
|
|
128
|
+
priceId: z.string().optional(),
|
|
129
|
+
planVersionId: z.string().optional(),
|
|
130
|
+
unitPrice: z.nullable(z.string()),
|
|
131
|
+
baseQuantity: z.string(),
|
|
132
|
+
quantityTransitions: z.array(
|
|
133
|
+
z.lazy(() => SubscriptionIntervalAddOpQuantityTransition$outboundSchema),
|
|
134
|
+
).optional(),
|
|
135
|
+
billingCadence: z.string(),
|
|
136
|
+
billingMode: SubscriptionIntervalAddOpBillingMode$outboundSchema,
|
|
137
|
+
billDate: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
138
|
+
startDate: z.date().transform(v => v.toISOString()),
|
|
139
|
+
endDate: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
export function subscriptionIntervalAddOpToJSON(
|
|
143
|
+
subscriptionIntervalAddOp: SubscriptionIntervalAddOp,
|
|
144
|
+
): string {
|
|
145
|
+
return JSON.stringify(
|
|
146
|
+
SubscriptionIntervalAddOp$outboundSchema.parse(subscriptionIntervalAddOp),
|
|
147
|
+
);
|
|
148
|
+
}
|