@paygentic/sdk 0.9.4 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +12 -5
  2. package/dist/commonjs/funcs/pricesUpdate.d.ts +1 -1
  3. package/dist/commonjs/funcs/pricesUpdate.d.ts.map +1 -1
  4. package/dist/commonjs/funcs/pricesUpdate.js +2 -2
  5. package/dist/commonjs/funcs/pricesUpdate.js.map +1 -1
  6. package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +19 -0
  7. package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.js +127 -0
  9. package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.js.map +1 -0
  10. package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts +18 -0
  11. package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.js +128 -0
  13. package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.js.map +1 -0
  14. package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.d.ts +19 -0
  15. package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.js +129 -0
  17. package/dist/commonjs/funcs/subscriptionsListSubscriptionAdjustments.js.map +1 -0
  18. package/dist/commonjs/lib/config.d.ts +2 -2
  19. package/dist/commonjs/lib/config.js +2 -2
  20. package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts +53 -0
  21. package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts.map +1 -0
  22. package/dist/commonjs/models/createsubscriptionadjustmentrequest.js +63 -0
  23. package/dist/commonjs/models/createsubscriptionadjustmentrequest.js.map +1 -0
  24. package/dist/commonjs/models/errors/index.d.ts +1 -0
  25. package/dist/commonjs/models/errors/index.d.ts.map +1 -1
  26. package/dist/commonjs/models/errors/index.js +1 -0
  27. package/dist/commonjs/models/errors/index.js.map +1 -1
  28. package/dist/commonjs/models/errors/updateprice.d.ts +36 -0
  29. package/dist/commonjs/models/errors/updateprice.d.ts.map +1 -0
  30. package/dist/commonjs/models/errors/updateprice.js +77 -0
  31. package/dist/commonjs/models/errors/updateprice.js.map +1 -0
  32. package/dist/commonjs/models/index.d.ts +4 -1
  33. package/dist/commonjs/models/index.d.ts.map +1 -1
  34. package/dist/commonjs/models/index.js +4 -1
  35. package/dist/commonjs/models/index.js.map +1 -1
  36. package/dist/commonjs/models/operations/createprice.d.ts +8 -3
  37. package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
  38. package/dist/commonjs/models/operations/createprice.js +2 -1
  39. package/dist/commonjs/models/operations/createprice.js.map +1 -1
  40. package/dist/commonjs/models/operations/createsubscriptionadjustment.d.ts +18 -0
  41. package/dist/commonjs/models/operations/createsubscriptionadjustment.d.ts.map +1 -0
  42. package/dist/commonjs/models/operations/createsubscriptionadjustment.js +56 -0
  43. package/dist/commonjs/models/operations/createsubscriptionadjustment.js.map +1 -0
  44. package/dist/commonjs/models/operations/deletesubscriptionadjustment.d.ts +20 -0
  45. package/dist/commonjs/models/operations/deletesubscriptionadjustment.d.ts.map +1 -0
  46. package/dist/commonjs/models/operations/deletesubscriptionadjustment.js +50 -0
  47. package/dist/commonjs/models/operations/deletesubscriptionadjustment.js.map +1 -0
  48. package/dist/commonjs/models/operations/index.d.ts +3 -0
  49. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  50. package/dist/commonjs/models/operations/index.js +3 -0
  51. package/dist/commonjs/models/operations/index.js.map +1 -1
  52. package/dist/commonjs/models/operations/listsubscriptionadjustments.d.ts +25 -0
  53. package/dist/commonjs/models/operations/listsubscriptionadjustments.d.ts.map +1 -0
  54. package/dist/commonjs/models/operations/listsubscriptionadjustments.js +51 -0
  55. package/dist/commonjs/models/operations/listsubscriptionadjustments.js.map +1 -0
  56. package/dist/commonjs/models/operations/updateprice.d.ts +18 -3
  57. package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
  58. package/dist/commonjs/models/operations/updateprice.js +14 -2
  59. package/dist/commonjs/models/operations/updateprice.js.map +1 -1
  60. package/dist/commonjs/models/planversionpriceslot.d.ts +4 -0
  61. package/dist/commonjs/models/planversionpriceslot.d.ts.map +1 -1
  62. package/dist/commonjs/models/planversionpriceslot.js +1 -0
  63. package/dist/commonjs/models/planversionpriceslot.js.map +1 -1
  64. package/dist/commonjs/models/price.d.ts +4 -0
  65. package/dist/commonjs/models/price.d.ts.map +1 -1
  66. package/dist/commonjs/models/price.js +1 -0
  67. package/dist/commonjs/models/price.js.map +1 -1
  68. package/dist/commonjs/models/pricemodel.d.ts +2 -2
  69. package/dist/commonjs/models/pricemodel.js +1 -1
  70. package/dist/commonjs/models/pricemodelinput.d.ts +3 -2
  71. package/dist/commonjs/models/pricemodelinput.d.ts.map +1 -1
  72. package/dist/commonjs/models/pricemodelinput.js +2 -1
  73. package/dist/commonjs/models/pricemodelinput.js.map +1 -1
  74. package/dist/commonjs/models/priceproperties.d.ts +125 -0
  75. package/dist/commonjs/models/priceproperties.d.ts.map +1 -0
  76. package/dist/commonjs/models/priceproperties.js +152 -0
  77. package/dist/commonjs/models/priceproperties.js.map +1 -0
  78. package/dist/commonjs/models/schemasprice.d.ts +7 -3
  79. package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
  80. package/dist/commonjs/models/schemasprice.js +3 -2
  81. package/dist/commonjs/models/schemasprice.js.map +1 -1
  82. package/dist/commonjs/models/subscriptionadjustment.d.ts +49 -0
  83. package/dist/commonjs/models/subscriptionadjustment.d.ts.map +1 -0
  84. package/dist/commonjs/models/subscriptionadjustment.js +68 -0
  85. package/dist/commonjs/models/subscriptionadjustment.js.map +1 -0
  86. package/dist/commonjs/models/subscriptionadjustmentsresponse.d.ts +16 -0
  87. package/dist/commonjs/models/subscriptionadjustmentsresponse.d.ts.map +1 -0
  88. package/dist/commonjs/models/subscriptionadjustmentsresponse.js +53 -0
  89. package/dist/commonjs/models/subscriptionadjustmentsresponse.js.map +1 -0
  90. package/dist/commonjs/sdk/subscriptions.d.ts +21 -0
  91. package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
  92. package/dist/commonjs/sdk/subscriptions.js +30 -0
  93. package/dist/commonjs/sdk/subscriptions.js.map +1 -1
  94. package/dist/esm/funcs/pricesUpdate.d.ts +1 -1
  95. package/dist/esm/funcs/pricesUpdate.d.ts.map +1 -1
  96. package/dist/esm/funcs/pricesUpdate.js +2 -2
  97. package/dist/esm/funcs/pricesUpdate.js.map +1 -1
  98. package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +19 -0
  99. package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts.map +1 -0
  100. package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.js +91 -0
  101. package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.js.map +1 -0
  102. package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts +18 -0
  103. package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts.map +1 -0
  104. package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.js +92 -0
  105. package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.js.map +1 -0
  106. package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.d.ts +19 -0
  107. package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.d.ts.map +1 -0
  108. package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.js +93 -0
  109. package/dist/esm/funcs/subscriptionsListSubscriptionAdjustments.js.map +1 -0
  110. package/dist/esm/lib/config.d.ts +2 -2
  111. package/dist/esm/lib/config.js +2 -2
  112. package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts +53 -0
  113. package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts.map +1 -0
  114. package/dist/esm/models/createsubscriptionadjustmentrequest.js +26 -0
  115. package/dist/esm/models/createsubscriptionadjustmentrequest.js.map +1 -0
  116. package/dist/esm/models/errors/index.d.ts +1 -0
  117. package/dist/esm/models/errors/index.d.ts.map +1 -1
  118. package/dist/esm/models/errors/index.js +1 -0
  119. package/dist/esm/models/errors/index.js.map +1 -1
  120. package/dist/esm/models/errors/updateprice.d.ts +36 -0
  121. package/dist/esm/models/errors/updateprice.d.ts.map +1 -0
  122. package/dist/esm/models/errors/updateprice.js +40 -0
  123. package/dist/esm/models/errors/updateprice.js.map +1 -0
  124. package/dist/esm/models/index.d.ts +4 -1
  125. package/dist/esm/models/index.d.ts.map +1 -1
  126. package/dist/esm/models/index.js +4 -1
  127. package/dist/esm/models/index.js.map +1 -1
  128. package/dist/esm/models/operations/createprice.d.ts +8 -3
  129. package/dist/esm/models/operations/createprice.d.ts.map +1 -1
  130. package/dist/esm/models/operations/createprice.js +2 -1
  131. package/dist/esm/models/operations/createprice.js.map +1 -1
  132. package/dist/esm/models/operations/createsubscriptionadjustment.d.ts +18 -0
  133. package/dist/esm/models/operations/createsubscriptionadjustment.d.ts.map +1 -0
  134. package/dist/esm/models/operations/createsubscriptionadjustment.js +19 -0
  135. package/dist/esm/models/operations/createsubscriptionadjustment.js.map +1 -0
  136. package/dist/esm/models/operations/deletesubscriptionadjustment.d.ts +20 -0
  137. package/dist/esm/models/operations/deletesubscriptionadjustment.d.ts.map +1 -0
  138. package/dist/esm/models/operations/deletesubscriptionadjustment.js +13 -0
  139. package/dist/esm/models/operations/deletesubscriptionadjustment.js.map +1 -0
  140. package/dist/esm/models/operations/index.d.ts +3 -0
  141. package/dist/esm/models/operations/index.d.ts.map +1 -1
  142. package/dist/esm/models/operations/index.js +3 -0
  143. package/dist/esm/models/operations/index.js.map +1 -1
  144. package/dist/esm/models/operations/listsubscriptionadjustments.d.ts +25 -0
  145. package/dist/esm/models/operations/listsubscriptionadjustments.d.ts.map +1 -0
  146. package/dist/esm/models/operations/listsubscriptionadjustments.js +14 -0
  147. package/dist/esm/models/operations/listsubscriptionadjustments.js.map +1 -0
  148. package/dist/esm/models/operations/updateprice.d.ts +18 -3
  149. package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
  150. package/dist/esm/models/operations/updateprice.js +12 -1
  151. package/dist/esm/models/operations/updateprice.js.map +1 -1
  152. package/dist/esm/models/planversionpriceslot.d.ts +4 -0
  153. package/dist/esm/models/planversionpriceslot.d.ts.map +1 -1
  154. package/dist/esm/models/planversionpriceslot.js +1 -0
  155. package/dist/esm/models/planversionpriceslot.js.map +1 -1
  156. package/dist/esm/models/price.d.ts +4 -0
  157. package/dist/esm/models/price.d.ts.map +1 -1
  158. package/dist/esm/models/price.js +1 -0
  159. package/dist/esm/models/price.js.map +1 -1
  160. package/dist/esm/models/pricemodel.d.ts +2 -2
  161. package/dist/esm/models/pricemodel.js +1 -1
  162. package/dist/esm/models/pricemodelinput.d.ts +3 -2
  163. package/dist/esm/models/pricemodelinput.d.ts.map +1 -1
  164. package/dist/esm/models/pricemodelinput.js +2 -1
  165. package/dist/esm/models/pricemodelinput.js.map +1 -1
  166. package/dist/esm/models/priceproperties.d.ts +125 -0
  167. package/dist/esm/models/priceproperties.d.ts.map +1 -0
  168. package/dist/esm/models/priceproperties.js +104 -0
  169. package/dist/esm/models/priceproperties.js.map +1 -0
  170. package/dist/esm/models/schemasprice.d.ts +7 -3
  171. package/dist/esm/models/schemasprice.d.ts.map +1 -1
  172. package/dist/esm/models/schemasprice.js +3 -2
  173. package/dist/esm/models/schemasprice.js.map +1 -1
  174. package/dist/esm/models/subscriptionadjustment.d.ts +49 -0
  175. package/dist/esm/models/subscriptionadjustment.d.ts.map +1 -0
  176. package/dist/esm/models/subscriptionadjustment.js +31 -0
  177. package/dist/esm/models/subscriptionadjustment.js.map +1 -0
  178. package/dist/esm/models/subscriptionadjustmentsresponse.d.ts +16 -0
  179. package/dist/esm/models/subscriptionadjustmentsresponse.d.ts.map +1 -0
  180. package/dist/esm/models/subscriptionadjustmentsresponse.js +16 -0
  181. package/dist/esm/models/subscriptionadjustmentsresponse.js.map +1 -0
  182. package/dist/esm/sdk/subscriptions.d.ts +21 -0
  183. package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
  184. package/dist/esm/sdk/subscriptions.js +30 -0
  185. package/dist/esm/sdk/subscriptions.js.map +1 -1
  186. package/jsr.json +1 -1
  187. package/package.json +1 -1
  188. package/src/funcs/pricesUpdate.ts +5 -1
  189. package/src/funcs/subscriptionsCreateSubscriptionAdjustment.ts +186 -0
  190. package/src/funcs/subscriptionsDeleteSubscriptionAdjustment.ts +185 -0
  191. package/src/funcs/subscriptionsListSubscriptionAdjustments.ts +183 -0
  192. package/src/lib/config.ts +2 -2
  193. package/src/models/createsubscriptionadjustmentrequest.ts +85 -0
  194. package/src/models/errors/index.ts +1 -0
  195. package/src/models/errors/updateprice.ts +71 -0
  196. package/src/models/index.ts +4 -1
  197. package/src/models/operations/createprice.ts +10 -4
  198. package/src/models/operations/createsubscriptionadjustment.ts +48 -0
  199. package/src/models/operations/deletesubscriptionadjustment.ts +42 -0
  200. package/src/models/operations/index.ts +3 -0
  201. package/src/models/operations/listsubscriptionadjustments.ts +48 -0
  202. package/src/models/operations/updateprice.ts +40 -4
  203. package/src/models/planversionpriceslot.ts +5 -0
  204. package/src/models/price.ts +5 -0
  205. package/src/models/pricemodel.ts +2 -2
  206. package/src/models/pricemodelinput.ts +3 -2
  207. package/src/models/priceproperties.ts +325 -0
  208. package/src/models/schemasprice.ts +11 -6
  209. package/src/models/subscriptionadjustment.ts +94 -0
  210. package/src/models/subscriptionadjustmentsresponse.ts +44 -0
  211. package/src/sdk/subscriptions.ts +54 -0
  212. package/dist/commonjs/models/pricepropertiesunion.d.ts +0 -152
  213. package/dist/commonjs/models/pricepropertiesunion.d.ts.map +0 -1
  214. package/dist/commonjs/models/pricepropertiesunion.js +0 -169
  215. package/dist/commonjs/models/pricepropertiesunion.js.map +0 -1
  216. package/dist/esm/models/pricepropertiesunion.d.ts +0 -152
  217. package/dist/esm/models/pricepropertiesunion.d.ts.map +0 -1
  218. package/dist/esm/models/pricepropertiesunion.js +0 -121
  219. package/dist/esm/models/pricepropertiesunion.js.map +0 -1
  220. package/src/models/pricepropertiesunion.ts +0 -364
