ce-storefront 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/docs/sdks/customers/README.md +85 -0
- package/esm/funcs/customersListSavedPaymentMethods.d.ts +26 -0
- package/esm/funcs/customersListSavedPaymentMethods.d.ts.map +1 -0
- package/esm/funcs/customersListSavedPaymentMethods.js +95 -0
- package/esm/funcs/customersListSavedPaymentMethods.js.map +1 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/components/index.d.ts +1 -0
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +1 -0
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/savedpaymentmethod.d.ts +260 -0
- package/esm/models/components/savedpaymentmethod.d.ts.map +1 -0
- package/esm/models/components/savedpaymentmethod.js +385 -0
- package/esm/models/components/savedpaymentmethod.js.map +1 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +1 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/listsavedpaymentmethods.d.ts +90 -0
- package/esm/models/operations/listsavedpaymentmethods.d.ts.map +1 -0
- package/esm/models/operations/listsavedpaymentmethods.js +105 -0
- package/esm/models/operations/listsavedpaymentmethods.js.map +1 -0
- package/esm/sdk/customers.d.ts +15 -0
- package/esm/sdk/customers.d.ts.map +1 -1
- package/esm/sdk/customers.js +18 -0
- package/esm/sdk/customers.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/customersListSavedPaymentMethods.ts +190 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/index.ts +1 -0
- package/src/models/components/savedpaymentmethod.ts +668 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listsavedpaymentmethods.ts +225 -0
- package/src/sdk/customers.ts +26 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as components from "../components/index.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export type ListSavedPaymentMethodsRequest = {
|
|
13
|
+
/**
|
|
14
|
+
* Customer Id
|
|
15
|
+
*/
|
|
16
|
+
customerId: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ListSavedPaymentMethodsContent = {
|
|
20
|
+
savedPaymentMethods?: components.SavedPaymentMethod | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* OK
|
|
25
|
+
*/
|
|
26
|
+
export type ListSavedPaymentMethodsResponseBody = {
|
|
27
|
+
message?: string | undefined;
|
|
28
|
+
success?: boolean | undefined;
|
|
29
|
+
content?: ListSavedPaymentMethodsContent | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const ListSavedPaymentMethodsRequest$inboundSchema: z.ZodType<
|
|
34
|
+
ListSavedPaymentMethodsRequest,
|
|
35
|
+
z.ZodTypeDef,
|
|
36
|
+
unknown
|
|
37
|
+
> = z.object({
|
|
38
|
+
customer_id: z.string(),
|
|
39
|
+
}).transform((v) => {
|
|
40
|
+
return remap$(v, {
|
|
41
|
+
"customer_id": "customerId",
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export type ListSavedPaymentMethodsRequest$Outbound = {
|
|
47
|
+
customer_id: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const ListSavedPaymentMethodsRequest$outboundSchema: z.ZodType<
|
|
52
|
+
ListSavedPaymentMethodsRequest$Outbound,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
ListSavedPaymentMethodsRequest
|
|
55
|
+
> = z.object({
|
|
56
|
+
customerId: z.string(),
|
|
57
|
+
}).transform((v) => {
|
|
58
|
+
return remap$(v, {
|
|
59
|
+
customerId: "customer_id",
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
66
|
+
*/
|
|
67
|
+
export namespace ListSavedPaymentMethodsRequest$ {
|
|
68
|
+
/** @deprecated use `ListSavedPaymentMethodsRequest$inboundSchema` instead. */
|
|
69
|
+
export const inboundSchema = ListSavedPaymentMethodsRequest$inboundSchema;
|
|
70
|
+
/** @deprecated use `ListSavedPaymentMethodsRequest$outboundSchema` instead. */
|
|
71
|
+
export const outboundSchema = ListSavedPaymentMethodsRequest$outboundSchema;
|
|
72
|
+
/** @deprecated use `ListSavedPaymentMethodsRequest$Outbound` instead. */
|
|
73
|
+
export type Outbound = ListSavedPaymentMethodsRequest$Outbound;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function listSavedPaymentMethodsRequestToJSON(
|
|
77
|
+
listSavedPaymentMethodsRequest: ListSavedPaymentMethodsRequest,
|
|
78
|
+
): string {
|
|
79
|
+
return JSON.stringify(
|
|
80
|
+
ListSavedPaymentMethodsRequest$outboundSchema.parse(
|
|
81
|
+
listSavedPaymentMethodsRequest,
|
|
82
|
+
),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function listSavedPaymentMethodsRequestFromJSON(
|
|
87
|
+
jsonString: string,
|
|
88
|
+
): SafeParseResult<ListSavedPaymentMethodsRequest, SDKValidationError> {
|
|
89
|
+
return safeParse(
|
|
90
|
+
jsonString,
|
|
91
|
+
(x) => ListSavedPaymentMethodsRequest$inboundSchema.parse(JSON.parse(x)),
|
|
92
|
+
`Failed to parse 'ListSavedPaymentMethodsRequest' from JSON`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** @internal */
|
|
97
|
+
export const ListSavedPaymentMethodsContent$inboundSchema: z.ZodType<
|
|
98
|
+
ListSavedPaymentMethodsContent,
|
|
99
|
+
z.ZodTypeDef,
|
|
100
|
+
unknown
|
|
101
|
+
> = z.object({
|
|
102
|
+
saved_payment_methods: components.SavedPaymentMethod$inboundSchema.optional(),
|
|
103
|
+
}).transform((v) => {
|
|
104
|
+
return remap$(v, {
|
|
105
|
+
"saved_payment_methods": "savedPaymentMethods",
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
/** @internal */
|
|
110
|
+
export type ListSavedPaymentMethodsContent$Outbound = {
|
|
111
|
+
saved_payment_methods?: components.SavedPaymentMethod$Outbound | undefined;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/** @internal */
|
|
115
|
+
export const ListSavedPaymentMethodsContent$outboundSchema: z.ZodType<
|
|
116
|
+
ListSavedPaymentMethodsContent$Outbound,
|
|
117
|
+
z.ZodTypeDef,
|
|
118
|
+
ListSavedPaymentMethodsContent
|
|
119
|
+
> = z.object({
|
|
120
|
+
savedPaymentMethods: components.SavedPaymentMethod$outboundSchema.optional(),
|
|
121
|
+
}).transform((v) => {
|
|
122
|
+
return remap$(v, {
|
|
123
|
+
savedPaymentMethods: "saved_payment_methods",
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
130
|
+
*/
|
|
131
|
+
export namespace ListSavedPaymentMethodsContent$ {
|
|
132
|
+
/** @deprecated use `ListSavedPaymentMethodsContent$inboundSchema` instead. */
|
|
133
|
+
export const inboundSchema = ListSavedPaymentMethodsContent$inboundSchema;
|
|
134
|
+
/** @deprecated use `ListSavedPaymentMethodsContent$outboundSchema` instead. */
|
|
135
|
+
export const outboundSchema = ListSavedPaymentMethodsContent$outboundSchema;
|
|
136
|
+
/** @deprecated use `ListSavedPaymentMethodsContent$Outbound` instead. */
|
|
137
|
+
export type Outbound = ListSavedPaymentMethodsContent$Outbound;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function listSavedPaymentMethodsContentToJSON(
|
|
141
|
+
listSavedPaymentMethodsContent: ListSavedPaymentMethodsContent,
|
|
142
|
+
): string {
|
|
143
|
+
return JSON.stringify(
|
|
144
|
+
ListSavedPaymentMethodsContent$outboundSchema.parse(
|
|
145
|
+
listSavedPaymentMethodsContent,
|
|
146
|
+
),
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function listSavedPaymentMethodsContentFromJSON(
|
|
151
|
+
jsonString: string,
|
|
152
|
+
): SafeParseResult<ListSavedPaymentMethodsContent, SDKValidationError> {
|
|
153
|
+
return safeParse(
|
|
154
|
+
jsonString,
|
|
155
|
+
(x) => ListSavedPaymentMethodsContent$inboundSchema.parse(JSON.parse(x)),
|
|
156
|
+
`Failed to parse 'ListSavedPaymentMethodsContent' from JSON`,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** @internal */
|
|
161
|
+
export const ListSavedPaymentMethodsResponseBody$inboundSchema: z.ZodType<
|
|
162
|
+
ListSavedPaymentMethodsResponseBody,
|
|
163
|
+
z.ZodTypeDef,
|
|
164
|
+
unknown
|
|
165
|
+
> = z.object({
|
|
166
|
+
message: z.string().optional(),
|
|
167
|
+
success: z.boolean().optional(),
|
|
168
|
+
content: z.lazy(() => ListSavedPaymentMethodsContent$inboundSchema)
|
|
169
|
+
.optional(),
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
/** @internal */
|
|
173
|
+
export type ListSavedPaymentMethodsResponseBody$Outbound = {
|
|
174
|
+
message?: string | undefined;
|
|
175
|
+
success?: boolean | undefined;
|
|
176
|
+
content?: ListSavedPaymentMethodsContent$Outbound | undefined;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/** @internal */
|
|
180
|
+
export const ListSavedPaymentMethodsResponseBody$outboundSchema: z.ZodType<
|
|
181
|
+
ListSavedPaymentMethodsResponseBody$Outbound,
|
|
182
|
+
z.ZodTypeDef,
|
|
183
|
+
ListSavedPaymentMethodsResponseBody
|
|
184
|
+
> = z.object({
|
|
185
|
+
message: z.string().optional(),
|
|
186
|
+
success: z.boolean().optional(),
|
|
187
|
+
content: z.lazy(() => ListSavedPaymentMethodsContent$outboundSchema)
|
|
188
|
+
.optional(),
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @internal
|
|
193
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
194
|
+
*/
|
|
195
|
+
export namespace ListSavedPaymentMethodsResponseBody$ {
|
|
196
|
+
/** @deprecated use `ListSavedPaymentMethodsResponseBody$inboundSchema` instead. */
|
|
197
|
+
export const inboundSchema =
|
|
198
|
+
ListSavedPaymentMethodsResponseBody$inboundSchema;
|
|
199
|
+
/** @deprecated use `ListSavedPaymentMethodsResponseBody$outboundSchema` instead. */
|
|
200
|
+
export const outboundSchema =
|
|
201
|
+
ListSavedPaymentMethodsResponseBody$outboundSchema;
|
|
202
|
+
/** @deprecated use `ListSavedPaymentMethodsResponseBody$Outbound` instead. */
|
|
203
|
+
export type Outbound = ListSavedPaymentMethodsResponseBody$Outbound;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function listSavedPaymentMethodsResponseBodyToJSON(
|
|
207
|
+
listSavedPaymentMethodsResponseBody: ListSavedPaymentMethodsResponseBody,
|
|
208
|
+
): string {
|
|
209
|
+
return JSON.stringify(
|
|
210
|
+
ListSavedPaymentMethodsResponseBody$outboundSchema.parse(
|
|
211
|
+
listSavedPaymentMethodsResponseBody,
|
|
212
|
+
),
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function listSavedPaymentMethodsResponseBodyFromJSON(
|
|
217
|
+
jsonString: string,
|
|
218
|
+
): SafeParseResult<ListSavedPaymentMethodsResponseBody, SDKValidationError> {
|
|
219
|
+
return safeParse(
|
|
220
|
+
jsonString,
|
|
221
|
+
(x) =>
|
|
222
|
+
ListSavedPaymentMethodsResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
223
|
+
`Failed to parse 'ListSavedPaymentMethodsResponseBody' from JSON`,
|
|
224
|
+
);
|
|
225
|
+
}
|
package/src/sdk/customers.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { customersDeleteAddress } from "../funcs/customersDeleteAddress.js";
|
|
|
7
7
|
import { customersGetAddressDetail } from "../funcs/customersGetAddressDetail.js";
|
|
8
8
|
import { customersGetLoyaltyDetails } from "../funcs/customersGetLoyaltyDetails.js";
|
|
9
9
|
import { customersListAddresses } from "../funcs/customersListAddresses.js";
|
|
10
|
+
import { customersListSavedPaymentMethods } from "../funcs/customersListSavedPaymentMethods.js";
|
|
10
11
|
import { customersListUserReviews } from "../funcs/customersListUserReviews.js";
|
|
11
12
|
import { customersUpdateAddressDetail } from "../funcs/customersUpdateAddressDetail.js";
|
|
12
13
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
@@ -14,6 +15,31 @@ import * as operations from "../models/operations/index.js";
|
|
|
14
15
|
import { unwrapAsync } from "../types/fp.js";
|
|
15
16
|
|
|
16
17
|
export class Customers extends ClientSDK {
|
|
18
|
+
/**
|
|
19
|
+
* List all saved payment methods
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* This endpoint acts as a proxy for JusPay’s “Fetch Saved Payment Methods” API. It enables to securely retrieve a list of payment methods (such as saved cards, UPI handles, wallets) that have been previously stored for a given customer.
|
|
23
|
+
*
|
|
24
|
+
* The operation helps streamline the checkout flow by allowing users to quickly select from existing payment methods, reducing input friction and improving conversion.
|
|
25
|
+
*
|
|
26
|
+
* API documentation of JusPay can be found at below link:
|
|
27
|
+
*
|
|
28
|
+
* https://juspay.io/in/docs/api-reference/docs/express-checkout/fetch-saved-payment-methods
|
|
29
|
+
*
|
|
30
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-saved-payment-methods} - API reference for the list-saved-payment-methods operation
|
|
31
|
+
*/
|
|
32
|
+
async listSavedPaymentMethods(
|
|
33
|
+
request: operations.ListSavedPaymentMethodsRequest,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): Promise<operations.ListSavedPaymentMethodsResponseBody> {
|
|
36
|
+
return unwrapAsync(customersListSavedPaymentMethods(
|
|
37
|
+
this,
|
|
38
|
+
request,
|
|
39
|
+
options,
|
|
40
|
+
));
|
|
41
|
+
}
|
|
42
|
+
|
|
17
43
|
/**
|
|
18
44
|
* Retrieve all addresses
|
|
19
45
|
*
|