@leaflow/sdk 0.122.0 → 0.124.0

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 (45) hide show
  1. package/dist/billing/type/order/v1/generated/models.d.ts +15 -3
  2. package/dist/billing/type/order/v1/generated/validators/accountBalance.zod.d.ts +1 -0
  3. package/dist/billing/type/order/v1/generated/validators/accountBalance.zod.js +2 -1
  4. package/dist/billing/type/order/v1/generated/validators/payInvoiceRequest.zod.js +1 -1
  5. package/dist/billing/type/order/v1/generated/validators/quoteCancellation.zod.js +1 -1
  6. package/dist/billing/type/order/v1/generated/validators/renewalOrderRequest.zod.d.ts +4 -0
  7. package/dist/billing/type/order/v1/generated/validators/renewalOrderRequest.zod.js +2 -0
  8. package/dist/billing/type/order/v1/generated/validators/subscription.zod.js +1 -1
  9. package/dist/billing/v1/generated/functions.d.ts +10 -3
  10. package/dist/billing/v1/generated/functions.js +10 -3
  11. package/dist/billing/v1/generated/models.d.ts +15 -3
  12. package/dist/billing/v1/generated/schemas.zod.d.ts +14 -3
  13. package/dist/billing/v1/generated/schemas.zod.js +10 -3
  14. package/dist/billing/v1/generated/validators/accountBalance.zod.d.ts +1 -0
  15. package/dist/billing/v1/generated/validators/accountBalance.zod.js +2 -1
  16. package/dist/billing/v1/generated/validators/payInvoiceRequest.zod.js +1 -1
  17. package/dist/billing/v1/generated/validators/quoteCancellation.zod.js +1 -1
  18. package/dist/billing/v1/generated/validators/renewalOrderRequest.zod.d.ts +4 -0
  19. package/dist/billing/v1/generated/validators/renewalOrderRequest.zod.js +2 -0
  20. package/dist/billing/v1/generated/validators/subscription.zod.js +1 -1
  21. package/dist/canopy/v1/generated/models.d.ts +15 -3
  22. package/dist/canopy/v1/generated/validators/accountBalance.zod.d.ts +1 -0
  23. package/dist/canopy/v1/generated/validators/accountBalance.zod.js +2 -1
  24. package/dist/canopy/v1/generated/validators/payInvoiceRequest.zod.js +1 -1
  25. package/dist/canopy/v1/generated/validators/quoteCancellation.zod.js +1 -1
  26. package/dist/canopy/v1/generated/validators/renewalOrderRequest.zod.d.ts +4 -0
  27. package/dist/canopy/v1/generated/validators/renewalOrderRequest.zod.js +2 -0
  28. package/dist/canopy/v1/generated/validators/subscription.zod.js +1 -1
  29. package/dist/compute/v1/generated/models.d.ts +15 -3
  30. package/dist/compute/v1/generated/validators/accountBalance.zod.d.ts +1 -0
  31. package/dist/compute/v1/generated/validators/accountBalance.zod.js +2 -1
  32. package/dist/compute/v1/generated/validators/payInvoiceRequest.zod.js +1 -1
  33. package/dist/compute/v1/generated/validators/quoteCancellation.zod.js +1 -1
  34. package/dist/compute/v1/generated/validators/renewalOrderRequest.zod.d.ts +4 -0
  35. package/dist/compute/v1/generated/validators/renewalOrderRequest.zod.js +2 -0
  36. package/dist/compute/v1/generated/validators/subscription.zod.js +1 -1
  37. package/dist/membership/v1/generated/models.d.ts +15 -3
  38. package/dist/membership/v1/generated/validators/accountBalance.zod.d.ts +1 -0
  39. package/dist/membership/v1/generated/validators/accountBalance.zod.js +2 -1
  40. package/dist/membership/v1/generated/validators/payInvoiceRequest.zod.js +1 -1
  41. package/dist/membership/v1/generated/validators/quoteCancellation.zod.js +1 -1
  42. package/dist/membership/v1/generated/validators/renewalOrderRequest.zod.d.ts +4 -0
  43. package/dist/membership/v1/generated/validators/renewalOrderRequest.zod.js +2 -0
  44. package/dist/membership/v1/generated/validators/subscription.zod.js +1 -1
  45. package/package.json +1 -1
