@paygentic/sdk 0.8.0 → 0.8.1

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 (143) hide show
  1. package/README.md +5 -3
  2. package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts +19 -0
  3. package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js +125 -0
  5. package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -0
  6. package/dist/commonjs/lib/config.d.ts +2 -2
  7. package/dist/commonjs/lib/config.js +2 -2
  8. package/dist/commonjs/models/index.d.ts +6 -0
  9. package/dist/commonjs/models/index.d.ts.map +1 -1
  10. package/dist/commonjs/models/index.js +6 -0
  11. package/dist/commonjs/models/index.js.map +1 -1
  12. package/dist/commonjs/models/invoice.d.ts +4 -4
  13. package/dist/commonjs/models/invoice.d.ts.map +1 -1
  14. package/dist/commonjs/models/invoice.js +7 -6
  15. package/dist/commonjs/models/invoice.js.map +1 -1
  16. package/dist/commonjs/models/operations/createplan.d.ts +8 -2
  17. package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
  18. package/dist/commonjs/models/operations/createplan.js +4 -1
  19. package/dist/commonjs/models/operations/createplan.js.map +1 -1
  20. package/dist/commonjs/models/operations/index.d.ts +1 -0
  21. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  22. package/dist/commonjs/models/operations/index.js +1 -0
  23. package/dist/commonjs/models/operations/index.js.map +1 -1
  24. package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.d.ts +30 -0
  25. package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.d.ts.map +1 -0
  26. package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.js +63 -0
  27. package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.js.map +1 -0
  28. package/dist/commonjs/models/operations/updateplan.d.ts +6 -0
  29. package/dist/commonjs/models/operations/updateplan.d.ts.map +1 -1
  30. package/dist/commonjs/models/operations/updateplan.js +3 -0
  31. package/dist/commonjs/models/operations/updateplan.js.map +1 -1
  32. package/dist/commonjs/models/plan.d.ts +5 -0
  33. package/dist/commonjs/models/plan.d.ts.map +1 -1
  34. package/dist/commonjs/models/plan.js +2 -0
  35. package/dist/commonjs/models/plan.js.map +1 -1
  36. package/dist/commonjs/models/plancreditallocation.d.ts +30 -0
  37. package/dist/commonjs/models/plancreditallocation.d.ts.map +1 -0
  38. package/dist/commonjs/models/plancreditallocation.js +62 -0
  39. package/dist/commonjs/models/plancreditallocation.js.map +1 -0
  40. package/dist/commonjs/models/reconciledfeatureadded.d.ts +15 -0
  41. package/dist/commonjs/models/reconciledfeatureadded.d.ts.map +1 -0
  42. package/dist/commonjs/models/reconciledfeatureadded.js +52 -0
  43. package/dist/commonjs/models/reconciledfeatureadded.js.map +1 -0
  44. package/dist/commonjs/models/reconciledfeaturefailed.d.ts +29 -0
  45. package/dist/commonjs/models/reconciledfeaturefailed.d.ts.map +1 -0
  46. package/dist/commonjs/models/reconciledfeaturefailed.js +62 -0
  47. package/dist/commonjs/models/reconciledfeaturefailed.js.map +1 -0
  48. package/dist/commonjs/models/reconciledfeatureremoved.d.ts +11 -0
  49. package/dist/commonjs/models/reconciledfeatureremoved.d.ts.map +1 -0
  50. package/dist/commonjs/models/reconciledfeatureremoved.js +51 -0
  51. package/dist/commonjs/models/reconciledfeatureremoved.js.map +1 -0
  52. package/dist/commonjs/models/reconciledfeatureskipped.d.ts +11 -0
  53. package/dist/commonjs/models/reconciledfeatureskipped.d.ts.map +1 -0
  54. package/dist/commonjs/models/reconciledfeatureskipped.js +51 -0
  55. package/dist/commonjs/models/reconciledfeatureskipped.js.map +1 -0
  56. package/dist/commonjs/models/subscriptionreconciliation.d.ts +62 -0
  57. package/dist/commonjs/models/subscriptionreconciliation.d.ts.map +1 -0
  58. package/dist/commonjs/models/subscriptionreconciliation.js +83 -0
  59. package/dist/commonjs/models/subscriptionreconciliation.js.map +1 -0
  60. package/dist/commonjs/sdk/subscriptions.d.ts +7 -0
  61. package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
  62. package/dist/commonjs/sdk/subscriptions.js +10 -0
  63. package/dist/commonjs/sdk/subscriptions.js.map +1 -1
  64. package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts +19 -0
  65. package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts.map +1 -0
  66. package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js +89 -0
  67. package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -0
  68. package/dist/esm/lib/config.d.ts +2 -2
  69. package/dist/esm/lib/config.js +2 -2
  70. package/dist/esm/models/index.d.ts +6 -0
  71. package/dist/esm/models/index.d.ts.map +1 -1
  72. package/dist/esm/models/index.js +6 -0
  73. package/dist/esm/models/index.js.map +1 -1
  74. package/dist/esm/models/invoice.d.ts +4 -4
  75. package/dist/esm/models/invoice.d.ts.map +1 -1
  76. package/dist/esm/models/invoice.js +5 -4
  77. package/dist/esm/models/invoice.js.map +1 -1
  78. package/dist/esm/models/operations/createplan.d.ts +8 -2
  79. package/dist/esm/models/operations/createplan.d.ts.map +1 -1
  80. package/dist/esm/models/operations/createplan.js +4 -1
  81. package/dist/esm/models/operations/createplan.js.map +1 -1
  82. package/dist/esm/models/operations/index.d.ts +1 -0
  83. package/dist/esm/models/operations/index.d.ts.map +1 -1
  84. package/dist/esm/models/operations/index.js +1 -0
  85. package/dist/esm/models/operations/index.js.map +1 -1
  86. package/dist/esm/models/operations/reconcilesubscriptionfeatures.d.ts +30 -0
  87. package/dist/esm/models/operations/reconcilesubscriptionfeatures.d.ts.map +1 -0
  88. package/dist/esm/models/operations/reconcilesubscriptionfeatures.js +25 -0
  89. package/dist/esm/models/operations/reconcilesubscriptionfeatures.js.map +1 -0
  90. package/dist/esm/models/operations/updateplan.d.ts +6 -0
  91. package/dist/esm/models/operations/updateplan.d.ts.map +1 -1
  92. package/dist/esm/models/operations/updateplan.js +3 -0
  93. package/dist/esm/models/operations/updateplan.js.map +1 -1
  94. package/dist/esm/models/plan.d.ts +5 -0
  95. package/dist/esm/models/plan.d.ts.map +1 -1
  96. package/dist/esm/models/plan.js +2 -0
  97. package/dist/esm/models/plan.js.map +1 -1
  98. package/dist/esm/models/plancreditallocation.d.ts +30 -0
  99. package/dist/esm/models/plancreditallocation.d.ts.map +1 -0
  100. package/dist/esm/models/plancreditallocation.js +24 -0
  101. package/dist/esm/models/plancreditallocation.js.map +1 -0
  102. package/dist/esm/models/reconciledfeatureadded.d.ts +15 -0
  103. package/dist/esm/models/reconciledfeatureadded.d.ts.map +1 -0
  104. package/dist/esm/models/reconciledfeatureadded.js +15 -0
  105. package/dist/esm/models/reconciledfeatureadded.js.map +1 -0
  106. package/dist/esm/models/reconciledfeaturefailed.d.ts +29 -0
  107. package/dist/esm/models/reconciledfeaturefailed.d.ts.map +1 -0
  108. package/dist/esm/models/reconciledfeaturefailed.js +25 -0
  109. package/dist/esm/models/reconciledfeaturefailed.js.map +1 -0
  110. package/dist/esm/models/reconciledfeatureremoved.d.ts +11 -0
  111. package/dist/esm/models/reconciledfeatureremoved.d.ts.map +1 -0
  112. package/dist/esm/models/reconciledfeatureremoved.js +14 -0
  113. package/dist/esm/models/reconciledfeatureremoved.js.map +1 -0
  114. package/dist/esm/models/reconciledfeatureskipped.d.ts +11 -0
  115. package/dist/esm/models/reconciledfeatureskipped.d.ts.map +1 -0
  116. package/dist/esm/models/reconciledfeatureskipped.js +14 -0
  117. package/dist/esm/models/reconciledfeatureskipped.js.map +1 -0
  118. package/dist/esm/models/subscriptionreconciliation.d.ts +62 -0
  119. package/dist/esm/models/subscriptionreconciliation.d.ts.map +1 -0
  120. package/dist/esm/models/subscriptionreconciliation.js +44 -0
  121. package/dist/esm/models/subscriptionreconciliation.js.map +1 -0
  122. package/dist/esm/sdk/subscriptions.d.ts +7 -0
  123. package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
  124. package/dist/esm/sdk/subscriptions.js +10 -0
  125. package/dist/esm/sdk/subscriptions.js.map +1 -1
  126. package/jsr.json +1 -1
  127. package/package.json +1 -1
  128. package/src/funcs/subscriptionsReconcileSubscriptionFeatures.ts +184 -0
  129. package/src/lib/config.ts +2 -2
  130. package/src/models/index.ts +6 -0
  131. package/src/models/invoice.ts +10 -9
  132. package/src/models/operations/createplan.ts +11 -3
  133. package/src/models/operations/index.ts +1 -0
  134. package/src/models/operations/reconcilesubscriptionfeatures.ts +78 -0
  135. package/src/models/operations/updateplan.ts +8 -0
  136. package/src/models/plan.ts +9 -0
  137. package/src/models/plancreditallocation.ts +68 -0
  138. package/src/models/reconciledfeatureadded.ts +38 -0
  139. package/src/models/reconciledfeaturefailed.ts +55 -0
  140. package/src/models/reconciledfeatureremoved.ts +33 -0
  141. package/src/models/reconciledfeatureskipped.ts +33 -0
  142. package/src/models/subscriptionreconciliation.ts +144 -0
  143. package/src/sdk/subscriptions.ts +18 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconciledfeatureskipped.js","sourceRoot":"","sources":["../../../src/models/reconciledfeatureskipped.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAS9C,gBAAgB;AAChB,MAAM,CAAC,MAAM,sCAAsC,GAI/C,CAAC,CAAC,MAAM,CAAC;IACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAEH,MAAM,UAAU,gCAAgC,CAC9C,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,sCAAsC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAClE,sDAAsD,CACvD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,62 @@
