@leaflow/sdk 0.126.0 → 0.127.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 (39) hide show
  1. package/dist/billing/type/order/v1/generated/models.d.ts +26 -1
  2. package/dist/billing/type/order/v1/generated/validators/accountBalance.zod.js +1 -1
  3. package/dist/billing/type/order/v1/generated/validators/monthlyStatement.zod.d.ts +36 -0
  4. package/dist/billing/type/order/v1/generated/validators/monthlyStatement.zod.js +30 -0
  5. package/dist/billing/type/order/v1/generated/validators/monthlyStatementList.zod.d.ts +43 -0
  6. package/dist/billing/type/order/v1/generated/validators/monthlyStatementList.zod.js +14 -0
  7. package/dist/billing/v1/generated/functions.d.ts +32 -6
  8. package/dist/billing/v1/generated/functions.js +35 -5
  9. package/dist/billing/v1/generated/models.d.ts +49 -1
  10. package/dist/billing/v1/generated/schemas.zod.d.ts +25 -5
  11. package/dist/billing/v1/generated/schemas.zod.js +35 -5
  12. package/dist/billing/v1/generated/validators/accountBalance.zod.js +1 -1
  13. package/dist/billing/v1/generated/validators/listMonthlyStatementsParams.zod.d.ts +21 -0
  14. package/dist/billing/v1/generated/validators/listMonthlyStatementsParams.zod.js +27 -0
  15. package/dist/billing/v1/generated/validators/monthlyStatement.zod.d.ts +36 -0
  16. package/dist/billing/v1/generated/validators/monthlyStatement.zod.js +30 -0
  17. package/dist/billing/v1/generated/validators/monthlyStatementList.zod.d.ts +43 -0
  18. package/dist/billing/v1/generated/validators/monthlyStatementList.zod.js +14 -0
  19. package/dist/canopy/v1/generated/models.d.ts +26 -1
  20. package/dist/canopy/v1/generated/validators/accountBalance.zod.js +1 -1
  21. package/dist/canopy/v1/generated/validators/monthlyStatement.zod.d.ts +59 -0
  22. package/dist/canopy/v1/generated/validators/monthlyStatement.zod.js +53 -0
  23. package/dist/canopy/v1/generated/validators/monthlyStatementList.zod.d.ts +66 -0
  24. package/dist/canopy/v1/generated/validators/monthlyStatementList.zod.js +37 -0
  25. package/dist/compute/v1/generated/models.d.ts +26 -1
  26. package/dist/compute/v1/generated/validators/accountBalance.zod.js +1 -1
  27. package/dist/compute/v1/generated/validators/monthlyStatement.zod.d.ts +52 -0
  28. package/dist/compute/v1/generated/validators/monthlyStatement.zod.js +46 -0
  29. package/dist/compute/v1/generated/validators/monthlyStatementList.zod.d.ts +59 -0
  30. package/dist/compute/v1/generated/validators/monthlyStatementList.zod.js +30 -0
  31. package/dist/membership/v1/generated/models.d.ts +26 -1
  32. package/dist/membership/v1/generated/validators/accountBalance.zod.js +1 -1
  33. package/dist/membership/v1/generated/validators/monthlyStatement.zod.d.ts +36 -0
  34. package/dist/membership/v1/generated/validators/monthlyStatement.zod.js +30 -0
  35. package/dist/membership/v1/generated/validators/monthlyStatementList.zod.d.ts +43 -0
  36. package/dist/membership/v1/generated/validators/monthlyStatementList.zod.js +14 -0
  37. package/dist/routes.d.ts +8 -0
  38. package/dist/routes.js +9 -0
  39. package/package.json +1 -1
@@ -891,7 +891,7 @@ export interface AccountBalance {
891
891
  * spendable balance and may differ from the recorded credits total.
892
892
  */
893
893
  credit_groups: CreditGroup[];
894
- /** Amount still payable on issued invoices. Unbilled usage is reported separately; arrears depend on actual eligible funding and grace terms. */
894
+ /** Amount still payable on issued invoices. The invoice of an order not yet accepted is a request to pay for that order rather than a debt, so it is excluded here and from available_credit. Unbilled usage is reported separately; arrears depend on actual eligible funding and grace terms. */
895
895
  due: Money;
896
896
  pending_returns_amount: Money;
897
897
  }
@@ -2874,6 +2874,31 @@ export interface StatementAmounts {
2874
2874
  tax_amount: Money;
2875
2875
  total: Money;
2876
2876
  }
2877
+ /**
2878
+ * One billing account's usage billing for one UTC calendar month, summed over the month's statements. It is a summary, not something to pay; each closing's invoice is collected on its own.
2879
+ */
2880
+ export interface MonthlyStatement {
2881
+ billing_account_id: number;
2882
+ currency: string;
2883
+ period_start: string;
2884
+ period_end: string;
2885
+ /** True after the period's final closing, which applies minimum charges for the whole month. Usage priced later is still billed in supplement statements and added here. */
2886
+ finalized: boolean;
2887
+ finalized_at?: string;
2888
+ /** Statements of the period, including the open one. */
2889
+ statement_count: number;
2890
+ billed: StatementAmounts;
2891
+ credited_amount: Money;
2892
+ unbilled?: StatementAmounts;
2893
+ credit_applied: Money;
2894
+ amount_paid: Money;
2895
+ amount_due: Money;
2896
+ amount_refunded: Money;
2897
+ }
2898
+ export interface MonthlyStatementList {
2899
+ items: MonthlyStatement[];
2900
+ pagination: OffsetPagination;
2901
+ }
2877
2902
  export type StatementStatus = (typeof StatementStatus)[keyof typeof StatementStatus];