@@ -0,0 +1,85 @@
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
+ /**
9
+ * The kind of adjustment. `percentageDiscount` reduces every discountable charge by a rate.
10
+ */
11
+ export const CreateSubscriptionAdjustmentRequestType = {
12
+ PercentageDiscount: "percentageDiscount",
13
+ } as const;
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);
52
+
53
+ /** @internal */
54
+ export type CreateSubscriptionAdjustmentRequest$Outbound = {
55
+ type: string;
56
+ percentageDiscount: string;
57
+ effectiveFrom: string;
58
+ effectiveTo?: string | null | undefined;
59
+ description?: string | null | undefined;
60
+ idempotencyKey?: string | undefined;
61
+ };
62
+
63
+ /** @internal */
64
+ export const CreateSubscriptionAdjustmentRequest$outboundSchema: z.ZodType<
65
+ CreateSubscriptionAdjustmentRequest$Outbound,
66
+ z.ZodTypeDef,
67
+ CreateSubscriptionAdjustmentRequest
68
+ > = z.object({
69
+ type: CreateSubscriptionAdjustmentRequestType$outboundSchema,
70
+ percentageDiscount: z.string(),
71
+ effectiveFrom: z.date().transform(v => v.toISOString()),
72
+ effectiveTo: z.nullable(z.date().transform(v => v.toISOString())).optional(),
73
+ description: z.nullable(z.string()).optional(),
74
+ idempotencyKey: z.string().optional(),
75
+ });
76
+
77
+ export function createSubscriptionAdjustmentRequestToJSON(
78
+ createSubscriptionAdjustmentRequest: CreateSubscriptionAdjustmentRequest,
79
+ ): string {
80
+ return JSON.stringify(
81
+ CreateSubscriptionAdjustmentRequest$outboundSchema.parse(
82
+ createSubscriptionAdjustmentRequest,
83
+ ),
84
+ );
85
+ }
@@ -12,4 +12,5 @@ export * from "./paygenticdefaulterror.js";
12
12
  export * from "./paygenticerror.js";