@@ -471,6 +471,10 @@ export interface Quote {
471
471
  /**
472
472
  * A cancellation to quote: what ending these subscriptions together would return. One mode per
473
473
  * request; to compare, quote `immediate` and `period_end` separately.
474
+ *
475
+ * Refused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being
476
+ * canceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a
477
+ * paid change still waiting to switch (`meta.order_id`).
474
478
  */
475
479
  export interface QuoteCancellation {
476
480
  /**
@@ -860,8 +864,10 @@ export interface CreditGroup {
860
864
  * Account balance, credits, and unpaid charges are reported separately.
861
865
  */
862
866
  export interface AccountBalance {
863
- /** Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative. */
867
+ /** Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes. */
864
868
  available_credit: Money;
869
+ /** Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount. */
870
+ estimated_credit_applied: Money;
865
871
  /** Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance. */
866
872
  unbilled_amount: Money;
867
873
  billing_account_id: number;
@@ -1135,6 +1141,9 @@ export interface PaymentMethodSetupResult {
1135
1141
  * through the selected gateway. Grants restricted to other purchases are not counted as available funds.
1136
1142
  * An unresolved channel payment is reused; retries do not apply the grant or balance portions twice.
1137
1143
  * Without a gateway selection, insufficient account funds fail without starting an online payment.
1144
+ *
1145
+ * `payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;
1146
+ * otherwise the request is refused with `BILLING_PURCHASE_INVALID`.
1138
1147
  */
1139
1148
  export interface PayInvoiceRequest {
1140
1149
  /**
@@ -1860,8 +1869,9 @@ export interface Subscription {
1860
1869
  cancellation?: SubscriptionCancellation;
1861
1870
  /**
1862
1871
  * The saved payment method automatic renewal charges after the account's balance and credits,
1863
- * before the account's default payment method. Set when the purchase, or a renewal, is paid with a saved
1864
- * payment method. It is used only while it belongs to the account that pays the renewal.
1872
+ * before the account's default payment method. Set when the purchase, a renewal or a change is paid with a
1873
+ * saved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the
1874
+ * account that pays the renewal.
1865
1875
  * @nullable
1866
1876
  */
1867
1877
  default_payment_method_id?: string | null;
@@ -2027,6 +2037,8 @@ export interface RenewalOrderRequest {
2027
2037
  interval_count?: number;
2028
2038
  /** As in renewing. */
2029
2039
  interval?: RenewalOrderRequestInterval;
2040
+ /** As in renewing. */
2041
+ termination_policy?: TerminationPolicy;
2030
2042
  }
2031
2043
  export interface AutoRenewSet {
2032
2044
  auto_renew: boolean;
@@ -8,6 +8,7 @@
8
8
  import * as zod from "zod";
9
9
  export declare const AccountBalance: zod.ZodObject<{
10
10
  available_credit: zod.ZodString;
11
+ estimated_credit_applied: zod.ZodString;
11
12
  unbilled_amount: zod.ZodString;
12
13
  billing_account_id: zod.ZodInt;
13
14
  currency: zod.ZodString;
@@ -10,7 +10,8 @@ import { CreditGroup } from "./creditGroup.zod.js";
10
10
  import { Money } from "./money.zod.js";
11
11
  export const AccountBalance = zod
12
12
  .strictObject({
13
- available_credit: Money.describe("Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative."),
13
+ available_credit: Money.describe("Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes."),
14
+ estimated_credit_applied: Money.describe("Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount."),
14
15
  unbilled_amount: Money.describe("Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance."),
15
16
  billing_account_id: zod.int(),
16
17
  currency: zod.string(),
@@ -50,4 +50,4 @@ export const PayInvoiceRequest = zod
50
50
  .optional()
51
51
  .describe("The invoice total to expect, after discounts and tax and before credit grants or balance, as the\npayment preview or an order quote gave it. A different total fails with BILLING_AMOUNT_CHANGED\nand nothing is charged. Omit to skip the comparison; an explicit zero is compared."),
52
52
  })
53
- .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.");
53
+ .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.\n\n`payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;\notherwise the request is refused with `BILLING_PURCHASE_INVALID`.");
@@ -17,4 +17,4 @@ export const QuoteCancellation = zod
17
17
  .describe("The subscriptions to end together, all of one service. Every subscription released with a resource must be included."),
18
18
  mode: TerminationPolicy,
19
19
  })
20
- .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.");
20
+ .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.\n\nRefused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being\ncanceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a\npaid change still waiting to switch (`meta.order_id`).");
@@ -16,6 +16,10 @@ export declare const RenewalOrderRequest: zod.ZodObject<{
16
16
  month: "month";
17
17
  year: "year";
18
18
  }>>;
19
+ termination_policy: zod.ZodOptional<zod.ZodEnum<{
20
+ immediate: "immediate";
21
+ period_end: "period_end";
22
+ }>>;
19
23
  }, zod.z.core.$strict>;
20
24
  export type RenewalOrderRequest = zod.input<typeof RenewalOrderRequest>;
21
25
  export type RenewalOrderRequestOutput = zod.output<typeof RenewalOrderRequest>;
@@ -6,6 +6,7 @@
6
6
  * OpenAPI spec version: v1
7
7
  */
8
8
  import * as zod from "zod";
9
+ import { TerminationPolicy } from "./terminationPolicy.zod.js";
9
10
  export const renewalOrderRequestPeriodsDefault = 1;
10
11
  export const RenewalOrderRequest = zod
11
12
  .strictObject({
@@ -19,5 +20,6 @@ export const RenewalOrderRequest = zod
19
20
  .describe("As in renewing."),
20
21
  interval_count: zod.int().min(1).optional().describe("As in renewing."),
21
22
  interval: zod.enum(["day", "month", "year"]).optional().describe("As in renewing."),
23
+ termination_policy: TerminationPolicy.optional().describe("As in renewing."),
22
24
  })
23
25
  .describe("The periods and price of the renewal, chosen as in renewing.");
@@ -44,7 +44,7 @@ export const Subscription = zod
44
44
  default_payment_method_id: zod
45
45
  .uuid()
46
46
  .nullish()
47
- .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, or a renewal, is paid with a saved\npayment method. It is used only while it belongs to the account that pays the renewal."),
47
+ .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, a renewal or a change is paid with a\nsaved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the\naccount that pays the renewal."),
48
48
  created_at: zod.iso.datetime({ offset: true }).optional(),
49
49
  id: zod.uuid(),
50
50
  billing_account_id: zod
@@ -614,7 +614,10 @@ export declare const getPayInvoiceUrl: (invoiceId: string) => string;
614
614
  * another charge. A void invoice is refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an
615
615
  * order that has failed or was
616
616
  * canceled, with `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`; and that of an order whose
617
- * payment deadline has passed, with `BILLING_ORDER_EXPIRED`.
617
+ * payment deadline has passed, with `BILLING_ORDER_EXPIRED`. A renewal invoice is also refused with
618
+ * `BILLING_INVOICE_NOT_PAYABLE` while its subscription is being canceled, is being reclaimed or has
619
+ * ended, with `meta.reason` `subscription_canceling`, `subscription_reclaiming` or
620
+ * `subscription_ended` respectively.
618
621
  * @summary Pay an invoice
619
622
  */
620
623
  export declare const payInvoice: (invoiceId: string, payInvoiceRequest?: PayInvoiceRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<payInvoiceResponse>;
@@ -678,7 +681,10 @@ export declare const getPayTogetherUrl: () => string;
678
681
  * `BILLING_INVOICE_NOT_PAYABLE`, a deferred period-end change not yet due to be invoiced with
679
682
  * `BILLING_CHANGE_NOT_INVOICED`, an order that has failed or was canceled with
680
683
  * `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`, and an order whose payment deadline has
681
- * passed with `BILLING_ORDER_EXPIRED`.
684
+ * passed with `BILLING_ORDER_EXPIRED`. A renewal invoice is refused with
685
+ * `BILLING_INVOICE_NOT_PAYABLE` while its subscription is being canceled, is being reclaimed or has
686
+ * ended, with `meta.reason` `subscription_canceling`, `subscription_reclaiming` or
687
+ * `subscription_ended` respectively.
682
688
  * @summary Pay together
683
689
  */
684
690
  export declare const payTogether: (payTogetherRequest: PayTogetherRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<payTogetherResponse>;
@@ -1142,7 +1148,8 @@ export declare const getCreateCancellationUrl: () => string;
1142
1148
  * - 409 `BILLING_CANCELLATION_SCHEDULES_DIFFER` when, for `period_end`, the paid terms end at
1143
1149
  * different times;
1144
1150
  * - 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being canceled
1145
- * (`meta.cancellation_id`) or reclaimed (`meta.action_id`);
1151
+ * (`meta.cancellation_id`) or reclaimed (`meta.reason` `reclaim_requested`), or has a paid
1152
+ * change still waiting to switch (`meta.order_id`);
1146
1153
  * - 409 `BILLING_ORDER_PAYMENT_IN_FLIGHT` while an online payment for a renewal of one of them
1147
1154
  * is in progress;
1148
1155
  * - 409 `BILLING_CANCELLATION_REFUND_CHANGED` when the refund is no longer
@@ -645,7 +645,10 @@ export const getPayInvoiceUrl = (invoiceId) => {
645
645
  * another charge. A void invoice is refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an
646
646
  * order that has failed or was
647
647
  * canceled, with `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`; and that of an order whose
648
- * payment deadline has passed, with `BILLING_ORDER_EXPIRED`.
648
+ * payment deadline has passed, with `BILLING_ORDER_EXPIRED`. A renewal invoice is also refused with
649
+ * `BILLING_INVOICE_NOT_PAYABLE` while its subscription is being canceled, is being reclaimed or has
650
+ * ended, with `meta.reason` `subscription_canceling`, `subscription_reclaiming` or
651
+ * `subscription_ended` respectively.
649
652
  * @summary Pay an invoice
650
653
  */
651
654
  export const payInvoice = async (invoiceId, payInvoiceRequest, options, fetchFn) => {
@@ -725,7 +728,10 @@ export const getPayTogetherUrl = () => {
725
728
  * `BILLING_INVOICE_NOT_PAYABLE`, a deferred period-end change not yet due to be invoiced with
726
729
  * `BILLING_CHANGE_NOT_INVOICED`, an order that has failed or was canceled with
727
730
  * `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`, and an order whose payment deadline has
728
- * passed with `BILLING_ORDER_EXPIRED`.
731
+ * passed with `BILLING_ORDER_EXPIRED`. A renewal invoice is refused with
732
+ * `BILLING_INVOICE_NOT_PAYABLE` while its subscription is being canceled, is being reclaimed or has
733
+ * ended, with `meta.reason` `subscription_canceling`, `subscription_reclaiming` or
734
+ * `subscription_ended` respectively.
729
735
  * @summary Pay together
730
736
  */
731
737
  export const payTogether = async (payTogetherRequest, options, fetchFn) => {
@@ -1257,7 +1263,8 @@ export const getCreateCancellationUrl = () => {
1257
1263
  * - 409 `BILLING_CANCELLATION_SCHEDULES_DIFFER` when, for `period_end`, the paid terms end at
1258
1264
  * different times;
1259
1265
  * - 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being canceled
1260
- * (`meta.cancellation_id`) or reclaimed (`meta.action_id`);
1266
+ * (`meta.cancellation_id`) or reclaimed (`meta.reason` `reclaim_requested`), or has a paid
1267
+ * change still waiting to switch (`meta.order_id`);
1261
1268
  * - 409 `BILLING_ORDER_PAYMENT_IN_FLIGHT` while an online payment for a renewal of one of them
1262
1269
  * is in progress;
1263
1270
  * - 409 `BILLING_CANCELLATION_REFUND_CHANGED` when the refund is no longer
@@ -281,6 +281,10 @@ export interface Quote {
281
281
  /**
282
282
  * A cancellation to quote: what ending these subscriptions together would return. One mode per
283
283
  * request; to compare, quote `immediate` and `period_end` separately.
284
+ *
285
+ * Refused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being
286
+ * canceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a
287
+ * paid change still waiting to switch (`meta.order_id`).
284
288
  */
285
289
  export interface QuoteCancellation {
286
290
  /**
@@ -681,8 +685,10 @@ export interface CreditGroup {
681
685
  * Account balance, credits, and unpaid charges are reported separately.
682
686
  */
683
687
  export interface AccountBalance {
684
- /** Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative. */
688
+ /** Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes. */
685
689
  available_credit: Money;
690
+ /** Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount. */
691
+ estimated_credit_applied: Money;
686
692
  /** Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance. */
687
693
  unbilled_amount: Money;
688
694
  billing_account_id: number;
@@ -956,6 +962,9 @@ export interface PaymentMethodSetupResult {
956
962
  * through the selected gateway. Grants restricted to other purchases are not counted as available funds.
957
963
  * An unresolved channel payment is reused; retries do not apply the grant or balance portions twice.
958
964
  * Without a gateway selection, insufficient account funds fail without starting an online payment.
965
+ *
966
+ * `payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;
967
+ * otherwise the request is refused with `BILLING_PURCHASE_INVALID`.
959
968
  */
960
969
  export interface PayInvoiceRequest {
961
970
  /**
@@ -1697,8 +1706,9 @@ export interface Subscription {
1697
1706
  cancellation?: SubscriptionCancellation;
1698
1707
  /**
1699
1708
  * The saved payment method automatic renewal charges after the account's balance and credits,
1700
- * before the account's default payment method. Set when the purchase, or a renewal, is paid with a saved
1701
- * payment method. It is used only while it belongs to the account that pays the renewal.
1709
+ * before the account's default payment method. Set when the purchase, a renewal or a change is paid with a
1710
+ * saved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the
1711
+ * account that pays the renewal.
1702
1712
  * @nullable
1703
1713
  */
1704
1714
  default_payment_method_id?: string | null;
@@ -1864,6 +1874,8 @@ export interface RenewalOrderRequest {
1864
1874
  interval_count?: number;
1865
1875
  /** As in renewing. */
1866
1876
  interval?: RenewalOrderRequestInterval;
1877
+ /** As in renewing. */
1878
+ termination_policy?: TerminationPolicy;
1867
1879
  }
1868
1880
  export interface AutoRenewSet {
1869
1881
  auto_renew: boolean;
@@ -341,7 +341,10 @@ export declare const DeletePaymentMethodParams: zod.ZodObject<{
341
341
  * another charge. A void invoice is refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an
342
342
  * order that has failed or was
343
343
  * canceled, with `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`; and that of an order whose
344
- * payment deadline has passed, with `BILLING_ORDER_EXPIRED`.
344
+ * payment deadline has passed, with `BILLING_ORDER_EXPIRED`. A renewal invoice is also refused with
345
+ * `BILLING_INVOICE_NOT_PAYABLE` while its subscription is being canceled, is being reclaimed or has
346
+ * ended, with `meta.reason` `subscription_canceling`, `subscription_reclaiming` or
347
+ * `subscription_ended` respectively.
345
348
  * @summary Pay an invoice
346
349
  */
347
350
  export declare const PayInvoiceParams: zod.ZodObject<{
@@ -395,7 +398,10 @@ export declare const PreviewInvoicePaymentQueryParams: zod.ZodObject<{
395
398
  * `BILLING_INVOICE_NOT_PAYABLE`, a deferred period-end change not yet due to be invoiced with
396
399
  * `BILLING_CHANGE_NOT_INVOICED`, an order that has failed or was canceled with
397
400
  * `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`, and an order whose payment deadline has
398
- * passed with `BILLING_ORDER_EXPIRED`.
401
+ * passed with `BILLING_ORDER_EXPIRED`. A renewal invoice is refused with
402
+ * `BILLING_INVOICE_NOT_PAYABLE` while its subscription is being canceled, is being reclaimed or has
403
+ * ended, with `meta.reason` `subscription_canceling`, `subscription_reclaiming` or
404
+ * `subscription_ended` respectively.
399
405
  * @summary Pay together
400
406
  */
401
407
  export declare const PayTogetherBody: zod.ZodObject<{
@@ -774,7 +780,8 @@ export declare const ListCancellationsQueryParams: zod.ZodObject<{
774
780
  * - 409 `BILLING_CANCELLATION_SCHEDULES_DIFFER` when, for `period_end`, the paid terms end at
775
781
  * different times;
776
782
  * - 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being canceled
777
- * (`meta.cancellation_id`) or reclaimed (`meta.action_id`);
783
+ * (`meta.cancellation_id`) or reclaimed (`meta.reason` `reclaim_requested`), or has a paid
784
+ * change still waiting to switch (`meta.order_id`);
778
785
  * - 409 `BILLING_ORDER_PAYMENT_IN_FLIGHT` while an online payment for a renewal of one of them
779
786
  * is in progress;
780
787
  * - 409 `BILLING_CANCELLATION_REFUND_CHANGED` when the refund is no longer
@@ -889,6 +896,10 @@ export declare const CreateRenewalOrderBody: zod.ZodObject<{
889
896
  month: "month";
890
897
  year: "year";
891
898
  }>>;
899
+ termination_policy: zod.ZodOptional<zod.ZodEnum<{
900
+ immediate: "immediate";
901
+ period_end: "period_end";
902
+ }>>;
892
903
  }, zod.z.core.$strict>;
893
904
  /**
894
905
  * Controls automatic prepaid renewal. Disabling it does not shorten current_term_end and still permits
@@ -396,7 +396,10 @@ export const DeletePaymentMethodParams = zod.strictObject({
396
396
  * another charge. A void invoice is refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an
397
397
  * order that has failed or was
398
398
  * canceled, with `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`; and that of an order whose
399
- * payment deadline has passed, with `BILLING_ORDER_EXPIRED`.
399
+ * payment deadline has passed, with `BILLING_ORDER_EXPIRED`. A renewal invoice is also refused with
400
+ * `BILLING_INVOICE_NOT_PAYABLE` while its subscription is being canceled, is being reclaimed or has
401
+ * ended, with `meta.reason` `subscription_canceling`, `subscription_reclaiming` or
402
+ * `subscription_ended` respectively.
400
403
  * @summary Pay an invoice
401
404
  */
402
405
  export const PayInvoiceParams = zod.strictObject({
@@ -452,7 +455,10 @@ export const PreviewInvoicePaymentQueryParams = zod.strictObject({
452
455
  * `BILLING_INVOICE_NOT_PAYABLE`, a deferred period-end change not yet due to be invoiced with
453
456
  * `BILLING_CHANGE_NOT_INVOICED`, an order that has failed or was canceled with
454
457
  * `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`, and an order whose payment deadline has
455
- * passed with `BILLING_ORDER_EXPIRED`.
458
+ * passed with `BILLING_ORDER_EXPIRED`. A renewal invoice is refused with
459
+ * `BILLING_INVOICE_NOT_PAYABLE` while its subscription is being canceled, is being reclaimed or has
460
+ * ended, with `meta.reason` `subscription_canceling`, `subscription_reclaiming` or
461
+ * `subscription_ended` respectively.
456
462
  * @summary Pay together
457
463
  */
458
464
  export const PayTogetherBody = PayTogetherRequest;
@@ -911,7 +917,8 @@ export const ListCancellationsQueryParams = zod.strictObject({
911
917
  * - 409 `BILLING_CANCELLATION_SCHEDULES_DIFFER` when, for `period_end`, the paid terms end at
912
918
  * different times;
913
919
  * - 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being canceled
914
- * (`meta.cancellation_id`) or reclaimed (`meta.action_id`);
920
+ * (`meta.cancellation_id`) or reclaimed (`meta.reason` `reclaim_requested`), or has a paid
921
+ * change still waiting to switch (`meta.order_id`);
915
922
  * - 409 `BILLING_ORDER_PAYMENT_IN_FLIGHT` while an online payment for a renewal of one of them
916
923
  * is in progress;
917
924
  * - 409 `BILLING_CANCELLATION_REFUND_CHANGED` when the refund is no longer
@@ -8,6 +8,7 @@
8
8
  import * as zod from "zod";
9
9
  export declare const AccountBalance: zod.ZodObject<{
10
10
  available_credit: zod.ZodString;
11
+ estimated_credit_applied: zod.ZodString;
11
12
  unbilled_amount: zod.ZodString;
12
13
  billing_account_id: zod.ZodInt;
13
14
  currency: zod.ZodString;
@@ -10,7 +10,8 @@ import { CreditGroup } from "./creditGroup.zod.js";
10
10
  import { Money } from "./money.zod.js";
11
11
  export const AccountBalance = zod
12
12
  .strictObject({
13
- available_credit: Money.describe("Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative."),
13
+ available_credit: Money.describe("Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes."),
14
+ estimated_credit_applied: Money.describe("Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount."),
14
15
  unbilled_amount: Money.describe("Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance."),
15
16
  billing_account_id: zod.int(),
16
17
  currency: zod.string(),
@@ -50,4 +50,4 @@ export const PayInvoiceRequest = zod
50
50
  .optional()
51
51
  .describe("The invoice total to expect, after discounts and tax and before credit grants or balance, as the\npayment preview or an order quote gave it. A different total fails with BILLING_AMOUNT_CHANGED\nand nothing is charged. Omit to skip the comparison; an explicit zero is compared."),
52
52
  })
53
- .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.");
53
+ .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.\n\n`payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;\notherwise the request is refused with `BILLING_PURCHASE_INVALID`.");
@@ -17,4 +17,4 @@ export const QuoteCancellation = zod
17
17
  .describe("The subscriptions to end together, all of one service. Every subscription released with a resource must be included."),
18
18
  mode: TerminationPolicy,
19
19
  })
20
- .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.");
20
+ .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.\n\nRefused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being\ncanceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a\npaid change still waiting to switch (`meta.order_id`).");
@@ -16,6 +16,10 @@ export declare const RenewalOrderRequest: zod.ZodObject<{
16
16
  month: "month";
17
17
  year: "year";
18
18
  }>>;
19
+ termination_policy: zod.ZodOptional<zod.ZodEnum<{
20
+ immediate: "immediate";
21
+ period_end: "period_end";
22
+ }>>;
19
23
  }, zod.z.core.$strict>;
20
24
  export type RenewalOrderRequest = zod.input<typeof RenewalOrderRequest>;
21
25
  export type RenewalOrderRequestOutput = zod.output<typeof RenewalOrderRequest>;
@@ -6,6 +6,7 @@
6
6
  * OpenAPI spec version: v1
7
7
  */
8
8
  import * as zod from "zod";
9
+ import { TerminationPolicy } from "./terminationPolicy.zod.js";
9
10
  export const renewalOrderRequestPeriodsDefault = 1;
10
11
  export const RenewalOrderRequest = zod
11
12
  .strictObject({
@@ -19,5 +20,6 @@ export const RenewalOrderRequest = zod
19
20
  .describe("As in renewing."),
20
21
  interval_count: zod.int().min(1).optional().describe("As in renewing."),
21
22
  interval: zod.enum(["day", "month", "year"]).optional().describe("As in renewing."),
23
+ termination_policy: TerminationPolicy.optional().describe("As in renewing."),
22
24
  })
23
25
  .describe("The periods and price of the renewal, chosen as in renewing.");
@@ -44,7 +44,7 @@ export const Subscription = zod
44
44
  default_payment_method_id: zod
45
45
  .uuid()
46
46
  .nullish()
47
- .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, or a renewal, is paid with a saved\npayment method. It is used only while it belongs to the account that pays the renewal."),
47
+ .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, a renewal or a change is paid with a\nsaved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the\naccount that pays the renewal."),
48
48
  created_at: zod.iso.datetime({ offset: true }).optional(),
49
49
  id: zod.uuid(),
50
50
  billing_account_id: zod
@@ -955,6 +955,10 @@ export type QuoteA200529 = Quote5f60d00;
955
955
  /**
956
956
  * A cancellation to quote: what ending these subscriptions together would return. One mode per
957
957
  * request; to compare, quote `immediate` and `period_end` separately.
958
+ *
959
+ * Refused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being
960
+ * canceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a
961
+ * paid change still waiting to switch (`meta.order_id`).
958
962
  */
959
963
  export interface QuoteCancellation {
960
964
  /**
@@ -1328,8 +1332,10 @@ export interface CreditGroup {
1328
1332
  * Account balance, credits, and unpaid charges are reported separately.
1329
1333
  */
1330
1334
  export interface AccountBalance {
1331
- /** Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative. */
1335
+ /** Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes. */
1332
1336
  available_credit: Money;
1337
+ /** Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount. */
1338
+ estimated_credit_applied: Money;
1333
1339
  /** Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance. */
1334
1340
  unbilled_amount: Money;
1335
1341
  billing_account_id: number;
@@ -1603,6 +1609,9 @@ export interface PaymentMethodSetupResult {
1603
1609
  * through the selected gateway. Grants restricted to other purchases are not counted as available funds.
1604
1610
  * An unresolved channel payment is reused; retries do not apply the grant or balance portions twice.
1605
1611
  * Without a gateway selection, insufficient account funds fail without starting an online payment.
1612
+ *
1613
+ * `payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;
1614
+ * otherwise the request is refused with `BILLING_PURCHASE_INVALID`.
1606
1615
  */
1607
1616
  export interface PayInvoiceRequest {
1608
1617
  /**
@@ -2328,8 +2337,9 @@ export interface Subscription {
2328
2337
  cancellation?: SubscriptionCancellation;
2329
2338
  /**
2330
2339
  * The saved payment method automatic renewal charges after the account's balance and credits,
2331
- * before the account's default payment method. Set when the purchase, or a renewal, is paid with a saved
2332
- * payment method. It is used only while it belongs to the account that pays the renewal.
2340
+ * before the account's default payment method. Set when the purchase, a renewal or a change is paid with a
2341
+ * saved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the
2342
+ * account that pays the renewal.
2333
2343
  * @nullable
2334
2344
  */
2335
2345
  default_payment_method_id?: string | null;
@@ -2495,6 +2505,8 @@ export interface RenewalOrderRequest {
2495
2505
  interval_count?: number;
2496
2506
  /** As in renewing. */
2497
2507
  interval?: RenewalOrderRequestInterval;
2508
+ /** As in renewing. */
2509
+ termination_policy?: TerminationPolicy;
2498
2510
  }
2499
2511
  export interface AutoRenewSet {
2500
2512
  auto_renew: boolean;
@@ -31,6 +31,7 @@
31
31
  import * as zod from "zod";
32
32
  export declare const AccountBalance: zod.ZodObject<{
33
33
  available_credit: zod.ZodString;
34
+ estimated_credit_applied: zod.ZodString;
34
35
  unbilled_amount: zod.ZodString;
35
36
  billing_account_id: zod.ZodInt;
36
37
  currency: zod.ZodString;
@@ -33,7 +33,8 @@ import { CreditGroup } from "./creditGroup.zod.js";
33
33
  import { Money } from "./money.zod.js";
34
34
  export const AccountBalance = zod
35
35
  .strictObject({
36
- available_credit: Money.describe("Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative."),
36
+ available_credit: Money.describe("Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes."),
37
+ estimated_credit_applied: Money.describe("Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount."),
37
38
  unbilled_amount: Money.describe("Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance."),
38
39
  billing_account_id: zod.int(),
39
40
  currency: zod.string(),
@@ -73,4 +73,4 @@ export const PayInvoiceRequest = zod
73
73
  .optional()
74
74
  .describe("The invoice total to expect, after discounts and tax and before credit grants or balance, as the\npayment preview or an order quote gave it. A different total fails with BILLING_AMOUNT_CHANGED\nand nothing is charged. Omit to skip the comparison; an explicit zero is compared."),
75
75
  })
76
- .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.");
76
+ .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.\n\n`payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;\notherwise the request is refused with `BILLING_PURCHASE_INVALID`.");
@@ -40,4 +40,4 @@ export const QuoteCancellation = zod
40
40
  .describe("The subscriptions to end together, all of one service. Every subscription released with a resource must be included."),
41
41
  mode: TerminationPolicy,
42
42
  })
43
- .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.");
43
+ .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.\n\nRefused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being\ncanceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a\npaid change still waiting to switch (`meta.order_id`).");
@@ -39,6 +39,10 @@ export declare const RenewalOrderRequest: zod.ZodObject<{
39
39
  month: "month";
40
40
  year: "year";
41
41
  }>>;
42
+ termination_policy: zod.ZodOptional<zod.ZodEnum<{
43
+ immediate: "immediate";
44
+ period_end: "period_end";
45
+ }>>;
42
46
  }, zod.z.core.$strict>;
43
47
  export type RenewalOrderRequest = zod.input<typeof RenewalOrderRequest>;
44
48
  export type RenewalOrderRequestOutput = zod.output<typeof RenewalOrderRequest>;
@@ -29,6 +29,7 @@
29
29
  * OpenAPI spec version: 1.0.0
30
30
  */
31
31
  import * as zod from "zod";
32
+ import { TerminationPolicy } from "./terminationPolicy.zod.js";
32
33
  export const renewalOrderRequestPeriodsDefault = 1;
33
34
  export const RenewalOrderRequest = zod
34
35
  .strictObject({
@@ -42,5 +43,6 @@ export const RenewalOrderRequest = zod
42
43
  .describe("As in renewing."),
43
44
  interval_count: zod.int().min(1).optional().describe("As in renewing."),
44
45
  interval: zod.enum(["day", "month", "year"]).optional().describe("As in renewing."),
46
+ termination_policy: TerminationPolicy.optional().describe("As in renewing."),
45
47
  })
46
48
  .describe("The periods and price of the renewal, chosen as in renewing.");
@@ -67,7 +67,7 @@ export const Subscription = zod
67
67
  default_payment_method_id: zod
68
68
  .uuid()
69
69
  .nullish()
70
- .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, or a renewal, is paid with a saved\npayment method. It is used only while it belongs to the account that pays the renewal."),
70
+ .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, a renewal or a change is paid with a\nsaved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the\naccount that pays the renewal."),
71
71
  created_at: zod.iso.datetime({ offset: true }).optional(),
72
72
  id: zod.uuid(),
73
73
  billing_account_id: zod
@@ -2901,6 +2901,10 @@ export type QuoteA200529 = Quote5f60d00;
2901
2901
  /**
2902
2902
  * A cancellation to quote: what ending these subscriptions together would return. One mode per
2903
2903
  * request; to compare, quote `immediate` and `period_end` separately.
2904
+ *
2905
+ * Refused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being
2906
+ * canceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a
2907
+ * paid change still waiting to switch (`meta.order_id`).
2904
2908
  */
2905
2909
  export interface QuoteCancellation {
2906
2910
  /**
@@ -3274,8 +3278,10 @@ export interface CreditGroup {
3274
3278
  * Account balance, credits, and unpaid charges are reported separately.
3275
3279
  */
3276
3280
  export interface AccountBalance {
3277
- /** Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative. */
3281
+ /** Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes. */
3278
3282
  available_credit: Money;
3283
+ /** Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount. */
3284
+ estimated_credit_applied: Money;
3279
3285
  /** Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance. */
3280
3286
  unbilled_amount: Money;
3281
3287
  billing_account_id: number;
@@ -3549,6 +3555,9 @@ export interface PaymentMethodSetupResult {
3549
3555
  * through the selected gateway. Grants restricted to other purchases are not counted as available funds.
3550
3556
  * An unresolved channel payment is reused; retries do not apply the grant or balance portions twice.
3551
3557
  * Without a gateway selection, insufficient account funds fail without starting an online payment.
3558
+ *
3559
+ * `payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;
3560
+ * otherwise the request is refused with `BILLING_PURCHASE_INVALID`.
3552
3561
  */
3553
3562
  export interface PayInvoiceRequest {
3554
3563
  /**
@@ -4274,8 +4283,9 @@ export interface Subscription {
4274
4283
  cancellation?: SubscriptionCancellation;
4275
4284
  /**
4276
4285
  * The saved payment method automatic renewal charges after the account's balance and credits,
4277
- * before the account's default payment method. Set when the purchase, or a renewal, is paid with a saved
4278
- * payment method. It is used only while it belongs to the account that pays the renewal.
4286
+ * before the account's default payment method. Set when the purchase, a renewal or a change is paid with a
4287
+ * saved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the
4288
+ * account that pays the renewal.
4279
4289
  * @nullable
4280
4290
  */
4281
4291
  default_payment_method_id?: string | null;
@@ -4441,6 +4451,8 @@ export interface RenewalOrderRequest {
4441
4451
  interval_count?: number;
4442
4452
  /** As in renewing. */
4443
4453
  interval?: RenewalOrderRequestInterval;
4454
+ /** As in renewing. */
4455
+ termination_policy?: TerminationPolicyBfdab9f;
4444
4456
  }
4445
4457
  export interface AutoRenewSet {
4446
4458
  auto_renew: boolean;
@@ -24,6 +24,7 @@
24
24
  import * as zod from "zod";
25
25
  export declare const AccountBalance: zod.ZodObject<{
26
26
  available_credit: zod.ZodString;
27
+ estimated_credit_applied: zod.ZodString;
27
28
  unbilled_amount: zod.ZodString;
28
29
  billing_account_id: zod.ZodInt;
29
30
  currency: zod.ZodString;
@@ -26,7 +26,8 @@ import { CreditGroup } from "./creditGroup.zod.js";
26
26
  import { Money } from "./money.zod.js";
27
27
  export const AccountBalance = zod
28
28
  .strictObject({
29
- available_credit: Money.describe("Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative."),
29
+ available_credit: Money.describe("Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes."),
30
+ estimated_credit_applied: Money.describe("Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount."),
30
31
  unbilled_amount: Money.describe("Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance."),
31
32
  billing_account_id: zod.int(),
32
33
  currency: zod.string(),
@@ -66,4 +66,4 @@ export const PayInvoiceRequest = zod
66
66
  .optional()
67
67
  .describe("The invoice total to expect, after discounts and tax and before credit grants or balance, as the\npayment preview or an order quote gave it. A different total fails with BILLING_AMOUNT_CHANGED\nand nothing is charged. Omit to skip the comparison; an explicit zero is compared."),
68
68
  })
69
- .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.");
69
+ .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.\n\n`payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;\notherwise the request is refused with `BILLING_PURCHASE_INVALID`.");
@@ -33,4 +33,4 @@ export const QuoteCancellation = zod
33
33
  .describe("The subscriptions to end together, all of one service. Every subscription released with a resource must be included."),
34
34
  mode: TerminationPolicyBfdab9f,
35
35
  })
36
- .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.");
36
+ .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.\n\nRefused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being\ncanceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a\npaid change still waiting to switch (`meta.order_id`).");
@@ -32,6 +32,10 @@ export declare const RenewalOrderRequest: zod.ZodObject<{
32
32
  month: "month";
33
33
  year: "year";
34
34
  }>>;
35
+ termination_policy: zod.ZodOptional<zod.ZodEnum<{
36
+ immediate: "immediate";
37
+ period_end: "period_end";
38
+ }>>;
35
39
  }, zod.z.core.$strict>;
36
40
  export type RenewalOrderRequest = zod.input<typeof RenewalOrderRequest>;
37
41
  export type RenewalOrderRequestOutput = zod.output<typeof RenewalOrderRequest>;
@@ -22,6 +22,7 @@
22
22
  * OpenAPI spec version: 1.0.0
23
23
  */
24
24
  import * as zod from "zod";
25
+ import { TerminationPolicyBfdab9f } from "./terminationPolicyBfdab9f.zod.js";
25
26
  export const renewalOrderRequestPeriodsDefault = 1;
26
27
  export const RenewalOrderRequest = zod
27
28
  .strictObject({
@@ -35,5 +36,6 @@ export const RenewalOrderRequest = zod
35
36
  .describe("As in renewing."),
36
37
  interval_count: zod.int().min(1).optional().describe("As in renewing."),
37
38
  interval: zod.enum(["day", "month", "year"]).optional().describe("As in renewing."),
39
+ termination_policy: TerminationPolicyBfdab9f.optional().describe("As in renewing."),
38
40
  })
39
41
  .describe("The periods and price of the renewal, chosen as in renewing.");
@@ -60,7 +60,7 @@ export const Subscription = zod
60
60
  default_payment_method_id: zod
61
61
  .uuid()
62
62
  .nullish()
63
- .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, or a renewal, is paid with a saved\npayment method. It is used only while it belongs to the account that pays the renewal."),
63
+ .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, a renewal or a change is paid with a\nsaved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the\naccount that pays the renewal."),
64
64
  created_at: zod.iso.datetime({ offset: true }).optional(),
65
65
  id: zod.uuid(),
66
66
  billing_account_id: zod
@@ -796,6 +796,10 @@ export interface Quote {
796
796
  /**
797
797
  * A cancellation to quote: what ending these subscriptions together would return. One mode per
798
798
  * request; to compare, quote `immediate` and `period_end` separately.
799
+ *
800
+ * Refused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being
801
+ * canceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a
802
+ * paid change still waiting to switch (`meta.order_id`).
799
803
  */
800
804
  export interface QuoteCancellation {
801
805
  /**
@@ -1170,8 +1174,10 @@ export interface CreditGroup {
1170
1174
  * Account balance, credits, and unpaid charges are reported separately.
1171
1175
  */
1172
1176
  export interface AccountBalance {
1173
- /** Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative. */
1177
+ /** Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes. */
1174
1178
  available_credit: Money;
1179
+ /** Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount. */
1180
+ estimated_credit_applied: Money;
1175
1181
  /** Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance. */
1176
1182
  unbilled_amount: Money;
1177
1183
  billing_account_id: number;
@@ -1445,6 +1451,9 @@ export interface PaymentMethodSetupResult {
1445
1451
  * through the selected gateway. Grants restricted to other purchases are not counted as available funds.
1446
1452
  * An unresolved channel payment is reused; retries do not apply the grant or balance portions twice.
1447
1453
  * Without a gateway selection, insufficient account funds fail without starting an online payment.
1454
+ *
1455
+ * `payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;
1456
+ * otherwise the request is refused with `BILLING_PURCHASE_INVALID`.
1448
1457
  */
1449
1458
  export interface PayInvoiceRequest {
1450
1459
  /**
@@ -2170,8 +2179,9 @@ export interface Subscription {
2170
2179
  cancellation?: SubscriptionCancellation;
2171
2180
  /**
2172
2181
  * The saved payment method automatic renewal charges after the account's balance and credits,
2173
- * before the account's default payment method. Set when the purchase, or a renewal, is paid with a saved
2174
- * payment method. It is used only while it belongs to the account that pays the renewal.
2182
+ * before the account's default payment method. Set when the purchase, a renewal or a change is paid with a
2183
+ * saved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the
2184
+ * account that pays the renewal.
2175
2185
  * @nullable
2176
2186
  */
2177
2187
  default_payment_method_id?: string | null;
@@ -2337,6 +2347,8 @@ export interface RenewalOrderRequest {
2337
2347
  interval_count?: number;
2338
2348
  /** As in renewing. */
2339
2349
  interval?: RenewalOrderRequestInterval;
2350
+ /** As in renewing. */
2351
+ termination_policy?: TerminationPolicy;
2340
2352
  }
2341
2353
  export interface AutoRenewSet {
2342
2354
  auto_renew: boolean;
@@ -23,6 +23,7 @@
23
23
  import * as zod from "zod";
24
24
  export declare const AccountBalance: zod.ZodObject<{
25
25
  available_credit: zod.ZodString;
26
+ estimated_credit_applied: zod.ZodString;
26
27
  unbilled_amount: zod.ZodString;
27
28
  billing_account_id: zod.ZodInt;
28
29
  currency: zod.ZodString;
@@ -25,7 +25,8 @@ import { CreditGroup } from "./creditGroup.zod.js";
25
25
  import { Money } from "./money.zod.js";
26
26
  export const AccountBalance = zod
27
27
  .strictObject({
28
- available_credit: Money.describe("Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative."),
28
+ available_credit: Money.describe("Balance minus pending balance returns and the part of unbilled_amount and due that estimated_credit_applied does not cover. Negative only when the balance and applicable credit fall short of what the account owes."),
29
+ estimated_credit_applied: Money.describe("Credit expected to pay unbilled_amount and due. Each charge is matched to grants whose scope, validity and conditions it meets, in the order credit is applied at payment. Nothing is reserved or deducted until an invoice is paid, so credits still includes this amount."),
29
30
  unbilled_amount: Money.describe("Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance."),
30
31
  billing_account_id: zod.int(),
31
32
  currency: zod.string(),
@@ -65,4 +65,4 @@ export const PayInvoiceRequest = zod
65
65
  .optional()
66
66
  .describe("The invoice total to expect, after discounts and tax and before credit grants or balance, as the\npayment preview or an order quote gave it. A different total fails with BILLING_AMOUNT_CHANGED\nand nothing is charged. Omit to skip the comparison; an explicit zero is compared."),
67
67
  })
68
- .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.");
68
+ .describe("Applies eligible credit grants and the available balance as requested, then collects only the remainder\nthrough the selected gateway. Grants restricted to other purchases are not counted as available funds.\nAn unresolved channel payment is reused; retries do not apply the grant or balance portions twice.\nWithout a gateway selection, insufficient account funds fail without starting an online payment.\n\n`payment_gateway` and `method_type` are given together, and `payment_method_id` only with both;\notherwise the request is refused with `BILLING_PURCHASE_INVALID`.");
@@ -32,4 +32,4 @@ export const QuoteCancellation = zod
32
32
  .describe("The subscriptions to end together, all of one service. Every subscription released with a resource must be included."),
33
33
  mode: TerminationPolicy,
34
34
  })
35
- .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.");
35
+ .describe("A cancellation to quote: what ending these subscriptions together would return. One mode per\nrequest; to compare, quote `immediate` and `period_end` separately.\n\nRefused with 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being\ncanceled (`meta.cancellation_id`), is being reclaimed (`meta.reason` `reclaim_requested`) or has a\npaid change still waiting to switch (`meta.order_id`).");
@@ -31,6 +31,10 @@ export declare const RenewalOrderRequest: zod.ZodObject<{
31
31
  month: "month";
32
32
  year: "year";
33
33
  }>>;
34
+ termination_policy: zod.ZodOptional<zod.ZodEnum<{
35
+ immediate: "immediate";
36
+ period_end: "period_end";
37
+ }>>;
34
38
  }, zod.z.core.$strict>;
35
39
  export type RenewalOrderRequest = zod.input<typeof RenewalOrderRequest>;
36
40
  export type RenewalOrderRequestOutput = zod.output<typeof RenewalOrderRequest>;
@@ -21,6 +21,7 @@
21
21
  * OpenAPI spec version: 1.0.0
22
22
  */
23
23
  import * as zod from "zod";
24
+ import { TerminationPolicy } from "./terminationPolicy.zod.js";
24
25
  export const renewalOrderRequestPeriodsDefault = 1;
25
26
  export const RenewalOrderRequest = zod
26
27
  .strictObject({
@@ -34,5 +35,6 @@ export const RenewalOrderRequest = zod
34
35
  .describe("As in renewing."),
35
36
  interval_count: zod.int().min(1).optional().describe("As in renewing."),
36
37
  interval: zod.enum(["day", "month", "year"]).optional().describe("As in renewing."),
38
+ termination_policy: TerminationPolicy.optional().describe("As in renewing."),
37
39
  })
38
40
  .describe("The periods and price of the renewal, chosen as in renewing.");
@@ -59,7 +59,7 @@ export const Subscription = zod
59
59
  default_payment_method_id: zod
60
60
  .uuid()
61
61
  .nullish()
62
- .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, or a renewal, is paid with a saved\npayment method. It is used only while it belongs to the account that pays the renewal."),
62
+ .describe("The saved payment method automatic renewal charges after the account's balance and credits,\nbefore the account's default payment method. Set when the purchase, a renewal or a change is paid with a\nsaved payment method; paying any other way leaves it unchanged. It is used only while it belongs to the\naccount that pays the renewal."),
63
63
  created_at: zod.iso.datetime({ offset: true }).optional(),
64
64
  id: zod.uuid(),
65
65
  billing_account_id: zod
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.122.0",
3
+ "version": "0.124.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {