@leaflow/sdk 0.109.0 → 0.111.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 (39) hide show
  1. package/dist/billing/v1/generated/functions.d.ts +172 -12
  2. package/dist/billing/v1/generated/functions.js +210 -11
  3. package/dist/billing/v1/generated/models.d.ts +115 -3
  4. package/dist/billing/v1/generated/models.js +5 -0
  5. package/dist/billing/v1/generated/schemas.zod.d.ts +116 -10
  6. package/dist/billing/v1/generated/schemas.zod.js +130 -10
  7. package/dist/billing/v1/generated/validators/cancelSubscriptionRequest.zod.d.ts +21 -0
  8. package/dist/billing/v1/generated/validators/cancelSubscriptionRequest.zod.js +21 -0
  9. package/dist/billing/v1/generated/validators/cancellationCreate.zod.js +1 -1
  10. package/dist/billing/v1/generated/validators/creditNote.zod.d.ts +24 -0
  11. package/dist/billing/v1/generated/validators/creditNote.zod.js +28 -0
  12. package/dist/billing/v1/generated/validators/creditNoteItem.zod.d.ts +17 -0
  13. package/dist/billing/v1/generated/validators/creditNoteItem.zod.js +16 -0
  14. package/dist/billing/v1/generated/validators/creditNoteItemList.zod.d.ts +24 -0
  15. package/dist/billing/v1/generated/validators/creditNoteItemList.zod.js +14 -0
  16. package/dist/billing/v1/generated/validators/creditNoteList.zod.d.ts +31 -0
  17. package/dist/billing/v1/generated/validators/creditNoteList.zod.js +14 -0
  18. package/dist/billing/v1/generated/validators/invoice.zod.d.ts +2 -0
  19. package/dist/billing/v1/generated/validators/invoice.zod.js +3 -1
  20. package/dist/billing/v1/generated/validators/invoiceList.zod.d.ts +2 -0
  21. package/dist/billing/v1/generated/validators/invoiceSummary.zod.d.ts +2 -0
  22. package/dist/billing/v1/generated/validators/invoiceSummary.zod.js +4 -1
  23. package/dist/billing/v1/generated/validators/listCreditNoteItemsParams.zod.d.ts +18 -0
  24. package/dist/billing/v1/generated/validators/listCreditNoteItemsParams.zod.js +24 -0
  25. package/dist/billing/v1/generated/validators/listCreditNotesParams.zod.d.ts +20 -0
  26. package/dist/billing/v1/generated/validators/listCreditNotesParams.zod.js +26 -0
  27. package/dist/billing/v1/generated/validators/order.zod.d.ts +2 -1
  28. package/dist/billing/v1/generated/validators/order.zod.js +0 -1
  29. package/dist/billing/v1/generated/validators/orderCancel.zod.d.ts +14 -0
  30. package/dist/billing/v1/generated/validators/orderCancel.zod.js +17 -0
  31. package/dist/billing/v1/generated/validators/orderList.zod.d.ts +2 -1
  32. package/dist/billing/v1/generated/validators/subscription.zod.d.ts +1 -0
  33. package/dist/billing/v1/generated/validators/subscription.zod.js +1 -1
  34. package/dist/billing/v1/generated/validators/subscriptionList.zod.d.ts +1 -0
  35. package/dist/billing/v1/generated/validators/terminateSubscriptionRequest.zod.d.ts +15 -0
  36. package/dist/billing/v1/generated/validators/terminateSubscriptionRequest.zod.js +16 -0
  37. package/dist/routes.d.ts +48 -0
  38. package/dist/routes.js +54 -0
  39. package/package.json +1 -1
@@ -428,6 +428,42 @@ export declare const ListCreditGrantsQueryParams: zod.ZodObject<{
428
428
  voided: "voided";
429
429
  }>>;
430
430
  }, zod.z.core.$strict>;