13
13
  export * from "./responsevalidationerror.js";
14
14
  export * from "./sdkvalidationerror.js";
15
+ export * from "./updateprice.js";
15
16
  export * from "./validationerror.js";
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import * as operations from "../operations/index.js";
7
+ import { PaygenticError } from "./paygenticerror.js";
8
+
9
+ /**
10
+ * Price cannot be restructured because a subscription still bills it directly
11
+ */
12
+ export type UpdatePriceConflictErrorData = {
13
+ error?: string | undefined;
14
+ message: string;
15
+ /**
16
+ * Machine-readable conflict code. Open set: a new code may appear, so branch on the ones you handle and treat anything else as an unhandled conflict.
17
+ */
18
+ code: string;
19
+ details?: operations.UpdatePriceDetails | undefined;
20
+ };
21
+
22
+ /**
23
+ * Price cannot be restructured because a subscription still bills it directly
24
+ */
25
+ export class UpdatePriceConflictError extends PaygenticError {
26
+ error?: string | undefined;
27
+ /**
28
+ * Machine-readable conflict code. Open set: a new code may appear, so branch on the ones you handle and treat anything else as an unhandled conflict.
29
+ */
30
+ code: string;
31
+ details?: operations.UpdatePriceDetails | undefined;
32
+
33
+ /** The original data that was passed to this error instance. */
34
+ data$: UpdatePriceConflictErrorData;
35
+
36
+ constructor(
37
+ err: UpdatePriceConflictErrorData,
38
+ httpMeta: { response: Response; request: Request; body: string },
39
+ ) {
40
+ const message = err.message || `API error occurred: ${JSON.stringify(err)}`;
41
+ super(message, httpMeta);
42
+ this.data$ = err;
43
+ if (err.error != null) this.error = err.error;
44
+ this.code = err.code;
45
+ if (err.details != null) this.details = err.details;
46
+
47
+ this.name = "UpdatePriceConflictError";
48
+ }
49
+ }
50
+
51
+ /** @internal */
52
+ export const UpdatePriceConflictError$inboundSchema: z.ZodType<
53
+ UpdatePriceConflictError,
54
+ z.ZodTypeDef,
55
+ unknown
56
+ > = z.object({
57
+ error: z.string().optional(),
58
+ message: z.string(),
59
+ code: z.string(),
60
+ details: z.lazy(() => operations.UpdatePriceDetails$inboundSchema).optional(),
61
+ request$: z.instanceof(Request),
62
+ response$: z.instanceof(Response),
63
+ body$: z.string(),
64
+ })
65
+ .transform((v) => {
66
+ return new UpdatePriceConflictError(v, {
67
+ request: v.request$,
68
+ response: v.response$,
69
+ body: v.body$,
70
+ });
71
+ });
@@ -22,6 +22,7 @@ export * from "./createorderapprovalrequest.js";
22
22
  export * from "./createorderlineitemrequest.js";
