@paygentic/sdk 0.9.11 → 0.9.12

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 (108) hide show
  1. package/README.md +6 -0
  2. package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts +3 -2
  3. package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts.map +1 -1
  4. package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.js +3 -3
  5. package/dist/commonjs/funcs/subscriptionsDeleteSubscriptionAdjustment.js.map +1 -1
  6. package/dist/commonjs/lib/config.d.ts +2 -2
  7. package/dist/commonjs/lib/config.js +2 -2
  8. package/dist/commonjs/models/createmaximumquantityadjustment.d.ts +45 -0
  9. package/dist/commonjs/models/createmaximumquantityadjustment.d.ts.map +1 -0
  10. package/dist/commonjs/models/createmaximumquantityadjustment.js +55 -0
  11. package/dist/commonjs/models/createmaximumquantityadjustment.js.map +1 -0
  12. package/dist/commonjs/models/createminimumquantityadjustment.d.ts +45 -0
  13. package/dist/commonjs/models/createminimumquantityadjustment.d.ts.map +1 -0
  14. package/dist/commonjs/models/createminimumquantityadjustment.js +55 -0
  15. package/dist/commonjs/models/createminimumquantityadjustment.js.map +1 -0
  16. package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts +5 -3
  17. package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts.map +1 -1
  18. package/dist/commonjs/models/createsubscriptionadjustmentrequest.js +4 -0
  19. package/dist/commonjs/models/createsubscriptionadjustmentrequest.js.map +1 -1
  20. package/dist/commonjs/models/currencybreakdownentry.d.ts +1 -1
  21. package/dist/commonjs/models/grouptrendentry.d.ts +1 -1
  22. package/dist/commonjs/models/index.d.ts +2 -0
  23. package/dist/commonjs/models/index.d.ts.map +1 -1
  24. package/dist/commonjs/models/index.js +2 -0
  25. package/dist/commonjs/models/index.js.map +1 -1
  26. package/dist/commonjs/models/invoicecategorysummary.d.ts +1 -1
  27. package/dist/commonjs/models/operations/createbillablemetric.d.ts +3 -3
  28. package/dist/commonjs/models/operations/createbillablemetric.d.ts.map +1 -1
  29. package/dist/commonjs/models/operations/createbillablemetric.js +1 -1
  30. package/dist/commonjs/models/operations/createbillablemetric.js.map +1 -1
  31. package/dist/commonjs/models/operations/createtestclock.d.ts +1 -1
  32. package/dist/commonjs/models/operations/updatebillablemetric.d.ts +4 -4
  33. package/dist/commonjs/models/operations/updatebillablemetric.d.ts.map +1 -1
  34. package/dist/commonjs/models/operations/updatebillablemetric.js +1 -1
  35. package/dist/commonjs/models/operations/updatebillablemetric.js.map +1 -1
  36. package/dist/commonjs/models/profitabilityrow.d.ts +1 -1
  37. package/dist/commonjs/models/revenuesummaryresponse.d.ts +2 -2
  38. package/dist/commonjs/models/revenuetrendbucket.d.ts +1 -1
  39. package/dist/commonjs/models/subscriptionadjustment.d.ts +16 -6
  40. package/dist/commonjs/models/subscriptionadjustment.d.ts.map +1 -1
  41. package/dist/commonjs/models/subscriptionadjustment.js +4 -0
  42. package/dist/commonjs/models/subscriptionadjustment.js.map +1 -1
  43. package/dist/commonjs/sdk/subscriptions.d.ts +2 -2
  44. package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
  45. package/dist/commonjs/sdk/subscriptions.js +1 -1
  46. package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts +3 -2
  47. package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.d.ts.map +1 -1
  48. package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.js +3 -3
  49. package/dist/esm/funcs/subscriptionsDeleteSubscriptionAdjustment.js.map +1 -1
  50. package/dist/esm/lib/config.d.ts +2 -2
  51. package/dist/esm/lib/config.js +2 -2
  52. package/dist/esm/models/createmaximumquantityadjustment.d.ts +45 -0
  53. package/dist/esm/models/createmaximumquantityadjustment.d.ts.map +1 -0
  54. package/dist/esm/models/createmaximumquantityadjustment.js +18 -0
  55. package/dist/esm/models/createmaximumquantityadjustment.js.map +1 -0
  56. package/dist/esm/models/createminimumquantityadjustment.d.ts +45 -0
  57. package/dist/esm/models/createminimumquantityadjustment.d.ts.map +1 -0
  58. package/dist/esm/models/createminimumquantityadjustment.js +18 -0
  59. package/dist/esm/models/createminimumquantityadjustment.js.map +1 -0
  60. package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts +5 -3
  61. package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts.map +1 -1
  62. package/dist/esm/models/createsubscriptionadjustmentrequest.js +4 -0
  63. package/dist/esm/models/createsubscriptionadjustmentrequest.js.map +1 -1
  64. package/dist/esm/models/currencybreakdownentry.d.ts +1 -1
  65. package/dist/esm/models/grouptrendentry.d.ts +1 -1
  66. package/dist/esm/models/index.d.ts +2 -0
  67. package/dist/esm/models/index.d.ts.map +1 -1
  68. package/dist/esm/models/index.js +2 -0
  69. package/dist/esm/models/index.js.map +1 -1
  70. package/dist/esm/models/invoicecategorysummary.d.ts +1 -1
  71. package/dist/esm/models/operations/createbillablemetric.d.ts +3 -3
  72. package/dist/esm/models/operations/createbillablemetric.d.ts.map +1 -1
  73. package/dist/esm/models/operations/createbillablemetric.js +1 -1
  74. package/dist/esm/models/operations/createbillablemetric.js.map +1 -1
  75. package/dist/esm/models/operations/createtestclock.d.ts +1 -1
  76. package/dist/esm/models/operations/updatebillablemetric.d.ts +4 -4
  77. package/dist/esm/models/operations/updatebillablemetric.d.ts.map +1 -1
  78. package/dist/esm/models/operations/updatebillablemetric.js +1 -1
  79. package/dist/esm/models/operations/updatebillablemetric.js.map +1 -1
  80. package/dist/esm/models/profitabilityrow.d.ts +1 -1
  81. package/dist/esm/models/revenuesummaryresponse.d.ts +2 -2
  82. package/dist/esm/models/revenuetrendbucket.d.ts +1 -1
  83. package/dist/esm/models/subscriptionadjustment.d.ts +16 -6
  84. package/dist/esm/models/subscriptionadjustment.d.ts.map +1 -1
  85. package/dist/esm/models/subscriptionadjustment.js +4 -0
  86. package/dist/esm/models/subscriptionadjustment.js.map +1 -1
  87. package/dist/esm/sdk/subscriptions.d.ts +2 -2
  88. package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
  89. package/dist/esm/sdk/subscriptions.js +1 -1
  90. package/jsr.json +1 -1
  91. package/package.json +1 -1
  92. package/src/funcs/subscriptionsDeleteSubscriptionAdjustment.ts +7 -6
  93. package/src/lib/config.ts +2 -2
  94. package/src/models/createmaximumquantityadjustment.ts +72 -0
  95. package/src/models/createminimumquantityadjustment.ts +72 -0
  96. package/src/models/createsubscriptionadjustmentrequest.ts +19 -3
  97. package/src/models/currencybreakdownentry.ts +1 -1
  98. package/src/models/grouptrendentry.ts +1 -1
  99. package/src/models/index.ts +2 -0
  100. package/src/models/invoicecategorysummary.ts +1 -1
  101. package/src/models/operations/createbillablemetric.ts +4 -4
  102. package/src/models/operations/createtestclock.ts +1 -1
  103. package/src/models/operations/updatebillablemetric.ts +5 -5
  104. package/src/models/profitabilityrow.ts +1 -1
  105. package/src/models/revenuesummaryresponse.ts +2 -2
  106. package/src/models/revenuetrendbucket.ts +1 -1
  107. package/src/models/subscriptionadjustment.ts +18 -6
  108. package/src/sdk/subscriptions.ts +2 -2
