@ominity/api-typescript 1.4.7 → 1.5.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/commonjs/funcs/commerce/customerSubscriptions.d.ts +6 -0
- package/dist/commonjs/funcs/commerce/customerSubscriptions.d.ts.map +1 -1
- package/dist/commonjs/funcs/commerce/customerSubscriptions.js +13 -1
- package/dist/commonjs/funcs/commerce/customerSubscriptions.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +1 -1
- package/dist/commonjs/models/commerce/index.d.ts +1 -0
- package/dist/commonjs/models/commerce/index.d.ts.map +1 -1
- package/dist/commonjs/models/commerce/index.js +1 -0
- package/dist/commonjs/models/commerce/index.js.map +1 -1
- package/dist/commonjs/models/commerce/subscription-change.d.ts +72 -0
- package/dist/commonjs/models/commerce/subscription-change.d.ts.map +1 -0
- package/dist/commonjs/models/commerce/subscription-change.js +96 -0
- package/dist/commonjs/models/commerce/subscription-change.js.map +1 -0
- package/dist/commonjs/models/commerce/subscription.d.ts +3 -1
- package/dist/commonjs/models/commerce/subscription.d.ts.map +1 -1
- package/dist/commonjs/models/commerce/subscription.js +2 -1
- package/dist/commonjs/models/commerce/subscription.js.map +1 -1
- package/dist/commonjs/models/errors/error-response.d.ts +6 -0
- package/dist/commonjs/models/errors/error-response.d.ts.map +1 -1
- package/dist/commonjs/models/errors/error-response.js +8 -1
- package/dist/commonjs/models/errors/error-response.js.map +1 -1
- package/dist/commonjs/models/operations/commerce-customer-subscriptions.d.ts +61 -0
- package/dist/commonjs/models/operations/commerce-customer-subscriptions.d.ts.map +1 -1
- package/dist/commonjs/models/operations/commerce-customer-subscriptions.js +17 -1
- package/dist/commonjs/models/operations/commerce-customer-subscriptions.js.map +1 -1
- package/dist/commonjs/sdk/commerce/customer-subscriptions.d.ts +15 -0
- package/dist/commonjs/sdk/commerce/customer-subscriptions.d.ts.map +1 -1
- package/dist/commonjs/sdk/commerce/customer-subscriptions.js +15 -0
- package/dist/commonjs/sdk/commerce/customer-subscriptions.js.map +1 -1
- package/dist/esm/funcs/commerce/customerSubscriptions.d.ts +6 -0
- package/dist/esm/funcs/commerce/customerSubscriptions.d.ts.map +1 -1
- package/dist/esm/funcs/commerce/customerSubscriptions.js +6 -0
- package/dist/esm/funcs/commerce/customerSubscriptions.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +1 -1
- package/dist/esm/models/commerce/index.d.ts +1 -0
- package/dist/esm/models/commerce/index.d.ts.map +1 -1
- package/dist/esm/models/commerce/index.js +1 -0
- package/dist/esm/models/commerce/index.js.map +1 -1
- package/dist/esm/models/commerce/subscription-change.d.ts +72 -0
- package/dist/esm/models/commerce/subscription-change.d.ts.map +1 -0
- package/dist/esm/models/commerce/subscription-change.js +60 -0
- package/dist/esm/models/commerce/subscription-change.js.map +1 -0
- package/dist/esm/models/commerce/subscription.d.ts +3 -1
- package/dist/esm/models/commerce/subscription.d.ts.map +1 -1
- package/dist/esm/models/commerce/subscription.js +2 -1
- package/dist/esm/models/commerce/subscription.js.map +1 -1
- package/dist/esm/models/errors/error-response.d.ts +6 -0
- package/dist/esm/models/errors/error-response.d.ts.map +1 -1
- package/dist/esm/models/errors/error-response.js +8 -1
- package/dist/esm/models/errors/error-response.js.map +1 -1
- package/dist/esm/models/operations/commerce-customer-subscriptions.d.ts +61 -0
- package/dist/esm/models/operations/commerce-customer-subscriptions.d.ts.map +1 -1
- package/dist/esm/models/operations/commerce-customer-subscriptions.js +16 -0
- package/dist/esm/models/operations/commerce-customer-subscriptions.js.map +1 -1
- package/dist/esm/sdk/commerce/customer-subscriptions.d.ts +15 -0
- package/dist/esm/sdk/commerce/customer-subscriptions.d.ts.map +1 -1
- package/dist/esm/sdk/commerce/customer-subscriptions.js +16 -1
- package/dist/esm/sdk/commerce/customer-subscriptions.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/commerce/customerSubscriptions.ts +6 -0
- package/src/lib/config.ts +1 -1
- package/src/models/commerce/index.ts +1 -0
- package/src/models/commerce/subscription-change.ts +137 -0
- package/src/models/commerce/subscription.ts +5 -2
- package/src/models/errors/error-response.ts +13 -1
- package/src/models/operations/commerce-customer-subscriptions.ts +37 -0
- package/src/sdk/commerce/customer-subscriptions.ts +16 -1
- package/tests/core-operations.test.mjs +125 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce-customer-subscriptions.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/commerce-customer-subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAyB,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,YAAY,EAA8B,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAA+C,MAAM,cAAc,CAAC;AAExF,MAAM,MAAM,gCAAgC,GAAG,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AACpF,MAAM,MAAM,iCAAiC,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AACxE,eAAO,MAAM,+CAA+C,EAAE,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAuE,CAAC;AAChL,eAAO,MAAM,+CAA+C,yGAA+D,CAAC;AAE5H,MAAM,MAAM,8BAA8B,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAC9G,MAAM,MAAM,+BAA+B,GAAG,YAAY,CAAC;AAC3D,eAAO,MAAM,6CAA6C,EAAE,CAAC,CAAC,OAAO,CAAC,8BAA8B,CAAoG,CAAC;AACzM,eAAO,MAAM,6CAA6C,mFAA6B,CAAC;AAExF,MAAM,MAAM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M,+CAA+C,mFAA6B,CAAC;AAE1F,MAAM,MAAM,iDAAiD,GAAG,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7H,MAAM,MAAM,kDAAkD,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AACpF,eAAO,MAAM,gEAAgE,EAAE,CAAC,CAAC,OAAO,CAAC,iDAAiD,CAAyG,CAAC;AACpP,eAAO,MAAM,gEAAgE,+FAAqD,CAAC;AAEnI,MAAM,MAAM,+CAA+C,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAC9J,MAAM,MAAM,gDAAgD,GAAG,OAAO,CAAC;AACvE,eAAO,MAAM,8DAA8D,EAAE,CAAC,CAAC,OAAO,CAAC,+CAA+C,CAA6I,CAAC;AACpR,eAAO,MAAM,8DAA8D,yEAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"commerce-customer-subscriptions.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/commerce-customer-subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAyB,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,YAAY,EAA8B,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAoC,sBAAsB,EAAwC,MAAM,oCAAoC,CAAC;AACxK,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAA+C,MAAM,cAAc,CAAC;AAExF,MAAM,MAAM,gCAAgC,GAAG,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AACpF,MAAM,MAAM,iCAAiC,GAAG,SAAS,CA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AAC;AAC5D,eAAO,MAAM,sDAAsD,EAAE,CAAC,CAAC,OAAO,CAAC,uCAAuC,CAAsG,CAAC;AAC7N,eAAO,MAAM,sDAAsD,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAY,CAAC;AAEhG,iGAAiG;AACjG,MAAM,MAAM,iCAAiC,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,SAAS,CAAA;KAAE,GAAG,SAAS,CAAA;CAAE,CAAC;AACrM,MAAM,MAAM,kCAAkC,GAAG,kBAAkB,CAAC;AACpE,eAAO,MAAM,gDAAgD,EAAE,CAAC,CAAC,OAAO,CAAC,iCAAiC,CAAuM,CAAC;AAClT,eAAO,MAAM,gDAAgD,+FAAmC,CAAC;AAEjG,MAAM,MAAM,6CAA6C,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3G,MAAM,MAAM,8CAA8C,GAAG,IAAI,CAAC;AAClE,eAAO,MAAM,4DAA4D,EAAE,CAAC,CAAC,OAAO,CAAC,6CAA6C,CAAgF,CAAC;AACnN,eAAO,MAAM,4DAA4D,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAY,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Product$inboundSchema } from "../commerce/product.js";
|
|
3
3
|
import { Subscription$inboundSchema } from "../commerce/subscription.js";
|
|
4
|
+
import { SubscriptionChange$inboundSchema, SubscriptionTransition$inboundSchema } from "../commerce/subscription-change.js";
|
|
4
5
|
import { ListRequest$outboundSchema, paginatedSchema } from "./helpers.js";
|
|
5
6
|
export const ListCustomerSubscriptionsRequest$outboundSchema = ListRequest$outboundSchema.extend({ customerId: z.number().int() });
|
|
6
7
|
export const ListCustomerSubscriptionsResponse$inboundSchema = paginatedSchema("subscriptions", Subscription$inboundSchema);
|
|
@@ -18,4 +19,19 @@ export const ListCustomerSubscriptionTransitionProductsRequest$outboundSchema =
|
|
|
18
19
|
export const ListCustomerSubscriptionTransitionProductsResponse$inboundSchema = paginatedSchema("products", Product$inboundSchema);
|
|
19
20
|
export const GetCustomerSubscriptionTransitionProductRequest$outboundSchema = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), productId: z.number().int(), include: z.string().optional() });
|
|
20
21
|
export const GetCustomerSubscriptionTransitionProductResponse$inboundSchema = Product$inboundSchema;
|
|
22
|
+
export const ListCustomerSubscriptionTransitionsRequest$outboundSchema = z.object({ customerId: z.number().int(), subscriptionId: z.number().int() });
|
|
23
|
+
export const ListCustomerSubscriptionTransitionsResponse$inboundSchema = z.object({
|
|
24
|
+
count: z.number().int(),
|
|
25
|
+
_embedded: z.object({ transitions: z.array(SubscriptionTransition$inboundSchema) }),
|
|
26
|
+
}).transform((value) => ({ count: value.count, items: value._embedded.transitions }));
|
|
27
|
+
export const QuoteCustomerSubscriptionChangeRequest$outboundSchema = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), data: z.object({ toOfferId: z.number().int(), timing: z.enum(["immediate", "period_end"]).optional() }) });
|
|
28
|
+
export const QuoteCustomerSubscriptionChangeResponse$inboundSchema = SubscriptionChange$inboundSchema;
|
|
29
|
+
export const ConfirmCustomerSubscriptionChangeRequest$outboundSchema = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), data: z.object({ quoteId: z.string() }) });
|
|
30
|
+
export const ConfirmCustomerSubscriptionChangeResponse$inboundSchema = SubscriptionChange$inboundSchema;
|
|
31
|
+
export const CancelCustomerSubscriptionChangeRequest$outboundSchema = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), changeId: z.string() });
|
|
32
|
+
export const CancelCustomerSubscriptionChangeResponse$inboundSchema = z.void();
|
|
33
|
+
export const CancelCustomerSubscriptionRequest$outboundSchema = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), data: z.object({ quoteId: z.string().optional(), timing: z.enum(["immediate", "period_end"]).optional() }).optional() });
|
|
34
|
+
export const CancelCustomerSubscriptionResponse$inboundSchema = SubscriptionChange$inboundSchema;
|
|
35
|
+
export const RevokeCustomerSubscriptionCancellationRequest$outboundSchema = z.object({ customerId: z.number().int(), subscriptionId: z.number().int() });
|
|
36
|
+
export const RevokeCustomerSubscriptionCancellationResponse$inboundSchema = z.void();
|
|
21
37
|
//# sourceMappingURL=commerce-customer-subscriptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce-customer-subscriptions.js","sourceRoot":"","sources":["../../../../src/models/operations/commerce-customer-subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAW,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAgB,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"commerce-customer-subscriptions.js","sourceRoot":"","sources":["../../../../src/models/operations/commerce-customer-subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAW,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAgB,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAsB,gCAAgC,EAA0B,oCAAoC,EAAE,MAAM,oCAAoC,CAAC;AAExK,OAAO,EAAe,0BAA0B,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIxF,MAAM,CAAC,MAAM,+CAA+C,GAAgD,0BAA0B,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAChL,MAAM,CAAC,MAAM,+CAA+C,GAAG,e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AE,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC7N,MAAM,CAAC,MAAM,sDAAsD,GAAoB,CAAC,CAAC,IAAI,EAAE,CAAC;AAKhG,MAAM,CAAC,MAAM,gDAAgD,GAAiD,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAClT,MAAM,CAAC,MAAM,gDAAgD,GAAG,gCAAgC,CAAC;AAIjG,MAAM,CAAC,MAAM,4DAA4D,GAA6D,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACnN,MAAM,CAAC,MAAM,4DAA4D,GAAoB,CAAC,CAAC,IAAI,EAAE,CAAC"}
|
|
@@ -5,9 +5,24 @@ export declare class CustomerSubscriptions extends ClientSDK {
|
|
|
5
5
|
get(request: operations.GetCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.GetCustomerSubscriptionResponse>;
|
|
6
6
|
create(request: operations.CreateCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.CreateCustomerSubscriptionResponse>;
|
|
7
7
|
update(request: operations.UpdateCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.UpdateCustomerSubscriptionResponse>;
|
|
8
|
+
/** Cancels the subscription straight away. Use `cancel` to cancel according to the cancellation policy (notice, minimum term, period end). */
|
|
8
9
|
delete(request: operations.DeleteCustomerSubscriptionRequest, options?: RequestOptions): Promise<void>;
|
|
9
10
|
renew(request: operations.RenewCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.RenewCustomerSubscriptionResponse>;
|
|
11
|
+
/** The plans the customer may change the subscription to, each quoted at the default timing. */
|
|
12
|
+
listTransitions(request: operations.ListCustomerSubscriptionTransitionsRequest, options?: RequestOptions): Promise<operations.ListCustomerSubscriptionTransitionsResponse>;
|
|
13
|
+
/** Quotes a change to another offer. Confirm it with `confirmChange` before `quoteExpiresAt`. */
|
|
14
|
+
quoteChange(request: operations.QuoteCustomerSubscriptionChangeRequest, options?: RequestOptions): Promise<operations.QuoteCustomerSubscriptionChangeResponse>;
|
|
15
|
+
/** Confirms a quoted change. An immediate upgrade that needs payment returns the order to pay as `orderId` / `links.checkout`. */
|
|
16
|
+
confirmChange(request: operations.ConfirmCustomerSubscriptionChangeRequest, options?: RequestOptions): Promise<operations.ConfirmCustomerSubscriptionChangeResponse>;
|
|
17
|
+
/** Withdraws a scheduled change, or an immediate upgrade that was not paid yet. */
|
|
18
|
+
cancelChange(request: operations.CancelCustomerSubscriptionChangeRequest, options?: RequestOptions): Promise<void>;
|
|
19
|
+
/** Without `quoteId` quotes the cancellation; with the quote's `id` confirms it. It can be revoked until it takes effect. */
|
|
20
|
+
cancel(request: operations.CancelCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.CancelCustomerSubscriptionResponse>;
|
|
21
|
+
/** Revokes a scheduled cancellation; the subscription keeps renewing. */
|
|
22
|
+
revokeCancellation(request: operations.RevokeCustomerSubscriptionCancellationRequest, options?: RequestOptions): Promise<void>;
|
|
23
|
+
/** @deprecated Use `listTransitions`. The server may answer 410 Gone once the legacy endpoints are retired. */
|
|
10
24
|
listTransitionProducts(request: operations.ListCustomerSubscriptionTransitionProductsRequest, options?: RequestOptions): Promise<operations.ListCustomerSubscriptionTransitionProductsResponse>;
|
|
25
|
+
/** @deprecated Use `quoteChange`. The server may answer 410 Gone once the legacy endpoints are retired. */
|
|
11
26
|
getTransitionProduct(request: operations.GetCustomerSubscriptionTransitionProductRequest, options?: RequestOptions): Promise<operations.GetCustomerSubscriptionTransitionProductResponse>;
|
|
12
27
|
}
|
|
13
28
|
//# sourceMappingURL=customer-subscriptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer-subscriptions.d.ts","sourceRoot":"","sources":["../../../../src/sdk/commerce/customer-subscriptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAE/D,qBAAa,qBAAsB,SAAQ,SAAS;IAC5C,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,gCAAgC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,iCAAiC,CAAC;IAC3I,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,8BAA8B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,+BAA+B,CAAC;IACtI,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,iCAAiC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,kCAAkC,CAAC;IAC/I,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,iCAAiC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"customer-subscriptions.d.ts","sourceRoot":"","sources":["../../../../src/sdk/commerce/customer-subscriptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAE/D,qBA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,CAAC,OAAO,EAAE,UAAU,CAAC,uCAAuC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IACxH,6HAA6H;IACvH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,iCAAiC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,kCAAkC,CAAC;IACrJ,yEAAyE;IACnE,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,6CAA6C,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IACpI,+GAA+G;IACzG,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,iDAAiD,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,kDAAkD,CAAC;IACrM,2GAA2G;IACrG,oBAAoB,CAAC,OAAO,EAAE,UAAU,CAAC,+CAA+C,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,gDAAgD,CAAC;CAChM"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { customerSubscriptionsCreate, customerSubscriptionsDelete, customerSubscriptionsGet, customerSubscriptionsGetTransitionProduct, customerSubscriptionsList, customerSubscriptionsListTransitionProducts, customerSubscriptionsRenew, customerSubscriptionsUpdate } from "../../funcs/commerce/index.js";
|
|
1
|
+
import { customerSubscriptionsCancel, customerSubscriptionsCancelChange, customerSubscriptionsConfirmChange, customerSubscriptionsCreate, customerSubscriptionsDelete, customerSubscriptionsGet, customerSubscriptionsGetTransitionProduct, customerSubscriptionsList, customerSubscriptionsListTransitionProducts, customerSubscriptionsListTransitions, customerSubscriptionsQuoteChange, customerSubscriptionsRenew, customerSubscriptionsRevokeCancellation, customerSubscriptionsUpdate } from "../../funcs/commerce/index.js";
|
|
2
2
|
import { ClientSDK } from "../../lib/sdks.js";
|
|
3
3
|
import { unwrapAsync } from "../../types/fp.js";
|
|
4
4
|
export class CustomerSubscriptions extends ClientSDK {
|
|
@@ -6,9 +6,24 @@ export class CustomerSubscriptions extends ClientSDK {
|
|
|
6
6
|
async get(request, options) { return unwrapAsync(customerSubscriptionsGet(this, request, options)); }
|
|
7
7
|
async create(request, options) { return unwrapAsync(customerSubscriptionsCreate(this, request, options)); }
|
|
8
8
|
async update(request, options) { return unwrapAsync(customerSubscriptionsUpdate(this, request, options)); }
|
|
9
|
+
/** Cancels the subscription straight away. Use `cancel` to cancel according to the cancellation policy (notice, minimum term, period end). */
|
|
9
10
|
async delete(request, options) { return unwrapAsync(customerSubscriptionsDelete(this, request, options)); }
|
|
10
11
|
async renew(request, options) { return unwrapAsync(customerSubscriptionsRenew(this, request, options)); }
|
|
12
|
+
/** The plans the customer may change the subscription to, each quoted at the default timing. */
|
|
13
|
+
async listTransitions(request, options) { return unwrapAsync(customerSubscriptionsListTransitions(this, request, options)); }
|
|
14
|
+
/** Quotes a change to another offer. Confirm it with `confirmChange` before `quoteExpiresAt`. */
|
|
15
|
+
async quoteChange(request, options) { return unwrapAsync(customerSubscriptionsQuoteChange(this, request, options)); }
|
|
16
|
+
/** Confirms a quoted change. An immediate upgrade that needs payment returns the order to pay as `orderId` / `links.checkout`. */
|
|
17
|
+
async confirmChange(request, options) { return unwrapAsync(customerSubscriptionsConfirmChange(this, request, options)); }
|
|
18
|
+
/** Withdraws a scheduled change, or an immediate upgrade that was not paid yet. */
|
|
19
|
+
async cancelChange(request, options) { return unwrapAsync(customerSubscriptionsCancelChange(this, request, options)); }
|
|
20
|
+
/** Without `quoteId` quotes the cancellation; with the quote's `id` confirms it. It can be revoked until it takes effect. */
|
|
21
|
+
async cancel(request, options) { return unwrapAsync(customerSubscriptionsCancel(this, request, options)); }
|
|
22
|
+
/** Revokes a scheduled cancellation; the subscription keeps renewing. */
|
|
23
|
+
async revokeCancellation(request, options) { return unwrapAsync(customerSubscriptionsRevokeCancellation(this, request, options)); }
|
|
24
|
+
/** @deprecated Use `listTransitions`. The server may answer 410 Gone once the legacy endpoints are retired. */
|
|
11
25
|
async listTransitionProducts(request, options) { return unwrapAsync(customerSubscriptionsListTransitionProducts(this, request, options)); }
|
|
26
|
+
/** @deprecated Use `quoteChange`. The server may answer 410 Gone once the legacy endpoints are retired. */
|
|
12
27
|
async getTransitionProduct(request, options) { return unwrapAsync(customerSubscriptionsGetTransitionProduct(this, request, options)); }
|
|
13
28
|
}
|
|
14
29
|
//# sourceMappingURL=customer-subscriptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer-subscriptions.js","sourceRoot":"","sources":["../../../../src/sdk/commerce/customer-subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,yCAAyC,EAAE,yBAAyB,EAAE,2CAA2C,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"customer-subscriptions.js","sourceRoot":"","sources":["../../../../src/sdk/commerce/customer-subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,kCAAkC,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,yCAAyC,EAAE,yBAAyB,EAAE,2CAA2C,EAAE,oCAAoC,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,uCAAuC,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACpgB,OAAO,EAAE,SAAS,EAAkB,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,KAAK,CAAC,IAAI,CAAC,OAAoD,EAAE,OAAwB,IAA2D,OAAO,WAAW,CAAC,yBAAyB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5N,KAAK,CAAC,GAAG,CAAC,O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;IAC9P,mFAAmF;IACnF,KAAK,CAAC,YAAY,CAAC,OAA2D,EAAE,OAAwB,IAAmB,OAAO,WAAW,CAAC,iCAAiC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3M,6HAA6H;IAC7H,KAAK,CAAC,MAAM,CAAC,OAAqD,EAAE,OAAwB,IAA4D,OAAO,WAAW,CAAC,2BAA2B,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClO,yEAAyE;IACzE,KAAK,CAAC,kBAAkB,CAAC,OAAiE,EAAE,OAAwB,IAAmB,OAAO,WAAW,CAAC,uCAAuC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7N,+GAA+G;IAC/G,KAAK,CAAC,sBAAsB,CAAC,OAAqE,EAAE,OAAwB,IAA4E,OAAO,WAAW,CAAC,2CAA2C,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClS,2GAA2G;IAC3G,KAAK,CAAC,oBAAoB,CAAC,OAAmE,EAAE,OAAwB,IAA0E,OAAO,WAAW,CAAC,yCAAyC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3R"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -10,3 +10,9 @@ export const customerSubscriptionsDelete = (client: ClientSDK, request: operatio
|
|
|
10
10
|
export const customerSubscriptionsRenew = (client: ClientSDK, request: operations.RenewCustomerSubscriptionRequest, options?: RequestOptions) => executeOperation(client, request, { operationID: "commerce.customerSubscriptions.renew", method: "POST", path: (v) => `/commerce/customers/${v.customerId}/subscriptions/${v.id}/renew`, requestSchema: operations.RenewCustomerSubscriptionRequest$outboundSchema, responseSchema: operations.RenewCustomerSubscriptionResponse$inboundSchema, query: encodeOperationQuery }, options);
|
|
11
11
|
export const customerSubscriptionsListTransitionProducts = (client: ClientSDK, request: operations.ListCustomerSubscriptionTransitionProductsRequest, options?: RequestOptions) => executeOperation(client, request, { operationID: "commerce.customerSubscriptions.listTransitionProducts", method: "GET", path: (v) => `/commerce/customers/${v.customerId}/subscriptions/${v.subscriptionId}/transition`, requestSchema: operations.ListCustomerSubscriptionTransitionProductsRequest$outboundSchema, responseSchema: operations.ListCustomerSubscriptionTransitionProductsResponse$inboundSchema, query: encodeOperationQuery }, options);
|
|
12
12
|
export const customerSubscriptionsGetTransitionProduct = (client: ClientSDK, request: operations.GetCustomerSubscriptionTransitionProductRequest, options?: RequestOptions) => executeOperation(client, request, { operationID: "commerce.customerSubscriptions.getTransitionProduct", method: "GET", path: (v) => `/commerce/customers/${v.customerId}/subscriptions/${v.subscriptionId}/transition/${v.productId}`, requestSchema: operations.GetCustomerSubscriptionTransitionProductRequest$outboundSchema, responseSchema: operations.GetCustomerSubscriptionTransitionProductResponse$inboundSchema, query: encodeOperationQuery }, options);
|
|
13
|
+
export const customerSubscriptionsListTransitions = (client: ClientSDK, request: operations.ListCustomerSubscriptionTransitionsRequest, options?: RequestOptions) => executeOperation(client, request, { operationID: "commerce.customerSubscriptions.listTransitions", method: "GET", path: (v) => `/commerce/customers/${v.customerId}/subscriptions/${v.subscriptionId}/transitions`, requestSchema: operations.ListCustomerSubscriptionTransitionsRequest$outboundSchema, responseSchema: operations.ListCustomerSubscriptionTransitionsResponse$inboundSchema }, options);
|
|
14
|
+
export const customerSubscriptionsQuoteChange = (client: ClientSDK, request: operations.QuoteCustomerSubscriptionChangeRequest, options?: RequestOptions) => executeOperation(client, request, { operationID: "commerce.customerSubscriptions.quoteChange", method: "POST", path: (v) => `/commerce/customers/${v.customerId}/subscriptions/${v.subscriptionId}/changes/quote`, requestSchema: operations.QuoteCustomerSubscriptionChangeRequest$outboundSchema, responseSchema: operations.QuoteCustomerSubscriptionChangeResponse$inboundSchema, body: (v) => v.data }, options);
|
|
15
|
+
export const customerSubscriptionsConfirmChange = (client: ClientSDK, request: operations.ConfirmCustomerSubscriptionChangeRequest, options?: RequestOptions) => executeOperation(client, request, { operationID: "commerce.customerSubscriptions.confirmChange", method: "POST", path: (v) => `/commerce/customers/${v.customerId}/subscriptions/${v.subscriptionId}/changes`, requestSchema: operations.ConfirmCustomerSubscriptionChangeRequest$outboundSchema, responseSchema: operations.ConfirmCustomerSubscriptionChangeResponse$inboundSchema, body: (v) => v.data }, options);
|
|
16
|
+
export const customerSubscriptionsCancelChange = (client: ClientSDK, request: operations.CancelCustomerSubscriptionChangeRequest, options?: RequestOptions) => executeOperation(client, request, { operationID: "commerce.customerSubscriptions.cancelChange", method: "DELETE", path: (v) => `/commerce/customers/${v.customerId}/subscriptions/${v.subscriptionId}/changes/${encodeURIComponent(v.changeId)}`, requestSchema: operations.CancelCustomerSubscriptionChangeRequest$outboundSchema, responseSchema: operations.CancelCustomerSubscriptionChangeResponse$inboundSchema, responseType: "void", successStatus: 204 }, options);
|
|
17
|
+
export const customerSubscriptionsCancel = (client: ClientSDK, request: operations.CancelCustomerSubscriptionRequest, options?: RequestOptions) => executeOperation(client, request, { operationID: "commerce.customerSubscriptions.cancel", method: "POST", path: (v) => `/commerce/customers/${v.customerId}/subscriptions/${v.subscriptionId}/cancellation`, requestSchema: operations.CancelCustomerSubscriptionRequest$outboundSchema, responseSchema: operations.CancelCustomerSubscriptionResponse$inboundSchema, body: (v) => v.data ?? {} }, options);
|
|
18
|
+
export const customerSubscriptionsRevokeCancellation = (client: ClientSDK, request: operations.RevokeCustomerSubscriptionCancellationRequest, options?: RequestOptions) => executeOperation(client, request, { operationID: "commerce.customerSubscriptions.revokeCancellation", method: "DELETE", path: (v) => `/commerce/customers/${v.customerId}/subscriptions/${v.subscriptionId}/cancellation`, requestSchema: operations.RevokeCustomerSubscriptionCancellationRequest$outboundSchema, responseSchema: operations.RevokeCustomerSubscriptionCancellationResponse$inboundSchema, responseType: "void", successStatus: 204 }, options);
|
package/src/lib/config.ts
CHANGED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
3
|
+
import { CurrencyAmount, CurrencyAmount$inboundSchema } from "../common/amount.js";
|
|
4
|
+
import { HalLinks, HalLinks$inboundSchema } from "../hal.js";
|
|
5
|
+
import { Product, Product$inboundSchema } from "./product.js";
|
|
6
|
+
|
|
7
|
+
/** `change` for a plan change, `cancel` for a cancellation. */
|
|
8
|
+
export type SubscriptionChangeType = "change" | "cancel" | (string & {});
|
|
9
|
+
|
|
10
|
+
export type SubscriptionChangeStatus =
|
|
11
|
+
| "quoted"
|
|
12
|
+
| "pending"
|
|
13
|
+
| "awaiting_payment"
|
|
14
|
+
| "applied"
|
|
15
|
+
| "cancelled"
|
|
16
|
+
| "expired"
|
|
17
|
+
| "failed"
|
|
18
|
+
| (string & {});
|
|
19
|
+
|
|
20
|
+
export type SubscriptionChangeTiming = "immediate" | "period_end" | (string & {});
|
|
21
|
+
|
|
22
|
+
/** The plan on one side of a change. */
|
|
23
|
+
export type SubscriptionChangePlan = {
|
|
24
|
+
productId: number | null;
|
|
25
|
+
offerId: number | null;
|
|
26
|
+
intervalId: number | null;
|
|
27
|
+
recurringAmount: CurrencyAmount | null;
|
|
28
|
+
quantity: number | null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type SubscriptionChangeQuoteLine = {
|
|
32
|
+
type: string | null;
|
|
33
|
+
description: string | null;
|
|
34
|
+
amount: CurrencyAmount;
|
|
35
|
+
tax: CurrencyAmount;
|
|
36
|
+
taxRate: number | null;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type SubscriptionChangeQuote = {
|
|
40
|
+
lines: SubscriptionChangeQuoteLine[];
|
|
41
|
+
charge: CurrencyAmount;
|
|
42
|
+
credit: CurrencyAmount;
|
|
43
|
+
settlement: string | null;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** A quoted, scheduled or applied plan change or cancellation. */
|
|
47
|
+
export type SubscriptionChange = {
|
|
48
|
+
resource: "subscription_change";
|
|
49
|
+
id: string;
|
|
50
|
+
subscriptionId: number;
|
|
51
|
+
type: SubscriptionChangeType;
|
|
52
|
+
direction: string | null;
|
|
53
|
+
status: SubscriptionChangeStatus;
|
|
54
|
+
timing: SubscriptionChangeTiming | null;
|
|
55
|
+
effectiveAt: string | null;
|
|
56
|
+
from: SubscriptionChangePlan;
|
|
57
|
+
to: SubscriptionChangePlan;
|
|
58
|
+
quote: SubscriptionChangeQuote;
|
|
59
|
+
warnings: string[];
|
|
60
|
+
quoteExpiresAt: string | null;
|
|
61
|
+
/** The order to pay for an immediate upgrade; also linked as `links.checkout`. */
|
|
62
|
+
orderId: number | null;
|
|
63
|
+
createdAt: string | null;
|
|
64
|
+
links?: HalLinks;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** A plan the customer may change the subscription to, quoted at the default timing. */
|
|
68
|
+
export type SubscriptionTransition = {
|
|
69
|
+
productId: number;
|
|
70
|
+
offerId: number;
|
|
71
|
+
direction: string | null;
|
|
72
|
+
timing: SubscriptionChangeTiming | null;
|
|
73
|
+
effectiveAt: string | null;
|
|
74
|
+
allowed: boolean;
|
|
75
|
+
reasons: string[];
|
|
76
|
+
charge: CurrencyAmount;
|
|
77
|
+
product: Product;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/** @internal */
|
|
81
|
+
export const SubscriptionChangePlan$inboundSchema: z.ZodType<SubscriptionChangePlan> = z.object({
|
|
82
|
+
productId: z.number().int().nullable(),
|
|
83
|
+
offerId: z.number().int().nullable(),
|
|
84
|
+
intervalId: z.number().int().nullable(),
|
|
85
|
+
recurringAmount: CurrencyAmount$inboundSchema.nullable(),
|
|
86
|
+
quantity: z.number().int().nullable(),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
/** @internal */
|
|
90
|
+
export const SubscriptionChangeQuoteLine$inboundSchema: z.ZodType<SubscriptionChangeQuoteLine> = z.object({
|
|
91
|
+
type: z.string().nullable(),
|
|
92
|
+
description: z.string().nullable(),
|
|
93
|
+
amount: CurrencyAmount$inboundSchema,
|
|
94
|
+
tax: CurrencyAmount$inboundSchema,
|
|
95
|
+
taxRate: z.number().nullable(),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
/** @internal */
|
|
99
|
+
export const SubscriptionChangeQuote$inboundSchema: z.ZodType<SubscriptionChangeQuote> = z.object({
|
|
100
|
+
lines: z.array(SubscriptionChangeQuoteLine$inboundSchema),
|
|
101
|
+
charge: CurrencyAmount$inboundSchema,
|
|
102
|
+
credit: CurrencyAmount$inboundSchema,
|
|
103
|
+
settlement: z.string().nullable(),
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
/** @internal */
|
|
107
|
+
export const SubscriptionChange$inboundSchema: z.ZodType<SubscriptionChange> = z.object({
|
|
108
|
+
resource: z.literal("subscription_change"),
|
|
109
|
+
id: z.string(),
|
|
110
|
+
subscriptionId: z.number().int(),
|
|
111
|
+
type: z.string(),
|
|
112
|
+
direction: z.string().nullable(),
|
|
113
|
+
status: z.string(),
|
|
114
|
+
timing: z.string().nullable(),
|
|
115
|
+
effectiveAt: z.string().nullable(),
|
|
116
|
+
from: SubscriptionChangePlan$inboundSchema,
|
|
117
|
+
to: SubscriptionChangePlan$inboundSchema,
|
|
118
|
+
quote: SubscriptionChangeQuote$inboundSchema,
|
|
119
|
+
warnings: z.array(z.string()),
|
|
120
|
+
quoteExpiresAt: z.string().nullable(),
|
|
121
|
+
orderId: z.number().int().nullable(),
|
|
122
|
+
createdAt: z.string().nullable(),
|
|
123
|
+
_links: HalLinks$inboundSchema.optional(),
|
|
124
|
+
}).loose().transform((value) => remap$(value, { _links: "links" }) as SubscriptionChange);
|
|
125
|
+
|
|
126
|
+
/** @internal */
|
|
127
|
+
export const SubscriptionTransition$inboundSchema: z.ZodType<SubscriptionTransition> = z.object({
|
|
128
|
+
productId: z.number().int(),
|
|
129
|
+
offerId: z.number().int(),
|
|
130
|
+
direction: z.string().nullable(),
|
|
131
|
+
timing: z.string().nullable(),
|
|
132
|
+
effectiveAt: z.string().nullable(),
|
|
133
|
+
allowed: z.boolean(),
|
|
134
|
+
reasons: z.array(z.string()),
|
|
135
|
+
charge: CurrencyAmount$inboundSchema,
|
|
136
|
+
product: Product$inboundSchema,
|
|
137
|
+
}).loose();
|
|
@@ -8,12 +8,14 @@ import { SubscriptionInterval, SubscriptionInterval$inboundSchema } from "./subs
|
|
|
8
8
|
export type SubscriptionPeriod = {
|
|
9
9
|
startedAt: string;
|
|
10
10
|
endsAt: string;
|
|
11
|
-
daysLeft: number;
|
|
11
|
+
daysLeft: number | null;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export type Subscription = {
|
|
15
15
|
resource: "subscription";
|
|
16
16
|
id: number;
|
|
17
|
+
/** Readable reference; its format is configured per install. */
|
|
18
|
+
reference?: string | null | undefined;
|
|
17
19
|
customerId: number;
|
|
18
20
|
productId: number;
|
|
19
21
|
intervalId: number;
|
|
@@ -35,13 +37,14 @@ export type Subscription = {
|
|
|
35
37
|
export const SubscriptionPeriod$inboundSchema: z.ZodType<SubscriptionPeriod> = z.object({
|
|
36
38
|
startedAt: z.string(),
|
|
37
39
|
endsAt: z.string(),
|
|
38
|
-
daysLeft: z.number(),
|
|
40
|
+
daysLeft: z.number().nullable(),
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
/** @internal */
|
|
42
44
|
export const Subscription$inboundSchema: z.ZodType<Subscription> = z.object({
|
|
43
45
|
resource: z.literal("subscription"),
|
|
44
46
|
id: z.number().int(),
|
|
47
|
+
reference: z.string().nullable().optional(),
|
|
45
48
|
customerId: z.number().int(),
|
|
46
49
|
productId: z.number().int(),
|
|
47
50
|
intervalId: z.number().int(),
|
|
@@ -29,6 +29,10 @@ export type ErrorResponseData = {
|
|
|
29
29
|
* A detailed human-readable description of the error that occurred.
|
|
30
30
|
*/
|
|
31
31
|
detail: string;
|
|
32
|
+
/**
|
|
33
|
+
* Stable, machine-readable reason of a refusal, e.g. `subscription.next_period_locked`.
|
|
34
|
+
*/
|
|
35
|
+
code?: string | undefined;
|
|
32
36
|
/**
|
|
33
37
|
* Optional validation errors keyed by field name.
|
|
34
38
|
*/
|
|
@@ -43,6 +47,7 @@ export class ErrorResponse extends OminityError {
|
|
|
43
47
|
status: number;
|
|
44
48
|
title: string;
|
|
45
49
|
detail: string;
|
|
50
|
+
code?: string | undefined;
|
|
46
51
|
fields?: Record<string, string[]> | undefined;
|
|
47
52
|
links: ErrorResponseLinks;
|
|
48
53
|
|
|
@@ -61,6 +66,7 @@ export class ErrorResponse extends OminityError {
|
|
|
61
66
|
this.status = err.status;
|
|
62
67
|
this.title = err.title;
|
|
63
68
|
this.detail = err.detail;
|
|
69
|
+
if (err.code != null) this.code = err.code;
|
|
64
70
|
if (err.fields != null) this.fields = err.fields;
|
|
65
71
|
this.links = err.links;
|
|
66
72
|
|
|
@@ -78,13 +84,17 @@ export const ErrorResponse$inboundSchema: z.ZodType<
|
|
|
78
84
|
status: types.number(),
|
|
79
85
|
title: types.string(),
|
|
80
86
|
detail: types.string(),
|
|
87
|
+
code: z.optional(z.string()),
|
|
81
88
|
fields: z.optional(ErrorResponseFieldsSchema),
|
|
89
|
+
errors: z.optional(ErrorResponseFieldsSchema),
|
|
82
90
|
_links: z.lazy(() => ErrorResponseLinks$inboundSchema),
|
|
83
91
|
request$: z.custom<Request>(x => x instanceof Request),
|
|
84
92
|
response$: z.custom<Response>(x => x instanceof Response),
|
|
85
93
|
body$: z.string(),
|
|
86
94
|
}).transform((v) => {
|
|
87
|
-
|
|
95
|
+
// The API sends validation messages as `errors`.
|
|
96
|
+
const { errors, ...rest } = v;
|
|
97
|
+
const remapped = remap$({ ...rest, fields: rest.fields ?? errors }, {
|
|
88
98
|
"_links": "links",
|
|
89
99
|
});
|
|
90
100
|
|
|
@@ -100,6 +110,7 @@ export type ErrorResponse$Outbound = {
|
|
|
100
110
|
status: number;
|
|
101
111
|
title: string;
|
|
102
112
|
detail: string;
|
|
113
|
+
code?: string | undefined;
|
|
103
114
|
fields?: Record<string, string[]> | undefined;
|
|
104
115
|
_links: ErrorResponseLinks$Outbound;
|
|
105
116
|
};
|
|
@@ -115,6 +126,7 @@ export const ErrorResponse$outboundSchema: z.ZodType<
|
|
|
115
126
|
status: data.status,
|
|
116
127
|
title: data.title,
|
|
117
128
|
detail: data.detail,
|
|
129
|
+
code: data.code,
|
|
118
130
|
fields: data.fields,
|
|
119
131
|
_links: data.links,
|
|
120
132
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Product, Product$inboundSchema } from "../commerce/product.js";
|
|
3
3
|
import { Subscription, Subscription$inboundSchema } from "../commerce/subscription.js";
|
|
4
|
+
import { SubscriptionChange, SubscriptionChange$inboundSchema, SubscriptionTransition, SubscriptionTransition$inboundSchema } from "../commerce/subscription-change.js";
|
|
4
5
|
import { Paginated } from "../pagination.js";
|
|
5
6
|
import { ListRequest, ListRequest$outboundSchema, paginatedSchema } from "./helpers.js";
|
|
6
7
|
|
|
@@ -34,12 +35,48 @@ export type RenewCustomerSubscriptionResponse = Subscription;
|
|
|
34
35
|
export const RenewCustomerSubscriptionRequest$outboundSchema: z.ZodType<RenewCustomerSubscriptionRequest> = GetCustomerSubscriptionRequest$outboundSchema;
|
|
35
36
|
export const RenewCustomerSubscriptionResponse$inboundSchema = Subscription$inboundSchema;
|
|
36
37
|
|
|
38
|
+
/** @deprecated Use `ListCustomerSubscriptionTransitionsRequest` (`GET .../transitions`). */
|
|
37
39
|
export type ListCustomerSubscriptionTransitionProductsRequest = ListRequest & { customerId: number; subscriptionId: number };
|
|
38
40
|
export type ListCustomerSubscriptionTransitionProductsResponse = Paginated<Product>;
|
|
39
41
|
export const ListCustomerSubscriptionTransitionProductsRequest$outboundSchema: z.ZodType<ListCustomerSubscriptionTransitionProductsRequest> = ListRequest$outboundSchema.extend({ customerId: z.number().int(), subscriptionId: z.number().int() });
|
|
40
42
|
export const ListCustomerSubscriptionTransitionProductsResponse$inboundSchema = paginatedSchema("products", Product$inboundSchema);
|
|
41
43
|
|
|
44
|
+
/** @deprecated Use `QuoteCustomerSubscriptionChangeRequest` (`POST .../changes/quote`). */
|
|
42
45
|
export type GetCustomerSubscriptionTransitionProductRequest = { customerId: number; subscriptionId: number; productId: number; include?: string | undefined };
|
|
43
46
|
export type GetCustomerSubscriptionTransitionProductResponse = Product;
|
|
44
47
|
export const GetCustomerSubscriptionTransitionProductRequest$outboundSchema: z.ZodType<GetCustomerSubscriptionTransitionProductRequest> = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), productId: z.number().int(), include: z.string().optional() });
|
|
45
48
|
export const GetCustomerSubscriptionTransitionProductResponse$inboundSchema = Product$inboundSchema;
|
|
49
|
+
|
|
50
|
+
export type ListCustomerSubscriptionTransitionsRequest = { customerId: number; subscriptionId: number };
|
|
51
|
+
export type ListCustomerSubscriptionTransitionsResponse = { count: number; items: SubscriptionTransition[] };
|
|
52
|
+
export const ListCustomerSubscriptionTransitionsRequest$outboundSchema: z.ZodType<ListCustomerSubscriptionTransitionsRequest> = z.object({ customerId: z.number().int(), subscriptionId: z.number().int() });
|
|
53
|
+
export const ListCustomerSubscriptionTransitionsResponse$inboundSchema: z.ZodType<ListCustomerSubscriptionTransitionsResponse> = z.object({
|
|
54
|
+
count: z.number().int(),
|
|
55
|
+
_embedded: z.object({ transitions: z.array(SubscriptionTransition$inboundSchema) }),
|
|
56
|
+
}).transform((value) => ({ count: value.count, items: value._embedded.transitions }));
|
|
57
|
+
|
|
58
|
+
export type QuoteCustomerSubscriptionChangeRequest = { customerId: number; subscriptionId: number; data: { toOfferId: number; timing?: "immediate" | "period_end" | undefined } };
|
|
59
|
+
export type QuoteCustomerSubscriptionChangeResponse = SubscriptionChange;
|
|
60
|
+
export const QuoteCustomerSubscriptionChangeRequest$outboundSchema: z.ZodType<QuoteCustomerSubscriptionChangeRequest> = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), data: z.object({ toOfferId: z.number().int(), timing: z.enum(["immediate", "period_end"]).optional() }) });
|
|
61
|
+
export const QuoteCustomerSubscriptionChangeResponse$inboundSchema = SubscriptionChange$inboundSchema;
|
|
62
|
+
|
|
63
|
+
export type ConfirmCustomerSubscriptionChangeRequest = { customerId: number; subscriptionId: number; data: { quoteId: string } };
|
|
64
|
+
export type ConfirmCustomerSubscriptionChangeResponse = SubscriptionChange;
|
|
65
|
+
export const ConfirmCustomerSubscriptionChangeRequest$outboundSchema: z.ZodType<ConfirmCustomerSubscriptionChangeRequest> = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), data: z.object({ quoteId: z.string() }) });
|
|
66
|
+
export const ConfirmCustomerSubscriptionChangeResponse$inboundSchema = SubscriptionChange$inboundSchema;
|
|
67
|
+
|
|
68
|
+
export type CancelCustomerSubscriptionChangeRequest = { customerId: number; subscriptionId: number; changeId: string };
|
|
69
|
+
export type CancelCustomerSubscriptionChangeResponse = void;
|
|
70
|
+
export const CancelCustomerSubscriptionChangeRequest$outboundSchema: z.ZodType<CancelCustomerSubscriptionChangeRequest> = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), changeId: z.string() });
|
|
71
|
+
export const CancelCustomerSubscriptionChangeResponse$inboundSchema: z.ZodType<void> = z.void();
|
|
72
|
+
|
|
73
|
+
/** Without `quoteId` the cancellation is quoted; with the `id` of that quote it is confirmed. */
|
|
74
|
+
export type CancelCustomerSubscriptionRequest = { customerId: number; subscriptionId: number; data?: { quoteId?: string | undefined; timing?: "immediate" | "period_end" | undefined } | undefined };
|
|
75
|
+
export type CancelCustomerSubscriptionResponse = SubscriptionChange;
|
|
76
|
+
export const CancelCustomerSubscriptionRequest$outboundSchema: z.ZodType<CancelCustomerSubscriptionRequest> = z.object({ customerId: z.number().int(), subscriptionId: z.number().int(), data: z.object({ quoteId: z.string().optional(), timing: z.enum(["immediate", "period_end"]).optional() }).optional() });
|
|
77
|
+
export const CancelCustomerSubscriptionResponse$inboundSchema = SubscriptionChange$inboundSchema;
|
|
78
|
+
|
|
79
|
+
export type RevokeCustomerSubscriptionCancellationRequest = { customerId: number; subscriptionId: number };
|
|
80
|
+
export type RevokeCustomerSubscriptionCancellationResponse = void;
|
|
81
|
+
export const RevokeCustomerSubscriptionCancellationRequest$outboundSchema: z.ZodType<RevokeCustomerSubscriptionCancellationRequest> = z.object({ customerId: z.number().int(), subscriptionId: z.number().int() });
|
|
82
|
+
export const RevokeCustomerSubscriptionCancellationResponse$inboundSchema: z.ZodType<void> = z.void();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { customerSubscriptionsCreate, customerSubscriptionsDelete, customerSubscriptionsGet, customerSubscriptionsGetTransitionProduct, customerSubscriptionsList, customerSubscriptionsListTransitionProducts, customerSubscriptionsRenew, customerSubscriptionsUpdate } from "../../funcs/commerce/index.js";
|
|
1
|
+
import { customerSubscriptionsCancel, customerSubscriptionsCancelChange, customerSubscriptionsConfirmChange, customerSubscriptionsCreate, customerSubscriptionsDelete, customerSubscriptionsGet, customerSubscriptionsGetTransitionProduct, customerSubscriptionsList, customerSubscriptionsListTransitionProducts, customerSubscriptionsListTransitions, customerSubscriptionsQuoteChange, customerSubscriptionsRenew, customerSubscriptionsRevokeCancellation, customerSubscriptionsUpdate } from "../../funcs/commerce/index.js";
|
|
2
2
|
import { ClientSDK, RequestOptions } from "../../lib/sdks.js";
|
|
3
3
|
import * as operations from "../../models/operations/index.js";
|
|
4
4
|
import { unwrapAsync } from "../../types/fp.js";
|
|
@@ -7,8 +7,23 @@ export class CustomerSubscriptions extends ClientSDK {
|
|
|
7
7
|
async get(request: operations.GetCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.GetCustomerSubscriptionResponse> { return unwrapAsync(customerSubscriptionsGet(this, request, options)); }
|
|
8
8
|
async create(request: operations.CreateCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.CreateCustomerSubscriptionResponse> { return unwrapAsync(customerSubscriptionsCreate(this, request, options)); }
|
|
9
9
|
async update(request: operations.UpdateCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.UpdateCustomerSubscriptionResponse> { return unwrapAsync(customerSubscriptionsUpdate(this, request, options)); }
|
|
10
|
+
/** Cancels the subscription straight away. Use `cancel` to cancel according to the cancellation policy (notice, minimum term, period end). */
|
|
10
11
|
async delete(request: operations.DeleteCustomerSubscriptionRequest, options?: RequestOptions): Promise<void> { return unwrapAsync(customerSubscriptionsDelete(this, request, options)); }
|
|
11
12
|
async renew(request: operations.RenewCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.RenewCustomerSubscriptionResponse> { return unwrapAsync(customerSubscriptionsRenew(this, request, options)); }
|
|
13
|
+
/** The plans the customer may change the subscription to, each quoted at the default timing. */
|
|
14
|
+
async listTransitions(request: operations.ListCustomerSubscriptionTransitionsRequest, options?: RequestOptions): Promise<operations.ListCustomerSubscriptionTransitionsResponse> { return unwrapAsync(customerSubscriptionsListTransitions(this, request, options)); }
|
|
15
|
+
/** Quotes a change to another offer. Confirm it with `confirmChange` before `quoteExpiresAt`. */
|
|
16
|
+
async quoteChange(request: operations.QuoteCustomerSubscriptionChangeRequest, options?: RequestOptions): Promise<operations.QuoteCustomerSubscriptionChangeResponse> { return unwrapAsync(customerSubscriptionsQuoteChange(this, request, options)); }
|
|
17
|
+
/** Confirms a quoted change. An immediate upgrade that needs payment returns the order to pay as `orderId` / `links.checkout`. */
|
|
18
|
+
async confirmChange(request: operations.ConfirmCustomerSubscriptionChangeRequest, options?: RequestOptions): Promise<operations.ConfirmCustomerSubscriptionChangeResponse> { return unwrapAsync(customerSubscriptionsConfirmChange(this, request, options)); }
|
|
19
|
+
/** Withdraws a scheduled change, or an immediate upgrade that was not paid yet. */
|
|
20
|
+
async cancelChange(request: operations.CancelCustomerSubscriptionChangeRequest, options?: RequestOptions): Promise<void> { return unwrapAsync(customerSubscriptionsCancelChange(this, request, options)); }
|
|
21
|
+
/** Without `quoteId` quotes the cancellation; with the quote's `id` confirms it. It can be revoked until it takes effect. */
|
|
22
|
+
async cancel(request: operations.CancelCustomerSubscriptionRequest, options?: RequestOptions): Promise<operations.CancelCustomerSubscriptionResponse> { return unwrapAsync(customerSubscriptionsCancel(this, request, options)); }
|
|
23
|
+
/** Revokes a scheduled cancellation; the subscription keeps renewing. */
|
|
24
|
+
async revokeCancellation(request: operations.RevokeCustomerSubscriptionCancellationRequest, options?: RequestOptions): Promise<void> { return unwrapAsync(customerSubscriptionsRevokeCancellation(this, request, options)); }
|
|
25
|
+
/** @deprecated Use `listTransitions`. The server may answer 410 Gone once the legacy endpoints are retired. */
|
|
12
26
|
async listTransitionProducts(request: operations.ListCustomerSubscriptionTransitionProductsRequest, options?: RequestOptions): Promise<operations.ListCustomerSubscriptionTransitionProductsResponse> { return unwrapAsync(customerSubscriptionsListTransitionProducts(this, request, options)); }
|
|
27
|
+
/** @deprecated Use `quoteChange`. The server may answer 410 Gone once the legacy endpoints are retired. */
|
|
13
28
|
async getTransitionProduct(request: operations.GetCustomerSubscriptionTransitionProductRequest, options?: RequestOptions): Promise<operations.GetCustomerSubscriptionTransitionProductResponse> { return unwrapAsync(customerSubscriptionsGetTransitionProduct(this, request, options)); }
|
|
14
29
|
}
|