@leaflow/sdk 0.128.0 → 0.129.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 (42) hide show
  1. package/dist/billing/type/order/v1/generated/models.d.ts +45 -18
  2. package/dist/billing/type/order/v1/generated/models.js +13 -8
  3. package/dist/billing/type/order/v1/generated/validators/scheduledChange.zod.d.ts +34 -0
  4. package/dist/billing/type/order/v1/generated/validators/scheduledChange.zod.js +26 -0
  5. package/dist/billing/type/order/v1/generated/validators/subscription.zod.d.ts +24 -0
  6. package/dist/billing/type/order/v1/generated/validators/subscription.zod.js +5 -0
  7. package/dist/billing/type/order/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  8. package/dist/billing/v1/generated/functions.d.ts +5 -3
  9. package/dist/billing/v1/generated/functions.js +5 -3
  10. package/dist/billing/v1/generated/models.d.ts +49 -18
  11. package/dist/billing/v1/generated/models.js +13 -8
  12. package/dist/billing/v1/generated/schemas.zod.d.ts +6 -3
  13. package/dist/billing/v1/generated/schemas.zod.js +9 -3
  14. package/dist/billing/v1/generated/validators/listInvoicesParams.zod.d.ts +1 -0
  15. package/dist/billing/v1/generated/validators/listInvoicesParams.zod.js +1 -0
  16. package/dist/billing/v1/generated/validators/scheduledChange.zod.d.ts +34 -0
  17. package/dist/billing/v1/generated/validators/scheduledChange.zod.js +26 -0
  18. package/dist/billing/v1/generated/validators/subscription.zod.d.ts +24 -0
  19. package/dist/billing/v1/generated/validators/subscription.zod.js +5 -0
  20. package/dist/billing/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  21. package/dist/canopy/v1/generated/models.d.ts +45 -18
  22. package/dist/canopy/v1/generated/models.js +13 -8
  23. package/dist/canopy/v1/generated/validators/scheduledChange.zod.d.ts +57 -0
  24. package/dist/canopy/v1/generated/validators/scheduledChange.zod.js +49 -0
  25. package/dist/canopy/v1/generated/validators/subscription.zod.d.ts +24 -0
  26. package/dist/canopy/v1/generated/validators/subscription.zod.js +5 -0
  27. package/dist/canopy/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  28. package/dist/compute/v1/generated/models.d.ts +45 -18
  29. package/dist/compute/v1/generated/models.js +13 -8
  30. package/dist/compute/v1/generated/validators/scheduledChange.zod.d.ts +50 -0
  31. package/dist/compute/v1/generated/validators/scheduledChange.zod.js +42 -0
  32. package/dist/compute/v1/generated/validators/subscription.zod.d.ts +24 -0
  33. package/dist/compute/v1/generated/validators/subscription.zod.js +5 -0
  34. package/dist/compute/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  35. package/dist/membership/v1/generated/models.d.ts +45 -18
  36. package/dist/membership/v1/generated/models.js +13 -8
  37. package/dist/membership/v1/generated/validators/scheduledChange.zod.d.ts +34 -0
  38. package/dist/membership/v1/generated/validators/scheduledChange.zod.js +26 -0
  39. package/dist/membership/v1/generated/validators/subscription.zod.d.ts +24 -0
  40. package/dist/membership/v1/generated/validators/subscription.zod.js +5 -0
  41. package/dist/membership/v1/generated/validators/subscriptionList.zod.d.ts +24 -0
  42. package/package.json +1 -1
@@ -1803,6 +1803,49 @@ export declare const SubscriptionInterval: {
1803
1803
  readonly month: "month";
1804
1804
  readonly year: "year";
1805
1805
  };