23
23
  export * from "./createorderrequest.js";
24
24
  export * from "./createrulerequest.js";
25
+ export * from "./createsubscriptionadjustmentrequest.js";
25
26
  export * from "./currencybreakdownentry.js";
26
27
  export * from "./customer.js";
27
28
  export * from "./entitlementdetail.js";
@@ -75,7 +76,7 @@ export * from "./pricefeature.js";
75
76
  export * from "./pricefeatureinput.js";
76
77
  export * from "./pricemodel.js";
77
78
  export * from "./pricemodelinput.js";
78
- export * from "./pricepropertiesunion.js";
79
+ export * from "./priceproperties.js";
79
80
  export * from "./product.js";
80
81
  export * from "./profitabilityrow.js";
81
82
  export * from "./profitabilitysummaryresponse.js";
@@ -104,6 +105,8 @@ export * from "./sourcerule.js";
104
105
  export * from "./staticentitlementdetail.js";
105
106
  export * from "./staticentitlementlistitem.js";
106
107
  export * from "./subscription.js";
108
+ export * from "./subscriptionadjustment.js";
109
+ export * from "./subscriptionadjustmentsresponse.js";
107
110
  export * from "./subscriptionmetadata.js";
108
111
  export * from "./subscriptionportal.js";
109
112
  export * from "./subscriptionreconciliation.js";
