@paygentic/sdk 0.9.6 → 0.9.8
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/dist/commonjs/funcs/customersList.js +2 -2
- package/dist/commonjs/funcs/customersList.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +1 -1
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.js +1 -1
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js +2 -2
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/createpercentagediscountadjustment.d.ts +40 -0
- package/dist/commonjs/models/createpercentagediscountadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/createpercentagediscountadjustment.js +54 -0
- package/dist/commonjs/models/createpercentagediscountadjustment.js.map +1 -0
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts +5 -45
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts.map +1 -1
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.js +7 -18
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.js.map +1 -1
- package/dist/commonjs/models/createusagediscountadjustment.d.ts +45 -0
- package/dist/commonjs/models/createusagediscountadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/createusagediscountadjustment.js +55 -0
- package/dist/commonjs/models/createusagediscountadjustment.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +4 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +4 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/invoicelineitem.d.ts +25 -0
- package/dist/commonjs/models/invoicelineitem.d.ts.map +1 -1
- package/dist/commonjs/models/invoicelineitem.js +15 -1
- package/dist/commonjs/models/invoicelineitem.js.map +1 -1
- package/dist/commonjs/models/lineitem.d.ts +7 -3
- package/dist/commonjs/models/lineitem.d.ts.map +1 -1
- package/dist/commonjs/models/lineitem.js +2 -1
- package/dist/commonjs/models/lineitem.js.map +1 -1
- package/dist/commonjs/models/operations/createprice.d.ts +15 -0
- package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createprice.js +3 -0
- package/dist/commonjs/models/operations/createprice.js.map +1 -1
- package/dist/commonjs/models/operations/updateprice.d.ts +15 -0
- package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateprice.js +3 -0
- package/dist/commonjs/models/operations/updateprice.js.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.d.ts +22 -0
- package/dist/commonjs/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.js +13 -1
- package/dist/commonjs/models/planversionpriceslot.js.map +1 -1
- package/dist/commonjs/models/price.d.ts +22 -0
- package/dist/commonjs/models/price.d.ts.map +1 -1
- package/dist/commonjs/models/price.js +13 -1
- package/dist/commonjs/models/price.js.map +1 -1
- package/dist/commonjs/models/pricetax.d.ts +58 -0
- package/dist/commonjs/models/pricetax.d.ts.map +1 -0
- package/dist/commonjs/models/pricetax.js +82 -0
- package/dist/commonjs/models/pricetax.js.map +1 -0
- package/dist/commonjs/models/ratetype.d.ts +18 -0
- package/dist/commonjs/models/ratetype.d.ts.map +1 -0
- package/dist/commonjs/models/ratetype.js +53 -0
- package/dist/commonjs/models/ratetype.js.map +1 -0
- package/dist/commonjs/models/schemasprice.d.ts +14 -0
- package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
- package/dist/commonjs/models/schemasprice.js +5 -0
- package/dist/commonjs/models/schemasprice.js.map +1 -1
- package/dist/commonjs/models/subscriptionadjustment.d.ts +14 -5
- package/dist/commonjs/models/subscriptionadjustment.d.ts.map +1 -1
- package/dist/commonjs/models/subscriptionadjustment.js +4 -1
- package/dist/commonjs/models/subscriptionadjustment.js.map +1 -1
- package/dist/commonjs/sdk/subscriptions.d.ts +1 -1
- package/dist/commonjs/sdk/subscriptions.js +1 -1
- package/dist/esm/funcs/customersList.js +2 -2
- package/dist/esm/funcs/customersList.js.map +1 -1
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +1 -1
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.js +1 -1
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js +2 -2
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/createpercentagediscountadjustment.d.ts +40 -0
- package/dist/esm/models/createpercentagediscountadjustment.d.ts.map +1 -0
- package/dist/esm/models/createpercentagediscountadjustment.js +17 -0
- package/dist/esm/models/createpercentagediscountadjustment.js.map +1 -0
- package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts +5 -45
- package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts.map +1 -1
- package/dist/esm/models/createsubscriptionadjustmentrequest.js +6 -17
- package/dist/esm/models/createsubscriptionadjustmentrequest.js.map +1 -1
- package/dist/esm/models/createusagediscountadjustment.d.ts +45 -0
- package/dist/esm/models/createusagediscountadjustment.d.ts.map +1 -0
- package/dist/esm/models/createusagediscountadjustment.js +18 -0
- package/dist/esm/models/createusagediscountadjustment.js.map +1 -0
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/invoicelineitem.d.ts +25 -0
- package/dist/esm/models/invoicelineitem.d.ts.map +1 -1
- package/dist/esm/models/invoicelineitem.js +14 -0
- package/dist/esm/models/invoicelineitem.js.map +1 -1
- package/dist/esm/models/lineitem.d.ts +7 -3
- package/dist/esm/models/lineitem.d.ts.map +1 -1
- package/dist/esm/models/lineitem.js +2 -1
- package/dist/esm/models/lineitem.js.map +1 -1
- package/dist/esm/models/operations/createprice.d.ts +15 -0
- package/dist/esm/models/operations/createprice.d.ts.map +1 -1
- package/dist/esm/models/operations/createprice.js +3 -0
- package/dist/esm/models/operations/createprice.js.map +1 -1
- package/dist/esm/models/operations/updateprice.d.ts +15 -0
- package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
- package/dist/esm/models/operations/updateprice.js +3 -0
- package/dist/esm/models/operations/updateprice.js.map +1 -1
- package/dist/esm/models/planversionpriceslot.d.ts +22 -0
- package/dist/esm/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/esm/models/planversionpriceslot.js +12 -0
- package/dist/esm/models/planversionpriceslot.js.map +1 -1
- package/dist/esm/models/price.d.ts +22 -0
- package/dist/esm/models/price.d.ts.map +1 -1
- package/dist/esm/models/price.js +12 -0
- package/dist/esm/models/price.js.map +1 -1
- package/dist/esm/models/pricetax.d.ts +58 -0
- package/dist/esm/models/pricetax.d.ts.map +1 -0
- package/dist/esm/models/pricetax.js +44 -0
- package/dist/esm/models/pricetax.js.map +1 -0
- package/dist/esm/models/ratetype.d.ts +18 -0
- package/dist/esm/models/ratetype.d.ts.map +1 -0
- package/dist/esm/models/ratetype.js +17 -0
- package/dist/esm/models/ratetype.js.map +1 -0
- package/dist/esm/models/schemasprice.d.ts +14 -0
- package/dist/esm/models/schemasprice.d.ts.map +1 -1
- package/dist/esm/models/schemasprice.js +5 -0
- package/dist/esm/models/schemasprice.js.map +1 -1
- package/dist/esm/models/subscriptionadjustment.d.ts +14 -5
- package/dist/esm/models/subscriptionadjustment.d.ts.map +1 -1
- package/dist/esm/models/subscriptionadjustment.js +4 -1
- package/dist/esm/models/subscriptionadjustment.js.map +1 -1
- package/dist/esm/sdk/subscriptions.d.ts +1 -1
- package/dist/esm/sdk/subscriptions.js +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/customersList.ts +2 -2
- package/src/funcs/subscriptionsCreateSubscriptionAdjustment.ts +1 -1
- package/src/funcs/subscriptionsReconcileSubscriptionFeatures.ts +2 -2
- package/src/lib/config.ts +2 -2
- package/src/models/createpercentagediscountadjustment.ts +66 -0
- package/src/models/createsubscriptionadjustmentrequest.ts +21 -59
- package/src/models/createusagediscountadjustment.ts +72 -0
- package/src/models/index.ts +4 -0
- package/src/models/invoicelineitem.ts +36 -0
- package/src/models/lineitem.ts +8 -3
- package/src/models/operations/createprice.ts +18 -0
- package/src/models/operations/updateprice.ts +18 -0
- package/src/models/planversionpriceslot.ts +30 -0
- package/src/models/price.ts +28 -0
- package/src/models/pricetax.ts +100 -0
- package/src/models/ratetype.ts +25 -0
- package/src/models/schemasprice.ts +17 -0
- package/src/models/subscriptionadjustment.ts +17 -6
- package/src/sdk/subscriptions.ts +1 -1
|
@@ -8,6 +8,7 @@ export declare const SubscriptionAdjustmentObject: {
|
|
|
8
8
|
export type SubscriptionAdjustmentObject = ClosedEnum<typeof SubscriptionAdjustmentObject>;
|
|
9
9
|
export declare const SubscriptionAdjustmentType: {
|
|
10
10
|
readonly PercentageDiscount: "percentageDiscount";
|
|
11
|
+
readonly UsageDiscount: "usageDiscount";
|
|
11
12
|
};
|
|
12
13
|
export type SubscriptionAdjustmentType = ClosedEnum<typeof SubscriptionAdjustmentType>;
|
|
13
14
|
export type SubscriptionAdjustment = {
|
|
@@ -22,19 +23,27 @@ export type SubscriptionAdjustment = {
|
|
|
22
23
|
subscriptionId: string;
|
|
23
24
|
type: SubscriptionAdjustmentType;
|
|
24
25
|
/**
|
|
25
|
-
* The discount rate as a decimal fraction between 0 and 1. "0.35" means 35 percent.
|
|
26
|
+
* The discount rate as a decimal fraction between 0 and 1. "0.35" means 35 percent. Null on a usageDiscount, which carries a unit count instead.
|
|
26
27
|
*/
|
|
27
|
-
percentageDiscount: string;
|
|
28
|
+
percentageDiscount: string | null;
|
|
28
29
|
/**
|
|
29
|
-
* The
|
|
30
|
+
* The number of usage units taken off the targeted line's billable quantity. Null on a percentageDiscount, which carries a rate instead.
|
|
31
|
+
*/
|
|
32
|
+
usageDiscount: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* The prices this adjustment reduces. Exactly one metered price on a usageDiscount; empty on a percentageDiscount, which reduces every discountable charge.
|
|
35
|
+
*/
|
|
36
|
+
targetPriceIds: Array<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Opens the window. Read per type: INCLUSIVE on a percentageDiscount, whose window is prorated by day overlap; EXCLUSIVE on a usageDiscount, which corrects a line whose period END falls strictly after this instant.
|
|
30
39
|
*/
|
|
31
40
|
effectiveFrom: Date;
|
|
32
41
|
/**
|
|
33
|
-
*
|
|
42
|
+
* Closes the window, or null for never. Read per type: EXCLUSIVE on a percentageDiscount; INCLUSIVE on a usageDiscount, which corrects a line whose period END falls on or before this instant.
|
|
34
43
|
*/
|
|
35
44
|
effectiveTo: Date | null;
|
|
36
45
|
/**
|
|
37
|
-
* The deal's own name
|
|
46
|
+
* The deal's own name. Shown on each discount line a percentageDiscount emits; a usageDiscount emits no line, so its description is carried here only.
|
|
38
47
|
*/
|
|
39
48
|
description: string | null;
|
|
40
49
|
createdAt: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptionadjustment.d.ts","sourceRoot":"","sources":["../../../src/models/subscriptionadjustment.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,eAAO,MAAM,4BAA4B;;CAE/B,CAAC;AACX,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,4BAA4B,CACpC,CAAC;AAEF,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"subscriptionadjustment.d.ts","sourceRoot":"","sources":["../../../src/models/subscriptionadjustment.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,eAAO,MAAM,4BAA4B;;CAE/B,CAAC;AACX,MAAM,MAAM,4BAA4B,GAAG,UAAU,CACnD,OAAO,4BAA4B,CACpC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;CAG7B,CAAC;AACX,MAAM,MAAM,0BAA0B,GAAG,UAAU,CACjD,OAAO,0BAA0B,CAClC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,4BAA4B,CAAC;IACrC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,0BAA0B,CAAC;IACjC;;OAEG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;OAEG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B;;OAEG;IACH,aAAa,EAAE,IAAI,CAAC;IACpB;;OAEG;IACH,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,0CAA0C,EAAE,CAAC,CAAC,aAAa,CACtE,OAAO,4BAA4B,CACS,CAAC;AAE/C,gBAAgB;AAChB,eAAO,MAAM,wCAAwC,EAAE,CAAC,CAAC,aAAa,CACpE,OAAO,0BAA0B,CACS,CAAC;AAE7C,gBAAgB;AAChB,eAAO,MAAM,oCAAoC,EAAE,CAAC,CAAC,OAAO,CAC1D,sBAAsB,EACtB,CAAC,CAAC,UAAU,EACZ,OAAO,CAiBP,CAAC;AAEH,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,sBAAsB,EAAE,kBAAkB,CAAC,CAM7D"}
|
|
@@ -8,6 +8,7 @@ export const SubscriptionAdjustmentObject = {
|
|
|
8
8
|
};
|
|
9
9
|
export const SubscriptionAdjustmentType = {
|
|
10
10
|
PercentageDiscount: "percentageDiscount",
|
|
11
|
+
UsageDiscount: "usageDiscount",
|
|
11
12
|
};
|
|
12
13
|
/** @internal */
|
|
13
14
|
export const SubscriptionAdjustmentObject$inboundSchema = z.nativeEnum(SubscriptionAdjustmentObject);
|
|
@@ -19,7 +20,9 @@ export const SubscriptionAdjustment$inboundSchema = z.object({
|
|
|
19
20
|
id: z.string(),
|
|
20
21
|
subscriptionId: z.string(),
|
|
21
22
|
type: SubscriptionAdjustmentType$inboundSchema,
|
|
22
|
-
percentageDiscount: z.string(),
|
|
23
|
+
percentageDiscount: z.nullable(z.string()),
|
|
24
|
+
usageDiscount: z.nullable(z.string()),
|
|
25
|
+
targetPriceIds: z.array(z.string()),
|
|
23
26
|
effectiveFrom: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
24
27
|
effectiveTo: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))),
|
|
25
28
|
description: z.nullable(z.string()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptionadjustment.js","sourceRoot":"","sources":["../../../src/models/subscriptionadjustment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,sBAAsB,EAAE,wBAAwB;CACxC,CAAC;AAKX,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,kBAAkB,EAAE,oBAAoB;
|
|
1
|
+
{"version":3,"file":"subscriptionadjustment.js","sourceRoot":"","sources":["../../../src/models/subscriptionadjustment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,sBAAsB,EAAE,wBAAwB;CACxC,CAAC;AAKX,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,kBAAkB,EAAE,oBAAoB;IACxC,aAAa,EAAE,eAAe;CACtB,CAAC;AA2CX,gBAAgB;AAChB,MAAM,CAAC,MAAM,0CAA0C,GAEnD,CAAC,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC;AAE/C,gBAAgB;AAChB,MAAM,CAAC,MAAM,wCAAwC,GAEjD,CAAC,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;AAE7C,gBAAgB;AAChB,MAAM,CAAC,MAAM,oCAAoC,GAI7C,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,EAAE,0CAA0C;IAClD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,IAAI,EAAE,wCAAwC;IAC9C,kBAAkB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1C,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACrC,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CACjE,IAAI,IAAI,CAAC,CAAC,CAAC,CACZ;IACD,WAAW,EAAE,CAAC,CAAC,QAAQ,CACrB,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAClE;IACD,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACnC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;CAC7E,CAAC,CAAC;AAEH,MAAM,UAAU,8BAA8B,CAC5C,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,oCAAoC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAChE,oDAAoD,CACrD,CAAC;AACJ,CAAC"}
|
|
@@ -53,7 +53,7 @@ export declare class Subscriptions extends ClientSDK {
|
|
|
53
53
|
* Create Adjustment
|
|
54
54
|
*
|
|
55
55
|
* @remarks
|
|
56
|
-
* Attaches
|
|
56
|
+
* Attaches an adjustment to the subscription for a dated window. A percentageDiscount reduces every discountable charge by a rate and carries one discount line per charge on the invoice. A usageDiscount takes a number of usage units off one metered price's billable quantity before that line is priced, so the line re-slots on a volume ladder and shows the corrected quantity; it emits no line of its own. Tax is assessed on the reduced amount either way. An invoice that already exists is not changed, including one still in draft — the adjustment reaches the periods that close after it is created. There is no update operation, and a window cannot be changed after it is created. To change an adjustment before any invoice has issued under it, delete it and create a replacement. Once an invoice has issued the adjustment is permanent, so set effectiveTo at creation time whenever the deal has a known end date.
|
|
57
57
|
*/
|
|
58
58
|
createSubscriptionAdjustment(request: operations.CreateSubscriptionAdjustmentRequest, options?: RequestOptions): Promise<models.SubscriptionAdjustment>;
|
|
59
59
|
/**
|
|
@@ -81,7 +81,7 @@ export class Subscriptions extends ClientSDK {
|
|
|
81
81
|
* Create Adjustment
|
|
82
82
|
*
|
|
83
83
|
* @remarks
|
|
84
|
-
* Attaches
|
|
84
|
+
* Attaches an adjustment to the subscription for a dated window. A percentageDiscount reduces every discountable charge by a rate and carries one discount line per charge on the invoice. A usageDiscount takes a number of usage units off one metered price's billable quantity before that line is priced, so the line re-slots on a volume ladder and shows the corrected quantity; it emits no line of its own. Tax is assessed on the reduced amount either way. An invoice that already exists is not changed, including one still in draft — the adjustment reaches the periods that close after it is created. There is no update operation, and a window cannot be changed after it is created. To change an adjustment before any invoice has issued under it, delete it and create a replacement. Once an invoice has issued the adjustment is permanent, so set effectiveTo at creation time whenever the deal has a known end date.
|
|
85
85
|
*/
|
|
86
86
|
async createSubscriptionAdjustment(request, options) {
|
|
87
87
|
return unwrapAsync(subscriptionsCreateSubscriptionAdjustment(this, request, options));
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -139,7 +139,7 @@ async function $do(
|
|
|
139
139
|
|
|
140
140
|
const doResult = await client._do(req, {
|
|
141
141
|
context,
|
|
142
|
-
errorCodes: ["400", "403", "4XX", "500", "5XX"],
|
|
142
|
+
errorCodes: ["400", "403", "429", "4XX", "500", "5XX"],
|
|
143
143
|
retryConfig: context.retryConfig,
|
|
144
144
|
retryCodes: context.retryCodes,
|
|
145
145
|
});
|
|
@@ -167,7 +167,7 @@ async function $do(
|
|
|
167
167
|
>(
|
|
168
168
|
M.json(200, operations.ListCustomersResponse$inboundSchema),
|
|
169
169
|
M.jsonErr(400, errors.BadRequest$inboundSchema),
|
|
170
|
-
M.jsonErr(403, errors.ErrorT$inboundSchema),
|
|
170
|
+
M.jsonErr([403, 429], errors.ErrorT$inboundSchema),
|
|
171
171
|
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
172
172
|
M.fail("4XX"),
|
|
173
173
|
M.fail("5XX"),
|
|
@@ -30,7 +30,7 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* Create Adjustment
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
* Attaches
|
|
33
|
+
* Attaches an adjustment to the subscription for a dated window. A percentageDiscount reduces every discountable charge by a rate and carries one discount line per charge on the invoice. A usageDiscount takes a number of usage units off one metered price's billable quantity before that line is priced, so the line re-slots on a volume ladder and shows the corrected quantity; it emits no line of its own. Tax is assessed on the reduced amount either way. An invoice that already exists is not changed, including one still in draft — the adjustment reaches the periods that close after it is created. There is no update operation, and a window cannot be changed after it is created. To change an adjustment before any invoice has issued under it, delete it and create a replacement. Once an invoice has issued the adjustment is permanent, so set effectiveTo at creation time whenever the deal has a known end date.
|
|
34
34
|
*/
|
|
35
35
|
export function subscriptionsCreateSubscriptionAdjustment(
|
|
36
36
|
client: PaygenticCore,
|
|
@@ -143,7 +143,7 @@ async function $do(
|
|
|
143
143
|
|
|
144
144
|
const doResult = await client._do(req, {
|
|
145
145
|
context,
|
|
146
|
-
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
146
|
+
errorCodes: ["400", "401", "403", "404", "429", "4XX", "500", "5XX"],
|
|
147
147
|
retryConfig: context.retryConfig,
|
|
148
148
|
retryCodes: context.retryCodes,
|
|
149
149
|
});
|
|
@@ -171,7 +171,7 @@ async function $do(
|
|
|
171
171
|
>(
|
|
172
172
|
M.json([200, 201], models.SubscriptionReconciliation$inboundSchema),
|
|
173
173
|
M.jsonErr(400, errors.BadRequest$inboundSchema),
|
|
174
|
-
M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
|
|
174
|
+
M.jsonErr([401, 403, 404, 429], errors.ErrorT$inboundSchema),
|
|
175
175
|
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
176
176
|
M.fail("4XX"),
|
|
177
177
|
M.fail("5XX"),
|
package/src/lib/config.ts
CHANGED
|
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
export const SDK_METADATA = {
|
|
66
66
|
language: "typescript",
|
|
67
67
|
openapiDocVersion: "0.1.0",
|
|
68
|
-
sdkVersion: "0.9.
|
|
68
|
+
sdkVersion: "0.9.8",
|
|
69
69
|
genVersion: "2.879.13",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.9.
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 0.9.8 2.879.13 0.1.0 @paygentic/sdk",
|
|
71
71
|
} as const;
|
|
@@ -0,0 +1,66 @@
|
|
|
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 CreatePercentageDiscountAdjustment = {
|
|
8
|
+
/**
|
|
9
|
+
* Reduces every discountable charge on the invoice by a rate.
|
|
10
|
+
*/
|
|
11
|
+
type: "percentageDiscount";
|
|
12
|
+
/**
|
|
13
|
+
* The discount rate as a decimal fraction between 0 and 1, sent as a string. "0.35" means 35 percent. "1" means 100 percent, not 1 percent. At most 6 decimal places. A value of 0 or above 1 is rejected.
|
|
14
|
+
*/
|
|
15
|
+
percentageDiscount: string;
|
|
16
|
+
/**
|
|
17
|
+
* The first instant the discount applies. Inclusive.
|
|
18
|
+
*/
|
|
19
|
+
effectiveFrom: Date;
|
|
20
|
+
/**
|
|
21
|
+
* The instant the discount stops applying. Exclusive, so a window ending on the same date another begins neither overlaps nor leaves a gap. Null means the discount never stops, and it cannot be ended later — set an instant whenever the deal has a known end date. Must be after effectiveFrom.
|
|
22
|
+
*/
|
|
23
|
+
effectiveTo?: Date | null | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The deal's own name, shown on each discount line of the invoice.
|
|
26
|
+
*/
|
|
27
|
+
description?: string | null | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* A key of your choosing that makes a retry safe. Sending the same key against the same subscription returns the adjustment already created and creates no second one. Without a key a retried request creates a second adjustment, and two percentage discounts compound — two of 0.35 bill 57.75 percent off, not 35 percent.
|
|
30
|
+
*/
|
|
31
|
+
idempotencyKey?: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export type CreatePercentageDiscountAdjustment$Outbound = {
|
|
36
|
+
type: "percentageDiscount";
|
|
37
|
+
percentageDiscount: string;
|
|
38
|
+
effectiveFrom: string;
|
|
39
|
+
effectiveTo?: string | null | undefined;
|
|
40
|
+
description?: string | null | undefined;
|
|
41
|
+
idempotencyKey?: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const CreatePercentageDiscountAdjustment$outboundSchema: z.ZodType<
|
|
46
|
+
CreatePercentageDiscountAdjustment$Outbound,
|
|
47
|
+
z.ZodTypeDef,
|
|
48
|
+
CreatePercentageDiscountAdjustment
|
|
49
|
+
> = z.object({
|
|
50
|
+
type: z.literal("percentageDiscount"),
|
|
51
|
+
percentageDiscount: z.string(),
|
|
52
|
+
effectiveFrom: z.date().transform(v => v.toISOString()),
|
|
53
|
+
effectiveTo: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
54
|
+
description: z.nullable(z.string()).optional(),
|
|
55
|
+
idempotencyKey: z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export function createPercentageDiscountAdjustmentToJSON(
|
|
59
|
+
createPercentageDiscountAdjustment: CreatePercentageDiscountAdjustment,
|
|
60
|
+
): string {
|
|
61
|
+
return JSON.stringify(
|
|
62
|
+
CreatePercentageDiscountAdjustment$outboundSchema.parse(
|
|
63
|
+
createPercentageDiscountAdjustment,
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -3,76 +3,38 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
CreatePercentageDiscountAdjustment,
|
|
8
|
+
CreatePercentageDiscountAdjustment$Outbound,
|
|
9
|
+
CreatePercentageDiscountAdjustment$outboundSchema,
|
|
10
|
+
} from "./createpercentagediscountadjustment.js";
|
|
11
|
+
import {
|
|
12
|
+
CreateUsageDiscountAdjustment,
|
|
13
|
+
CreateUsageDiscountAdjustment$Outbound,
|
|
14
|
+
CreateUsageDiscountAdjustment$outboundSchema,
|
|
15
|
+
} from "./createusagediscountadjustment.js";
|
|
7
16
|
|
|
8
17
|
/**
|
|
9
|
-
*
|
|
18
|
+
* One adjustment to attach to the subscription. The type decides which number the body carries: a rate for percentageDiscount, a unit count and one target price for usageDiscount.
|
|
10
19
|
*/
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The kind of adjustment. `percentageDiscount` reduces every discountable charge by a rate.
|
|
16
|
-
*/
|
|
17
|
-
export type CreateSubscriptionAdjustmentRequestType = ClosedEnum<
|
|
18
|
-
typeof CreateSubscriptionAdjustmentRequestType
|
|
19
|
-
>;
|
|
20
|
-
|
|
21
|
-
export type CreateSubscriptionAdjustmentRequest = {
|
|
22
|
-
/**
|
|
23
|
-
* The kind of adjustment. `percentageDiscount` reduces every discountable charge by a rate.
|
|
24
|
-
*/
|
|
25
|
-
type: CreateSubscriptionAdjustmentRequestType;
|
|
26
|
-
/**
|
|
27
|
-
* The discount rate as a decimal fraction between 0 and 1, sent as a string. "0.35" means 35 percent. "1" means 100 percent, not 1 percent. At most 6 decimal places. A value of 0 or above 1 is rejected.
|
|
28
|
-
*/
|
|
29
|
-
percentageDiscount: string;
|
|
30
|
-
/**
|
|
31
|
-
* The first instant the discount applies. Inclusive.
|
|
32
|
-
*/
|
|
33
|
-
effectiveFrom: Date;
|
|
34
|
-
/**
|
|
35
|
-
* The instant the discount stops applying. Exclusive, so a window ending on the same date another begins neither overlaps nor leaves a gap. Null means the discount never stops, and it cannot be ended later — set an instant whenever the deal has a known end date. Must be after effectiveFrom.
|
|
36
|
-
*/
|
|
37
|
-
effectiveTo?: Date | null | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* The deal's own name, shown on each discount line of the invoice.
|
|
40
|
-
*/
|
|
41
|
-
description?: string | null | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* A key of your choosing that makes a retry safe. Sending the same key against the same subscription returns the adjustment already created and creates no second one. Without a key a retried request creates a second adjustment, and two percentage discounts compound — two of 0.35 bill 57.75 percent off, not 35 percent.
|
|
44
|
-
*/
|
|
45
|
-
idempotencyKey?: string | undefined;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/** @internal */
|
|
49
|
-
export const CreateSubscriptionAdjustmentRequestType$outboundSchema:
|
|
50
|
-
z.ZodNativeEnum<typeof CreateSubscriptionAdjustmentRequestType> = z
|
|
51
|
-
.nativeEnum(CreateSubscriptionAdjustmentRequestType);
|
|
20
|
+
export type CreateSubscriptionAdjustmentRequest =
|
|
21
|
+
| CreatePercentageDiscountAdjustment
|
|
22
|
+
| CreateUsageDiscountAdjustment;
|
|
52
23
|
|
|
53
24
|
/** @internal */
|
|
54
|
-
export type CreateSubscriptionAdjustmentRequest$Outbound =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
effectiveFrom: string;
|
|
58
|
-
effectiveTo?: string | null | undefined;
|
|
59
|
-
description?: string | null | undefined;
|
|
60
|
-
idempotencyKey?: string | undefined;
|
|
61
|
-
};
|
|
25
|
+
export type CreateSubscriptionAdjustmentRequest$Outbound =
|
|
26
|
+
| CreatePercentageDiscountAdjustment$Outbound
|
|
27
|
+
| CreateUsageDiscountAdjustment$Outbound;
|
|
62
28
|
|
|
63
29
|
/** @internal */
|
|
64
30
|
export const CreateSubscriptionAdjustmentRequest$outboundSchema: z.ZodType<
|
|
65
31
|
CreateSubscriptionAdjustmentRequest$Outbound,
|
|
66
32
|
z.ZodTypeDef,
|
|
67
33
|
CreateSubscriptionAdjustmentRequest
|
|
68
|
-
> = z.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
effectiveTo: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
73
|
-
description: z.nullable(z.string()).optional(),
|
|
74
|
-
idempotencyKey: z.string().optional(),
|
|
75
|
-
});
|
|
34
|
+
> = z.union([
|
|
35
|
+
CreatePercentageDiscountAdjustment$outboundSchema,
|
|
36
|
+
CreateUsageDiscountAdjustment$outboundSchema,
|
|
37
|
+
]);
|
|
76
38
|
|
|
77
39
|
export function createSubscriptionAdjustmentRequestToJSON(
|
|
78
40
|
createSubscriptionAdjustmentRequest: CreateSubscriptionAdjustmentRequest,
|
|
@@ -0,0 +1,72 @@
|
|
|
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 CreateUsageDiscountAdjustment = {
|
|
8
|
+
/**
|
|
9
|
+
* Reduces one metered price's billable quantity by a number of usage units, before the line is priced.
|
|
10
|
+
*/
|
|
11
|
+
type: "usageDiscount";
|
|
12
|
+
/**
|
|
13
|
+
* The number of usage units to take off the billable quantity, sent as a plain decimal string. "300" waives 300 units. Greater than 0, at most 6 decimal places, fewer than 35 digits before the point. Plain notation only — no sign, exponent, hex or digit separators, so "1_000" and "1e3" are rejected rather than read as 1000. Applied in full or not at all — a unit count is never prorated across a partial window — and once per matching line, so an invoice bundling several periods is corrected on each of them. The line is floored at 0, so a discount larger than the billable quantity zeroes it rather than crediting.
|
|
14
|
+
*/
|
|
15
|
+
usageDiscount: string;
|
|
16
|
+
/**
|
|
17
|
+
* Exactly one metered price of this subscription, priced as standard or volume. Usage units are not comparable across metrics, so a usage discount names the one price it reduces. A dynamic or percentage price is refused: its quantity is a monetary amount rather than a unit count. A price billing at a negative rate (a usage-scaled rebate) is refused too, because removing its units would raise the invoice.
|
|
18
|
+
*/
|
|
19
|
+
targetPriceIds: Array<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Opens the window. Exclusive for this type: a metered line is corrected when its period END falls after this instant, so a window opening exactly when a period ends belongs to the next period, not that one. Set it to the start of the period you are correcting.
|
|
22
|
+
*/
|
|
23
|
+
effectiveFrom: Date;
|
|
24
|
+
/**
|
|
25
|
+
* Closes the window. INCLUSIVE for this type, unlike percentageDiscount: a metered line bills in arrears, so set this to the exact period end you are correcting and that period is covered. Null means the discount never stops — it then takes its full unit count off this price on EVERY later invoice, so set both bounds whenever you are correcting one period. Must be after effectiveFrom.
|
|
26
|
+
*/
|
|
27
|
+
effectiveTo?: Date | null | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Your own name for this correction. A usageDiscount emits no invoice line, so this is printed nowhere on the invoice — it is returned on the adjustment for your own records.
|
|
30
|
+
*/
|
|
31
|
+
description?: string | null | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* A key of your choosing that makes a retry safe. Sending the same key against the same subscription returns the adjustment already created and creates no second one. Without a key a retried request creates a second adjustment, and usage discounts against one price SUM — two of "300" waive 600 units, not 300. Nothing else detects a duplicate.
|
|
34
|
+
*/
|
|
35
|
+
idempotencyKey?: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export type CreateUsageDiscountAdjustment$Outbound = {
|
|
40
|
+
type: "usageDiscount";
|
|
41
|
+
usageDiscount: string;
|
|
42
|
+
targetPriceIds: Array<string>;
|
|
43
|
+
effectiveFrom: string;
|
|
44
|
+
effectiveTo?: string | null | undefined;
|
|
45
|
+
description?: string | null | undefined;
|
|
46
|
+
idempotencyKey?: string | undefined;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** @internal */
|
|
50
|
+
export const CreateUsageDiscountAdjustment$outboundSchema: z.ZodType<
|
|
51
|
+
CreateUsageDiscountAdjustment$Outbound,
|
|
52
|
+
z.ZodTypeDef,
|
|
53
|
+
CreateUsageDiscountAdjustment
|
|
54
|
+
> = z.object({
|
|
55
|
+
type: z.literal("usageDiscount"),
|
|
56
|
+
usageDiscount: z.string(),
|
|
57
|
+
targetPriceIds: z.array(z.string()),
|
|
58
|
+
effectiveFrom: z.date().transform(v => v.toISOString()),
|
|
59
|
+
effectiveTo: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
60
|
+
description: z.nullable(z.string()).optional(),
|
|
61
|
+
idempotencyKey: z.string().optional(),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export function createUsageDiscountAdjustmentToJSON(
|
|
65
|
+
createUsageDiscountAdjustment: CreateUsageDiscountAdjustment,
|
|
66
|
+
): string {
|
|
67
|
+
return JSON.stringify(
|
|
68
|
+
CreateUsageDiscountAdjustment$outboundSchema.parse(
|
|
69
|
+
createUsageDiscountAdjustment,
|
|
70
|
+
),
|
|
71
|
+
);
|
|
72
|
+
}
|
package/src/models/index.ts
CHANGED
|
@@ -21,8 +21,10 @@ export * from "./createmanuallineitemrequest.js";
|
|
|
21
21
|
export * from "./createorderapprovalrequest.js";
|
|
22
22
|
export * from "./createorderlineitemrequest.js";
|
|
23
23
|
export * from "./createorderrequest.js";
|
|
24
|
+
export * from "./createpercentagediscountadjustment.js";
|
|
24
25
|
export * from "./createrulerequest.js";
|
|
25
26
|
export * from "./createsubscriptionadjustmentrequest.js";
|
|
27
|
+
export * from "./createusagediscountadjustment.js";
|
|
26
28
|
export * from "./currencybreakdownentry.js";
|
|
27
29
|
export * from "./customer.js";
|
|
28
30
|
export * from "./entitlementdetail.js";
|
|
@@ -77,12 +79,14 @@ export * from "./pricefeatureinput.js";
|
|
|
77
79
|
export * from "./pricemodel.js";
|
|
78
80
|
export * from "./pricemodelinput.js";
|
|
79
81
|
export * from "./priceproperties.js";
|
|
82
|
+
export * from "./pricetax.js";
|
|
80
83
|
export * from "./product.js";
|
|
81
84
|
export * from "./profitabilityrow.js";
|
|
82
85
|
export * from "./profitabilitysummaryresponse.js";
|
|
83
86
|
export * from "./profitabilitytrend.js";
|
|
84
87
|
export * from "./purchasegrantrequest.js";
|
|
85
88
|
export * from "./purchasegrantresponse.js";
|
|
89
|
+
export * from "./ratetype.js";
|
|
86
90
|
export * from "./reconciledfeatureadded.js";
|
|
87
91
|
export * from "./reconciledfeaturefailed.js";
|
|
88
92
|
export * from "./reconciledfeatureremoved.js";
|
|
@@ -21,6 +21,20 @@ export const EventType = {
|
|
|
21
21
|
*/
|
|
22
22
|
export type EventType = ClosedEnum<typeof EventType>;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* When this line falls due relative to the window it covers: `in_advance` at the window's start, `in_arrears` at its end. A metered line is stamped `in_arrears`, because usage is only known once the window closes — but metered rows written before that rule carry `null` and were never backfilled, so do not read a metered line's term as guaranteed. `null` also means the line is not billed on a term of its own: manual, grant-discount and adjustment lines carry no term, and an adjustment instead falls due with the charge it reduces. Treat `null` as an expected value on any line type, not an error.
|
|
26
|
+
*/
|
|
27
|
+
export const InvoiceLineItemPaymentTerm = {
|
|
28
|
+
InAdvance: "in_advance",
|
|
29
|
+
InArrears: "in_arrears",
|
|
30
|
+
} as const;
|
|
31
|
+
/**
|
|
32
|
+
* When this line falls due relative to the window it covers: `in_advance` at the window's start, `in_arrears` at its end. A metered line is stamped `in_arrears`, because usage is only known once the window closes — but metered rows written before that rule carry `null` and were never backfilled, so do not read a metered line's term as guaranteed. `null` also means the line is not billed on a term of its own: manual, grant-discount and adjustment lines carry no term, and an adjustment instead falls due with the charge it reduces. Treat `null` as an expected value on any line type, not an error.
|
|
33
|
+
*/
|
|
34
|
+
export type InvoiceLineItemPaymentTerm = ClosedEnum<
|
|
35
|
+
typeof InvoiceLineItemPaymentTerm
|
|
36
|
+
>;
|
|
37
|
+
|
|
24
38
|
/**
|
|
25
39
|
* Type of line item: 'charge' for regular billing, 'refund' for refunded items (amounts are negated)
|
|
26
40
|
*/
|
|
@@ -60,6 +74,18 @@ export type InvoiceLineItem = {
|
|
|
60
74
|
* The price this line was generated from, or `null` when the line has no originating charge. With `itemId` it says whether a missing tag is fixable: `priceId` set and `itemId` null means the charge was simply untagged, which tagging it and restamping resolves; both null means the line records a grant-credit purchase, which is deferred revenue and is never tagged. Any measure of outstanding mapping work must exclude the latter or it can never reach zero.
|
|
61
75
|
*/
|
|
62
76
|
priceId?: string | null | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Start of the billed window this line covers, inclusive. Distinct from the invoice's own period, which is the union of its lines' windows (earliest start to latest end) and so covers time no single line bills on a mixed-timing invoice.
|
|
79
|
+
*/
|
|
80
|
+
periodStart?: Date | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* End of the billed window this line covers, exclusive — the instant at `periodEnd` belongs to the next window. Equal to `periodStart` on a one-off charge, which bills at an instant and has no period grid.
|
|
83
|
+
*/
|
|
84
|
+
periodEnd?: Date | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* When this line falls due relative to the window it covers: `in_advance` at the window's start, `in_arrears` at its end. A metered line is stamped `in_arrears`, because usage is only known once the window closes — but metered rows written before that rule carry `null` and were never backfilled, so do not read a metered line's term as guaranteed. `null` also means the line is not billed on a term of its own: manual, grant-discount and adjustment lines carry no term, and an adjustment instead falls due with the charge it reduces. Treat `null` as an expected value on any line type, not an error.
|
|
87
|
+
*/
|
|
88
|
+
paymentTerm?: InvoiceLineItemPaymentTerm | null | undefined;
|
|
63
89
|
/**
|
|
64
90
|
* Display name for this line item on invoices
|
|
65
91
|
*/
|
|
@@ -114,6 +140,11 @@ export type InvoiceLineItem = {
|
|
|
114
140
|
export const EventType$inboundSchema: z.ZodNativeEnum<typeof EventType> = z
|
|
115
141
|
.nativeEnum(EventType);
|
|
116
142
|
|
|
143
|
+
/** @internal */
|
|
144
|
+
export const InvoiceLineItemPaymentTerm$inboundSchema: z.ZodNativeEnum<
|
|
145
|
+
typeof InvoiceLineItemPaymentTerm
|
|
146
|
+
> = z.nativeEnum(InvoiceLineItemPaymentTerm);
|
|
147
|
+
|
|
117
148
|
/** @internal */
|
|
118
149
|
export const InvoiceLineItemLineItemType$inboundSchema: z.ZodNativeEnum<
|
|
119
150
|
typeof InvoiceLineItemLineItemType
|
|
@@ -131,6 +162,11 @@ export const InvoiceLineItem$inboundSchema: z.ZodType<
|
|
|
131
162
|
billableMetricId: z.string(),
|
|
132
163
|
itemId: z.nullable(z.string()).optional(),
|
|
133
164
|
priceId: z.nullable(z.string()).optional(),
|
|
165
|
+
periodStart: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
166
|
+
.optional(),
|
|
167
|
+
periodEnd: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
168
|
+
.optional(),
|
|
169
|
+
paymentTerm: z.nullable(InvoiceLineItemPaymentTerm$inboundSchema).optional(),
|
|
134
170
|
invoiceDisplayName: z.string(),
|
|
135
171
|
lineItemType: InvoiceLineItemLineItemType$inboundSchema,
|
|
136
172
|
meterEventId: z.string(),
|
package/src/models/lineitem.ts
CHANGED
|
@@ -36,14 +36,14 @@ export const LineItemStatus = {
|
|
|
36
36
|
export type LineItemStatus = ClosedEnum<typeof LineItemStatus>;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* When the line falls due relative to the window it covers. A fee line carries its price's term; a metered line is stamped `in_arrears`, though metered rows predating that rule carry `null`. Manual, grant-discount and adjustment lines are billed on no term of their own and are `null`. `null` is listed in the enum as well as via `nullable` because OpenAPI 3.0 validators check the enum independently — `nullable: true` alone does not admit it, and createLineItem (which always returns null here) was emitting a schema-violating body.
|
|
40
40
|
*/
|
|
41
41
|
export const LineItemPaymentTerm = {
|
|
42
42
|
InAdvance: "in_advance",
|
|
43
43
|
InArrears: "in_arrears",
|
|
44
44
|
} as const;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* When the line falls due relative to the window it covers. A fee line carries its price's term; a metered line is stamped `in_arrears`, though metered rows predating that rule carry `null`. Manual, grant-discount and adjustment lines are billed on no term of their own and are `null`. `null` is listed in the enum as well as via `nullable` because OpenAPI 3.0 validators check the enum independently — `nullable: true` alone does not admit it, and createLineItem (which always returns null here) was emitting a schema-violating body.
|
|
47
47
|
*/
|
|
48
48
|
export type LineItemPaymentTerm = ClosedEnum<typeof LineItemPaymentTerm>;
|
|
49
49
|
|
|
@@ -121,7 +121,11 @@ export type LineItem = {
|
|
|
121
121
|
*/
|
|
122
122
|
meteredQuantity?: string | null | undefined;
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
124
|
+
* The subscription adjustments of type `usageDiscount` that reduced this line's billable `quantity`. Empty for every other line. Where this is non-empty, `quantity` is below `meteredQuantity` because an operator waived units, rather than because a grant covered them.
|
|
125
|
+
*/
|
|
126
|
+
usageDiscountIds?: Array<string> | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* When the line falls due relative to the window it covers. A fee line carries its price's term; a metered line is stamped `in_arrears`, though metered rows predating that rule carry `null`. Manual, grant-discount and adjustment lines are billed on no term of their own and are `null`. `null` is listed in the enum as well as via `nullable` because OpenAPI 3.0 validators check the enum independently — `nullable: true` alone does not admit it, and createLineItem (which always returns null here) was emitting a schema-violating body.
|
|
125
129
|
*/
|
|
126
130
|
paymentTerm?: LineItemPaymentTerm | null | undefined;
|
|
127
131
|
/**
|
|
@@ -196,6 +200,7 @@ export const LineItem$inboundSchema: z.ZodType<
|
|
|
196
200
|
quantity: z.nullable(z.string()).optional(),
|
|
197
201
|
unitPrice: z.string(),
|
|
198
202
|
meteredQuantity: z.nullable(z.string()).optional(),
|
|
203
|
+
usageDiscountIds: z.array(z.string()).optional(),
|
|
199
204
|
paymentTerm: z.nullable(LineItemPaymentTerm$inboundSchema).optional(),
|
|
200
205
|
subtotal: z.string().optional(),
|
|
201
206
|
taxesTotal: z.nullable(z.string()).optional(),
|
|
@@ -39,6 +39,10 @@ export type CreatePriceRequest = {
|
|
|
39
39
|
* Line item label shown on customer invoices. Sample values: 'Claude Token Consumption', 'Storage Usage (GB)', 'Inference API Calls', 'Image Generation Count', 'Training Compute Hours', 'Data Transfer (TB)'
|
|
40
40
|
*/
|
|
41
41
|
invoiceDisplayName: string;
|
|
42
|
+
/**
|
|
43
|
+
* Presentation only. Prices sharing this value, within one billing period, print as a single row on the rendered invoice PDF and are described by this string. Every member still bills its own line item on the ledger, this API and the compliance document. The combined row's rate is derived from the members' own rates. Requires the 'standard' pricing model. Sample values: 'Cross Border Fees', 'FX Fees'
|
|
44
|
+
*/
|
|
45
|
+
invoiceDisplayGroup?: string | null | undefined;
|
|
42
46
|
/**
|
|
43
47
|
* Billing timing preference: 'in_advance' (prepaid — charged upfront or drawn from a prepaid commitment) or 'in_arrears' (charged at period end).
|
|
44
48
|
*/
|
|
@@ -57,6 +61,14 @@ export type CreatePriceRequest = {
|
|
|
57
61
|
* A fixed amount owed whole rather than a per-period rate. An obligation is not prorated over a partial first period: when a subscription starts before its billing anchor, no truncated stub is billed and the first charge is the full amount at the next anchor. An obligation also refuses an interval boundary that falls strictly inside one of its own billing periods, since part of an amount owed whole is not a thing to bill. Defaults to false, which is a rate and is today's behaviour for every price. Not supported on a metered price, whose amount resolves from usage at close.
|
|
58
62
|
*/
|
|
59
63
|
isObligation?: boolean | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* What properties.unitPrice is denominated in. 'amount' (the default) is an amount of the invoice currency for each unit metered, so the quantity is the multiplier. 'proportion' is the reverse: a dimensionless share of a currency-denominated quantity, so '0.02' is 2% and the invoice prints '2.00%'. Presentation only. Requires a standard metered price in real currency.
|
|
66
|
+
*/
|
|
67
|
+
rateType?: models.RateType | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* A price's tax declaration. Optional on write — a price that declares nothing is `IN_SCOPE`, and is billed and taxed exactly as it was before this object existed. Always present on read. Replaced as a whole on update: send the object to change it, omit it to leave it alone.
|
|
70
|
+
*/
|
|
71
|
+
tax?: models.PriceTax | undefined;
|
|
60
72
|
/**
|
|
61
73
|
* Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
62
74
|
*/
|
|
@@ -75,12 +87,15 @@ export type CreatePriceRequest$Outbound = {
|
|
|
75
87
|
pricingUnitId?: string | undefined;
|
|
76
88
|
model?: string | undefined;
|
|
77
89
|
invoiceDisplayName: string;
|
|
90
|
+
invoiceDisplayGroup?: string | null | undefined;
|
|
78
91
|
paymentTerm: string;
|
|
79
92
|
billingCadence?: string | null | undefined;
|
|
80
93
|
properties: models.PriceProperties$Outbound;
|
|
81
94
|
feature?: models.PriceFeatureInput$Outbound | undefined;
|
|
82
95
|
grantDiscountEnabled: boolean;
|
|
83
96
|
isObligation: boolean;
|
|
97
|
+
rateType?: string | undefined;
|
|
98
|
+
tax?: models.PriceTax$Outbound | undefined;
|
|
84
99
|
quantity?: number | undefined;
|
|
85
100
|
};
|
|
86
101
|
|
|
@@ -95,12 +110,15 @@ export const CreatePriceRequest$outboundSchema: z.ZodType<
|
|
|
95
110
|
pricingUnitId: z.string().optional(),
|
|
96
111
|
model: models.PriceModelInput$outboundSchema.optional(),
|
|
97
112
|
invoiceDisplayName: z.string(),
|
|
113
|
+
invoiceDisplayGroup: z.nullable(z.string()).optional(),
|
|
98
114
|
paymentTerm: CreatePricePaymentTerm$outboundSchema,
|
|
99
115
|
billingCadence: z.nullable(z.string()).optional(),
|
|
100
116
|
properties: models.PriceProperties$outboundSchema,
|
|
101
117
|
feature: models.PriceFeatureInput$outboundSchema.optional(),
|
|
102
118
|
grantDiscountEnabled: z.boolean().default(false),
|
|
103
119
|
isObligation: z.boolean().default(false),
|
|
120
|
+
rateType: models.RateType$outboundSchema.optional(),
|
|
121
|
+
tax: models.PriceTax$outboundSchema.optional(),
|
|
104
122
|
quantity: z.number().int().optional(),
|
|
105
123
|
});
|
|
106
124
|
|