1806
+ /**
1807
+ * Follows the items. `pending` is not yet accepted and may be unpaid or paid; its invoice shows
1808
+ * whether payment is still needed, and it can expire or be canceled. `accepted` is accepted with items still
1809
+ * being set up. `completed` means every item was set up. `partially_completed` means some items were set up
1810
+ * and the others failed or were canceled and were refunded to their original payment sources. `failed` means
1811
+ * no item was delivered and at least one failed; collected amounts for the undelivered items are refunded.
1812
+ * `canceled` means every item was withdrawn without delivery; collected amounts are returned to their original
1813
+ * payment sources. No status establishes service delivery by itself.
1814
+ */
1815
+ export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
1816
+ export declare const OrderStatus: {
1817
+ readonly pending: "pending";
1818
+ readonly accepted: "accepted";
1819
+ readonly completed: "completed";
1820
+ readonly partially_completed: "partially_completed";
1821
+ readonly failed: "failed";
1822
+ readonly canceled: "canceled";
1823
+ };
1824
+ export type ScheduledChangeInterval = (typeof ScheduledChangeInterval)[keyof typeof ScheduledChangeInterval];
1825
+ export declare const ScheduledChangeInterval: {
1826
+ readonly day: "day";
1827
+ readonly month: "month";
1828
+ readonly year: "year";
1829
+ };
1830
+ /**
1831
+ * The next accepted period-end change for a subscription. It describes the target terms and does not change the current subscription until effective_at.
1832
+ */
1833
+ export interface ScheduledChange {
1834
+ order_id: string;
1835
+ status: OrderStatus;
1836
+ /** When the target terms take effect, normally the end of the current paid period. */
1837
+ effective_at: string;
1838
+ plan_id: string;
1839
+ plan_name: string;
1840
+ price_id: string;
1841
+ quantity: string;
1842
+ /** The target prepaid renewal amount before tax. */
1843
+ recurring_amount: string;
1844
+ currency: string;
1845
+ interval: ScheduledChangeInterval;
1846
+ /** @minimum 1 */
1847
+ interval_count: number;
1848
+ }
1806
1849
  /**
1807
1850
  * pending means the purchase relationship exists but its order has not been accepted.
1808
1851
  * provisioning means the service accepted the order and is delivering. For a service-owned
@@ -1867,6 +1910,8 @@ export interface Subscription {
1867
1910
  suspend_reason?: string;
1868
1911
  billing_cycle_anchor?: string;
1869
1912
  cancellation?: SubscriptionCancellation;
1913
+ /** The accepted period-end change currently scheduled for this subscription. Null when no such change exists. */
1914
+ scheduled_change?: ScheduledChange | null;
1870
1915
  /**
1871
1916
  * The saved payment method automatic renewal charges after the account's balance and credits,
1872
1917
  * before the account's default payment method. Set when the purchase, a renewal or a change is paid with a
@@ -2043,24 +2088,6 @@ export interface RenewalOrderRequest {
2043
2088
  export interface AutoRenewSet {
2044
2089
  auto_renew: boolean;
2045
2090
  }
2046
- /**
2047
- * Follows the items. `pending` is not yet accepted and may be unpaid or paid; its invoice shows
2048
- * whether payment is still needed, and it can expire or be canceled. `accepted` is accepted with items still
2049
- * being set up. `completed` means every item was set up. `partially_completed` means some items were set up
2050
- * and the others failed or were canceled and were refunded to their original payment sources. `failed` means
2051
- * no item was delivered and at least one failed; collected amounts for the undelivered items are refunded.
2052
- * `canceled` means every item was withdrawn without delivery; collected amounts are returned to their original
2053
- * payment sources. No status establishes service delivery by itself.
2054
- */
2055
- export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
2056
- export declare const OrderStatus: {
2057
- readonly pending: "pending";
2058
- readonly accepted: "accepted";
2059
- readonly completed: "completed";
2060
- readonly partially_completed: "partially_completed";
2061
- readonly failed: "failed";
2062
- readonly canceled: "canceled";
2063
- };
2064
2091
  /**
2065
2092
  * `pending` is waiting to be set up. `completed` was confirmed by the service.
2066
2093
  * `failed` was not set up and its amount was refunded to the original payment sources.
@@ -210,6 +210,19 @@ export const SubscriptionInterval = {
210
210
  month: "month",
211
211
  year: "year",
212
212
  };
213
+ export const OrderStatus = {
214
+ pending: "pending",
215
+ accepted: "accepted",
216
+ completed: "completed",
217
+ partially_completed: "partially_completed",
218
+ failed: "failed",
219
+ canceled: "canceled",
220
+ };
221
+ export const ScheduledChangeInterval = {
222
+ day: "day",
223
+ month: "month",
224
+ year: "year",
225
+ };
213
226
  export const SubscriptionStatus = {
214
227
  pending: "pending",
215
228
  provisioning: "provisioning",
@@ -233,14 +246,6 @@ export const RenewalOrderRequestInterval = {
233
246
  month: "month",
234
247
  year: "year",
235
248
  };
236
- export const OrderStatus = {
237
- pending: "pending",
238
- accepted: "accepted",
239
- completed: "completed",
240
- partially_completed: "partially_completed",
241
- failed: "failed",
242
- canceled: "canceled",
243
- };
244
249
  export const OrderItemStatus = {
245
250
  pending: "pending",
246
251
  completed: "completed",
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Billing Order Types
5
+ * The Billing order a product purchase placed. Types only; this document declares no operations.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const ScheduledChange: zod.ZodObject<{
10
+ order_id: zod.ZodUUID;
11
+ status: zod.ZodEnum<{
12
+ pending: "pending";
13
+ completed: "completed";
14
+ failed: "failed";
15
+ canceled: "canceled";
16
+ accepted: "accepted";
17
+ partially_completed: "partially_completed";
18
+ }>;
19
+ effective_at: zod.z.ZodISODateTime;
20
+ plan_id: zod.ZodUUID;
21
+ plan_name: zod.ZodString;
22
+ price_id: zod.ZodUUID;
23
+ quantity: zod.ZodString;
24
+ recurring_amount: zod.ZodString;
25
+ currency: zod.ZodString;
26
+ interval: zod.ZodEnum<{
27
+ day: "day";
28
+ month: "month";
29
+ year: "year";
30
+ }>;
31
+ interval_count: zod.ZodInt;
32
+ }, zod.z.core.$strict>;
33
+ export type ScheduledChange = zod.input<typeof ScheduledChange>;
34
+ export type ScheduledChangeOutput = zod.output<typeof ScheduledChange>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Billing Order Types
5
+ * The Billing order a product purchase placed. Types only; this document declares no operations.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { OrderStatus } from "./orderStatus.zod.js";
10
+ export const ScheduledChange = zod
11
+ .strictObject({
12
+ order_id: zod.uuid(),
13
+ status: OrderStatus,
14
+ effective_at: zod.iso
15
+ .datetime({ offset: true })
16
+ .describe("When the target terms take effect, normally the end of the current paid period."),
17
+ plan_id: zod.uuid(),
18
+ plan_name: zod.string(),
19
+ price_id: zod.uuid(),
20
+ quantity: zod.string(),
21
+ recurring_amount: zod.string().describe("The target prepaid renewal amount before tax."),
22
+ currency: zod.string(),
23
+ interval: zod.enum(["day", "month", "year"]),
24
+ interval_count: zod.int().min(1),
25
+ })
26
+ .describe("The next accepted period-end change for a subscription. It describes the target terms and does not change the current subscription until effective_at.");
@@ -68,6 +68,30 @@ export declare const Subscription: zod.ZodObject<{
68
68
  failure_code: zod.ZodOptional<zod.ZodString>;
69
69
  failure_reason: zod.ZodOptional<zod.ZodString>;
70
70
  }, zod.z.core.$strict>>;
71
+ scheduled_change: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
72
+ order_id: zod.ZodUUID;
73
+ status: zod.ZodEnum<{
74
+ pending: "pending";
75
+ completed: "completed";
76
+ failed: "failed";
77
+ canceled: "canceled";
78
+ accepted: "accepted";
79
+ partially_completed: "partially_completed";
80
+ }>;
81
+ effective_at: zod.z.ZodISODateTime;
82
+ plan_id: zod.ZodUUID;
83
+ plan_name: zod.ZodString;
84
+ price_id: zod.ZodUUID;
85
+ quantity: zod.ZodString;
86
+ recurring_amount: zod.ZodString;
87
+ currency: zod.ZodString;
88
+ interval: zod.ZodEnum<{
89
+ day: "day";
90
+ month: "month";
91
+ year: "year";
92
+ }>;
93
+ interval_count: zod.ZodInt;
94
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
71
95
  default_payment_method_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
72
96
  created_at: zod.ZodOptional<zod.z.ZodISODateTime>;
73
97
  id: zod.ZodUUID;
@@ -12,6 +12,7 @@ import { ObjectIdentity } from "./objectIdentity.zod.js";
12
12
  import { Product } from "./product.zod.js";
13
13
  import { ProductID } from "./productID.zod.js";
14
14
  import { RefundPolicy } from "./refundPolicy.zod.js";
15
+ import { ScheduledChange } from "./scheduledChange.zod.js";
15
16
  import { SubscriptionCancellation } from "./subscriptionCancellation.zod.js";
16
17
  import { TerminationPolicy } from "./terminationPolicy.zod.js";
17
18
  export const subscriptionDiscountedRenewalsRemainingMin = 0;
@@ -41,6 +42,10 @@ export const Subscription = zod
41
42
  suspend_reason: zod.string().optional(),
42
43
  billing_cycle_anchor: zod.iso.datetime({ offset: true }).optional(),
43
44
  cancellation: SubscriptionCancellation.optional(),
45
+ scheduled_change: zod
46
+ .union([ScheduledChange, zod.null()])
47
+ .optional()
48
+ .describe("The accepted period-end change currently scheduled for this subscription. Null when no such change exists."),
44
49
  default_payment_method_id: zod
45
50
  .uuid()
46
51
  .nullish()
@@ -68,6 +68,30 @@ export declare const SubscriptionList: zod.ZodObject<{
68
68
  failure_code: zod.ZodOptional<zod.ZodString>;
69
69
  failure_reason: zod.ZodOptional<zod.ZodString>;
70
70
  }, zod.z.core.$strict>>;
71
+ scheduled_change: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
72
+ order_id: zod.ZodUUID;
73
+ status: zod.ZodEnum<{
74
+ pending: "pending";
75
+ completed: "completed";
76
+ failed: "failed";
77
+ canceled: "canceled";
78
+ accepted: "accepted";
79
+ partially_completed: "partially_completed";
80
+ }>;
81
+ effective_at: zod.z.ZodISODateTime;
82
+ plan_id: zod.ZodUUID;
83
+ plan_name: zod.ZodString;
84
+ price_id: zod.ZodUUID;
85
+ quantity: zod.ZodString;
86
+ recurring_amount: zod.ZodString;
87
+ currency: zod.ZodString;
88
+ interval: zod.ZodEnum<{
89
+ day: "day";
90
+ month: "month";
91
+ year: "year";
92
+ }>;
93
+ interval_count: zod.ZodInt;
94
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
71
95
  default_payment_method_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
72
96
  created_at: zod.ZodOptional<zod.z.ZodISODateTime>;
73
97
  id: zod.ZodUUID;
@@ -740,7 +740,7 @@ export type listInvoicesResponseError = listInvoicesResponseDefault & {
740
740
  export type listInvoicesResponse = listInvoicesResponseSuccess | listInvoicesResponseError;
741
741
  export declare const getListInvoicesUrl: (params?: ListInvoicesParams) => string;
742
742
  /**
743
- * Paginated issued invoices belonging to owned billing accounts, filtered by billing_account_id, status and creation interval. Drafts are excluded, including the draft invoice of an order awaiting payment, which is reached through its order; top-ups do not create invoices.
743
+ * Paginated issued invoices belonging to owned billing accounts, filtered by billing_account_id, subscription_id, status and creation interval. Drafts are excluded, including the draft invoice of an order awaiting payment, which is reached through its order; top-ups do not create invoices.
744
744
  * @summary List invoices
745
745
  */