@@ -32,7 +32,7 @@ export type CreatePriceRequest = {
32
32
  */
33
33
  pricingUnitId?: string | undefined;
34
34
  /**
35
- * Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard'). Only 'standard' is accepted; for percentage/revenue-share use 'standard' with a unit-price multiplier. Legacy prices using 'dynamic'/'volume'/'percentage' stay readable and billable but cannot be created.
35
+ * Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard'). 'standard' and 'volume' are accepted; fees only support 'standard'. For percentage/revenue-share use 'standard' with a unit-price multiplier. Legacy prices using 'dynamic'/'percentage' stay readable and billable but cannot be created.
36
36
  */
37
37
  model?: models.PriceModelInput | undefined;
38
38
  /**
@@ -47,12 +47,16 @@ export type CreatePriceRequest = {
47
47
  * ISO 8601 duration for recurring charges (e.g., 'P1M' for monthly, 'P1Y' for yearly) or 'P0D' for one-time charges. Required for fees, optional for billable metrics. Sample values: 'P0D' for one-time, 'P1M' for monthly recurring, 'P1Y' for yearly recurring
48
48
  */
49
49
  billingCadence?: string | null | undefined;
50
- properties: models.PricePropertiesUnion;
50
+ properties: models.PriceProperties;
51
51
  feature?: models.PriceFeatureInput | undefined;
52
52
  /**
53
53
  * When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
54
54
  */
55
55
  grantDiscountEnabled?: boolean | undefined;
56
+ /**
57
+ * 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
+ */
59
+ isObligation?: boolean | undefined;
56
60
  /**
57
61
  * Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
58
62
  */
@@ -73,9 +77,10 @@ export type CreatePriceRequest$Outbound = {
73
77
  invoiceDisplayName: string;
74
78
  paymentTerm: string;
75
79
  billingCadence?: string | null | undefined;
76
- properties: models.PricePropertiesUnion$Outbound;
80
+ properties: models.PriceProperties$Outbound;
77
81
  feature?: models.PriceFeatureInput$Outbound | undefined;
78
82
  grantDiscountEnabled: boolean;
83
+ isObligation: boolean;
79
84
  quantity?: number | undefined;
80
85
  };
81
86
 
@@ -92,9 +97,10 @@ export const CreatePriceRequest$outboundSchema: z.ZodType<
92
97
  invoiceDisplayName: z.string(),
93
98
  paymentTerm: CreatePricePaymentTerm$outboundSchema,
94
99
  billingCadence: z.nullable(z.string()).optional(),
95
- properties: models.PricePropertiesUnion$outboundSchema,
100
+ properties: models.PriceProperties$outboundSchema,
96
101
  feature: models.PriceFeatureInput$outboundSchema.optional(),
97
102
  grantDiscountEnabled: z.boolean().default(false),
103
+ isObligation: z.boolean().default(false),
98
104
  quantity: z.number().int().optional(),
99
105
  });
100
106
 