2878
2903
  export declare const StatementStatus: {
2879
2904
  readonly open: "open";
@@ -21,7 +21,7 @@ export const AccountBalance = zod
21
21
  credit_groups: zod
22
22
  .array(CreditGroup)
23
23
  .describe("Currently valid, unspent credit grouped by permitted use. Restrictions and\nvalidity dates determine which charges a group can cover, so these groups are not a general\nspendable balance and may differ from the recorded credits total."),
24
- due: Money.describe("Amount still payable on issued invoices. Unbilled usage is reported separately; arrears depend on actual eligible funding and grace terms."),
24
+ due: Money.describe("Amount still payable on issued invoices. The invoice of an order not yet accepted is a request to pay for that order rather than a debt, so it is excluded here and from available_credit. Unbilled usage is reported separately; arrears depend on actual eligible funding and grace terms."),
25
25
  pending_returns_amount: Money,
26
26
  })
27
27
  .describe("Account balance, credits, and unpaid charges are reported separately.");
@@ -0,0 +1,36 @@
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 MonthlyStatement: zod.ZodObject<{
10
+ billing_account_id: zod.ZodInt;
11
+ currency: zod.ZodString;
12
+ period_start: zod.z.ZodISODateTime;
13
+ period_end: zod.z.ZodISODateTime;
14
+ finalized: zod.ZodBoolean;
15
+ finalized_at: zod.ZodOptional<zod.z.ZodISODateTime>;
16
+ statement_count: zod.ZodInt;
17
+ billed: zod.ZodObject<{
18
+ subtotal: zod.ZodString;
19
+ discount_amount: zod.ZodString;
20
+ tax_amount: zod.ZodString;
21
+ total: zod.ZodString;
22
+ }, zod.z.core.$strict>;
23
+ credited_amount: zod.ZodString;
24
+ unbilled: zod.ZodOptional<zod.ZodObject<{
25
+ subtotal: zod.ZodString;
26
+ discount_amount: zod.ZodString;
27
+ tax_amount: zod.ZodString;
28
+ total: zod.ZodString;
29
+ }, zod.z.core.$strict>>;
30
+ credit_applied: zod.ZodString;
31
+ amount_paid: zod.ZodString;
32
+ amount_due: zod.ZodString;
33
+ amount_refunded: zod.ZodString;
34
+ }, zod.z.core.$strict>;
35
+ export type MonthlyStatement = zod.input<typeof MonthlyStatement>;
36
+ export type MonthlyStatementOutput = zod.output<typeof MonthlyStatement>;
@@ -0,0 +1,30 @@
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 { Money } from "./money.zod.js";
10
+ import { StatementAmounts } from "./statementAmounts.zod.js";
11
+ export const MonthlyStatement = zod
12
+ .strictObject({
13
+ billing_account_id: zod.int(),
14
+ currency: zod.string(),
15
+ period_start: zod.iso.datetime({ offset: true }),
16
+ period_end: zod.iso.datetime({ offset: true }),
17
+ finalized: zod
18
+ .boolean()
19
+ .describe("True after the period's final closing, which applies minimum charges for the whole month. Usage priced later is still billed in supplement statements and added here."),
20
+ finalized_at: zod.iso.datetime({ offset: true }).optional(),
21
+ statement_count: zod.int().describe("Statements of the period, including the open one."),
22
+ billed: StatementAmounts,
23
+ credited_amount: Money,
24
+ unbilled: StatementAmounts.optional(),
25
+ credit_applied: Money,
26
+ amount_paid: Money,
27
+ amount_due: Money,
28
+ amount_refunded: Money,
29
+ })
30
+ .describe("One billing account's usage billing for one UTC calendar month, summed over the month's statements. It is a summary, not something to pay; each closing's invoice is collected on its own.");
@@ -0,0 +1,43 @@
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 MonthlyStatementList: zod.ZodObject<{
10
+ items: zod.ZodArray<zod.ZodObject<{
11
+ billing_account_id: zod.ZodInt;
12
+ currency: zod.ZodString;
13
+ period_start: zod.z.ZodISODateTime;
14
+ period_end: zod.z.ZodISODateTime;
15
+ finalized: zod.ZodBoolean;
16
+ finalized_at: zod.ZodOptional<zod.z.ZodISODateTime>;
17
+ statement_count: zod.ZodInt;
18
+ billed: zod.ZodObject<{
19
+ subtotal: zod.ZodString;
20
+ discount_amount: zod.ZodString;
21
+ tax_amount: zod.ZodString;
22
+ total: zod.ZodString;
23
+ }, zod.z.core.$strict>;
24
+ credited_amount: zod.ZodString;
25
+ unbilled: zod.ZodOptional<zod.ZodObject<{
26
+ subtotal: zod.ZodString;
27
+ discount_amount: zod.ZodString;
28
+ tax_amount: zod.ZodString;
29
+ total: zod.ZodString;
30
+ }, zod.z.core.$strict>>;
31
+ credit_applied: zod.ZodString;
32
+ amount_paid: zod.ZodString;
33
+ amount_due: zod.ZodString;
34
+ amount_refunded: zod.ZodString;
35
+ }, zod.z.core.$strict>>;
36
+ pagination: zod.ZodObject<{
37
+ page: zod.ZodInt;
38
+ page_size: zod.ZodInt;
39
+ total_count: zod.ZodOptional<zod.ZodInt>;
40
+ }, zod.z.core.$strict>;
41
+ }, zod.z.core.$strict>;
42
+ export type MonthlyStatementList = zod.input<typeof MonthlyStatementList>;
43
+ export type MonthlyStatementListOutput = zod.output<typeof MonthlyStatementList>;
@@ -0,0 +1,14 @@
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 { MonthlyStatement } from "./monthlyStatement.zod.js";
10
+ import { OffsetPagination } from "./offsetPagination.zod.js";
11
+ export const MonthlyStatementList = zod.strictObject({
12
+ items: zod.array(MonthlyStatement),
13
+ pagination: OffsetPagination,
14
+ });
@@ -5,7 +5,7 @@
5
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
6
  * OpenAPI spec version: v1