1
+ import * as z from "zod/v3";
2
+ import { ClosedEnum } from "../types/enums.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ import { ReconciledFeatureAdded } from "./reconciledfeatureadded.js";
6
+ import { ReconciledFeatureFailed } from "./reconciledfeaturefailed.js";
7
+ import { ReconciledFeatureRemoved } from "./reconciledfeatureremoved.js";
8
+ import { ReconciledFeatureSkipped } from "./reconciledfeatureskipped.js";
9
+ export declare const SubscriptionReconciliationObject: {
10
+ readonly SubscriptionReconciliation: "subscriptionReconciliation";
11
+ };
12
+ export type SubscriptionReconciliationObject = ClosedEnum<typeof SubscriptionReconciliationObject>;
13
+ export type Features = {
14
+ added: Array<ReconciledFeatureAdded>;
15
+ /**
16
+ * Features the subscription already had an active entitlement for — left unchanged.
17
+ */
18
+ skipped: Array<ReconciledFeatureSkipped>;
19
+ /**
20
+ * Features no longer on the plan: their entitlement was canceled and grants voided so the subscription matches the plan's current features.
21
+ */
22
+ removed: Array<ReconciledFeatureRemoved>;
23
+ /**
24
+ * Features that could not be fully provisioned. Never billed by this call.
25
+ */
26
+ failed: Array<ReconciledFeatureFailed>;
27
+ };
28
+ export type SubscriptionReconciliationLineItems = {
29
+ /**
30
+ * Number of features newly billed on the subscription by this reconciliation. A dry-run preview returns the same count as the applied run.
31
+ */
32
+ created: number;
33
+ /**
34
+ * Number of features whose billing was removed from the subscription's upcoming (not-yet-invoiced) invoice because their price is no longer on the plan.
35
+ */
36
+ removed: number;
37
+ /**
38
+ * True when entitlements were provisioned successfully but the line-item synchronization step failed. Safe to retry.
39
+ */
40
+ syncFailed?: boolean | undefined;
41
+ };
42
+ export type SubscriptionReconciliation = {
43
+ object: SubscriptionReconciliationObject;
44
+ /**
45
+ * True when this reconciliation was a preview — no entitlement, grant, or line item was created.
46
+ */
47
+ dryRun: boolean;
48
+ features: Features;
49
+ lineItems: SubscriptionReconciliationLineItems;
50
+ };
51
+ /** @internal */
52
+ export declare const SubscriptionReconciliationObject$inboundSchema: z.ZodNativeEnum<typeof SubscriptionReconciliationObject>;
53
+ /** @internal */
54
+ export declare const Features$inboundSchema: z.ZodType<Features, z.ZodTypeDef, unknown>;
55
+ export declare function featuresFromJSON(jsonString: string): SafeParseResult<Features, SDKValidationError>;
56
+ /** @internal */
57
+ export declare const SubscriptionReconciliationLineItems$inboundSchema: z.ZodType<SubscriptionReconciliationLineItems, z.ZodTypeDef, unknown>;
58
+ export declare function subscriptionReconciliationLineItemsFromJSON(jsonString: string): SafeParseResult<SubscriptionReconciliationLineItems, SDKValidationError>;
59
+ /** @internal */
60
+ export declare const SubscriptionReconciliation$inboundSchema: z.ZodType<SubscriptionReconciliation, z.ZodTypeDef, unknown>;
61
+ export declare function subscriptionReconciliationFromJSON(jsonString: string): SafeParseResult<SubscriptionReconciliation, SDKValidationError>;
62
+ //# sourceMappingURL=subscriptionreconciliation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptionreconciliation.d.ts","sourceRoot":"","sources":["../../../src/models/subscriptionreconciliation.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;AACpE,OAAO,EACL,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,uBAAuB,EAExB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,wBAAwB,EAEzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,wBAAwB,EAEzB,MAAM,+BAA+B,CAAC;AAEvC,eAAO,MAAM,gCAAgC;;CAEnC,CAAC;AACX,MAAM,MAAM,gCAAgC,GAAG,U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CAAC,CAO1E;AAED,gBAAgB;AAChB,eAAO,MAAM,wCAAwC,EAAE,CAAC,CAAC,OAAO,CAC9D,0BAA0B,EAC1B,CAAC,CAAC,UAAU,EACZ,OAAO,CAMP,CAAC;AAEH,wBAAgB,kCAAkC,CAChD,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAMjE"}
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import * as z from "zod/v3";
5
+ import { safeParse } from "../lib/schemas.js";
6
+ import { ReconciledFeatureAdded$inboundSchema, } from "./reconciledfeatureadded.js";
7
+ import { ReconciledFeatureFailed$inboundSchema, } from "./reconciledfeaturefailed.js";
8
+ import { ReconciledFeatureRemoved$inboundSchema, } from "./reconciledfeatureremoved.js";
9
+ import { ReconciledFeatureSkipped$inboundSchema, } from "./reconciledfeatureskipped.js";
10
+ export const SubscriptionReconciliationObject = {
11
+ SubscriptionReconciliation: "subscriptionReconciliation",
12
+ };
13
+ /** @internal */
14
+ export const SubscriptionReconciliationObject$inboundSchema = z.nativeEnum(SubscriptionReconciliationObject);
15
+ /** @internal */
16
+ export const Features$inboundSchema = z.object({
17
+ added: z.array(ReconciledFeatureAdded$inboundSchema),
18
+ skipped: z.array(ReconciledFeatureSkipped$inboundSchema),
19
+ removed: z.array(ReconciledFeatureRemoved$inboundSchema),
20
+ failed: z.array(ReconciledFeatureFailed$inboundSchema),
21
+ });
22
+ export function featuresFromJSON(jsonString) {
23
+ return safeParse(jsonString, (x) => Features$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Features' from JSON`);
24
+ }
25
+ /** @internal */
26
+ export const SubscriptionReconciliationLineItems$inboundSchema = z.object({
27
+ created: z.number().int(),
28
+ removed: z.number().int(),
29
+ syncFailed: z.boolean().optional(),
30
+ });
31
+ export function subscriptionReconciliationLineItemsFromJSON(jsonString) {
32
+ return safeParse(jsonString, (x) => SubscriptionReconciliationLineItems$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SubscriptionReconciliationLineItems' from JSON`);
33
+ }
34
+ /** @internal */
35
+ export const SubscriptionReconciliation$inboundSchema = z.object({
36
+ object: SubscriptionReconciliationObject$inboundSchema,
37
+ dryRun: z.boolean(),
38
+ features: z.lazy(() => Features$inboundSchema),
39
+ lineItems: z.lazy(() => SubscriptionReconciliationLineItems$inboundSchema),
40
+ });
41
+ export function subscriptionReconciliationFromJSON(jsonString) {
42
+ return safeParse(jsonString, (x) => SubscriptionReconciliation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SubscriptionReconciliation' from JSON`);
43
+ }
44
+ //# sourceMappingURL=subscriptionreconciliation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptionreconciliation.js","sourceRoot":"","sources":["../../../src/models/subscriptionreconciliation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI9C,OAAO,EAEL,oCAAoC,GACrC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,qCAAqC,GACtC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,sCAAsC,GACvC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,sCAAsC,GACvC,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,0BAA0B,EAAE,4BAA4B;CAChD,CAAC;AA8CX,gBAAgB;AAChB,MAAM,CAAC,MAAM,8CAA8C,GAEvD,CAAC,CAAC,UAAU,CAAC,gCAAgC,CAAC,CAAC;AAEnD,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAI/B,CAAC,CAAC,MAAM,CAAC;IACX,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,oCAAoC,CAAC;IACpD,OAAO,EAAE,CAAC,CAAC,KAAK,CA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ACV,CAAC,CAAC,EAAE,EAAE,CAAC,wCAAwC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACpE,wDAAwD,CACzD,CAAC;AACJ,CAAC"}
@@ -35,5 +35,12 @@ export declare class Subscriptions extends ClientSDK {
35
35
  * Terminates a subscription with a required reason. This endpoint is for merchant-initiated termination only.
36
36
  */
37
37
  terminate(request: operations.TerminateSubscriptionRequest, options?: RequestOptions): Promise<models.Subscription>;
38
+ /**
39
+ * Reconcile Features
40
+ *
41
+ * @remarks
42
+ * Creates a reconciliation that converges a subscription's feature entitlements to its current plan. Provisions a missing entitlement (and, for metered features, its initial grant) for every plan feature the subscription does not already have; cancels the entitlement and voids the grants of any feature no longer on the plan; then synchronizes the corresponding prices' billing. An already-present feature is left unchanged. Restricted to active subscriptions billed on their plan's line-item schedule.
43
+ */
44
+ reconcileSubscriptionFeatures(request: operations.ReconcileSubscriptionFeaturesRequest, options?: RequestOptions): Promise<models.SubscriptionReconciliation>;
38
45
  }
39
46
  //# sourceMappingURL=subscriptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../../src/sdk/subscriptions.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,aAAc,SAAQ,SAAS;IAC1C;;OAEG;IACG,IAAI,CACR,OAAO,CAAC,EAAE,UAAU,CAAC,wBAAwB,GAAG,SAAS,EACzD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,yBAAyB,CAAC;IAQhD;;;;;OAKG;IACG,MAAM,CACV,OAAO,EAAE,UAAU,CAAC,yBAAyB,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM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,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;IAQ/B;;OAEG;IACG,kBAAkB,CACtB,OAAO,EAAE,UAAU,CAAC,yBAAyB,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;IAQ/B;;;;;OAKG;IACG,kBAAkB,CACtB,OAAO,EAAE,UAAU,CAAC,yBAAyB,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;IAQrC;;;;;OAKG;IACG,SAAS,CACb,OAAO,EAAE,UAAU,CAAC,4BAA4B,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;IAQ/B;;;;;OAKG;IACG,6BAA6B,CACjC,OAAO,EAAE,UAAU,CAAC,oCAAoC,EACxD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAAC;CAO9C"}
@@ -5,6 +5,7 @@ import { subscriptionsCreate } from "../funcs/subscriptionsCreate.js";
5
5
  import { subscriptionsGeneratePortalLink } from "../funcs/subscriptionsGeneratePortalLink.js";
6
6
  import { subscriptionsGet } from "../funcs/subscriptionsGet.js";
7
7
  import { subscriptionsList } from "../funcs/subscriptionsList.js";
8
+ import { subscriptionsReconcileSubscriptionFeatures } from "../funcs/subscriptionsReconcileSubscriptionFeatures.js";
8
9
  import { subscriptionsTerminate } from "../funcs/subscriptionsTerminate.js";
9
10
  import { subscriptionsUpdateSubscription } from "../funcs/subscriptionsUpdateSubscription.js";
10
11
  import { ClientSDK } from "../lib/sdks.js";
@@ -55,5 +56,14 @@ export class Subscriptions extends ClientSDK {
55
56
  async terminate(request, options) {
56
57
  return unwrapAsync(subscriptionsTerminate(this, request, options));
57
58
  }
59
+ /**
60
+ * Reconcile Features
61
+ *
62
+ * @remarks
63
+ * Creates a reconciliation that converges a subscription's feature entitlements to its current plan. Provisions a missing entitlement (and, for metered features, its initial grant) for every plan feature the subscription does not already have; cancels the entitlement and voids the grants of any feature no longer on the plan; then synchronizes the corresponding prices' billing. An already-present feature is left unchanged. Restricted to active subscriptions billed on their plan's line-item schedule.
64
+ */
65
+ async reconcileSubscriptionFeatures(request, options) {
66
+ return unwrapAsync(subscriptionsReconcileSubscriptionFeatures(this, request, options));
67
+ }
58
68
  }
59
69
  //# sourceMappingURL=subscriptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/sdk/subscriptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,OAAyD,EACzD,OAAwB;QAExB,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,OAA6C,EAC7C,OAAwB;QAExB,OAAO,WAAW,CAAC,mBAAmB,CACpC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CACP,OAA0C,EAC1C,OAAw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CACR,OAAyD,EACzD,OAAwB;QAExB,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,OAA6C,EAC7C,OAAwB;QAExB,OAAO,WAAW,CAAC,mBAAmB,CACpC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CACP,OAA0C,EAC1C,OAAwB;QAExB,OAAO,WAAW,CAAC,gBAAgB,CACjC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,OAA6C,EAC7C,OAAwB;QAExB,OAAO,WAAW,CAAC,+BAA+B,CAChD,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kBAAkB,CACtB,OAA6C,EAC7C,OAAwB;QAExB,OAAO,WAAW,CAAC,+BAA+B,CAChD,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CACb,OAAgD,EAChD,OAAwB;QAExB,OAAO,WAAW,CAAC,sBAAsB,CACvC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,6BAA6B,CACjC,OAAwD,EACxD,OAAwB;QAExB,OAAO,WAAW,CAAC,0CAA0C,CAC3D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@paygentic/sdk",
5
- "version": "0.8.0",
5
+ "version": "0.8.1",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paygentic/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "author": "Speakeasy",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,184 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { PaygenticCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { PaygenticError } from "../models/errors/paygenticerror.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as models from "../models/index.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Reconcile Features
31
+ *
32
+ * @remarks
33
+ * Creates a reconciliation that converges a subscription's feature entitlements to its current plan. Provisions a missing entitlement (and, for metered features, its initial grant) for every plan feature the subscription does not already have; cancels the entitlement and voids the grants of any feature no longer on the plan; then synchronizes the corresponding prices' billing. An already-present feature is left unchanged. Restricted to active subscriptions billed on their plan's line-item schedule.
34
+ */
35
+ export function subscriptionsReconcileSubscriptionFeatures(
36
+ client: PaygenticCore,
37
+ request: operations.ReconcileSubscriptionFeaturesRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ models.SubscriptionReconciliation,
42
+ | errors.BadRequest
43
+ | errors.ErrorT
44
+ | PaygenticError
45
+ | ResponseValidationError
46
+ | ConnectionError
47
+ | RequestAbortedError
48
+ | RequestTimeoutError
49
+ | InvalidRequestError
50
+ | UnexpectedClientError
51
+ | SDKValidationError
52
+ >
53
+ > {
54
+ return new APIPromise($do(
55
+ client,
56
+ request,
57
+ options,
58
+ ));
59
+ }
60
+
61
+ async function $do(
62
+ client: PaygenticCore,
63
+ request: operations.ReconcileSubscriptionFeaturesRequest,
64
+ options?: RequestOptions,
65
+ ): Promise<
66
+ [
67
+ Result<
68
+ models.SubscriptionReconciliation,
69
+ | errors.BadRequest
70
+ | errors.ErrorT
71
+ | PaygenticError
72
+ | ResponseValidationError
73
+ | ConnectionError
74
+ | RequestAbortedError
75
+ | RequestTimeoutError
76
+ | InvalidRequestError
77
+ | UnexpectedClientError
78
+ | SDKValidationError
79
+ >,
80
+ APICall,
81
+ ]
82
+ > {
83
+ const parsed = safeParse(
84
+ request,
85
+ (value) =>
86
+ operations.ReconcileSubscriptionFeaturesRequest$outboundSchema.parse(
87
+ value,
88
+ ),
89
+ "Input validation failed",
90
+ );
91
+ if (!parsed.ok) {
92
+ return [parsed, { status: "invalid" }];
93
+ }
94
+ const payload = parsed.value;
95
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
96
+
97
+ const pathParams = {
98
+ id: encodeSimple("id", payload.id, {
99
+ explode: false,
100
+ charEncoding: "percent",
101
+ }),
102
+ };
103
+ const path = pathToFunc("/v0/subscriptions/{id}/reconciliations")(pathParams);
104
+
105
+ const headers = new Headers(compactMap({
106
+ "Content-Type": "application/json",
107
+ Accept: "application/json",
108
+ }));
109
+
110
+ const secConfig = await extractSecurity(client._options.bearerAuth);
111
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
112
+ const requestSecurity = resolveGlobalSecurity(securityInput);
113
+
114
+ const context = {
115
+ options: client._options,
116
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
117
+ operationID: "reconcileSubscriptionFeatures",
118
+ oAuth2Scopes: null,
119
+
120
+ resolvedSecurity: requestSecurity,
121
+
122
+ securitySource: client._options.bearerAuth,
123
+ retryConfig: options?.retries
124
+ || client._options.retryConfig
125
+ || { strategy: "none" },
126
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
127
+ };
128
+
129
+ const requestRes = client._createRequest(context, {
130
+ security: requestSecurity,
131
+ method: "POST",
132
+ baseURL: options?.serverURL,
133
+ path: path,
134
+ headers: headers,
135
+ body: body,
136
+ userAgent: client._options.userAgent,
137
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
138
+ }, options);
139
+ if (!requestRes.ok) {
140
+ return [requestRes, { status: "invalid" }];
141
+ }
142
+ const req = requestRes.value;
143
+
144
+ const doResult = await client._do(req, {
145
+ context,
146
+ errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
147
+ retryConfig: context.retryConfig,
148
+ retryCodes: context.retryCodes,
149
+ });
150
+ if (!doResult.ok) {
151
+ return [doResult, { status: "request-error", request: req }];
152
+ }
153
+ const response = doResult.value;
154
+
155
+ const responseFields = {
156
+ HttpMeta: { Response: response, Request: req },
157
+ };
158
+
159
+ const [result] = await M.match<
160
+ models.SubscriptionReconciliation,
161
+ | errors.BadRequest
162
+ | errors.ErrorT
163
+ | PaygenticError
164
+ | ResponseValidationError
165
+ | ConnectionError
166
+ | RequestAbortedError
167
+ | RequestTimeoutError
168
+ | InvalidRequestError
169
+ | UnexpectedClientError
170
+ | SDKValidationError
171
+ >(
172
+ M.json([200, 201], models.SubscriptionReconciliation$inboundSchema),
173
+ M.jsonErr(400, errors.BadRequest$inboundSchema),
174
+ M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
175
+ M.jsonErr(500, errors.ErrorT$inboundSchema),
176
+ M.fail("4XX"),
177
+ M.fail("5XX"),
178
+ )(response, req, { extraFields: responseFields });
179
+ if (!result.ok) {
180
+ return [result, { status: "complete", request: req, response }];
181
+ }
182
+
183
+ return [result, { status: "complete", request: req, response }];
184
+ }
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.8.0",
68
+ sdkVersion: "0.8.1",
69
69
  genVersion: "2.879.13",
70
- userAgent: "speakeasy-sdk/typescript 0.8.0 2.879.13 0.1.0 @paygentic/sdk",
70
+ userAgent: "speakeasy-sdk/typescript 0.8.1 2.879.13 0.1.0 @paygentic/sdk",
71
71
  } as const;
@@ -65,6 +65,7 @@ export * from "./paymentmethod.js";
65
65
  export * from "./paymentsession.js";
66
66
  export * from "./paymentsummary.js";
67
67
  export * from "./plan.js";
68
+ export * from "./plancreditallocation.js";
68
69
  export * from "./price.js";
69
70
  export * from "./pricefeature.js";
70
71
  export * from "./pricefeatureinput.js";
@@ -77,6 +78,10 @@ export * from "./profitabilitysummaryresponse.js";
77
78
  export * from "./profitabilitytrend.js";
78
79
  export * from "./purchasegrantrequest.js";
79
80
  export * from "./purchasegrantresponse.js";
81
+ export * from "./reconciledfeatureadded.js";
82
+ export * from "./reconciledfeaturefailed.js";
83
+ export * from "./reconciledfeatureremoved.js";
84
+ export * from "./reconciledfeatureskipped.js";
80
85
  export * from "./replacescheduleintervalsrequest.js";
81
86
  export * from "./revenuesummaryresponse.js";
82
87
  export * from "./revenuetrendbucket.js";
@@ -96,6 +101,7 @@ export * from "./staticentitlementlistitem.js";
96
101
  export * from "./subscription.js";
97
102
  export * from "./subscriptionmetadata.js";
98
103
  export * from "./subscriptionportal.js";
104
+ export * from "./subscriptionreconciliation.js";
99
105
  export * from "./testclock.js";
100
106
  export * from "./updateapprovalrequest.js";
101
107
  export * from "./updatebillingschedulerequest.js";
@@ -26,7 +26,7 @@ export type InvoiceObject = ClosedEnum<typeof InvoiceObject>;
26
26
  /**
27
27
  * Line items (only present if expand=lineItems query parameter is provided)
28
28
  */
29
- export type LineItems = {
29
+ export type InvoiceLineItems = {
30
30
  /**
31
31
  * The invoice ID
32
32
  */
@@ -156,7 +156,7 @@ export type Invoice = {
156
156
  /**
157
157
  * Line items (only present if expand=lineItems query parameter is provided)
158
158
  */
159
- lineItems?: LineItems | null | undefined;
159
+ lineItems?: InvoiceLineItems | null | undefined;
160
160
  /**
161
161
  * The merchant organization ID
162
162
  */
@@ -245,8 +245,8 @@ export const InvoiceObject$inboundSchema: z.ZodNativeEnum<
245
245
  > = z.nativeEnum(InvoiceObject);
246
246
 
247
247
  /** @internal */
248
- export const LineItems$inboundSchema: z.ZodType<
249
- LineItems,
248
+ export const InvoiceLineItems$inboundSchema: z.ZodType<
249
+ InvoiceLineItems,
250
250
  z.ZodTypeDef,
251
251
  unknown
252
252
  > = z.object({
@@ -256,13 +256,13 @@ export const LineItems$inboundSchema: z.ZodType<
256
256
  totalCount: z.number().int(),
257
257
  });
258
258
 
259
- export function lineItemsFromJSON(
259
+ export function invoiceLineItemsFromJSON(
260
260
  jsonString: string,
261
- ): SafeParseResult<LineItems, SDKValidationError> {
261
+ ): SafeParseResult<InvoiceLineItems, SDKValidationError> {
262
262
  return safeParse(
263
263
  jsonString,
264
- (x) => LineItems$inboundSchema.parse(JSON.parse(x)),
265
- `Failed to parse 'LineItems' from JSON`,
264
+ (x) => InvoiceLineItems$inboundSchema.parse(JSON.parse(x)),
265
+ `Failed to parse 'InvoiceLineItems' from JSON`,
266
266
  );
267
267
  }
268
268
 
@@ -317,7 +317,8 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
317
317
  grandTotal: z.string(),
318
318
  invoiceNumber: z.nullable(z.string()).optional(),
319
319
  itemCount: z.number().int(),
320
- lineItems: z.nullable(z.lazy(() => LineItems$inboundSchema)).optional(),
320
+ lineItems: z.nullable(z.lazy(() => InvoiceLineItems$inboundSchema))
321
+ .optional(),
321
322
  merchantId: z.string(),
322
323
  metadata: z.record(z.any()).optional(),
323
324
  nextActionAt: z.nullable(
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as z from "zod/v3";
6
6
  import { ClosedEnum } from "../../types/enums.js";
7
+ import * as models from "../index.js";
7
8
 
8
9
  /**
9
10
  * ISO 8601 duration for the billing period. Takes precedence over billingInterval when both are provided.
@@ -104,7 +105,7 @@ export type CreatePlanRequest = {
104
105
  /**
105
106
  * Unique identifier for a product
106
107
  */
107
- productId?: string | undefined;
108
+ productId: string;
108
109
  /**
109
110
  * Whether tax is added on top of the price (exclusive) or included in the price (inclusive)
110
111
  */
@@ -125,6 +126,10 @@ export type CreatePlanRequest = {
125
126
  * ISO 8601 datetime reference point for billing period alignment. Must be in the past or present. When set, subscriptions created under this plan align their first billing period to the next recurrence of this anchor.
126
127
  */
127
128
  billingAnchor?: Date | null | undefined;
129
+ /**
130
+ * Credit-pool funding declarations for this plan. Each entry funds a distinct pricing unit's credit pool when a subscription to this plan activates: the allocated amount is minted as a credit grant on the customer's pool for that pricing unit, once at activation, or on a recurring basis only when that allocation explicitly sets recurrencePeriod. A plan may declare zero or more allocations; no two allocations on the same plan may target the same pricingUnitId.
131
+ */
132
+ creditAllocations?: Array<models.PlanCreditAllocation> | undefined;
128
133
  };
129
134
 
130
135
  /** @internal */
@@ -159,12 +164,13 @@ export type CreatePlanRequest$Outbound = {
159
164
  merchantId: string;
160
165
  name: string;
161
166
  prices?: Array<string> | undefined;
162
- productId?: string | undefined;
167
+ productId: string;
163
168
  taxBehavior: string;
164
169
  renewalReminderEnabled: boolean;
165
170
  renewalReminderDays: number;
166
171
  billingVersion: number;
167
172
  billingAnchor?: string | null | undefined;
173
+ creditAllocations?: Array<models.PlanCreditAllocation$Outbound> | undefined;
168
174
  };
169
175
 
170
176
  /** @internal */
@@ -183,13 +189,15 @@ export const CreatePlanRequest$outboundSchema: z.ZodType<
183
189
  merchantId: z.string(),
184
190
  name: z.string(),
185
191
  prices: z.array(z.string()).optional(),
186
- productId: z.string().optional(),
192
+ productId: z.string(),
187
193
  taxBehavior: CreatePlanTaxBehavior$outboundSchema.default("exclusive"),
188
194
  renewalReminderEnabled: z.boolean().default(true),
189
195
  renewalReminderDays: z.number().int().default(3),
190
196
  billingVersion: BillingVersion$outboundSchema.default(1),
191
197
  billingAnchor: z.nullable(z.date().transform(v => v.toISOString()))
192
198
  .optional(),
199
+ creditAllocations: z.array(models.PlanCreditAllocation$outboundSchema)
200
+ .optional(),
193
201
  });
194
202
 
195
203
  export function createPlanRequestToJSON(
@@ -105,6 +105,7 @@ export * from "./listsources.js";
105
105
  export * from "./listsubscriptions.js";
106
106
  export * from "./listtestclocks.js";
107
107
  export * from "./purchaseentitlementgrant.js";
108
+ export * from "./reconcilesubscriptionfeatures.js";
108
109
  export * from "./rejectsourceevent.js";
109
110
  export * from "./replacescheduleintervals.js";
110
111
  export * from "./terminatesubscription.js";
@@ -0,0 +1,78 @@
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
+
8
+ export type ReconcileSubscriptionFeaturesRequestBody = {
9
+ /**
10
+ * Preview the outcome without creating any entitlement, grant, or line item.
11
+ */
12
+ dryRun?: boolean | undefined;
13
+ };
14
+
15
+ export type ReconcileSubscriptionFeaturesRequest = {
16
+ /**
17
+ * The subscription ID
18
+ */
19
+ id: string;
20
+ requestBody?: ReconcileSubscriptionFeaturesRequestBody | undefined;
21
+ };
22
+
23
+ /** @internal */
24
+ export type ReconcileSubscriptionFeaturesRequestBody$Outbound = {
25
+ dryRun: boolean;
26
+ };
27
+
28
+ /** @internal */
29
+ export const ReconcileSubscriptionFeaturesRequestBody$outboundSchema: z.ZodType<
30
+ ReconcileSubscriptionFeaturesRequestBody$Outbound,
31
+ z.ZodTypeDef,
32
+ ReconcileSubscriptionFeaturesRequestBody
33
+ > = z.object({
34
+ dryRun: z.boolean().default(false),
35
+ });
36
+
37
+ export function reconcileSubscriptionFeaturesRequestBodyToJSON(
38
+ reconcileSubscriptionFeaturesRequestBody:
39
+ ReconcileSubscriptionFeaturesRequestBody,
40
+ ): string {
41
+ return JSON.stringify(
42
+ ReconcileSubscriptionFeaturesRequestBody$outboundSchema.parse(
43
+ reconcileSubscriptionFeaturesRequestBody,
44
+ ),
45
+ );
46
+ }
47
+
48
+ /** @internal */
49
+ export type ReconcileSubscriptionFeaturesRequest$Outbound = {
50
+ id: string;
51
+ RequestBody?: ReconcileSubscriptionFeaturesRequestBody$Outbound | undefined;
52
+ };
53
+
54
+ /** @internal */
55
+ export const ReconcileSubscriptionFeaturesRequest$outboundSchema: z.ZodType<
56
+ ReconcileSubscriptionFeaturesRequest$Outbound,
57
+ z.ZodTypeDef,
58
+ ReconcileSubscriptionFeaturesRequest
59
+ > = z.object({
60
+ id: z.string(),
61
+ requestBody: z.lazy(() =>
62
+ ReconcileSubscriptionFeaturesRequestBody$outboundSchema
63
+ ).optional(),
64
+ }).transform((v) => {
65
+ return remap$(v, {
66
+ requestBody: "RequestBody",
67
+ });
68
+ });
69
+
70
+ export function reconcileSubscriptionFeaturesRequestToJSON(
71
+ reconcileSubscriptionFeaturesRequest: ReconcileSubscriptionFeaturesRequest,
72
+ ): string {
73
+ return JSON.stringify(
74
+ ReconcileSubscriptionFeaturesRequest$outboundSchema.parse(
75
+ reconcileSubscriptionFeaturesRequest,
76
+ ),
77
+ );
78
+ }
@@ -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
  /**
10
11
  * ISO 8601 duration for the billing period. Takes precedence over billingInterval when both are provided.
@@ -98,6 +99,10 @@ export type UpdatePlanRequestBody = {
98
99
  * ISO 8601 datetime reference point for billing period alignment. Must be in the past or present. Set to null to clear the anchor and revert to start-time-based anchoring.
99
100
  */
100
101
  billingAnchor?: Date | null | undefined;
102
+ /**
103
+ * Credit-pool funding declarations for this plan. Each entry funds a distinct pricing unit's credit pool when a subscription to this plan activates: the allocated amount is minted as a credit grant on the customer's pool for that pricing unit, once at activation, or on a recurring basis only when that allocation explicitly sets recurrencePeriod. A plan may declare zero or more allocations; no two allocations on the same plan may target the same pricingUnitId.
104
+ */
105
+ creditAllocations?: Array<models.PlanCreditAllocation> | undefined;
101
106
  };
102
107
 
103
108
  export type UpdatePlanRequest = {
@@ -137,6 +142,7 @@ export type UpdatePlanRequestBody$Outbound = {
137
142
  renewalReminderEnabled?: boolean | undefined;
138
143
  renewalReminderDays?: number | undefined;
139
144
  billingAnchor?: string | null | undefined;
145
+ creditAllocations?: Array<models.PlanCreditAllocation$Outbound> | undefined;
140
146
  };
141
147
 
142
148
  /** @internal */
@@ -158,6 +164,8 @@ export const UpdatePlanRequestBody$outboundSchema: z.ZodType<
158
164
  renewalReminderDays: z.number().int().optional(),
159
165
  billingAnchor: z.nullable(z.date().transform(v => v.toISOString()))
160
166
  .optional(),
167
+ creditAllocations: z.array(models.PlanCreditAllocation$outboundSchema)
168
+ .optional(),
161
169
  });
162
170
 
163
171
  export function updatePlanRequestBodyToJSON(