@@ -0,0 +1,48 @@
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 CreateSubscriptionAdjustmentRequest = {
10
+ /**
11
+ * The subscription ID
12
+ */
13
+ id: string;
14
+ createSubscriptionAdjustmentRequest:
15
+ models.CreateSubscriptionAdjustmentRequest;
16
+ };
17
+
18
+ /** @internal */
19
+ export type CreateSubscriptionAdjustmentRequest$Outbound = {
20
+ id: string;
21
+ CreateSubscriptionAdjustmentRequest:
22
+ models.CreateSubscriptionAdjustmentRequest$Outbound;
23
+ };
24
+
25
+ /** @internal */
26
+ export const CreateSubscriptionAdjustmentRequest$outboundSchema: z.ZodType<
27
+ CreateSubscriptionAdjustmentRequest$Outbound,
28
+ z.ZodTypeDef,
29
+ CreateSubscriptionAdjustmentRequest
30
+ > = z.object({
31
+ id: z.string(),
32
+ createSubscriptionAdjustmentRequest:
33
+ models.CreateSubscriptionAdjustmentRequest$outboundSchema,
34
+ }).transform((v) => {
35
+ return remap$(v, {
36
+ createSubscriptionAdjustmentRequest: "CreateSubscriptionAdjustmentRequest",
37
+ });
38
+ });
39
+
40
+ export function createSubscriptionAdjustmentRequestToJSON(
41
+ createSubscriptionAdjustmentRequest: CreateSubscriptionAdjustmentRequest,
42
+ ): string {
43
+ return JSON.stringify(
44
+ CreateSubscriptionAdjustmentRequest$outboundSchema.parse(
45
+ createSubscriptionAdjustmentRequest,
46
+ ),
47
+ );
48
+ }
@@ -0,0 +1,42 @@
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 DeleteSubscriptionAdjustmentRequest = {
8
+ /**
9
+ * The subscription ID
10
+ */
11
+ id: string;
12
+ /**
13
+ * The adjustment ID
14
+ */
15
+ adjustmentId: string;
16
+ };
17
+
18
+ /** @internal */
19
+ export type DeleteSubscriptionAdjustmentRequest$Outbound = {
20
+ id: string;
21
+ adjustmentId: string;
22
+ };
23
+
24
+ /** @internal */
25
+ export const DeleteSubscriptionAdjustmentRequest$outboundSchema: z.ZodType<
26
+ DeleteSubscriptionAdjustmentRequest$Outbound,
27
+ z.ZodTypeDef,
28
+ DeleteSubscriptionAdjustmentRequest
29
+ > = z.object({
30
+ id: z.string(),
31
+ adjustmentId: z.string(),
32
+ });
33
+
34
+ export function deleteSubscriptionAdjustmentRequestToJSON(
35
+ deleteSubscriptionAdjustmentRequest: DeleteSubscriptionAdjustmentRequest,
36
+ ): string {
37
+ return JSON.stringify(
38
+ DeleteSubscriptionAdjustmentRequest$outboundSchema.parse(
39
+ deleteSubscriptionAdjustmentRequest,
40
+ ),
41
+ );
42
+ }
@@ -25,6 +25,7 @@ export * from "./createprice.js";
25
25
  export * from "./createproduct.js";
26
26
  export * from "./createsource.js";
27
27
  export * from "./createsubscription.js";
28
+ export * from "./createsubscriptionadjustment.js";
28
29
  export * from "./createtestclock.js";
29
30
  export * from "./deletebillingschedule.js";
30
31
  export * from "./deletecost.js";
@@ -36,6 +37,7 @@ export * from "./deleteorder.js";
36
37
  export * from "./deleteorderlineitem.js";
37
38
  export * from "./deleteprice.js";
38
39
  export * from "./deletesourcerule.js";
40
+ export * from "./deletesubscriptionadjustment.js";
39
41
  export * from "./deletetestclock.js";
40
42
  export * from "./disconnectmerchantintegration.js";
41
43
  export * from "./downloadinvoicepdf.js";
@@ -103,6 +105,7 @@ export * from "./listscheduleinvoices.js";
103
105
  export * from "./listsourceevents.js";
104
106
  export * from "./listsourcerules.js";
105
107
  export * from "./listsources.js";
108
+ export * from "./listsubscriptionadjustments.js";
106
109
  export * from "./listsubscriptions.js";
107
110
  export * from "./listtestclocks.js";
108
111
  export * from "./mintplanversion.js";
@@ -0,0 +1,48 @@
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 ListSubscriptionAdjustmentsRequest = {
8
+ /**
9
+ * The subscription ID
10
+ */
11
+ id: string;
12
+ /**
13
+ * Number of adjustments to return
14
+ */
15
+ limit?: string | undefined;
16
+ /**
17
+ * Number of adjustments to skip
18
+ */
19
+ offset?: string | undefined;
20
+ };
21
+
22
+ /** @internal */
23
+ export type ListSubscriptionAdjustmentsRequest$Outbound = {
24
+ id: string;
25
+ limit: string;
26
+ offset: string;
27
+ };
28
+
29
+ /** @internal */
30
+ export const ListSubscriptionAdjustmentsRequest$outboundSchema: z.ZodType<
31
+ ListSubscriptionAdjustmentsRequest$Outbound,
32
+ z.ZodTypeDef,
33
+ ListSubscriptionAdjustmentsRequest
34
+ > = z.object({
35
+ id: z.string(),
36
+ limit: z.string().default("10"),
37
+ offset: z.string().default("0"),
38
+ });
39
+
40
+ export function listSubscriptionAdjustmentsRequestToJSON(
41
+ listSubscriptionAdjustmentsRequest: ListSubscriptionAdjustmentsRequest,
42
+ ): string {
43
+ return JSON.stringify(
44
+ ListSubscriptionAdjustmentsRequest$outboundSchema.parse(
45
+ listSubscriptionAdjustmentsRequest,
46
+ ),
47
+ );
48
+ }
@@ -4,7 +4,10 @@
4
4
 