431
+ /**
432
+ * Newest issued_at first, then ID. Requires authorization for the invoice's billing account. Filters narrow authorized results and apply before counting and paging.
433
+ * @summary List credit notes
434
+ */
435
+ export declare const listCreditNotesQueryPageDefault = 1;
436
+ export declare const listCreditNotesQueryPageMax = 2147483647;
437
+ export declare const listCreditNotesQueryPageSizeDefault = 50;
438
+ export declare const listCreditNotesQueryPageSizeMax = 200;
439
+ export declare const ListCreditNotesQueryParams: zod.ZodObject<{
440
+ page: zod.ZodDefault<zod.ZodInt>;
441
+ page_size: zod.ZodDefault<zod.ZodInt>;
442
+ billing_account_id: zod.ZodOptional<zod.ZodInt>;
443
+ invoice_id: zod.ZodOptional<zod.ZodUUID>;
444
+ }, zod.z.core.$strict>;
445
+ /**
446
+ * Requires authorization for the invoice's billing account.
447
+ * @summary Get credit note
448
+ */
449
+ export declare const GetCreditNoteParams: zod.ZodObject<{
450
+ creditNoteId: zod.ZodUUID;
451
+ }, zod.z.core.$strict>;
452
+ /**
453
+ * The original invoice lines reduced by this note. Requires authorization for their invoice's billing account.
454
+ * @summary List credit note items
455
+ */
456
+ export declare const ListCreditNoteItemsParams: zod.ZodObject<{
457
+ creditNoteId: zod.ZodUUID;
458
+ }, zod.z.core.$strict>;
459
+ export declare const listCreditNoteItemsQueryPageDefault = 1;
460
+ export declare const listCreditNoteItemsQueryPageMax = 2147483647;
461
+ export declare const listCreditNoteItemsQueryPageSizeDefault = 50;
462
+ export declare const listCreditNoteItemsQueryPageSizeMax = 200;
463
+ export declare const ListCreditNoteItemsQueryParams: zod.ZodObject<{
464
+ page: zod.ZodDefault<zod.ZodInt>;
465
+ page_size: zod.ZodDefault<zod.ZodInt>;
466
+ }, zod.z.core.$strict>;
431
467
  /**
432
468
  * Newest first.
433
469
  * @summary List refunds
@@ -491,6 +527,66 @@ export declare const ListSubscriptionsQueryParams: zod.ZodObject<{
491
527
  export declare const GetSubscriptionParams: zod.ZodObject<{
492
528
  subscriptionId: zod.ZodUUID;
493
529
  }, zod.z.core.$strict>;
530
+ /**
531
+ * Hides an already terminated subscription from your subscription list and detail. Your account
532
+ * access token must authorize the subscription's current billing account. Billing and financial
533
+ * history remain available. This operation cannot force termination, skip cleanup, or delete a
534
+ * pending, provisioning, active or suspended subscription. Other states, including canceled, are
535
+ * refused with 409 BILLING_SUBSCRIPTION_NOT_TERMINATED and status in error params. A canceled
536
+ * subscription must first be converted to terminated. Sends no cleanup command and creates no refund.
537
+ * @summary Delete subscription
538
+ */
539
+ export declare const DeleteSubscriptionParams: zod.ZodObject<{
540
+ subscriptionId: zod.ZodUUID;
541
+ }, zod.z.core.$strict>;
542
+ /**
543
+ * Requests cancellation on the purchase's agreed terms. Uses the same quotation, eligibility,
544
+ * metering and original-payment-source refund rules as creating a cancellation.
545
+ * Supply the refund amount from create-quote with this subscription in cancellation.subscription_ids.
546
+ * Your account access token must authorize the subscription's current billing account.
547
+ *
548
+ * Immediate cancellation asks the owning service to clean up now. Period-end cancellation keeps
549
+ * the subscription active or suspended until the paid term ends. Neither payment nor acceptance
550
+ * of this request proves cleanup. The subscription becomes canceled only after the service
551
+ * confirms release and the end of metering; follow the returned cancellation for progress.
552
+ *
553
+ * Related subscriptions released together must be submitted as one group to create-cancellation.
554
+ * Pending or provisioning purchases are canceled through their order, not this operation.
555
+ * Repeating the same open cancellation returns it without another refund or command.
556
+ * @summary Cancel subscription
557
+ */
558
+ export declare const CancelSubscriptionParams: zod.ZodObject<{
559
+ subscriptionId: zod.ZodUUID;
560
+ }, zod.z.core.$strict>;
561
+ export declare const CancelSubscriptionBody: zod.ZodObject<{
562
+ mode: zod.ZodEnum<{
563
+ immediate: "immediate";
564
+ period_end: "period_end";
565
+ }>;
566
+ proration_date: zod.ZodOptional<zod.z.ZodISODateTime>;
567
+ expected_refundable_amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
568
+ reason: zod.ZodOptional<zod.ZodString>;
569
+ }, zod.z.core.$strict>;
570
+ /**
571
+ * Converts an already canceled subscription to terminated so it can subsequently be hidden.
572
+ * Your account access token must authorize the subscription's current billing account. Preserves
573
+ * the original billing end and financial history, sends no new cleanup command, and creates no
574
+ * credit note or refund. A terminated subscription is returned unchanged on repeat; a deleted
575
+ * subscription remains hidden from tenant reads.
576
+ *
577
+ * Account holders cannot force termination of pending, provisioning, active or suspended
578
+ * subscriptions. These states are refused with 400 BILLING_SUBSCRIPTION_INVALID and status in
579
+ * error params. Use cancellation under the agreed terms to end service. Immediate commercial
580
+ * termination is reserved for administrators and the owning service. The audited reason does
581
+ * not grant permission to terminate. No force, skip-cleanup or refund options are accepted.
582
+ * @summary Terminate subscription
583
+ */
584
+ export declare const TerminateSubscriptionParams: zod.ZodObject<{
585
+ subscriptionId: zod.ZodUUID;
586
+ }, zod.z.core.$strict>;
587
+ export declare const TerminateSubscriptionBody: zod.ZodObject<{
588
+ reason: zod.ZodString;
589
+ }, zod.z.core.$strict>;
494
590
  /**
495
591
  * Calculates exactly one target for a billing account you own: proposed items, existing order checkout, renewals, cancellation or order refund. Returns all requested calculations or a structured error. No quote is saved and no resource, payment, reservation or redemption is created.
496
592
  *
@@ -847,22 +943,32 @@ export declare const CheckoutOrderBody: zod.ZodObject<{
847
943
  expected_amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
848
944
  }, zod.z.core.$strict>;
849
945
  /**
850
- * Withdraws an unaccepted order without recording a delivery failure. Payment may be absent,
851
- * partial or complete; the order becomes canceled and any collected amount is automatically
852
- * returned to its original payment sources. External payment-method refunds can finish
853
- * asynchronously. Canceling an already canceled order returns it unchanged. A previously failed
854
- * order keeps its failure outcome. The order and financial history are retained.
946
+ * Cancels the selected, still-undelivered items of an unaccepted order without recording a
947
+ * delivery failure. Omit order_item_ids to select every still-pending item, or name one or
948
+ * more items. Successful items remain delivered and are not refunded. Whole-order and partial
949
+ * cancellation both require confirmed non-delivery and necessary cleanup. The order keeps
950
+ * its existing pending phase while any item is still pending; its final outcome follows all
951
+ * item outcomes. Previously failed items keep their failure outcome.
855
952
  *
856
- * Refused once the order is accepted: its owning service must coordinate cancellation during
857
- * provisioning and confirm non-delivery and necessary cleanup before recording cancellation.
858
- * Delivered items are ended through subscription cancellation. An unknown or in-flight payment
859
- * outcome must first be reconciled; it is not assumed to be unpaid. Scheduled changes continue
860
- * to be canceled through the service that owns them. Refund quotations use CreateQuote.refund.
953
+ * Payment may be absent, partial or complete. Confirmed checkout keeps the selected items'
954
+ * agreed amounts and discounts; credit notes reduce issued invoices, and collected amounts
955
+ * are returned to their original payment sources. When checkout has not been confirmed, the
956
+ * remaining items are quoted again. External payment-method refunds can finish asynchronously.
957
+ * The order and financial history are retained; the same cancellation does not refund twice.
958
+ *
959
+ * Once the order is accepted, its owning service coordinates cancellation and confirms
960
+ * non-delivery and cleanup through the cancellation RPC. Delivered items are ended through
961
+ * subscription cancellation. Unknown delivery or payment outcomes are not refund evidence;
962
+ * in-flight or unknown payments must be reconciled first. Scheduled changes continue to be
963
+ * canceled through the owning service. Refund quotations use CreateQuote.refund.
861
964
  * @summary Cancel order
862
965
  */