7
7
  */
8
- import type { AccountBalance, ActiveResourceList, AllowanceList, AutoRenewSet, BillingAccount, BillingAccountCreate, BillingAccountList, BillingAccountUpdate, CancelSubscriptionRequest, Cancellation, CancellationCreate, CancellationList, Contact, ContactCreate, ContactList, ContactUpdate, CreditGrantList, CreditNote, CreditNoteItemList, CreditNoteList, CurrencyList, DiscountList, EntitlementList, Error, ErrorResponse, FeatureGrantList, GetPlanHeaders, GetPriceHeaders, GetProductHeaders, GetStatementUsageParams, Invoice, InvoiceItemList, InvoiceList, ListAccountDiscountsParams, ListActiveResourcesParams, ListAllowancesParams, ListBillingAccountsParams, ListCancellationsParams, ListContactsParams, ListCreditGrantsParams, ListCreditNoteItemsParams, ListCreditNotesParams, ListCurrenciesParams, ListEntitlementsParams, ListFeatureGrantsParams, ListInvoiceItemsParams, ListInvoicesParams, ListOrderItemsParams, ListOrdersParams, ListPaymentMethodsParams, ListPaymentOptionsParams, ListPlansHeaders, ListPlansParams, ListPricesByPlanHeaders, ListPricesByPlanParams, ListPricesHeaders, ListPricesParams, ListProductsHeaders, ListProductsParams, ListProjectAssignmentsParams, ListRatesHeaders, ListRatesParams, ListRefundsParams, ListRenewalPricesParams, ListSpendParams, ListStatementsParams, ListSubscriptionsParams, ListTopUpsParams, ListTransactionsParams, ListUsageChargesParams, NotModifiedResponse, Order, OrderCancel, OrderItemList, OrderList, PayInvoiceRequest, PayTogetherRequest, PaymentMethod, PaymentMethodList, PaymentMethodSetup, PaymentMethodSetupResult, PaymentOptionList, PaymentPreview, PaymentResult, Plan, PlanList, PreviewInvoicePaymentParams, Price, PriceList, Product, ProductID, ProductList, ProjectAssignment, ProjectAssignmentList, Quote, QuoteRequest, RateList, RefundList, RenewRequest, RenewalOrderRequest, RenewalPriceList, SetProjectAssignmentRequest, SpendRowList, Statement, StatementList, StatementSummary, Subscription, SubscriptionList, TopUp, TopUpCreate, TopUpList, TransactionList, UsageChargeList } from "./models.js";
8
+ import type { AccountBalance, ActiveResourceList, AllowanceList, AutoRenewSet, BillingAccount, BillingAccountCreate, BillingAccountList, BillingAccountUpdate, CancelSubscriptionRequest, Cancellation, CancellationCreate, CancellationList, Contact, ContactCreate, ContactList, ContactUpdate, CreditGrantList, CreditNote, CreditNoteItemList, CreditNoteList, CurrencyList, DiscountList, EntitlementList, Error, ErrorResponse, FeatureGrantList, GetPlanHeaders, GetPriceHeaders, GetProductHeaders, GetStatementUsageParams, Invoice, InvoiceItemList, InvoiceList, ListAccountDiscountsParams, ListActiveResourcesParams, ListAllowancesParams, ListBillingAccountsParams, ListCancellationsParams, ListContactsParams, ListCreditGrantsParams, ListCreditNoteItemsParams, ListCreditNotesParams, ListCurrenciesParams, ListEntitlementsParams, ListFeatureGrantsParams, ListInvoiceItemsParams, ListInvoicesParams, ListMonthlyStatementsParams, ListOrderItemsParams, ListOrdersParams, ListPaymentMethodsParams, ListPaymentOptionsParams, ListPlansHeaders, ListPlansParams, ListPricesByPlanHeaders, ListPricesByPlanParams, ListPricesHeaders, ListPricesParams, ListProductsHeaders, ListProductsParams, ListProjectAssignmentsParams, ListRatesHeaders, ListRatesParams, ListRefundsParams, ListRenewalPricesParams, ListSpendParams, ListStatementsParams, ListSubscriptionsParams, ListTopUpsParams, ListTransactionsParams, ListUsageChargesParams, MonthlyStatementList, NotModifiedResponse, Order, OrderCancel, OrderItemList, OrderList, PayInvoiceRequest, PayTogetherRequest, PaymentMethod, PaymentMethodList, PaymentMethodSetup, PaymentMethodSetupResult, PaymentOptionList, PaymentPreview, PaymentResult, Plan, PlanList, PreviewInvoicePaymentParams, Price, PriceList, Product, ProductID, ProductList, ProjectAssignment, ProjectAssignmentList, Quote, QuoteRequest, RateList, RefundList, RenewRequest, RenewalOrderRequest, RenewalPriceList, SetProjectAssignmentRequest, SpendRowList, Statement, StatementList, StatementSummary, Subscription, SubscriptionList, TopUp, TopUpCreate, TopUpList, TransactionList, UsageChargeList } from "./models.js";
9
9
  export type HTTPStatusCode1xx = 100 | 101 | 102 | 103;