5
5
  import * as z from "zod/v3";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
7
8
  import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
8
11
  import * as models from "../index.js";
9
12
 
10
13
  /**
@@ -33,10 +36,10 @@ export type UpdatePriceRequestBody = {
33
36
  */
34
37
  invoiceDisplayName?: string | undefined;
35
38
  /**
36
- * The pricing model to set. Only 'standard' is accepted. Legacy 'dynamic'/'volume'/'percentage' prices can still be edited (other fields) but cannot be switched to those models. Percentage/revenue-share is expressed via 'standard' with a unit-price multiplier.
39
+ * The pricing model to set. 'standard' and 'volume' are accepted. Legacy 'dynamic'/'percentage' prices can still be edited (other fields) but cannot be switched back to those models. Percentage/revenue-share is expressed via 'standard' with a unit-price multiplier.
37
40
  */
38
41
  model?: models.PriceModelInput | undefined;
39
- properties?: models.PricePropertiesUnion | undefined;
42
+ properties?: models.PriceProperties | undefined;
40
43
  /**
41
44
  * Billing timing preference: 'in_advance' (prepaid — charged upfront or drawn from a prepaid commitment) or 'in_arrears' (charged at period end).
42
45
  */
@@ -53,6 +56,10 @@ export type UpdatePriceRequestBody = {
53
56
  * When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
54
57
  */
55
58
  grantDiscountEnabled?: boolean | undefined;
59
+ /**
60
+ * 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.
61
+ */
62
+ isObligation?: boolean | undefined;
56
63
  /**
57
64
  * Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
58
65
  */
@@ -67,6 +74,12 @@ export type UpdatePriceRequest = {
67
74
  requestBody: UpdatePriceRequestBody;
68
75
  };
69
76
 
77
+ export type UpdatePriceDetails = {
78
+ priceId?: string | undefined;
79
+ fields?: Array<string> | undefined;
80
+ subscriptionCount?: number | undefined;
81
+ };
82
+
70
83
  /** @internal */
71
84
  export const UpdatePricePaymentTerm$outboundSchema: z.ZodNativeEnum<
72
85
  typeof UpdatePricePaymentTerm
@@ -78,11 +91,12 @@ export type UpdatePriceRequestBody$Outbound = {
78
91
  pricingUnitId?: string | null | undefined;
79
92
  invoiceDisplayName?: string | undefined;
80
93
  model?: string | undefined;
81
- properties?: models.PricePropertiesUnion$Outbound | undefined;
94
+ properties?: models.PriceProperties$Outbound | undefined;
82
95
  paymentTerm?: string | undefined;
83
96
  billingCadence?: string | null | undefined;
84
97
  feature?: models.PriceFeatureInput$Outbound | null | undefined;
85
98
  grantDiscountEnabled?: boolean | undefined;
99
+ isObligation?: boolean | undefined;
86
100
  quantity?: number | undefined;
87
101
  };
88
102
 
@@ -96,11 +110,12 @@ export const UpdatePriceRequestBody$outboundSchema: z.ZodType<
96
110
  pricingUnitId: z.nullable(z.string()).optional(),
97
111
  invoiceDisplayName: z.string().optional(),
98
112
  model: models.PriceModelInput$outboundSchema.optional(),
99
- properties: models.PricePropertiesUnion$outboundSchema.optional(),
113
+ properties: models.PriceProperties$outboundSchema.optional(),
100
114
  paymentTerm: UpdatePricePaymentTerm$outboundSchema.optional(),
101
115
  billingCadence: z.nullable(z.string()).optional(),
102
116
  feature: z.nullable(models.PriceFeatureInput$outboundSchema).optional(),
103
117
  grantDiscountEnabled: z.boolean().optional(),
118
+ isObligation: z.boolean().optional(),
104
119
  quantity: z.number().int().optional(),
105
120
  });
106
121
 
@@ -139,3 +154,24 @@ export function updatePriceRequestToJSON(
139
154
  UpdatePriceRequest$outboundSchema.parse(updatePriceRequest),
140
155
  );
141
156
  }