863
966
  export declare const CancelOrderParams: zod.ZodObject<{
864
967
  orderId: zod.ZodUUID;
865
968
  }, zod.z.core.$strict>;
969
+ export declare const CancelOrderBody: zod.ZodObject<{
970
+ order_item_ids: zod.ZodOptional<zod.ZodArray<zod.ZodUUID>>;
971
+ }, zod.z.core.$strict>;
866
972
  /**
867
973
  * One entry per item bought, with the price charged and the period it covers.
868
974
  * @summary List order items
@@ -9,8 +9,10 @@ import * as zod from "zod";
9
9
  import { AutoRenewSet } from "./validators/autoRenewSet.zod.js";
10
10
  import { BillingAccountCreate } from "./validators/billingAccountCreate.zod.js";
11
11
  import { BillingAccountUpdate } from "./validators/billingAccountUpdate.zod.js";
12
+ import { CancelSubscriptionRequest } from "./validators/cancelSubscriptionRequest.zod.js";
12
13
  import { CancellationCreate } from "./validators/cancellationCreate.zod.js";
13
14
  import { CheckoutOrderRequest } from "./validators/checkoutOrderRequest.zod.js";
15
+ import { OrderCancel } from "./validators/orderCancel.zod.js";
14
16
  import { PayInvoiceRequest } from "./validators/payInvoiceRequest.zod.js";
15
17
  import { PayTogetherRequest } from "./validators/payTogetherRequest.zod.js";
16
18
  import { PaymentMethodSetup } from "./validators/paymentMethodSetup.zod.js";
@@ -18,6 +20,7 @@ import { QuoteRequest } from "./validators/quoteRequest.zod.js";
18
20
  import { RenewRequest } from "./validators/renewRequest.zod.js";
19
21
  import { RenewalOrderRequest } from "./validators/renewalOrderRequest.zod.js";
20
22
  import { SetProjectAssignmentRequest } from "./validators/setProjectAssignmentRequest.zod.js";
23
+ import { TerminateSubscriptionRequest } from "./validators/terminateSubscriptionRequest.zod.js";
21
24
  import { TopUpCreate } from "./validators/topUpCreate.zod.js";
22
25
  /**
23
26
  * The currencies a new billing account can be opened in. A retired currency is not listed,
@@ -529,6 +532,65 @@ export const ListCreditGrantsQueryParams = zod.strictObject({
529
532
  .describe("Restrict to one of your accounts. All of them when omitted."),
530
533
  status: zod.enum(["active", "depleted", "expired", "voided"]).optional(),
531
534
  });
535
+ /**
536
+ * Newest issued_at first, then ID. Requires authorization for the invoice's billing account. Filters narrow authorized results and apply before counting and paging.
537
+ * @summary List credit notes
538
+ */
539
+ export const listCreditNotesQueryPageDefault = 1;
540
+ export const listCreditNotesQueryPageMax = 2147483647;
541
+ export const listCreditNotesQueryPageSizeDefault = 50;
542
+ export const listCreditNotesQueryPageSizeMax = 200;
543
+ export const ListCreditNotesQueryParams = zod.strictObject({
544
+ page: zod
545
+ .int()
546
+ .min(1)
547
+ .max(listCreditNotesQueryPageMax)
548
+ .default(listCreditNotesQueryPageDefault)
549
+ .describe("1-based page number. Defaults to 1."),
550
+ page_size: zod
551
+ .int()
552
+ .min(1)
553
+ .max(listCreditNotesQueryPageSizeMax)
554
+ .default(listCreditNotesQueryPageSizeDefault)
555
+ .describe("Items per page. Defaults to 50; at most 200."),
556
+ billing_account_id: zod
557
+ .int()
558
+ .optional()
559
+ .describe("Restrict to one of your accounts. All of them when omitted."),
560
+ invoice_id: zod.uuid().optional().describe("Only the notes for this invoice."),
561
+ });
562
+ /**
563
+ * Requires authorization for the invoice's billing account.
564
+ * @summary Get credit note
565
+ */
566
+ export const GetCreditNoteParams = zod.strictObject({
567
+ creditNoteId: zod.uuid(),
568
+ });
569
+ /**
570
+ * The original invoice lines reduced by this note. Requires authorization for their invoice's billing account.
571
+ * @summary List credit note items
572
+ */
573
+ export const ListCreditNoteItemsParams = zod.strictObject({
574
+ creditNoteId: zod.uuid(),
575
+ });
576
+ export const listCreditNoteItemsQueryPageDefault = 1;
577
+ export const listCreditNoteItemsQueryPageMax = 2147483647;
578
+ export const listCreditNoteItemsQueryPageSizeDefault = 50;
579
+ export const listCreditNoteItemsQueryPageSizeMax = 200;
580
+ export const ListCreditNoteItemsQueryParams = zod.strictObject({
581
+ page: zod
582
+ .int()
583
+ .min(1)
584
+ .max(listCreditNoteItemsQueryPageMax)
585
+ .default(listCreditNoteItemsQueryPageDefault)
586
+ .describe("1-based page number. Defaults to 1."),
587
+ page_size: zod
588
+ .int()
589
+ .min(1)
590
+ .max(listCreditNoteItemsQueryPageSizeMax)
591
+ .default(listCreditNoteItemsQueryPageSizeDefault)
592
+ .describe("Items per page. Defaults to 50; at most 200."),
593
+ });
532
594
  /**
533
595
  * Newest first.
534
596
  * @summary List refunds
@@ -653,6 +715,56 @@ export const ListSubscriptionsQueryParams = zod.strictObject({
653
715
  export const GetSubscriptionParams = zod.strictObject({
654
716
  subscriptionId: zod.uuid(),
655
717
  });
718
+ /**
719
+ * Hides an already terminated subscription from your subscription list and detail. Your account
720
+ * access token must authorize the subscription's current billing account. Billing and financial
721
+ * history remain available. This operation cannot force termination, skip cleanup, or delete a
722
+ * pending, provisioning, active or suspended subscription. Other states, including canceled, are
723
+ * refused with 409 BILLING_SUBSCRIPTION_NOT_TERMINATED and status in error params. A canceled
724
+ * subscription must first be converted to terminated. Sends no cleanup command and creates no refund.
725
+ * @summary Delete subscription
726
+ */
727
+ export const DeleteSubscriptionParams = zod.strictObject({
728
+ subscriptionId: zod.uuid(),
729
+ });
730
+ /**
731
+ * Requests cancellation on the purchase's agreed terms. Uses the same quotation, eligibility,
732
+ * metering and original-payment-source refund rules as creating a cancellation.
733
+ * Supply the refund amount from create-quote with this subscription in cancellation.subscription_ids.
734
+ * Your account access token must authorize the subscription's current billing account.
735
+ *
736
+ * Immediate cancellation asks the owning service to clean up now. Period-end cancellation keeps
737
+ * the subscription active or suspended until the paid term ends. Neither payment nor acceptance
738
+ * of this request proves cleanup. The subscription becomes canceled only after the service
739
+ * confirms release and the end of metering; follow the returned cancellation for progress.
740
+ *
741
+ * Related subscriptions released together must be submitted as one group to create-cancellation.
742
+ * Pending or provisioning purchases are canceled through their order, not this operation.
743
+ * Repeating the same open cancellation returns it without another refund or command.
744
+ * @summary Cancel subscription
745
+ */
746
+ export const CancelSubscriptionParams = zod.strictObject({
747
+ subscriptionId: zod.uuid(),
748
+ });
749
+ export const CancelSubscriptionBody = CancelSubscriptionRequest;
750
+ /**
751
+ * Converts an already canceled subscription to terminated so it can subsequently be hidden.
752
+ * Your account access token must authorize the subscription's current billing account. Preserves
753
+ * the original billing end and financial history, sends no new cleanup command, and creates no
754
+ * credit note or refund. A terminated subscription is returned unchanged on repeat; a deleted
755
+ * subscription remains hidden from tenant reads.
756
+ *
757
+ * Account holders cannot force termination of pending, provisioning, active or suspended
758
+ * subscriptions. These states are refused with 400 BILLING_SUBSCRIPTION_INVALID and status in
759
+ * error params. Use cancellation under the agreed terms to end service. Immediate commercial
760
+ * termination is reserved for administrators and the owning service. The audited reason does
761
+ * not grant permission to terminate. No force, skip-cleanup or refund options are accepted.
762
+ * @summary Terminate subscription
763
+ */
764
+ export const TerminateSubscriptionParams = zod.strictObject({
765
+ subscriptionId: zod.uuid(),
766
+ });
767
+ export const TerminateSubscriptionBody = TerminateSubscriptionRequest;
656
768
  /**
657
769
  * Calculates exactly one target for a billing account you own: proposed items, existing order checkout, renewals, cancellation or order refund. Returns all requested calculations or a structured error. No quote is saved and no resource, payment, reservation or redemption is created.
658
770
  *
@@ -977,22 +1089,30 @@ export const CheckoutOrderParams = zod.strictObject({
977
1089
  });
978
1090
  export const CheckoutOrderBody = CheckoutOrderRequest;
979
1091
  /**
980
- * Withdraws an unaccepted order without recording a delivery failure. Payment may be absent,
981
- * partial or complete; the order becomes canceled and any collected amount is automatically
982
- * returned to its original payment sources. External payment-method refunds can finish
983
- * asynchronously. Canceling an already canceled order returns it unchanged. A previously failed
984
- * order keeps its failure outcome. The order and financial history are retained.
1092
+ * Cancels the selected, still-undelivered items of an unaccepted order without recording a
1093
+ * delivery failure. Omit order_item_ids to select every still-pending item, or name one or
1094
+ * more items. Successful items remain delivered and are not refunded. Whole-order and partial
1095
+ * cancellation both require confirmed non-delivery and necessary cleanup. The order keeps
1096
+ * its existing pending phase while any item is still pending; its final outcome follows all
1097
+ * item outcomes. Previously failed items keep their failure outcome.
1098
+ *
1099
+ * Payment may be absent, partial or complete. Confirmed checkout keeps the selected items'
1100
+ * agreed amounts and discounts; credit notes reduce issued invoices, and collected amounts
1101
+ * are returned to their original payment sources. When checkout has not been confirmed, the
1102
+ * remaining items are quoted again. External payment-method refunds can finish asynchronously.
1103
+ * The order and financial history are retained; the same cancellation does not refund twice.
985
1104
  *
986
- * Refused once the order is accepted: its owning service must coordinate cancellation during
987
- * provisioning and confirm non-delivery and necessary cleanup before recording cancellation.
988
- * Delivered items are ended through subscription cancellation. An unknown or in-flight payment
989
- * outcome must first be reconciled; it is not assumed to be unpaid. Scheduled changes continue
990
- * to be canceled through the service that owns them. Refund quotations use CreateQuote.refund.
1105
+ * Once the order is accepted, its owning service coordinates cancellation and confirms
1106
+ * non-delivery and cleanup through the cancellation RPC. Delivered items are ended through
1107
+ * subscription cancellation. Unknown delivery or payment outcomes are not refund evidence;
1108
+ * in-flight or unknown payments must be reconciled first. Scheduled changes continue to be
1109
+ * canceled through the owning service. Refund quotations use CreateQuote.refund.
991
1110
  * @summary Cancel order
992
1111
  */