10
10
  export type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;
11
11
  export type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;
@@ -607,8 +607,12 @@ export declare const getPayInvoiceUrl: (invoiceId: string) => string;
607
607
  * `BILLING_CHANGE_NOT_INVOICED`.
608
608
  *
609
609
  * Returns a payment action when customer interaction is required. requires_action and processing
610
- * do not mean paid; the invoice is marked paid after payment is confirmed. An unresolved payment
611
- * attempt is reused, and retries do not apply credit grants or balance twice.
610
+ * do not mean paid; the invoice is marked paid after payment is confirmed. An unresolved online
611
+ * payment made with the same gateway, method and saved payment method is reused, and retries do not
612
+ * apply credit grants or balance twice. Paying any other way cancels that earlier online payment
613
+ * first; if the gateway had already collected it, the invoice is paid by it and nothing more is
614
+ * charged. One the gateway is still processing is refused with `BILLING_PAYMENT_PENDING` and
615
+ * `meta.transaction_id`; wait for its outcome.
612
616
  *
613
617
  * Calling this on an invoice that is already paid returns the existing payment result without
614
618
  * another charge. A void invoice is refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an
@@ -679,8 +683,9 @@ export declare const getPayTogetherUrl: () => string;
679
683
  * Either every invoice is paid or none is. When the credit grants and balance cannot cover
680
684
  * them all, the request fails with `BILLING_INSUFFICIENT_FUNDS` and nothing is charged.
681
685
  * A total different from expected_amount fails with `BILLING_AMOUNT_CHANGED` and nothing is charged.
682
- * Invoices that are already paid are not charged again. An invoice with an online payment
683
- * still in progress is refused with `BILLING_PAYMENT_PENDING`, a void invoice with
686
+ * Invoices that are already paid are not charged again. An online payment started earlier for one
687
+ * of the invoices is canceled first; one the gateway is still processing is refused with
688
+ * `BILLING_PAYMENT_PENDING` and `meta.transaction_id`, a void invoice with
684
689
  * `BILLING_INVOICE_NOT_PAYABLE`, a deferred period-end change not yet due to be invoiced with
685
690
  * `BILLING_CHANGE_NOT_INVOICED`, an order that has failed or was canceled with
686
691
  * `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`, and an order whose payment deadline has
@@ -1430,7 +1435,7 @@ export declare const getCancelOrderUrl: (orderId: string) => string;
1430
1435
  * Payment may be absent, partial or complete. Once the order's terms are fixed, the selected items
1431
1436
  * keep their agreed amounts and discounts; credit notes reduce issued invoices, and collected amounts
1432
1437
  * are returned to their original payment sources. While the terms of a deferred order are not fixed,
1433
- * the remaining items are priced again. External payment-method refunds can finish asynchronously.
1438
+ * the remaining items are priced again. External payment-method refunds can finish asynchronously. An online payment still waiting for the payer is canceled with the order; one the gateway is already processing is refused with `BILLING_PAYMENT_PENDING` and `meta.transaction_id`.
1434
1439
  * The order and financial history are retained; the same cancellation does not refund twice.
1435
1440
  *
1436
1441
  * Once the order is accepted, its owning service coordinates cancellation and confirms
@@ -1770,6 +1775,27 @@ export declare const getListSpendUrl: (params: ListSpendParams) => string;
1770
1775
  * @summary List account spend
1771
1776
  */