746
746
  export declare const listInvoices: (params?: ListInvoicesParams, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listInvoicesResponse>;
@@ -1323,8 +1323,10 @@ export type setAutoRenewResponseError = setAutoRenewResponseDefault & {
1323
1323
  export type setAutoRenewResponse = setAutoRenewResponseSuccess | setAutoRenewResponseError;
1324
1324
  export declare const getSetAutoRenewUrl: (subscriptionId: string) => string;
1325
1325
  /**
1326
- * Controls automatic prepaid renewal. Disabling it does not shorten current_term_end and still permits
1327
- * manual renewal. A postpaid subscription always continues until it is canceled; setting it is refused with 409
1326
+ * Controls automatic prepaid renewal for an active or suspended subscription. A pending or provisioning
1327
+ * subscription cannot set this preference and returns 409 `BILLING_SUBSCRIPTION_AUTO_RENEW_INACTIVE`. Disabling it does
1328
+ * not shorten current_term_end and still permits manual renewal. A postpaid subscription always continues until it is
1329
+ * canceled; setting it is refused with 409
1328
1330
  * `BILLING_SUBSCRIPTION_AUTO_RENEW_FIXED`.
1329
1331
  *
1330
1332
  * While the subscription has an open cancellation, turning it on or off is refused with 409
@@ -820,7 +820,7 @@ export const getListInvoicesUrl = (params) => {
820
820
  : `https://billing.leaflow.cloud/api/v1/invoices`;
821
821
  };
822
822
  /**
823
- * Paginated issued invoices belonging to owned billing accounts, filtered by billing_account_id, status and creation interval. Drafts are excluded, including the draft invoice of an order awaiting payment, which is reached through its order; top-ups do not create invoices.
823
+ * Paginated issued invoices belonging to owned billing accounts, filtered by billing_account_id, subscription_id, status and creation interval. Drafts are excluded, including the draft invoice of an order awaiting payment, which is reached through its order; top-ups do not create invoices.
824
824
  * @summary List invoices
825
825
  */
826
826
  export const listInvoices = async (params, options, fetchFn) => {
@@ -1460,8 +1460,10 @@ export const getSetAutoRenewUrl = (subscriptionId) => {
1460
1460
  return `https://billing.leaflow.cloud/api/v1/subscriptions/${encodeURIComponent(String(subscriptionId))}/auto-renew`;
1461
1461
  };
1462
1462
  /**
1463
- * Controls automatic prepaid renewal. Disabling it does not shorten current_term_end and still permits
1464
- * manual renewal. A postpaid subscription always continues until it is canceled; setting it is refused with 409
1463
+ * Controls automatic prepaid renewal for an active or suspended subscription. A pending or provisioning
1464
+ * subscription cannot set this preference and returns 409 `BILLING_SUBSCRIPTION_AUTO_RENEW_INACTIVE`. Disabling it does
1465
+ * not shorten current_term_end and still permits manual renewal. A postpaid subscription always continues until it is
1466
+ * canceled; setting it is refused with 409
1465
1467
  * `BILLING_SUBSCRIPTION_AUTO_RENEW_FIXED`.
1466
1468
  *
1467
1469
  * While the subscription has an open cancellation, turning it on or off is refused with 409
@@ -1640,6 +1640,49 @@ export declare const SubscriptionInterval: {
1640
1640
  readonly month: "month";
1641
1641
  readonly year: "year";
1642
1642
  };
1643
+ /**
1644
+ * Follows the items. `pending` is not yet accepted and may be unpaid or paid; its invoice shows
1645
+ * whether payment is still needed, and it can expire or be canceled. `accepted` is accepted with items still
1646
+ * being set up. `completed` means every item was set up. `partially_completed` means some items were set up
1647
+ * and the others failed or were canceled and were refunded to their original payment sources. `failed` means
1648
+ * no item was delivered and at least one failed; collected amounts for the undelivered items are refunded.
1649
+ * `canceled` means every item was withdrawn without delivery; collected amounts are returned to their original
1650
+ * payment sources. No status establishes service delivery by itself.
1651
+ */
1652
+ export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
1653
+ export declare const OrderStatus: {
1654
+ readonly pending: "pending";
1655
+ readonly accepted: "accepted";
1656
+ readonly completed: "completed";
1657
+ readonly partially_completed: "partially_completed";
1658
+ readonly failed: "failed";
1659
+ readonly canceled: "canceled";
1660
+ };
1661
+ export type ScheduledChangeInterval = (typeof ScheduledChangeInterval)[keyof typeof ScheduledChangeInterval];
1662
+ export declare const ScheduledChangeInterval: {
1663
+ readonly day: "day";
1664
+ readonly month: "month";
1665
+ readonly year: "year";
1666
+ };
1667
+ /**
1668
+ * The next accepted period-end change for a subscription. It describes the target terms and does not change the current subscription until effective_at.
1669
+ */
1670
+ export interface ScheduledChange {
1671
+ order_id: string;
1672
+ status: OrderStatus;
1673
+ /** When the target terms take effect, normally the end of the current paid period. */
1674
+ effective_at: string;
1675
+ plan_id: string;
1676
+ plan_name: string;
1677
+ price_id: string;
1678
+ quantity: string;
1679
+ /** The target prepaid renewal amount before tax. */
1680
+ recurring_amount: string;
1681
+ currency: string;
1682
+ interval: ScheduledChangeInterval;
1683
+ /** @minimum 1 */
1684
+ interval_count: number;
1685
+ }
1643
1686
  /**
1644
1687
  * pending means the purchase relationship exists but its order has not been accepted.
1645
1688
  * provisioning means the service accepted the order and is delivering. For a service-owned
@@ -1704,6 +1747,8 @@ export interface Subscription {
1704
1747
  suspend_reason?: string;
1705
1748
  billing_cycle_anchor?: string;
1706
1749
  cancellation?: SubscriptionCancellation;
1750
+ /** The accepted period-end change currently scheduled for this subscription. Null when no such change exists. */
1751
+ scheduled_change?: ScheduledChange | null;
1707
1752
  /**
1708
1753
  * The saved payment method automatic renewal charges after the account's balance and credits,
1709
1754
  * before the account's default payment method. Set when the purchase, a renewal or a change is paid with a
@@ -1880,24 +1925,6 @@ export interface RenewalOrderRequest {
1880
1925
  export interface AutoRenewSet {
1881
1926
  auto_renew: boolean;
1882
1927
  }
1883
- /**
1884
- * Follows the items. `pending` is not yet accepted and may be unpaid or paid; its invoice shows
1885
- * whether payment is still needed, and it can expire or be canceled. `accepted` is accepted with items still
1886
- * being set up. `completed` means every item was set up. `partially_completed` means some items were set up
1887
- * and the others failed or were canceled and were refunded to their original payment sources. `failed` means
1888
- * no item was delivered and at least one failed; collected amounts for the undelivered items are refunded.
1889
- * `canceled` means every item was withdrawn without delivery; collected amounts are returned to their original
1890
- * payment sources. No status establishes service delivery by itself.
1891
- */
1892
- export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
1893
- export declare const OrderStatus: {
1894
- readonly pending: "pending";
1895
- readonly accepted: "accepted";
1896
- readonly completed: "completed";
1897
- readonly partially_completed: "partially_completed";
1898
- readonly failed: "failed";
1899
- readonly canceled: "canceled";
1900
- };
1901
1928
  /**
1902
1929
  * `pending` is waiting to be set up. `completed` was confirmed by the service.
1903
1930
  * `failed` was not set up and its amount was refunded to the original payment sources.
@@ -3135,6 +3162,10 @@ export type ListInvoicesParams = {
3135
3162
  */
3136
3163
  billing_account_id?: AccountIdQueryParameter;
3137
3164
  status?: InvoiceStatus;
3165
+ /**
3166
+ * Only invoices containing a charge from this subscription. The returned invoice amount is the total for the whole invoice.
3167
+ */
3168
+ subscription_id?: string;
3138
3169
  from?: FromParameter;
3139
3170
  /**
3140
3171
  * Exclusive.
@@ -205,6 +205,19 @@ export const SubscriptionInterval = {
205
205
  month: "month",
206
206
  year: "year",
207
207
  };
208
+ export const OrderStatus = {
209
+ pending: "pending",
210
+ accepted: "accepted",
211
+ completed: "completed",
212
+ partially_completed: "partially_completed",
213
+ failed: "failed",
214
+ canceled: "canceled",
215
+ };
216
+ export const ScheduledChangeInterval = {
217
+ day: "day",
218
+ month: "month",
219
+ year: "year",
220
+ };
208
221
  export const SubscriptionStatus = {
209
222
  pending: "pending",
210
223
  provisioning: "provisioning",
@@ -228,14 +241,6 @@ export const RenewalOrderRequestInterval = {
228
241
  month: "month",
229
242
  year: "year",
230
243
  };
231
- export const OrderStatus = {
232
- pending: "pending",
233
- accepted: "accepted",
234
- completed: "completed",
235
- partially_completed: "partially_completed",
236
- failed: "failed",
237
- canceled: "canceled",
238
- };
239
244
  export const OrderItemStatus = {
240
245
  pending: "pending",
241
246
  completed: "completed",
@@ -433,7 +433,7 @@ export declare const PreviewPayTogetherBody: zod.ZodObject<{
433
433
  expected_amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
434
434
  }, zod.z.core.$strict>;
435
435
  /**
436
- * Paginated issued invoices belonging to owned billing accounts, filtered by billing_account_id, status and creation interval. Drafts are excluded, including the draft invoice of an order awaiting payment, which is reached through its order; top-ups do not create invoices.
436
+ * Paginated issued invoices belonging to owned billing accounts, filtered by billing_account_id, subscription_id, status and creation interval. Drafts are excluded, including the draft invoice of an order awaiting payment, which is reached through its order; top-ups do not create invoices.
437
437
  * @summary List invoices
438
438
  */
439
439
  export declare const listInvoicesQueryPageDefault = 1;
@@ -451,6 +451,7 @@ export declare const ListInvoicesQueryParams: zod.ZodObject<{
451
451
  paid: "paid";
452
452
  uncollectible: "uncollectible";
453
453
  }>>;
454
+ subscription_id: zod.ZodOptional<zod.ZodUUID>;
454
455
  from: zod.ZodOptional<zod.z.ZodISODateTime>;
455
456
  to: zod.ZodOptional<zod.z.ZodISODateTime>;
456
457
  }, zod.z.core.$strict>;
@@ -910,8 +911,10 @@ export declare const CreateRenewalOrderBody: zod.ZodObject<{
910
911
  }>>;
911
912
  }, zod.z.core.$strict>;
912
913
  /**
913
- * Controls automatic prepaid renewal. Disabling it does not shorten current_term_end and still permits
914
- * manual renewal. A postpaid subscription always continues until it is canceled; setting it is refused with 409
914
+ * Controls automatic prepaid renewal for an active or suspended subscription. A pending or provisioning
915
+ * subscription cannot set this preference and returns 409 `BILLING_SUBSCRIPTION_AUTO_RENEW_INACTIVE`. Disabling it does
916
+ * not shorten current_term_end and still permits manual renewal. A postpaid subscription always continues until it is
917
+ * canceled; setting it is refused with 409
915
918
  * `BILLING_SUBSCRIPTION_AUTO_RENEW_FIXED`.
916
919
  *
917
920
  * While the subscription has an open cancellation, turning it on or off is refused with 409
@@ -482,7 +482,7 @@ export const PayTogetherBody = PayTogetherRequest;
482
482
  */
483
483
  export const PreviewPayTogetherBody = PayTogetherRequest;
484
484
  /**
485
- * Paginated issued invoices belonging to owned billing accounts, filtered by billing_account_id, status and creation interval. Drafts are excluded, including the draft invoice of an order awaiting payment, which is reached through its order; top-ups do not create invoices.
485
+ * Paginated issued invoices belonging to owned billing accounts, filtered by billing_account_id, subscription_id, status and creation interval. Drafts are excluded, including the draft invoice of an order awaiting payment, which is reached through its order; top-ups do not create invoices.
486
486
  * @summary List invoices
487
487
  */
488
488
  export const listInvoicesQueryPageDefault = 1;
@@ -510,6 +510,10 @@ export const ListInvoicesQueryParams = zod.strictObject({
510
510
  .enum(["draft", "open", "paid", "void", "uncollectible"])
511
511
  .optional()
512
512
  .describe("A draft is not yet issued. The draft invoice of an order shows base prices until it is paid, when\nthe discount is applied and it is issued; other drafts are private to administrators.\nAn issued invoice is open until settled; a zero-total issued invoice is immediately paid.\nUnbilled usage remains separate from invoices until it is invoiced.\nA refund does not change the status: a paid invoice stays paid, with the refunded part in\namount_refunded. void means collection has stopped and any funds received have been returned."),
513
+ subscription_id: zod
514
+ .uuid()
515
+ .optional()
516
+ .describe("Only invoices containing a charge from this subscription. The returned invoice amount is the total for the whole invoice."),
513
517
  from: zod.iso.datetime({ offset: true }).optional(),
514
518
  to: zod.iso.datetime({ offset: true }).optional().describe("Exclusive."),
515
519
  });
@@ -1018,8 +1022,10 @@ export const CreateRenewalOrderParams = zod.strictObject({
1018
1022
  });
1019
1023
  export const CreateRenewalOrderBody = RenewalOrderRequest;
1020
1024
  /**
1021
- * Controls automatic prepaid renewal. Disabling it does not shorten current_term_end and still permits
1022
- * manual renewal. A postpaid subscription always continues until it is canceled; setting it is refused with 409
1025
+ * Controls automatic prepaid renewal for an active or suspended subscription. A pending or provisioning
1026
+ * subscription cannot set this preference and returns 409 `BILLING_SUBSCRIPTION_AUTO_RENEW_INACTIVE`. Disabling it does
1027
+ * not shorten current_term_end and still permits manual renewal. A postpaid subscription always continues until it is
1028
+ * canceled; setting it is refused with 409
1023
1029
  * `BILLING_SUBSCRIPTION_AUTO_RENEW_FIXED`.
1024
1030
  *
1025
1031
  * While the subscription has an open cancellation, turning it on or off is refused with 409
@@ -21,6 +21,7 @@ export declare const ListInvoicesParams: zod.ZodObject<{
21
21
  paid: "paid";
22
22
  uncollectible: "uncollectible";
23
23
  }>>;
24
+ subscription_id: zod.ZodOptional<zod.ZodUUID>;
24
25
  from: zod.ZodOptional<zod.z.ZodISODateTime>;
25
26
  to: zod.ZodOptional<zod.z.ZodISODateTime>;
26
27
  }, zod.z.core.$strict>;
@@ -20,6 +20,7 @@ export const ListInvoicesParams = zod.strictObject({
20
20
  .default(listInvoicesParamsPageSizeDefault),
21
21
  billing_account_id: zod.int().optional(),
22
22
  status: InvoiceStatus.optional(),
23
+ subscription_id: zod.uuid().optional(),
23
24
  from: zod.iso.datetime({ offset: true }).optional(),
24
25
  to: zod.iso.datetime({ offset: true }).optional(),
25
26
  });
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Financial operations require an account access token and billing-account authorization. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const ScheduledChange: zod.ZodObject<{
10
+ order_id: zod.ZodUUID;
11
+ status: zod.ZodEnum<{
12
+ pending: "pending";
13
+ completed: "completed";
14
+ failed: "failed";
15
+ canceled: "canceled";
16
+ accepted: "accepted";
17
+ partially_completed: "partially_completed";
18
+ }>;
19
+ effective_at: zod.z.ZodISODateTime;
20
+ plan_id: zod.ZodUUID;
21
+ plan_name: zod.ZodString;
22
+ price_id: zod.ZodUUID;
23
+ quantity: zod.ZodString;
24
+ recurring_amount: zod.ZodString;
25
+ currency: zod.ZodString;
26
+ interval: zod.ZodEnum<{
27
+ day: "day";
28
+ month: "month";
29
+ year: "year";
30
+ }>;
31
+ interval_count: zod.ZodInt;
32
+ }, zod.z.core.$strict>;
33
+ export type ScheduledChange = zod.input<typeof ScheduledChange>;
34
+ export type ScheduledChangeOutput = zod.output<typeof ScheduledChange>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Financial operations require an account access token and billing-account authorization. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { OrderStatus } from "./orderStatus.zod.js";
10
+ export const ScheduledChange = zod
11
+ .strictObject({
12
+ order_id: zod.uuid(),
13
+ status: OrderStatus,
14
+ effective_at: zod.iso
15
+ .datetime({ offset: true })
16
+ .describe("When the target terms take effect, normally the end of the current paid period."),
17
+ plan_id: zod.uuid(),
18
+ plan_name: zod.string(),
19
+ price_id: zod.uuid(),
20
+ quantity: zod.string(),
21
+ recurring_amount: zod.string().describe("The target prepaid renewal amount before tax."),
22
+ currency: zod.string(),
23
+ interval: zod.enum(["day", "month", "year"]),
24
+ interval_count: zod.int().min(1),
25
+ })
26
+ .describe("The next accepted period-end change for a subscription. It describes the target terms and does not change the current subscription until effective_at.");
@@ -68,6 +68,30 @@ export declare const Subscription: zod.ZodObject<{
68
68
  failure_code: zod.ZodOptional<zod.ZodString>;
69
69
  failure_reason: zod.ZodOptional<zod.ZodString>;
70
70
  }, zod.z.core.$strict>>;
71
+ scheduled_change: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
72
+ order_id: zod.ZodUUID;
73
+ status: zod.ZodEnum<{
74
+ pending: "pending";
75
+ completed: "completed";
76
+ failed: "failed";
77
+ canceled: "canceled";
78
+ accepted: "accepted";
79
+ partially_completed: "partially_completed";
80
+ }>;
81
+ effective_at: zod.z.ZodISODateTime;
82
+ plan_id: zod.ZodUUID;
83
+ plan_name: zod.ZodString;
84
+ price_id: zod.ZodUUID;
85
+ quantity: zod.ZodString;
86
+ recurring_amount: zod.ZodString;
87
+ currency: zod.ZodString;
88
+ interval: zod.ZodEnum<{
89
+ day: "day";
90
+ month: "month";
91
+ year: "year";
92
+ }>;
93
+ interval_count: zod.ZodInt;
94
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
71
95
  default_payment_method_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
72
96
  created_at: zod.ZodOptional<zod.z.ZodISODateTime>;
73
97
  id: zod.ZodUUID;
@@ -12,6 +12,7 @@ import { ObjectIdentity } from "./objectIdentity.zod.js";
12
12
  import { Product } from "./product.zod.js";
13
13
  import { ProductID } from "./productID.zod.js";
14
14
  import { RefundPolicy } from "./refundPolicy.zod.js";
15
+ import { ScheduledChange } from "./scheduledChange.zod.js";
15
16
  import { SubscriptionCancellation } from "./subscriptionCancellation.zod.js";
16
17
  import { TerminationPolicy } from "./terminationPolicy.zod.js";
17
18
  export const subscriptionDiscountedRenewalsRemainingMin = 0;
@@ -41,6 +42,10 @@ export const Subscription = zod
41
42
  suspend_reason: zod.string().optional(),
42
43
  billing_cycle_anchor: zod.iso.datetime({ offset: true }).optional(),
43
44
  cancellation: SubscriptionCancellation.optional(),
45
+ scheduled_change: zod
46
+ .union([ScheduledChange, zod.null()])
47
+ .optional()
48
+ .describe("The accepted period-end change currently scheduled for this subscription. Null when no such change exists."),
44
49
  default_payment_method_id: zod
45
50
  .uuid()
46
51
  .nullish()