157
+
158
+ /** @internal */
159
+ export const UpdatePriceDetails$inboundSchema: z.ZodType<
160
+ UpdatePriceDetails,
161
+ z.ZodTypeDef,
162
+ unknown
163
+ > = z.object({
164
+ priceId: z.string().optional(),
165
+ fields: z.array(z.string()).optional(),
166
+ subscriptionCount: z.number().int().optional(),
167
+ });
168
+
169
+ export function updatePriceDetailsFromJSON(
170
+ jsonString: string,
171
+ ): SafeParseResult<UpdatePriceDetails, SDKValidationError> {
172
+ return safeParse(
173
+ jsonString,
174
+ (x) => UpdatePriceDetails$inboundSchema.parse(JSON.parse(x)),
175
+ `Failed to parse 'UpdatePriceDetails' from JSON`,
176
+ );
177
+ }
@@ -73,6 +73,10 @@ export type PlanVersionPriceSlot = {
73
73
  * When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
74
74
  */
75
75
  grantDiscountEnabled: boolean;
76
+ /**
77
+ * 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.
78
+ */
79
+ isObligation: boolean;
76
80
  /**
77
81
  * Quantity used when generating invoice line items for this price. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
78
82
  */
@@ -121,6 +125,7 @@ export const PlanVersionPriceSlot$inboundSchema: z.ZodType<
121
125
  updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
122
126
  features: z.array(PriceFeature$inboundSchema).optional(),
123
127
  grantDiscountEnabled: z.boolean().default(false),
128
+ isObligation: z.boolean().default(false),
124
129
  quantity: z.number().int().default(1),
125
130
  priceDeleted: z.boolean(),
126
131
  });
@@ -64,6 +64,10 @@ export type Price = {
64
64
  * When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
65
65
  */
66
66
  grantDiscountEnabled: boolean;
67
+ /**
68
+ * 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.
69
+ */
70
+ isObligation: boolean;
67
71
  /**
68
72
  * Quantity used when generating invoice line items for this price. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
69
73
  */
@@ -107,6 +111,7 @@ export const Price$inboundSchema: z.ZodType<Price, z.ZodTypeDef, unknown> = z
107
111
  ),
108
112
  features: z.array(PriceFeature$inboundSchema).optional(),
109
113
  grantDiscountEnabled: z.boolean().default(false),
114
+ isObligation: z.boolean().default(false),
110
115
  quantity: z.number().int().default(1),
111
116
  });
112
117
 
@@ -7,7 +7,7 @@ import * as openEnums from "../types/enums.js";
7
7
  import { OpenEnum } from "../types/enums.js";
8
8
 
9
9
  /**
10
- * Pricing model of a price as returned by the API. Includes legacy models ('dynamic', 'volume', 'percentage') retained for existing prices; only 'standard' can be created (see PriceModelInput).
10
+ * Pricing model of a price as returned by the API. Includes the legacy models ('dynamic', 'percentage') retained for existing prices; 'standard' and 'volume' can be created (see PriceModelInput).
11
11
  */
12
12
  export const PriceModel = {
13
13
  Standard: "standard",
@@ -16,7 +16,7 @@ export const PriceModel = {
16
16
  Percentage: "percentage",
17
17
  } as const;
18
18
  /**
19
- * Pricing model of a price as returned by the API. Includes legacy models ('dynamic', 'volume', 'percentage') retained for existing prices; only 'standard' can be created (see PriceModelInput).
19
+ * Pricing model of a price as returned by the API. Includes the legacy models ('dynamic', 'percentage') retained for existing prices; 'standard' and 'volume' can be created (see PriceModelInput).
20
20
  */
21
21
  export type PriceModel = OpenEnum<typeof PriceModel>;
22
22
 
@@ -6,13 +6,14 @@ import * as z from "zod/v3";
6
6
  import { ClosedEnum } from "../types/enums.js";
7
7
 
8
8
  /**
9
- * Pricing model accepted when creating or updating a price. Only 'standard' is creatable. Percentage-style and revenue-share pricing are expressed with 'standard' plus a unit-price multiplier (e.g. 10% ⇒ unitPrice '0.1'). The legacy 'dynamic', 'volume', and 'percentage' models remain billable and readable on existing prices but can no longer be created.
9
+ * Pricing model accepted when creating or updating a price. 'standard' takes a single rate in properties.unitPrice; 'volume' takes a ladder of bands in properties.tiers. Percentage-style and revenue-share pricing are expressed with 'standard' plus a unit-price multiplier (e.g. 10% ⇒ unitPrice '0.1'). The legacy 'dynamic' and 'percentage' models remain billable and readable on existing prices but can no longer be created.
10
10
  */
11
11
  export const PriceModelInput = {
12
12
  Standard: "standard",
13
+ Volume: "volume",
13
14
  } as const;
14
15
  /**
15
- * Pricing model accepted when creating or updating a price. Only 'standard' is creatable. Percentage-style and revenue-share pricing are expressed with 'standard' plus a unit-price multiplier (e.g. 10% ⇒ unitPrice '0.1'). The legacy 'dynamic', 'volume', and 'percentage' models remain billable and readable on existing prices but can no longer be created.
16
+ * Pricing model accepted when creating or updating a price. 'standard' takes a single rate in properties.unitPrice; 'volume' takes a ladder of bands in properties.tiers. Percentage-style and revenue-share pricing are expressed with 'standard' plus a unit-price multiplier (e.g. 10% ⇒ unitPrice '0.1'). The legacy 'dynamic' and 'percentage' models remain billable and readable on existing prices but can no longer be created.
16
17
  */
17
18
  export type PriceModelInput = ClosedEnum<typeof PriceModelInput>;
18
19