993
1112
  export const CancelOrderParams = zod.strictObject({
994
1113
  orderId: zod.uuid(),
995
1114
  });
1115
+ export const CancelOrderBody = OrderCancel;
996
1116
  /**
997
1117
  * One entry per item bought, with the price charged and the period it covers.
998
1118
  * @summary List order items
@@ -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 cancelSubscriptionRequestExpectedRefundableAmountTwoRegExp: RegExp;
10
+ export declare const cancelSubscriptionRequestReasonMax = 1024;
11
+ export declare const CancelSubscriptionRequest: zod.ZodObject<{
12
+ mode: zod.ZodEnum<{
13
+ immediate: "immediate";
14
+ period_end: "period_end";
15
+ }>;
16
+ proration_date: zod.ZodOptional<zod.z.ZodISODateTime>;
17
+ expected_refundable_amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
18
+ reason: zod.ZodOptional<zod.ZodString>;
19
+ }, zod.z.core.$strict>;
20
+ export type CancelSubscriptionRequest = zod.input<typeof CancelSubscriptionRequest>;
21
+ export type CancelSubscriptionRequestOutput = zod.output<typeof CancelSubscriptionRequest>;
@@ -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
+ import { Money } from "./money.zod.js";
10
+ import { TerminationPolicy } from "./terminationPolicy.zod.js";
11
+ export const cancelSubscriptionRequestExpectedRefundableAmountTwoRegExp = new RegExp("^[0-9]{1,15}([.][0-9]{1,10})?$");
12
+ export const cancelSubscriptionRequestReasonMax = 1024;
13
+ export const CancelSubscriptionRequest = zod.strictObject({
14
+ mode: TerminationPolicy,
15
+ proration_date: zod.iso
16
+ .datetime({ offset: true })
17
+ .optional()
18
+ .describe("For immediate cancellation, the quoted whole-second refund basis. Now when omitted."),
19
+ expected_refundable_amount: Money.and(zod.string().regex(cancelSubscriptionRequestExpectedRefundableAmountTwoRegExp)).describe("The cancellation quote's refundable amount, including an explicit zero."),
20
+ reason: zod.string().max(cancelSubscriptionRequestReasonMax).optional(),
21
+ });
@@ -9,7 +9,7 @@ import * as zod from "zod";
9
9
  import { Money } from "./money.zod.js";
10
10
  import { TerminationPolicy } from "./terminationPolicy.zod.js";
11
11
  export const cancellationCreateSubscriptionIdsMax = 50;
12
- export const cancellationCreateExpectedRefundableAmountTwoRegExp = new RegExp("^-?[0-9]{1,15}([.][0-9]{1,10})?$");
12
+ export const cancellationCreateExpectedRefundableAmountTwoRegExp = new RegExp("^[0-9]{1,15}([.][0-9]{1,10})?$");
13
13
  export const cancellationCreateReasonMax = 1024;
14
14
  export const CancellationCreate = zod.strictObject({
15
15
  subscription_ids: zod
@@ -0,0 +1,24 @@
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 CreditNote: zod.ZodObject<{
10
+ id: zod.ZodUUID;
11
+ invoice_id: zod.ZodUUID;
12
+ currency: zod.ZodString;
13
+ issued_at: zod.z.ZodISODateTime;
14
+ status: zod.ZodEnum<{
15
+ void: "void";
16
+ issued: "issued";
17
+ }>;
18
+ voided_at: zod.ZodNullable<zod.z.ZodISODateTime>;
19
+ unpaid_amount: zod.ZodString;
20
+ paid_amount: zod.ZodString;
21
+ refund_id: zod.ZodNullable<zod.ZodUUID>;
22
+ }, zod.z.core.$strict>;
23
+ export type CreditNote = zod.input<typeof CreditNote>;
24
+ export type CreditNoteOutput = zod.output<typeof CreditNote>;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Financial operations require an account access token and billing-account authorization. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { Money } from "./money.zod.js";
10
+ export const CreditNote = zod
11
+ .strictObject({
12
+ id: zod.uuid(),
13
+ invoice_id: zod.uuid(),
14
+ currency: zod.string(),
15
+ issued_at: zod.iso.datetime({ offset: true }),
16
+ status: zod.enum(["issued", "void"]),
17
+ voided_at: zod.iso
18
+ .datetime({ offset: true })
19
+ .nullable()
20
+ .describe("When this note was voided; null while issued."),
21
+ unpaid_amount: Money.describe("The reduction of unpaid receivables. A void note no longer reduces what is due."),
22
+ paid_amount: Money.describe("The credited part of payments already received. This is not proof that its refund has completed."),
23
+ refund_id: zod
24
+ .uuid()
25
+ .nullable()
26
+ .describe("The refund to the original payment sources, or null when no paid amount was credited."),
27
+ })
28
+ .describe("An issued invoice reduction. Its credited amount is unpaid_amount plus paid_amount. A paid credit records a return obligation; refund_id identifies its refund, whose outcome may still be pending. Original invoice amounts remain unchanged.");
@@ -0,0 +1,17 @@
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 CreditNoteItem: zod.ZodObject<{
10
+ id: zod.ZodUUID;
11
+ credit_note_id: zod.ZodUUID;
12
+ invoice_item_id: zod.ZodUUID;
13
+ unpaid_amount: zod.ZodString;
14
+ paid_amount: zod.ZodString;
15
+ }, zod.z.core.$strict>;
16
+ export type CreditNoteItem = zod.input<typeof CreditNoteItem>;
17
+ export type CreditNoteItemOutput = zod.output<typeof CreditNoteItem>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Financial operations require an account access token and billing-account authorization. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { Money } from "./money.zod.js";
10
+ export const CreditNoteItem = zod.strictObject({
11
+ id: zod.uuid(),
12
+ credit_note_id: zod.uuid(),
13
+ invoice_item_id: zod.uuid(),
14
+ unpaid_amount: Money,
15
+ paid_amount: Money,
16
+ });
@@ -0,0 +1,24 @@
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 CreditNoteItemList: zod.ZodObject<{
10
+ items: zod.ZodArray<zod.ZodObject<{
11
+ id: zod.ZodUUID;
12
+ credit_note_id: zod.ZodUUID;
13
+ invoice_item_id: zod.ZodUUID;
14
+ unpaid_amount: zod.ZodString;
15
+ paid_amount: zod.ZodString;
16
+ }, zod.z.core.$strict>>;
17
+ pagination: zod.ZodObject<{
18
+ page: zod.ZodInt;
19
+ page_size: zod.ZodInt;
20
+ total_count: zod.ZodOptional<zod.ZodInt>;
21
+ }, zod.z.core.$strict>;
22
+ }, zod.z.core.$strict>;
23
+ export type CreditNoteItemList = zod.input<typeof CreditNoteItemList>;
24
+ export type CreditNoteItemListOutput = zod.output<typeof CreditNoteItemList>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Financial operations require an account access token and billing-account authorization. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { CreditNoteItem } from "./creditNoteItem.zod.js";
10
+ import { OffsetPagination } from "./offsetPagination.zod.js";
11
+ export const CreditNoteItemList = zod.strictObject({
12
+ items: zod.array(CreditNoteItem),
13
+ pagination: OffsetPagination,
14
+ });
@@ -0,0 +1,31 @@
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 CreditNoteList: zod.ZodObject<{
10
+ items: zod.ZodArray<zod.ZodObject<{
11
+ id: zod.ZodUUID;
12
+ invoice_id: zod.ZodUUID;
13
+ currency: zod.ZodString;
14
+ issued_at: zod.z.ZodISODateTime;
15
+ status: zod.ZodEnum<{
16
+ void: "void";
17
+ issued: "issued";
18
+ }>;
19
+ voided_at: zod.ZodNullable<zod.z.ZodISODateTime>;
20
+ unpaid_amount: zod.ZodString;
21
+ paid_amount: zod.ZodString;
22
+ refund_id: zod.ZodNullable<zod.ZodUUID>;
23
+ }, zod.z.core.$strict>>;
24
+ pagination: zod.ZodObject<{
25
+ page: zod.ZodInt;
26
+ page_size: zod.ZodInt;
27
+ total_count: zod.ZodOptional<zod.ZodInt>;
28
+ }, zod.z.core.$strict>;
29
+ }, zod.z.core.$strict>;
30
+ export type CreditNoteList = zod.input<typeof CreditNoteList>;
31
+ export type CreditNoteListOutput = zod.output<typeof CreditNoteList>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Financial operations require an account access token and billing-account authorization. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { CreditNote } from "./creditNote.zod.js";
10
+ import { OffsetPagination } from "./offsetPagination.zod.js";
11
+ export const CreditNoteList = zod.strictObject({
12
+ items: zod.array(CreditNote),
13
+ pagination: OffsetPagination,
14
+ });
@@ -44,6 +44,8 @@ export declare const Invoice: zod.ZodObject<{
44
44
  credit_applied: zod.ZodOptional<zod.ZodString>;
45
45
  total: zod.ZodString;
46
46
  amount_paid: zod.ZodOptional<zod.ZodString>;
47
+ unpaid_credit_notes_amount: zod.ZodString;
48
+ paid_credit_notes_amount: zod.ZodString;
47
49
  amount_due: zod.ZodString;
48
50
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
49
51
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -32,7 +32,9 @@ export const Invoice = zod.strictObject({
32
32
  credit_applied: Money.optional().describe("Successful credit-grant payments included in amount_paid. Does not reduce the receivable or tax base."),
33
33
  total: Money.describe("Subtotal less discount plus tax. Balance and credit grants are payment sources, not reductions of the receivable."),
34
34
  amount_paid: Money.optional(),
35
- amount_due: Money.describe("What is still collectible after applied credits and successful payments; never below zero. A draft order invoice is not collectible until checkout confirms it, and a paid or void invoice has none."),
35
+ unpaid_credit_notes_amount: Money.describe("Issued, non-void credit notes that reduced unpaid receivables. Does not rewrite the original invoice total."),
36
+ paid_credit_notes_amount: Money.describe("Issued credit notes against payments already received. This is a return obligation, not evidence of completed refunds."),
37
+ amount_due: Money.describe("What is still collectible after unpaid credit notes and successful payments; never below zero. A draft order invoice is not collectible until checkout confirms it, and a paid or void invoice has none."),
36
38
  period_start: zod.iso.datetime({ offset: true }).nullish(),
37
39
  period_end: zod.iso.datetime({ offset: true }).nullish().describe("Exclusive."),
38
40
  customer_name: zod
@@ -45,6 +45,8 @@ export declare const InvoiceList: zod.ZodObject<{
45
45
  credit_applied: zod.ZodOptional<zod.ZodString>;
46
46
  total: zod.ZodString;
47
47
  amount_paid: zod.ZodOptional<zod.ZodString>;
48
+ unpaid_credit_notes_amount: zod.ZodString;
49
+ paid_credit_notes_amount: zod.ZodString;
48
50
  amount_due: zod.ZodString;
49
51
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
50
52
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -24,6 +24,8 @@ export declare const InvoiceSummary: zod.ZodObject<{
24
24
  tax_amount: zod.ZodString;
25
25
  total: zod.ZodString;
26
26
  amount_paid: zod.ZodString;
27
+ unpaid_credit_notes_amount: zod.ZodString;
28
+ paid_credit_notes_amount: zod.ZodString;
27
29
  amount_due: zod.ZodString;
28
30
  amount_refunded: zod.ZodString;
29
31
  due_at: zod.ZodOptional<zod.z.ZodISODateTime>;
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  import { InvoiceStatus } from "./invoiceStatus.zod.js";
10
+ import { Money } from "./money.zod.js";
10
11
  export const invoiceSummaryAmountDueRegExp = new RegExp("^\\d+(\\.\\d{1,10})?$");
11
12
  export const InvoiceSummary = zod
12
13
  .strictObject({
@@ -21,10 +22,12 @@ export const InvoiceSummary = zod
21
22
  tax_amount: zod.string(),
22
23
  total: zod.string(),
23
24
  amount_paid: zod.string(),
25
+ unpaid_credit_notes_amount: Money.describe("Issued, non-void credit notes that reduced unpaid receivables. Does not rewrite the original invoice total."),
26
+ paid_credit_notes_amount: Money.describe("Issued credit notes against payments already received. This is a return obligation, not evidence of completed refunds."),
24
27
  amount_due: zod
25
28
  .string()
26
29
  .regex(invoiceSummaryAmountDueRegExp)
27
- .describe("What is still collectible after applied credits and successful payments; never below zero."),
30
+ .describe("What is still collectible after unpaid credit notes and successful payments; never below zero."),
28
31
  amount_refunded: zod.string(),
29
32
  due_at: zod.iso.datetime({ offset: true }).optional(),
30
33
  })