1772
1777
  export declare const listSpend: (params: ListSpendParams, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listSpendResponse>;
1778
+ export type listMonthlyStatementsResponse200 = {
1779
+ data: MonthlyStatementList;
1780
+ status: 200;
1781
+ };
1782
+ export type listMonthlyStatementsResponseDefault = {
1783
+ data: ErrorResponse;
1784
+ status: Exclude<HTTPStatusCodes, 200>;
1785
+ };
1786
+ export type listMonthlyStatementsResponseSuccess = listMonthlyStatementsResponse200 & {
1787
+ headers: Headers;
1788
+ };
1789
+ export type listMonthlyStatementsResponseError = listMonthlyStatementsResponseDefault & {
1790
+ headers: Headers;
1791
+ };
1792
+ export type listMonthlyStatementsResponse = listMonthlyStatementsResponseSuccess | listMonthlyStatementsResponseError;
1793
+ export declare const getListMonthlyStatementsUrl: (params?: ListMonthlyStatementsParams) => string;
1794
+ /**
1795
+ * Usage billing by UTC calendar month for owned billing accounts, newest first. Each period combines its statements, the invoices they issued and how those invoices were paid; usage is billed about hourly, so a month holds many statements. Filter by billing_account_id and by period start.
1796
+ * @summary List monthly statements
1797
+ */
1798
+ export declare const listMonthlyStatements: (params?: ListMonthlyStatementsParams, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listMonthlyStatementsResponse>;
1773
1799
  export type listStatementsResponse200 = {
1774
1800
  data: StatementList;
1775
1801
  status: 200;
@@ -638,8 +638,12 @@ export const getPayInvoiceUrl = (invoiceId) => {
638
638
  * `BILLING_CHANGE_NOT_INVOICED`.
639
639
  *
640
640
  * Returns a payment action when customer interaction is required. requires_action and processing
641
- * do not mean paid; the invoice is marked paid after payment is confirmed. An unresolved payment
642
- * attempt is reused, and retries do not apply credit grants or balance twice.
641
+ * do not mean paid; the invoice is marked paid after payment is confirmed. An unresolved online
642
+ * payment made with the same gateway, method and saved payment method is reused, and retries do not
643
+ * apply credit grants or balance twice. Paying any other way cancels that earlier online payment
644
+ * first; if the gateway had already collected it, the invoice is paid by it and nothing more is
645
+ * charged. One the gateway is still processing is refused with `BILLING_PAYMENT_PENDING` and
646
+ * `meta.transaction_id`; wait for its outcome.
643
647
  *
644
648
  * Calling this on an invoice that is already paid returns the existing payment result without
645
649
  * another charge. A void invoice is refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an
@@ -726,8 +730,9 @@ export const getPayTogetherUrl = () => {
726
730
  * Either every invoice is paid or none is. When the credit grants and balance cannot cover
727
731
  * them all, the request fails with `BILLING_INSUFFICIENT_FUNDS` and nothing is charged.
728
732
  * A total different from expected_amount fails with `BILLING_AMOUNT_CHANGED` and nothing is charged.
729
- * Invoices that are already paid are not charged again. An invoice with an online payment
730
- * still in progress is refused with `BILLING_PAYMENT_PENDING`, a void invoice with
733
+ * Invoices that are already paid are not charged again. An online payment started earlier for one
734
+ * of the invoices is canceled first; one the gateway is still processing is refused with
735
+ * `BILLING_PAYMENT_PENDING` and `meta.transaction_id`, a void invoice with
731
736
  * `BILLING_INVOICE_NOT_PAYABLE`, a deferred period-end change not yet due to be invoiced with
732
737
  * `BILLING_CHANGE_NOT_INVOICED`, an order that has failed or was canceled with
733
738
  * `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`, and an order whose payment deadline has
@@ -1578,7 +1583,7 @@ export const getCancelOrderUrl = (orderId) => {
1578
1583
  * Payment may be absent, partial or complete. Once the order's terms are fixed, the selected items
1579
1584
  * keep their agreed amounts and discounts; credit notes reduce issued invoices, and collected amounts
1580
1585
  * are returned to their original payment sources. While the terms of a deferred order are not fixed,
1581
- * the remaining items are priced again. External payment-method refunds can finish asynchronously.
1586
+ * the remaining items are priced again. External payment-method refunds can finish asynchronously. An online payment still waiting for the payer is canceled with the order; one the gateway is already processing is refused with `BILLING_PAYMENT_PENDING` and `meta.transaction_id`.
1582
1587
  * The order and financial history are retained; the same cancellation does not refund twice.
1583
1588
  *
1584
1589
  * Once the order is accepted, its owning service coordinates cancellation and confirms
@@ -2064,6 +2069,31 @@ export const listSpend = async (params, options, fetchFn) => {
2064
2069
  const data = body ? JSON.parse(body) : {};
2065
2070
  return { data, status: res.status, headers: res.headers };
2066
2071
  };
2072
+ export const getListMonthlyStatementsUrl = (params) => {
2073
+ const normalizedParams = new URLSearchParams();
2074
+ Object.entries(params || {}).forEach(([key, value]) => {
2075
+ if (value !== undefined) {
2076
+ normalizedParams.append(key, value === null ? "null" : String(value));
2077
+ }
2078
+ });
2079
+ const stringifiedParams = normalizedParams.toString();
2080
+ return stringifiedParams.length > 0
2081
+ ? `https://billing.leaflow.cloud/api/v1/monthly-statements?${stringifiedParams}`
2082
+ : `https://billing.leaflow.cloud/api/v1/monthly-statements`;
2083
+ };
2084
+ /**
2085
+ * Usage billing by UTC calendar month for owned billing accounts, newest first. Each period combines its statements, the invoices they issued and how those invoices were paid; usage is billed about hourly, so a month holds many statements. Filter by billing_account_id and by period start.
2086
+ * @summary List monthly statements
2087
+ */
2088
+ export const listMonthlyStatements = async (params, options, fetchFn) => {
2089
+ const res = await (fetchFn ?? fetch)(getListMonthlyStatementsUrl(params), {
2090
+ ...options,
2091
+ method: "GET",
2092
+ });
2093
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
2094
+ const data = body ? JSON.parse(body) : {};
2095
+ return { data, status: res.status, headers: res.headers };
2096
+ };
2067
2097
  export const getListStatementsUrl = (params) => {
2068
2098
  const normalizedParams = new URLSearchParams();
2069
2099
  Object.entries(params || {}).forEach(([key, value]) => {
@@ -712,7 +712,7 @@ export interface AccountBalance {
712
712
  * spendable balance and may differ from the recorded credits total.
713
713
  */
714
714
  credit_groups: CreditGroup[];
715
- /** Amount still payable on issued invoices. Unbilled usage is reported separately; arrears depend on actual eligible funding and grace terms. */
715
+ /** Amount still payable on issued invoices. The invoice of an order not yet accepted is a request to pay for that order rather than a debt, so it is excluded here and from available_credit. Unbilled usage is reported separately; arrears depend on actual eligible funding and grace terms. */
716
716
  due: Money;
717
717
  pending_returns_amount: Money;
718
718
  }
@@ -2858,6 +2858,31 @@ export interface StatementAmounts {
2858
2858
  tax_amount: Money;
2859
2859
  total: Money;
2860
2860
  }
2861
+ /**
2862
+ * One billing account's usage billing for one UTC calendar month, summed over the month's statements. It is a summary, not something to pay; each closing's invoice is collected on its own.
2863
+ */
2864
+ export interface MonthlyStatement {
2865
+ billing_account_id: number;
2866
+ currency: string;
2867
+ period_start: string;
2868
+ period_end: string;
2869
+ /** True after the period's final closing, which applies minimum charges for the whole month. Usage priced later is still billed in supplement statements and added here. */
2870
+ finalized: boolean;
2871
+ finalized_at?: string;
2872
+ /** Statements of the period, including the open one. */
2873
+ statement_count: number;
2874
+ billed: StatementAmounts;
2875
+ credited_amount: Money;
2876
+ unbilled?: StatementAmounts;
2877
+ credit_applied: Money;
2878
+ amount_paid: Money;
2879
+ amount_due: Money;
2880
+ amount_refunded: Money;
2881
+ }
2882
+ export interface MonthlyStatementList {
2883
+ items: MonthlyStatement[];
2884
+ pagination: OffsetPagination;
2885
+ }
2861
2886
  export type StatementStatus = (typeof StatementStatus)[keyof typeof StatementStatus];
2862
2887
  export declare const StatementStatus: {
2863
2888
  readonly open: "open";
@@ -3750,6 +3775,29 @@ export declare const ListSpendGroupBy: {
3750
3775
  readonly plan: "plan";
3751
3776
  readonly resource: "resource";
3752
3777
  };
3778
+ export type ListMonthlyStatementsParams = {
3779
+ billing_account_id?: number;
3780
+ /**
3781
+ * Earliest period start, inclusive.
3782
+ */
3783
+ from?: string;
3784
+ /**
3785
+ * Latest period start, exclusive.
3786
+ */
3787
+ to?: string;
3788
+ /**
3789
+ * 1-based page number. Defaults to 1.
3790
+ * @minimum 1
3791
+ * @maximum 2147483647
3792
+ */
3793
+ page?: number;
3794
+ /**
3795
+ * Items per page. Defaults to 50; at most 200.
3796
+ * @minimum 1
3797
+ * @maximum 200
3798
+ */
3799
+ page_size?: number;
3800
+ };
3753
3801
  export type ListStatementsParams = {
3754
3802
  billing_account_id?: number;
3755
3803
  status?: StatementStatus;
@@ -334,8 +334,12 @@ export declare const DeletePaymentMethodParams: zod.ZodObject<{
334
334
  * `BILLING_CHANGE_NOT_INVOICED`.
335
335
  *
336
336
  * Returns a payment action when customer interaction is required. requires_action and processing
337
- * do not mean paid; the invoice is marked paid after payment is confirmed. An unresolved payment
338
- * attempt is reused, and retries do not apply credit grants or balance twice.
337
+ * do not mean paid; the invoice is marked paid after payment is confirmed. An unresolved online
338
+ * payment made with the same gateway, method and saved payment method is reused, and retries do not
339
+ * apply credit grants or balance twice. Paying any other way cancels that earlier online payment
340
+ * first; if the gateway had already collected it, the invoice is paid by it and nothing more is
341
+ * charged. One the gateway is still processing is refused with `BILLING_PAYMENT_PENDING` and
342
+ * `meta.transaction_id`; wait for its outcome.
339
343
  *
340
344
  * Calling this on an invoice that is already paid returns the existing payment result without
341
345
  * another charge. A void invoice is refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an
@@ -396,8 +400,9 @@ export declare const PreviewInvoicePaymentQueryParams: zod.ZodObject<{
396
400
  * Either every invoice is paid or none is. When the credit grants and balance cannot cover
397
401
  * them all, the request fails with `BILLING_INSUFFICIENT_FUNDS` and nothing is charged.
398
402
  * A total different from expected_amount fails with `BILLING_AMOUNT_CHANGED` and nothing is charged.
399
- * Invoices that are already paid are not charged again. An invoice with an online payment
400
- * still in progress is refused with `BILLING_PAYMENT_PENDING`, a void invoice with
403
+ * Invoices that are already paid are not charged again. An online payment started earlier for one
404
+ * of the invoices is canceled first; one the gateway is still processing is refused with
405
+ * `BILLING_PAYMENT_PENDING` and `meta.transaction_id`, a void invoice with
401
406
  * `BILLING_INVOICE_NOT_PAYABLE`, a deferred period-end change not yet due to be invoiced with
402
407
  * `BILLING_CHANGE_NOT_INVOICED`, an order that has failed or was canceled with
403
408
  * `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`, and an order whose payment deadline has
@@ -996,7 +1001,7 @@ export declare const GetOrderParams: zod.ZodObject<{
996
1001
  * Payment may be absent, partial or complete. Once the order's terms are fixed, the selected items
997
1002
  * keep their agreed amounts and discounts; credit notes reduce issued invoices, and collected amounts
998
1003
  * are returned to their original payment sources. While the terms of a deferred order are not fixed,
999
- * the remaining items are priced again. External payment-method refunds can finish asynchronously.
1004
+ * the remaining items are priced again. External payment-method refunds can finish asynchronously. An online payment still waiting for the payer is canceled with the order; one the gateway is already processing is refused with `BILLING_PAYMENT_PENDING` and `meta.transaction_id`.
1000
1005
  * The order and financial history are retained; the same cancellation does not refund twice.
1001
1006
  *
1002
1007
  * Once the order is accepted, its owning service coordinates cancellation and confirms
@@ -1273,6 +1278,21 @@ export declare const ListSpendQueryParams: zod.ZodObject<{
1273
1278
  billing_account_id: zod.ZodInt;
1274
1279
  project_ids: zod.ZodOptional<zod.ZodArray<zod.ZodUUID>>;
1275
1280
  }, zod.z.core.$strict>;
1281
+ /**
1282
+ * Usage billing by UTC calendar month for owned billing accounts, newest first. Each period combines its statements, the invoices they issued and how those invoices were paid; usage is billed about hourly, so a month holds many statements. Filter by billing_account_id and by period start.
1283
+ * @summary List monthly statements
1284
+ */
1285
+ export declare const listMonthlyStatementsQueryPageDefault = 1;
1286
+ export declare const listMonthlyStatementsQueryPageMax = 2147483647;
1287
+ export declare const listMonthlyStatementsQueryPageSizeDefault = 50;
1288
+ export declare const listMonthlyStatementsQueryPageSizeMax = 200;
1289
+ export declare const ListMonthlyStatementsQueryParams: zod.ZodObject<{
1290
+ billing_account_id: zod.ZodOptional<zod.ZodInt>;
1291
+ from: zod.ZodOptional<zod.z.ZodISODateTime>;
1292
+ to: zod.ZodOptional<zod.z.ZodISODateTime>;
1293
+ page: zod.ZodDefault<zod.ZodInt>;
1294
+ page_size: zod.ZodDefault<zod.ZodInt>;
1295
+ }, zod.z.core.$strict>;
1276
1296
  /**
1277
1297
  * Paginated consumption statement batches for owned billing accounts, filtered by billing_account_id, open or closed state and period-start interval. A closed batch is not proof that the whole month has finished.
1278
1298
  * @summary List statements
@@ -389,8 +389,12 @@ export const DeletePaymentMethodParams = zod.strictObject({
389
389
  * `BILLING_CHANGE_NOT_INVOICED`.
390
390
  *
391
391
  * Returns a payment action when customer interaction is required. requires_action and processing
392
- * do not mean paid; the invoice is marked paid after payment is confirmed. An unresolved payment
393
- * attempt is reused, and retries do not apply credit grants or balance twice.
392
+ * do not mean paid; the invoice is marked paid after payment is confirmed. An unresolved online
393
+ * payment made with the same gateway, method and saved payment method is reused, and retries do not
394
+ * apply credit grants or balance twice. Paying any other way cancels that earlier online payment
395
+ * first; if the gateway had already collected it, the invoice is paid by it and nothing more is
396
+ * charged. One the gateway is still processing is refused with `BILLING_PAYMENT_PENDING` and
397
+ * `meta.transaction_id`; wait for its outcome.
394
398
  *
395
399
  * Calling this on an invoice that is already paid returns the existing payment result without
396
400
  * another charge. A void invoice is refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an
@@ -453,8 +457,9 @@ export const PreviewInvoicePaymentQueryParams = zod.strictObject({
453
457
  * Either every invoice is paid or none is. When the credit grants and balance cannot cover
454
458
  * them all, the request fails with `BILLING_INSUFFICIENT_FUNDS` and nothing is charged.
455
459
  * A total different from expected_amount fails with `BILLING_AMOUNT_CHANGED` and nothing is charged.
456
- * Invoices that are already paid are not charged again. An invoice with an online payment
457
- * still in progress is refused with `BILLING_PAYMENT_PENDING`, a void invoice with
460
+ * Invoices that are already paid are not charged again. An online payment started earlier for one
461
+ * of the invoices is canceled first; one the gateway is still processing is refused with
462
+ * `BILLING_PAYMENT_PENDING` and `meta.transaction_id`, a void invoice with
458
463
  * `BILLING_INVOICE_NOT_PAYABLE`, a deferred period-end change not yet due to be invoiced with
459
464
  * `BILLING_CHANGE_NOT_INVOICED`, an order that has failed or was canceled with
460
465
  * `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`, and an order whose payment deadline has
@@ -1135,7 +1140,7 @@ export const GetOrderParams = zod.strictObject({
1135
1140
  * Payment may be absent, partial or complete. Once the order's terms are fixed, the selected items
1136
1141
  * keep their agreed amounts and discounts; credit notes reduce issued invoices, and collected amounts
1137
1142
  * are returned to their original payment sources. While the terms of a deferred order are not fixed,
1138
- * the remaining items are priced again. External payment-method refunds can finish asynchronously.
1143
+ * the remaining items are priced again. External payment-method refunds can finish asynchronously. An online payment still waiting for the payer is canceled with the order; one the gateway is already processing is refused with `BILLING_PAYMENT_PENDING` and `meta.transaction_id`.
1139
1144
  * The order and financial history are retained; the same cancellation does not refund twice.
1140
1145
  *
1141
1146
  * Once the order is accepted, its owning service coordinates cancellation and confirms
@@ -1600,6 +1605,31 @@ export const ListSpendQueryParams = zod.strictObject({
1600
1605
  .optional()
1601
1606
  .describe("Restrict the account-authorized results to these projects. Omit for all projects and account-level records. This filter does not grant access to another billing account."),
1602
1607
  });
1608
+ /**
1609
+ * Usage billing by UTC calendar month for owned billing accounts, newest first. Each period combines its statements, the invoices they issued and how those invoices were paid; usage is billed about hourly, so a month holds many statements. Filter by billing_account_id and by period start.
1610
+ * @summary List monthly statements
1611
+ */
1612
+ export const listMonthlyStatementsQueryPageDefault = 1;
1613
+ export const listMonthlyStatementsQueryPageMax = 2147483647;
1614
+ export const listMonthlyStatementsQueryPageSizeDefault = 50;
1615
+ export const listMonthlyStatementsQueryPageSizeMax = 200;
1616
+ export const ListMonthlyStatementsQueryParams = zod.strictObject({
1617
+ billing_account_id: zod.int().optional(),
1618
+ from: zod.iso.datetime({ offset: true }).optional().describe("Earliest period start, inclusive."),
1619
+ to: zod.iso.datetime({ offset: true }).optional().describe("Latest period start, exclusive."),
1620
+ page: zod
1621
+ .int()
1622
+ .min(1)
1623
+ .max(listMonthlyStatementsQueryPageMax)
1624
+ .default(listMonthlyStatementsQueryPageDefault)
1625
+ .describe("1-based page number. Defaults to 1."),
1626
+ page_size: zod
1627
+ .int()
1628
+ .min(1)
1629
+ .max(listMonthlyStatementsQueryPageSizeMax)
1630
+ .default(listMonthlyStatementsQueryPageSizeDefault)
1631
+ .describe("Items per page. Defaults to 50; at most 200."),
1632
+ });
1603
1633
  /**
1604
1634
  * Paginated consumption statement batches for owned billing accounts, filtered by billing_account_id, open or closed state and period-start interval. A closed batch is not proof that the whole month has finished.
1605
1635
  * @summary List statements
@@ -21,7 +21,7 @@ export const AccountBalance = zod
21
21
  credit_groups: zod
22
22
  .array(CreditGroup)
23
23
  .describe("Currently valid, unspent credit grouped by permitted use. Restrictions and\nvalidity dates determine which charges a group can cover, so these groups are not a general\nspendable balance and may differ from the recorded credits total."),
24
- due: Money.describe("Amount still payable on issued invoices. Unbilled usage is reported separately; arrears depend on actual eligible funding and grace terms."),
24
+ due: Money.describe("Amount still payable on issued invoices. The invoice of an order not yet accepted is a request to pay for that order rather than a debt, so it is excluded here and from available_credit. Unbilled usage is reported separately; arrears depend on actual eligible funding and grace terms."),
25
25
  pending_returns_amount: Money,
26
26
  })
27
27
  .describe("Account balance, credits, and unpaid charges are reported separately.");
@@ -0,0 +1,21 @@
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 listMonthlyStatementsParamsPageDefault = 1;
10
+ export declare const listMonthlyStatementsParamsPageMax = 2147483647;
11
+ export declare const listMonthlyStatementsParamsPageSizeDefault = 50;
12
+ export declare const listMonthlyStatementsParamsPageSizeMax = 200;
13
+ export declare const ListMonthlyStatementsParams: zod.ZodObject<{
14
+ billing_account_id: zod.ZodOptional<zod.ZodInt>;
15
+ from: zod.ZodOptional<zod.z.ZodISODateTime>;
16
+ to: zod.ZodOptional<zod.z.ZodISODateTime>;
17
+ page: zod.ZodDefault<zod.ZodInt>;
18
+ page_size: zod.ZodDefault<zod.ZodInt>;
19
+ }, zod.z.core.$strict>;
20
+ export type ListMonthlyStatementsParams = zod.input<typeof ListMonthlyStatementsParams>;
21
+ export type ListMonthlyStatementsParamsOutput = zod.output<typeof ListMonthlyStatementsParams>;
@@ -0,0 +1,27 @@
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 const listMonthlyStatementsParamsPageDefault = 1;
10
+ export const listMonthlyStatementsParamsPageMax = 2147483647;
11
+ export const listMonthlyStatementsParamsPageSizeDefault = 50;
12
+ export const listMonthlyStatementsParamsPageSizeMax = 200;
13
+ export const ListMonthlyStatementsParams = zod.strictObject({
14
+ billing_account_id: zod.int().optional(),
15
+ from: zod.iso.datetime({ offset: true }).optional(),
16
+ to: zod.iso.datetime({ offset: true }).optional(),
17
+ page: zod
18
+ .int()
19
+ .min(1)
20
+ .max(listMonthlyStatementsParamsPageMax)
21
+ .default(listMonthlyStatementsParamsPageDefault),
22
+ page_size: zod
23
+ .int()
24
+ .min(1)
25
+ .max(listMonthlyStatementsParamsPageSizeMax)
26
+ .default(listMonthlyStatementsParamsPageSizeDefault),
27
+ });
@@ -0,0 +1,36 @@
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 MonthlyStatement: zod.ZodObject<{
10
+ billing_account_id: zod.ZodInt;
11
+ currency: zod.ZodString;
12
+ period_start: zod.z.ZodISODateTime;
13
+ period_end: zod.z.ZodISODateTime;
14
+ finalized: zod.ZodBoolean;
15
+ finalized_at: zod.ZodOptional<zod.z.ZodISODateTime>;
16
+ statement_count: zod.ZodInt;
17
+ billed: zod.ZodObject<{
18
+ subtotal: zod.ZodString;
19
+ discount_amount: zod.ZodString;
20
+ tax_amount: zod.ZodString;
21
+ total: zod.ZodString;
22
+ }, zod.z.core.$strict>;
23
+ credited_amount: zod.ZodString;
24
+ unbilled: zod.ZodOptional<zod.ZodObject<{
25
+ subtotal: zod.ZodString;
26
+ discount_amount: zod.ZodString;
27
+ tax_amount: zod.ZodString;
28
+ total: zod.ZodString;
29
+ }, zod.z.core.$strict>>;
30
+ credit_applied: zod.ZodString;
31
+ amount_paid: zod.ZodString;
32
+ amount_due: zod.ZodString;
33
+ amount_refunded: zod.ZodString;
34
+ }, zod.z.core.$strict>;
35
+ export type MonthlyStatement = zod.input<typeof MonthlyStatement>;
36
+ export type MonthlyStatementOutput = zod.output<typeof MonthlyStatement>;