@leaflow/sdk 0.110.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.
- package/dist/billing/v1/generated/functions.d.ts +91 -1
- package/dist/billing/v1/generated/functions.js +109 -0
- package/dist/billing/v1/generated/models.d.ts +17 -0
- package/dist/billing/v1/generated/models.js +1 -0
- package/dist/billing/v1/generated/schemas.zod.d.ts +60 -0
- package/dist/billing/v1/generated/schemas.zod.js +52 -0
- package/dist/billing/v1/generated/validators/cancelSubscriptionRequest.zod.d.ts +21 -0
- package/dist/billing/v1/generated/validators/cancelSubscriptionRequest.zod.js +21 -0
- package/dist/billing/v1/generated/validators/cancellationCreate.zod.js +1 -1
- package/dist/billing/v1/generated/validators/subscription.zod.d.ts +1 -0
- package/dist/billing/v1/generated/validators/subscription.zod.js +1 -1
- package/dist/billing/v1/generated/validators/subscriptionList.zod.d.ts +1 -0
- package/dist/billing/v1/generated/validators/terminateSubscriptionRequest.zod.d.ts +15 -0
- package/dist/billing/v1/generated/validators/terminateSubscriptionRequest.zod.js +16 -0
- package/dist/routes.d.ts +24 -0
- package/dist/routes.js +27 -0
- package/package.json +1 -1
|
@@ -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, Cancellation, CancellationCreate, CancellationList, CheckoutOrderRequest, CreditGrantList, CreditNote, CreditNoteItemList, CreditNoteList, CurrencyList, DiscountList, EntitlementList, Error, ErrorResponse, GetPlanHeaders, GetPriceHeaders, GetProductHeaders, Invoice, InvoiceItemList, InvoiceList, ListAccountDiscountsParams, ListActiveResourcesParams, ListAllowancesParams, ListBillingAccountsParams, ListCancellationsParams, ListCreditGrantsParams, ListCreditNoteItemsParams, ListCreditNotesParams, ListCurrenciesParams, ListEntitlementsParams, ListInvoiceItemsParams, ListInvoicesParams, ListOrderItemsParams, ListOrdersParams, ListPaymentMethodsParams, ListPaymentOptionsParams, ListPlansHeaders, ListPlansParams, ListPricesByPlanHeaders, ListPricesByPlanParams, ListPricesHeaders, ListPricesParams, ListProductsHeaders, ListProductsParams, ListProjectAssignmentsParams, ListRatesHeaders, ListRatesParams, ListRefundsParams, ListRenewalPricesParams, ListSpendParams, ListSubscriptionsParams, ListTopUpsParams, ListTransactionsParams, ListUsageChargesParams, MeteredUsage, 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, 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, CheckoutOrderRequest, CreditGrantList, CreditNote, CreditNoteItemList, CreditNoteList, CurrencyList, DiscountList, EntitlementList, Error, ErrorResponse, GetPlanHeaders, GetPriceHeaders, GetProductHeaders, Invoice, InvoiceItemList, InvoiceList, ListAccountDiscountsParams, ListActiveResourcesParams, ListAllowancesParams, ListBillingAccountsParams, ListCancellationsParams, ListCreditGrantsParams, ListCreditNoteItemsParams, ListCreditNotesParams, ListCurrenciesParams, ListEntitlementsParams, ListInvoiceItemsParams, ListInvoicesParams, ListOrderItemsParams, ListOrdersParams, ListPaymentMethodsParams, ListPaymentOptionsParams, ListPlansHeaders, ListPlansParams, ListPricesByPlanHeaders, ListPricesByPlanParams, ListPricesHeaders, ListPricesParams, ListProductsHeaders, ListProductsParams, ListProjectAssignmentsParams, ListRatesHeaders, ListRatesParams, ListRefundsParams, ListRenewalPricesParams, ListSpendParams, ListSubscriptionsParams, ListTopUpsParams, ListTransactionsParams, ListUsageChargesParams, MeteredUsage, 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, Subscription, SubscriptionList, TerminateSubscriptionRequest, 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;
|
|
@@ -878,6 +878,96 @@ export declare const getGetSubscriptionUrl: (subscriptionId: string) => string;
|
|
|
878
878
|
* @summary Get subscription
|
|
879
879
|
*/
|
|
880
880
|
export declare const getSubscription: (subscriptionId: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getSubscriptionResponse>;
|
|
881
|
+
export type deleteSubscriptionResponse204 = {
|
|
882
|
+
data: void;
|
|
883
|
+
status: 204;
|
|
884
|
+
};
|
|
885
|
+
export type deleteSubscriptionResponseDefault = {
|
|
886
|
+
data: ErrorResponse;
|
|
887
|
+
status: Exclude<HTTPStatusCodes, 204>;
|
|
888
|
+
};
|
|
889
|
+
export type deleteSubscriptionResponseSuccess = deleteSubscriptionResponse204 & {
|
|
890
|
+
headers: Headers;
|
|
891
|
+
};
|
|
892
|
+
export type deleteSubscriptionResponseError = deleteSubscriptionResponseDefault & {
|
|
893
|
+
headers: Headers;
|
|
894
|
+
};
|
|
895
|
+
export type deleteSubscriptionResponse = deleteSubscriptionResponseSuccess | deleteSubscriptionResponseError;
|
|
896
|
+
export declare const getDeleteSubscriptionUrl: (subscriptionId: string) => string;
|
|
897
|
+
/**
|
|
898
|
+
* Hides an already terminated subscription from your subscription list and detail. Your account
|
|
899
|
+
* access token must authorize the subscription's current billing account. Billing and financial
|
|
900
|
+
* history remain available. This operation cannot force termination, skip cleanup, or delete a
|
|
901
|
+
* pending, provisioning, active or suspended subscription. Other states, including canceled, are
|
|
902
|
+
* refused with 409 BILLING_SUBSCRIPTION_NOT_TERMINATED and status in error params. A canceled
|
|
903
|
+
* subscription must first be converted to terminated. Sends no cleanup command and creates no refund.
|
|
904
|
+
* @summary Delete subscription
|
|
905
|
+
*/
|
|
906
|
+
export declare const deleteSubscription: (subscriptionId: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<deleteSubscriptionResponse>;
|
|
907
|
+
export type cancelSubscriptionResponse202 = {
|
|
908
|
+
data: Cancellation;
|
|
909
|
+
status: 202;
|
|
910
|
+
};
|
|
911
|
+
export type cancelSubscriptionResponseDefault = {
|
|
912
|
+
data: ErrorResponse;
|
|
913
|
+
status: Exclude<HTTPStatusCodes, 202>;
|
|
914
|
+
};
|
|
915
|
+
export type cancelSubscriptionResponseSuccess = cancelSubscriptionResponse202 & {
|
|
916
|
+
headers: Headers;
|
|
917
|
+
};
|
|
918
|
+
export type cancelSubscriptionResponseError = cancelSubscriptionResponseDefault & {
|
|
919
|
+
headers: Headers;
|
|
920
|
+
};
|
|
921
|
+
export type cancelSubscriptionResponse = cancelSubscriptionResponseSuccess | cancelSubscriptionResponseError;
|
|
922
|
+
export declare const getCancelSubscriptionUrl: (subscriptionId: string) => string;
|
|
923
|
+
/**
|
|
924
|
+
* Requests cancellation on the purchase's agreed terms. Uses the same quotation, eligibility,
|
|
925
|
+
* metering and original-payment-source refund rules as creating a cancellation.
|
|
926
|
+
* Supply the refund amount from create-quote with this subscription in cancellation.subscription_ids.
|
|
927
|
+
* Your account access token must authorize the subscription's current billing account.
|
|
928
|
+
*
|
|
929
|
+
* Immediate cancellation asks the owning service to clean up now. Period-end cancellation keeps
|
|
930
|
+
* the subscription active or suspended until the paid term ends. Neither payment nor acceptance
|
|
931
|
+
* of this request proves cleanup. The subscription becomes canceled only after the service
|
|
932
|
+
* confirms release and the end of metering; follow the returned cancellation for progress.
|
|
933
|
+
*
|
|
934
|
+
* Related subscriptions released together must be submitted as one group to create-cancellation.
|
|
935
|
+
* Pending or provisioning purchases are canceled through their order, not this operation.
|
|
936
|
+
* Repeating the same open cancellation returns it without another refund or command.
|
|
937
|
+
* @summary Cancel subscription
|
|
938
|
+
*/
|
|
939
|
+
export declare const cancelSubscription: (subscriptionId: string, cancelSubscriptionRequest: CancelSubscriptionRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<cancelSubscriptionResponse>;
|
|
940
|
+
export type terminateSubscriptionResponse200 = {
|
|
941
|
+
data: Subscription;
|
|
942
|
+
status: 200;
|
|
943
|
+
};
|
|
944
|
+
export type terminateSubscriptionResponseDefault = {
|
|
945
|
+
data: ErrorResponse;
|
|
946
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
947
|
+
};
|
|
948
|
+
export type terminateSubscriptionResponseSuccess = terminateSubscriptionResponse200 & {
|
|
949
|
+
headers: Headers;
|
|
950
|
+
};
|
|
951
|
+
export type terminateSubscriptionResponseError = terminateSubscriptionResponseDefault & {
|
|
952
|
+
headers: Headers;
|
|
953
|
+
};
|
|
954
|
+
export type terminateSubscriptionResponse = terminateSubscriptionResponseSuccess | terminateSubscriptionResponseError;
|
|
955
|
+
export declare const getTerminateSubscriptionUrl: (subscriptionId: string) => string;
|
|
956
|
+
/**
|
|
957
|
+
* Converts an already canceled subscription to terminated so it can subsequently be hidden.
|
|
958
|
+
* Your account access token must authorize the subscription's current billing account. Preserves
|
|
959
|
+
* the original billing end and financial history, sends no new cleanup command, and creates no
|
|
960
|
+
* credit note or refund. A terminated subscription is returned unchanged on repeat; a deleted
|
|
961
|
+
* subscription remains hidden from tenant reads.
|
|
962
|
+
*
|
|
963
|
+
* Account holders cannot force termination of pending, provisioning, active or suspended
|
|
964
|
+
* subscriptions. These states are refused with 400 BILLING_SUBSCRIPTION_INVALID and status in
|
|
965
|
+
* error params. Use cancellation under the agreed terms to end service. Immediate commercial
|
|
966
|
+
* termination is reserved for administrators and the owning service. The audited reason does
|
|
967
|
+
* not grant permission to terminate. No force, skip-cleanup or refund options are accepted.
|
|
968
|
+
* @summary Terminate subscription
|
|
969
|
+
*/
|
|
970
|
+
export declare const terminateSubscription: (subscriptionId: string, terminateSubscriptionRequest: TerminateSubscriptionRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<terminateSubscriptionResponse>;
|
|
881
971
|
export type createQuoteResponse200 = {
|
|
882
972
|
data: Quote;
|
|
883
973
|
status: 200;
|
|
@@ -964,6 +964,115 @@ export const getSubscription = async (subscriptionId, options, fetchFn) => {
|
|
|
964
964
|
const data = body ? JSON.parse(body) : {};
|
|
965
965
|
return { data, status: res.status, headers: res.headers };
|
|
966
966
|
};
|
|
967
|
+
export const getDeleteSubscriptionUrl = (subscriptionId) => {
|
|
968
|
+
return `https://billing.leaflow.cloud/api/v1/subscriptions/${encodeURIComponent(String(subscriptionId))}`;
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Hides an already terminated subscription from your subscription list and detail. Your account
|
|
972
|
+
* access token must authorize the subscription's current billing account. Billing and financial
|
|
973
|
+
* history remain available. This operation cannot force termination, skip cleanup, or delete a
|
|
974
|
+
* pending, provisioning, active or suspended subscription. Other states, including canceled, are
|
|
975
|
+
* refused with 409 BILLING_SUBSCRIPTION_NOT_TERMINATED and status in error params. A canceled
|
|
976
|
+
* subscription must first be converted to terminated. Sends no cleanup command and creates no refund.
|
|
977
|
+
* @summary Delete subscription
|
|
978
|
+
*/
|
|
979
|
+
export const deleteSubscription = async (subscriptionId, options, fetchFn) => {
|
|
980
|
+
const res = await (fetchFn ?? fetch)(getDeleteSubscriptionUrl(subscriptionId), {
|
|
981
|
+
...options,
|
|
982
|
+
method: "DELETE",
|
|
983
|
+
});
|
|
984
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
985
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
986
|
+
return { data, status: res.status, headers: res.headers };
|
|
987
|
+
};
|
|
988
|
+
export const getCancelSubscriptionUrl = (subscriptionId) => {
|
|
989
|
+
return `https://billing.leaflow.cloud/api/v1/subscriptions/${encodeURIComponent(String(subscriptionId))}/cancel`;
|
|
990
|
+
};
|
|
991
|
+
/**
|
|
992
|
+
* Requests cancellation on the purchase's agreed terms. Uses the same quotation, eligibility,
|
|
993
|
+
* metering and original-payment-source refund rules as creating a cancellation.
|
|
994
|
+
* Supply the refund amount from create-quote with this subscription in cancellation.subscription_ids.
|
|
995
|
+
* Your account access token must authorize the subscription's current billing account.
|
|
996
|
+
*
|
|
997
|
+
* Immediate cancellation asks the owning service to clean up now. Period-end cancellation keeps
|
|
998
|
+
* the subscription active or suspended until the paid term ends. Neither payment nor acceptance
|
|
999
|
+
* of this request proves cleanup. The subscription becomes canceled only after the service
|
|
1000
|
+
* confirms release and the end of metering; follow the returned cancellation for progress.
|
|
1001
|
+
*
|
|
1002
|
+
* Related subscriptions released together must be submitted as one group to create-cancellation.
|
|
1003
|
+
* Pending or provisioning purchases are canceled through their order, not this operation.
|
|
1004
|
+
* Repeating the same open cancellation returns it without another refund or command.
|
|
1005
|
+
* @summary Cancel subscription
|
|
1006
|
+
*/
|
|
1007
|
+
export const cancelSubscription = async (subscriptionId, cancelSubscriptionRequest, options, fetchFn) => {
|
|
1008
|
+
const getHeaders = (h) => {
|
|
1009
|
+
if (!h)
|
|
1010
|
+
return {};
|
|
1011
|
+
if (h instanceof Headers)
|
|
1012
|
+
return Object.fromEntries(h.entries());
|
|
1013
|
+
if (Symbol.iterator in h) {
|
|
1014
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1015
|
+
}
|
|
1016
|
+
const headers = {};
|
|
1017
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1018
|
+
if (value !== undefined)
|
|
1019
|
+
headers[name] = value;
|
|
1020
|
+
}
|
|
1021
|
+
return headers;
|
|
1022
|
+
};
|
|
1023
|
+
const res = await (fetchFn ?? fetch)(getCancelSubscriptionUrl(subscriptionId), {
|
|
1024
|
+
...options,
|
|
1025
|
+
method: "POST",
|
|
1026
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1027
|
+
body: JSON.stringify(cancelSubscriptionRequest),
|
|
1028
|
+
});
|
|
1029
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1030
|
+
const data = body ? JSON.parse(body) : {};
|
|
1031
|
+
return { data, status: res.status, headers: res.headers };
|
|
1032
|
+
};
|
|
1033
|
+
export const getTerminateSubscriptionUrl = (subscriptionId) => {
|
|
1034
|
+
return `https://billing.leaflow.cloud/api/v1/subscriptions/${encodeURIComponent(String(subscriptionId))}/terminate`;
|
|
1035
|
+
};
|
|
1036
|
+
/**
|
|
1037
|
+
* Converts an already canceled subscription to terminated so it can subsequently be hidden.
|
|
1038
|
+
* Your account access token must authorize the subscription's current billing account. Preserves
|
|
1039
|
+
* the original billing end and financial history, sends no new cleanup command, and creates no
|
|
1040
|
+
* credit note or refund. A terminated subscription is returned unchanged on repeat; a deleted
|
|
1041
|
+
* subscription remains hidden from tenant reads.
|
|
1042
|
+
*
|
|
1043
|
+
* Account holders cannot force termination of pending, provisioning, active or suspended
|
|
1044
|
+
* subscriptions. These states are refused with 400 BILLING_SUBSCRIPTION_INVALID and status in
|
|
1045
|
+
* error params. Use cancellation under the agreed terms to end service. Immediate commercial
|
|
1046
|
+
* termination is reserved for administrators and the owning service. The audited reason does
|
|
1047
|
+
* not grant permission to terminate. No force, skip-cleanup or refund options are accepted.
|
|
1048
|
+
* @summary Terminate subscription
|
|
1049
|
+
*/
|
|
1050
|
+
export const terminateSubscription = async (subscriptionId, terminateSubscriptionRequest, options, fetchFn) => {
|
|
1051
|
+
const getHeaders = (h) => {
|
|
1052
|
+
if (!h)
|
|
1053
|
+
return {};
|
|
1054
|
+
if (h instanceof Headers)
|
|
1055
|
+
return Object.fromEntries(h.entries());
|
|
1056
|
+
if (Symbol.iterator in h) {
|
|
1057
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1058
|
+
}
|
|
1059
|
+
const headers = {};
|
|
1060
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1061
|
+
if (value !== undefined)
|
|
1062
|
+
headers[name] = value;
|
|
1063
|
+
}
|
|
1064
|
+
return headers;
|
|
1065
|
+
};
|
|
1066
|
+
const res = await (fetchFn ?? fetch)(getTerminateSubscriptionUrl(subscriptionId), {
|
|
1067
|
+
...options,
|
|
1068
|
+
method: "POST",
|
|
1069
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1070
|
+
body: JSON.stringify(terminateSubscriptionRequest),
|
|
1071
|
+
});
|
|
1072
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1073
|
+
const data = body ? JSON.parse(body) : {};
|
|
1074
|
+
return { data, status: res.status, headers: res.headers };
|
|
1075
|
+
};
|
|
967
1076
|
export const getCreateQuoteUrl = () => {
|
|
968
1077
|
return `https://billing.leaflow.cloud/api/v1/quotes`;
|
|
969
1078
|
};
|
|
@@ -1679,6 +1679,7 @@ export declare const SubscriptionStatus: {
|
|
|
1679
1679
|
readonly suspended: "suspended";
|
|
1680
1680
|
readonly canceled: "canceled";
|
|
1681
1681
|
readonly terminated: "terminated";
|
|
1682
|
+
readonly deleted: "deleted";
|
|
1682
1683
|
};
|
|
1683
1684
|
/**
|
|
1684
1685
|
* An independently billed purchase relationship, separate from the owning service's resource.
|
|
@@ -2646,6 +2647,22 @@ export interface CursorPagination {
|
|
|
2646
2647
|
/** @nullable */
|
|
2647
2648
|
next_cursor?: string | null;
|
|
2648
2649
|
}
|
|
2650
|
+
export interface TerminateSubscriptionRequest {
|
|
2651
|
+
/**
|
|
2652
|
+
* @minLength 8
|
|
2653
|
+
* @maxLength 1024
|
|
2654
|
+
*/
|
|
2655
|
+
reason: string;
|
|
2656
|
+
}
|
|
2657
|
+
export interface CancelSubscriptionRequest {
|
|
2658
|
+
mode: TerminationPolicy;
|
|
2659
|
+
/** For immediate cancellation, the quoted whole-second refund basis. Now when omitted. */
|
|
2660
|
+
proration_date?: string;
|
|
2661
|
+
/** The cancellation quote's refundable amount, including an explicit zero. */
|
|
2662
|
+
expected_refundable_amount: Money & string;
|
|
2663
|
+
/** @maxLength 1024 */
|
|
2664
|
+
reason?: string;
|
|
2665
|
+
}
|
|
2649
2666
|
/**
|
|
2650
2667
|
* Error
|
|
2651
2668
|
*/
|
|
@@ -527,6 +527,66 @@ export declare const ListSubscriptionsQueryParams: zod.ZodObject<{
|
|
|
527
527
|
export declare const GetSubscriptionParams: zod.ZodObject<{
|
|
528
528
|
subscriptionId: zod.ZodUUID;
|
|
529
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>;
|
|
530
590
|
/**
|
|
531
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.
|
|
532
592
|
*
|
|
@@ -9,6 +9,7 @@ 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";
|
|
14
15
|
import { OrderCancel } from "./validators/orderCancel.zod.js";
|
|
@@ -19,6 +20,7 @@ import { QuoteRequest } from "./validators/quoteRequest.zod.js";
|
|
|
19
20
|
import { RenewRequest } from "./validators/renewRequest.zod.js";
|
|
20
21
|
import { RenewalOrderRequest } from "./validators/renewalOrderRequest.zod.js";
|
|
21
22
|
import { SetProjectAssignmentRequest } from "./validators/setProjectAssignmentRequest.zod.js";
|
|
23
|
+
import { TerminateSubscriptionRequest } from "./validators/terminateSubscriptionRequest.zod.js";
|
|
22
24
|
import { TopUpCreate } from "./validators/topUpCreate.zod.js";
|
|
23
25
|
/**
|
|
24
26
|
* The currencies a new billing account can be opened in. A retired currency is not listed,
|
|
@@ -713,6 +715,56 @@ export const ListSubscriptionsQueryParams = zod.strictObject({
|
|
|
713
715
|
export const GetSubscriptionParams = zod.strictObject({
|
|
714
716
|
subscriptionId: zod.uuid(),
|
|
715
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;
|
|
716
768
|
/**
|
|
717
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.
|
|
718
770
|
*
|
|
@@ -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("
|
|
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
|
|
@@ -69,7 +69,7 @@ export const Subscription = zod
|
|
|
69
69
|
.describe("End of the prepaid service already activated. Null until a new subscription becomes active,\neven when its purchase has been paid, and for postpaid subscriptions with no prepaid end date."),
|
|
70
70
|
auto_renew: zod.boolean(),
|
|
71
71
|
status: zod
|
|
72
|
-
.enum(["pending", "provisioning", "active", "suspended", "canceled", "terminated"])
|
|
72
|
+
.enum(["pending", "provisioning", "active", "suspended", "canceled", "terminated", "deleted"])
|
|
73
73
|
.describe("pending means the purchase relationship exists but its order has not been accepted.\nprovisioning means the service accepted the order and is delivering. For a service-owned\npurchase, only confirmed delivery moves it to active; paying alone does not."),
|
|
74
74
|
started_at: zod.iso
|
|
75
75
|
.datetime({ offset: true })
|
|
@@ -0,0 +1,15 @@
|
|
|
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 terminateSubscriptionRequestReasonMin = 8;
|
|
10
|
+
export declare const terminateSubscriptionRequestReasonMax = 1024;
|
|
11
|
+
export declare const TerminateSubscriptionRequest: zod.ZodObject<{
|
|
12
|
+
reason: zod.ZodString;
|
|
13
|
+
}, zod.z.core.$strict>;
|
|
14
|
+
export type TerminateSubscriptionRequest = zod.input<typeof TerminateSubscriptionRequest>;
|
|
15
|
+
export type TerminateSubscriptionRequestOutput = zod.output<typeof TerminateSubscriptionRequest>;
|
|
@@ -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
|
+
export const terminateSubscriptionRequestReasonMin = 8;
|
|
10
|
+
export const terminateSubscriptionRequestReasonMax = 1024;
|
|
11
|
+
export const TerminateSubscriptionRequest = zod.strictObject({
|
|
12
|
+
reason: zod
|
|
13
|
+
.string()
|
|
14
|
+
.min(terminateSubscriptionRequestReasonMin)
|
|
15
|
+
.max(terminateSubscriptionRequestReasonMax),
|
|
16
|
+
});
|
package/dist/routes.d.ts
CHANGED
|
@@ -3270,5 +3270,29 @@ export declare const routes: readonly [{
|
|
|
3270
3270
|
readonly operationId: "rotate-l4-tunnel-subscription";
|
|
3271
3271
|
readonly securityScheme: "ScopedToken";
|
|
3272
3272
|
readonly upstreamUrl: "https://tunnel.leaflow.cloud";
|
|
3273
|
+
}, {
|
|
3274
|
+
readonly service: "billing";
|
|
3275
|
+
readonly contract: "billing";
|
|
3276
|
+
readonly method: "DELETE";
|
|
3277
|
+
readonly path: "/api/v1/subscriptions/{subscriptionId}";
|
|
3278
|
+
readonly operationId: "delete-subscription";
|
|
3279
|
+
readonly securityScheme: "AccessToken";
|
|
3280
|
+
readonly upstreamUrl: "https://billing.leaflow.cloud";
|
|
3281
|
+
}, {
|
|
3282
|
+
readonly service: "billing";
|
|
3283
|
+
readonly contract: "billing";
|
|
3284
|
+
readonly method: "POST";
|
|
3285
|
+
readonly path: "/api/v1/subscriptions/{subscriptionId}/cancel";
|
|
3286
|
+
readonly operationId: "cancel-subscription";
|
|
3287
|
+
readonly securityScheme: "AccessToken";
|
|
3288
|
+
readonly upstreamUrl: "https://billing.leaflow.cloud";
|
|
3289
|
+
}, {
|
|
3290
|
+
readonly service: "billing";
|
|
3291
|
+
readonly contract: "billing";
|
|
3292
|
+
readonly method: "POST";
|
|
3293
|
+
readonly path: "/api/v1/subscriptions/{subscriptionId}/terminate";
|
|
3294
|
+
readonly operationId: "terminate-subscription";
|
|
3295
|
+
readonly securityScheme: "AccessToken";
|
|
3296
|
+
readonly upstreamUrl: "https://billing.leaflow.cloud";
|
|
3273
3297
|
}];
|
|
3274
3298
|
export type Route = (typeof routes)[number];
|
package/dist/routes.js
CHANGED
|
@@ -3681,4 +3681,31 @@ export const routes = [
|
|
|
3681
3681
|
securityScheme: "ScopedToken",
|
|
3682
3682
|
upstreamUrl: "https://tunnel.leaflow.cloud",
|
|
3683
3683
|
},
|
|
3684
|
+
{
|
|
3685
|
+
service: "billing",
|
|
3686
|
+
contract: "billing",
|
|
3687
|
+
method: "DELETE",
|
|
3688
|
+
path: "/api/v1/subscriptions/{subscriptionId}",
|
|
3689
|
+
operationId: "delete-subscription",
|
|
3690
|
+
securityScheme: "AccessToken",
|
|
3691
|
+
upstreamUrl: "https://billing.leaflow.cloud",
|
|
3692
|
+
},
|
|
3693
|
+
{
|
|
3694
|
+
service: "billing",
|
|
3695
|
+
contract: "billing",
|
|
3696
|
+
method: "POST",
|
|
3697
|
+
path: "/api/v1/subscriptions/{subscriptionId}/cancel",
|
|
3698
|
+
operationId: "cancel-subscription",
|
|
3699
|
+
securityScheme: "AccessToken",
|
|
3700
|
+
upstreamUrl: "https://billing.leaflow.cloud",
|
|
3701
|
+
},
|
|
3702
|
+
{
|
|
3703
|
+
service: "billing",
|
|
3704
|
+
contract: "billing",
|
|
3705
|
+
method: "POST",
|
|
3706
|
+
path: "/api/v1/subscriptions/{subscriptionId}/terminate",
|
|
3707
|
+
operationId: "terminate-subscription",
|
|
3708
|
+
securityScheme: "AccessToken",
|
|
3709
|
+
upstreamUrl: "https://billing.leaflow.cloud",
|
|
3710
|
+
},
|
|
3684
3711
|
];
|