@@ -17,7 +17,7 @@ export type GroupTrendEntry = {
17
17
  */
18
18
  groupLabel: string;
19
19
  /**
20
- * Total issued invoice amount in dollars for this group in this bucket
20
+ * Total issued invoice amount in dollars for this group in this bucket, excluding tax
21
21
  */
22
22
  issuedInvoices: string;
23
23
  };
@@ -18,6 +18,8 @@ export * from "./createapprovalrequest.js";
18
18
  export * from "./createbillingschedulerequest.js";
19
19
  export * from "./creategrantrequest.js";
20
20
  export * from "./createmanuallineitemrequest.js";
21
+ export * from "./createmaximumquantityadjustment.js";
22
+ export * from "./createminimumquantityadjustment.js";
21
23
  export * from "./createorderapprovalrequest.js";
22
24
  export * from "./createorderlineitemrequest.js";
23
25
  export * from "./createorderrequest.js";
@@ -13,7 +13,7 @@ export type InvoiceCategorySummary = {
13
13
  */
14
14
  count: number;
15
15
  /**
16
- * Total amount of invoices in this category in dollars
16
+ * Total amount of invoices in this category in dollars, including tax
17
17
  */
18
18
  amount: string;
19
19
  };
@@ -56,9 +56,9 @@ export type CreateBillableMetricRequest = {
56
56
  /**
57
57
  * CloudEvents type for meter routing. Links this billable metric to the metering service.
58
58
  */
59
- eventType?: string | undefined;
59
+ eventType: string;
60
60
  /**
61
- * JSONPath to extract a numeric value from event data. Must start with `$.` (example: `$.amount` or `$.payload.bytes`). Required for SUM/AVG/MIN/MAX/LATEST aggregations.
61
+ * JSONPath to extract a numeric value from event data. Must start with `$.` (example: `$.amount` or `$.payload.bytes`). Required for SUM/AVG/MIN/MAX/LATEST aggregations. Optional for UNIQUE_COUNT, which counts distinct values of this property when set and distinct events when not. Not stored for COUNT.
62
62
  */
63
63
  valueProperty?: string | undefined;
64
64
  /**
@@ -85,7 +85,7 @@ export type CreateBillableMetricRequest$Outbound = {
85
85
  productId?: string | undefined;
86
86
  itemId?: string | undefined;
87
87
  unit: string;
88
- eventType?: string | undefined;
88
+ eventType: string;
89
89
  valueProperty?: string | undefined;
90
90
  groupBy?: { [k: string]: string } | undefined;
91
91
  eventFrom?: string | undefined;
@@ -104,7 +104,7 @@ export const CreateBillableMetricRequest$outboundSchema: z.ZodType<
104
104
  productId: z.string().optional(),
105
105
  itemId: z.string().optional(),
106
106
  unit: z.string(),
107
- eventType: z.string().optional(),
107
+ eventType: z.string(),
108
108
  valueProperty: z.string().optional(),
109
109
  groupBy: z.record(z.string()).optional(),
110
110
  eventFrom: z.date().transform(v => v.toISOString()).optional(),
@@ -6,7 +6,7 @@ import * as z from "zod/v3";
6
6
 
7
7
  export type CreateTestClockRequest = {
8
8
  /**
9
- * Initial time for the test clock (defaults to current time). Cannot be more than 1 hour in the past to prevent accidental backdating. The 1-hour buffer accounts for clock drift and network delays.
9
+ * Initial time for the test clock (defaults to current time). May be in the past, which lets a subscription on the clock start on a past date and bill its periods as the clock advances.
10
10
  */
11
11
  currentTime?: Date | undefined;
12
12
  /**
@@ -23,11 +23,11 @@ export type UpdateBillableMetricRequestBody = {
23
23
  */
24
24
  itemId?: string | null | undefined;
25
25
  /**
26
- * CloudEvents type for meter routing.
26
+ * CloudEvents type for meter routing. Cannot be cleared: every billable metric needs one.
27
27
  */
28
- eventType?: string | null | undefined;
28
+ eventType?: string | undefined;
29
29
  /**
30
- * JSONPath to extract a numeric value from event data. Must start with `$.` (example: `$.amount` or `$.payload.bytes`).
30
+ * JSONPath to extract a numeric value from event data. Must start with `$.` (example: `$.amount` or `$.payload.bytes`). Cannot be cleared on a SUM/AVG/MIN/MAX/LATEST metric. Not stored for COUNT.
31
31
  */
32
32
  valueProperty?: string | null | undefined;
33
33
  /**
@@ -51,7 +51,7 @@ export type UpdateBillableMetricRequestBody$Outbound = {
51
51
  name?: string | undefined;
52
52
  unit?: string | undefined;
53
53
  itemId?: string | null | undefined;
54
- eventType?: string | null | undefined;
54
+ eventType?: string | undefined;
55
55
  valueProperty?: string | null | undefined;
56
56
  groupBy?: { [k: string]: string } | null | undefined;
57
57
  eventFrom?: string | null | undefined;
@@ -67,7 +67,7 @@ export const UpdateBillableMetricRequestBody$outboundSchema: z.ZodType<
67
67
  name: z.string().optional(),
68
68
  unit: z.string().optional(),
69
69
  itemId: z.nullable(z.string()).optional(),
70
- eventType: z.nullable(z.string()).optional(),
70
+ eventType: z.string().optional(),
71
71
  valueProperty: z.nullable(z.string()).optional(),
72
72
  groupBy: z.nullable(z.record(z.string())).optional(),
73
73
  eventFrom: z.nullable(z.date().transform(v => v.toISOString())).optional(),
@@ -21,7 +21,7 @@ export type ProfitabilityRow = {
21
21
  */
22
22
  customerName: string;
23
23
  /**
24
- * Net revenue (paid + outstanding) in unit currency, with two decimals.
24
+ * Revenue excluding tax (paid + outstanding invoices issued in the period), in unit currency, with two decimals.
25
25
  */
26
26
  netRevenue: string;
27
27
  /**
@@ -47,11 +47,11 @@ export type RevenueSummaryResponse = {
47
47
  */
48
48
  object: "revenue_summary";
49
49
  /**
50
- * Net collected revenue in dollars (paid invoices + completed payments), already net of non-voided refunds. Omitted when groupBy=currency is active.
50
+ * Revenue in dollars, excluding tax: invoices issued in the period plus completed payments, less non-voided refunds issued in the period. Invoices and refunds are counted excluding tax. Omitted when groupBy=currency is active.
51
51
  */
52
52
  netRevenue?: string | undefined;
53
53
  /**
54
- * Gross total of non-voided refunds (credit notes) issued in the period, in dollars. Already subtracted from netRevenue and invoice totals. Omitted when groupBy=currency is active.
54
+ * Total of non-voided refunds (credit notes) issued in the period, in dollars, including tax. netRevenue subtracts these refunds excluding tax. Omitted when groupBy=currency is active.
55
55
  */
56
56
  totalRefunds?: string | undefined;
57
57
  /**
@@ -17,7 +17,7 @@ export type RevenueTrendBucket = {
17
17
  */
18
18
  timestamp: Date;
19
19
  /**
20
- * Total amount of all invoices issued in this bucket (all statuses, by issuedAt)
20
+ * Total amount of all invoices issued in this bucket (all statuses, by issuedAt), excluding tax
21
21
  */
22
22
  issuedInvoices: string;
23
23
  /**
@@ -18,6 +18,8 @@ export type SubscriptionAdjustmentObject = ClosedEnum<
18
18
  export const SubscriptionAdjustmentType = {
19
19
  PercentageDiscount: "percentageDiscount",
20
20
  UsageDiscount: "usageDiscount",
21
+ MinimumQuantity: "minimumQuantity",
22
+ MaximumQuantity: "maximumQuantity",
21
23
  } as const;
22
24
  export type SubscriptionAdjustmentType = ClosedEnum<
23
25
  typeof SubscriptionAdjustmentType
@@ -35,27 +37,35 @@ export type SubscriptionAdjustment = {
35
37
  subscriptionId: string;
36
38
  type: SubscriptionAdjustmentType;
37
39
  /**
38
- * 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.
40
+ * The discount rate as a decimal fraction between 0 and 1. "0.35" means 35 percent. Null on every other type.
39
41
  */
40
42
  percentageDiscount: string | null;
41
43
  /**
42
- * The number of usage units taken off the targeted line's billable quantity. Null on a percentageDiscount, which carries a rate instead.
44
+ * The number of usage units taken off the targeted line's billable quantity. Null on every other type.
43
45
  */
44
46
  usageDiscount: string | null;
45
47
  /**
46
- * The prices this adjustment reduces. Exactly one metered price on a usageDiscount; empty on a percentageDiscount, which reduces every discountable charge.
48
+ * The contracted minimum quantity billed for one period of the targeted price. Null on every other type.
49
+ */
50
+ minimumQuantity: string | null;
51
+ /**
52
+ * The contracted maximum quantity billed for one period of the targeted price. Null on every other type.
53
+ */
54
+ maximumQuantity: string | null;
55
+ /**
56
+ * The prices this adjustment applies to. Exactly one price on a usageDiscount; empty on a percentageDiscount, which reduces every discountable charge. A minimumQuantity or maximumQuantity is created against exactly one price, and later lists more than one only where that charge moved to a new price — a floating subscription moving to a new plan version, or a price edit freezing the subscription's version. Every id listed is the same charge, and the bound applies to whichever one a period bills under.
47
57
  */
48
58
  targetPriceIds: Array<string>;
49
59
  /**
50
- * 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.
60
+ * Opens the window. Read per type: INCLUSIVE on a percentageDiscount, whose window is prorated by day overlap; EXCLUSIVE on a usageDiscount and on both quantity bounds, which apply to a line whose period END falls strictly after this instant.
51
61
  */
52
62
  effectiveFrom: Date;
53
63
  /**
54
- * 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.
64
+ * Closes the window, or null for never. Read per type: EXCLUSIVE on a percentageDiscount; INCLUSIVE on a usageDiscount and on both quantity bounds, which apply to a line whose period END falls on or before this instant. A delete shortens this to the end of the last period the adjustment has already been billed on.
55
65
  */
56
66
  effectiveTo: Date | null;
57
67
  /**
58
- * 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.
68
+ * The deal's own name. Shown on each discount line a percentageDiscount emits; every other type emits no line, so its description is carried here only.
59
69
  */
60
70
  description: string | null;
61
71
  createdAt: Date;
@@ -83,6 +93,8 @@ export const SubscriptionAdjustment$inboundSchema: z.ZodType<
83
93
  type: SubscriptionAdjustmentType$inboundSchema,
84
94
  percentageDiscount: z.nullable(z.string()),
85
95
  usageDiscount: z.nullable(z.string()),
96
+ minimumQuantity: z.nullable(z.string()),
97
+ maximumQuantity: z.nullable(z.string()),
86
98
  targetPriceIds: z.array(z.string()),
87
99
  effectiveFrom: z.string().datetime({ offset: true }).transform(v =>
88
100
  new Date(v)
@@ -166,12 +166,12 @@ export class Subscriptions extends ClientSDK {
166
166
  * Delete Adjustment
167
167
  *
168
168
  * @remarks
169
- * Deletes an adjustment that has not yet reached an issued invoice. No invoice changes: an invoice still in draft keeps its numbers, and loses the discount only when its period is calculated again. An adjustment that has already discounted an issued invoice cannot be deleted, because the invoice records why the customer was charged that amount. Its window cannot be shortened afterwards either, so set effectiveTo at creation time whenever the deal has a known end date.
169
+ * Stops an adjustment from applying to any period it has not already been billed on. An adjustment that has never reached an issued invoice is removed, and the response is 204. An adjustment that has already been billed on an issued invoice is RETRACTED instead: its effectiveTo moves to the end of the last period it was billed on, the adjustment still exists, and the response is 200 carrying it. Read a 200 as "shortened", not as "removed". No invoice changes either way: an issued invoice keeps its numbers, and a draft loses the adjustment only when its period is calculated again. Deleting the same adjustment again returns the same 200 and the same window.
170
170
  */
171
171
  async deleteSubscriptionAdjustment(
172
172
  request: operations.DeleteSubscriptionAdjustmentRequest,
173
173
  options?: RequestOptions,
174
- ): Promise<void> {
174
+ ): Promise<models.SubscriptionAdjustment | undefined> {
175
175
  return unwrapAsync(subscriptionsDeleteSubscriptionAdjustment(
176
176
  this,
177
177
  request,