ce-storefront 0.18.0 → 0.18.2
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/docs/sdks/orders/README.md +0 -16
- 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 +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/models/components/index.d.ts +9 -1
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +9 -1
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/juspaycard.d.ts +86 -0
- package/esm/models/components/juspaycard.d.ts.map +1 -0
- package/esm/models/components/juspaycard.js +114 -0
- package/esm/models/components/juspaycard.js.map +1 -0
- package/esm/models/components/juspayexpresscheckout.d.ts +33 -0
- package/esm/models/components/juspayexpresscheckout.d.ts.map +1 -0
- package/esm/models/components/juspayexpresscheckout.js +44 -0
- package/esm/models/components/juspayexpresscheckout.js.map +1 -0
- package/esm/models/components/juspayhypercheckout.d.ts +63 -0
- package/esm/models/components/juspayhypercheckout.d.ts.map +1 -0
- package/esm/models/components/juspayhypercheckout.js +74 -0
- package/esm/models/components/juspayhypercheckout.js.map +1 -0
- package/esm/models/components/juspaynetbanking.d.ts +44 -0
- package/esm/models/components/juspaynetbanking.d.ts.map +1 -0
- package/esm/models/components/juspaynetbanking.js +65 -0
- package/esm/models/components/juspaynetbanking.js.map +1 -0
- package/esm/models/components/juspaypaymentgatewayparams.d.ts +8 -8
- package/esm/models/components/juspaypaymentgatewayparams.d.ts.map +1 -1
- package/esm/models/components/juspaypaymentgatewayparams.js +12 -13
- package/esm/models/components/juspaypaymentgatewayparams.js.map +1 -1
- package/esm/models/components/juspaysavedcardtoken.d.ts +80 -0
- package/esm/models/components/juspaysavedcardtoken.d.ts.map +1 -0
- package/esm/models/components/juspaysavedcardtoken.js +102 -0
- package/esm/models/components/juspaysavedcardtoken.js.map +1 -0
- package/esm/models/components/juspayupicollect.d.ts +46 -0
- package/esm/models/components/juspayupicollect.d.ts.map +1 -0
- package/esm/models/components/juspayupicollect.js +69 -0
- package/esm/models/components/juspayupicollect.js.map +1 -0
- package/esm/models/components/juspayupiintent.d.ts +48 -0
- package/esm/models/components/juspayupiintent.d.ts.map +1 -0
- package/esm/models/components/juspayupiintent.js +73 -0
- package/esm/models/components/juspayupiintent.js.map +1 -0
- package/esm/models/components/paymentmethodpayload.d.ts +30 -0
- package/esm/models/components/paymentmethodpayload.d.ts.map +1 -0
- package/esm/models/components/paymentmethodpayload.js +35 -0
- package/esm/models/components/paymentmethodpayload.js.map +1 -0
- 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/createorder.d.ts +2 -4
- package/esm/models/operations/createorder.d.ts.map +1 -1
- package/esm/models/operations/createorder.js +4 -8
- package/esm/models/operations/createorder.js.map +1 -1
- 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 +3 -3
- package/src/models/components/index.ts +9 -1
- package/src/models/components/juspaycard.ts +185 -0
- package/src/models/components/juspayexpresscheckout.ts +113 -0
- package/src/models/components/juspayhypercheckout.ts +126 -0
- package/src/models/components/juspaynetbanking.ts +115 -0
- package/src/models/components/juspaypaymentgatewayparams.ts +18 -14
- package/src/models/components/juspaysavedcardtoken.ts +174 -0
- package/src/models/components/juspayupicollect.ts +121 -0
- package/src/models/components/juspayupiintent.ts +125 -0
- package/src/models/components/paymentmethodpayload.ts +81 -0
- package/src/models/components/savedpaymentmethod.ts +668 -0
- package/src/models/operations/createorder.ts +6 -12
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listsavedpaymentmethods.ts +225 -0
- package/src/sdk/customers.ts +26 -0
- package/esm/models/components/paymentgateway.d.ts +0 -34
- package/esm/models/components/paymentgateway.d.ts.map +0 -1
- package/esm/models/components/paymentgateway.js +0 -27
- package/esm/models/components/paymentgateway.js.map +0 -1
- package/src/models/components/paymentgateway.ts +0 -39
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CeStorefrontCore } from "../core.js";
|
|
6
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import { CeStorefrontError } from "../models/errors/cestorefronterror.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import * as errors from "../models/errors/index.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* List all saved payment methods
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* 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.
|
|
33
|
+
*
|
|
34
|
+
* The operation helps streamline the checkout flow by allowing users to quickly select from existing payment methods, reducing input friction and improving conversion.
|
|
35
|
+
*
|
|
36
|
+
* API documentation of JusPay can be found at below link:
|
|
37
|
+
*
|
|
38
|
+
* https://juspay.io/in/docs/api-reference/docs/express-checkout/fetch-saved-payment-methods
|
|
39
|
+
*
|
|
40
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/operations/list-saved-payment-methods} - API reference for the list-saved-payment-methods operation
|
|
41
|
+
*/
|
|
42
|
+
export function customersListSavedPaymentMethods(
|
|
43
|
+
client: CeStorefrontCore,
|
|
44
|
+
request: operations.ListSavedPaymentMethodsRequest,
|
|
45
|
+
options?: RequestOptions,
|
|
46
|
+
): APIPromise<
|
|
47
|
+
Result<
|
|
48
|
+
operations.ListSavedPaymentMethodsResponseBody,
|
|
49
|
+
| errors.Unauthorized
|
|
50
|
+
| errors.NotFound
|
|
51
|
+
| CeStorefrontError
|
|
52
|
+
| ResponseValidationError
|
|
53
|
+
| ConnectionError
|
|
54
|
+
| RequestAbortedError
|
|
55
|
+
| RequestTimeoutError
|
|
56
|
+
| InvalidRequestError
|
|
57
|
+
| UnexpectedClientError
|
|
58
|
+
| SDKValidationError
|
|
59
|
+
>
|
|
60
|
+
> {
|
|
61
|
+
return new APIPromise($do(
|
|
62
|
+
client,
|
|
63
|
+
request,
|
|
64
|
+
options,
|
|
65
|
+
));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function $do(
|
|
69
|
+
client: CeStorefrontCore,
|
|
70
|
+
request: operations.ListSavedPaymentMethodsRequest,
|
|
71
|
+
options?: RequestOptions,
|
|
72
|
+
): Promise<
|
|
73
|
+
[
|
|
74
|
+
Result<
|
|
75
|
+
operations.ListSavedPaymentMethodsResponseBody,
|
|
76
|
+
| errors.Unauthorized
|
|
77
|
+
| errors.NotFound
|
|
78
|
+
| CeStorefrontError
|
|
79
|
+
| ResponseValidationError
|
|
80
|
+
| ConnectionError
|
|
81
|
+
| RequestAbortedError
|
|
82
|
+
| RequestTimeoutError
|
|
83
|
+
| InvalidRequestError
|
|
84
|
+
| UnexpectedClientError
|
|
85
|
+
| SDKValidationError
|
|
86
|
+
>,
|
|
87
|
+
APICall,
|
|
88
|
+
]
|
|
89
|
+
> {
|
|
90
|
+
const parsed = safeParse(
|
|
91
|
+
request,
|
|
92
|
+
(value) =>
|
|
93
|
+
operations.ListSavedPaymentMethodsRequest$outboundSchema.parse(value),
|
|
94
|
+
"Input validation failed",
|
|
95
|
+
);
|
|
96
|
+
if (!parsed.ok) {
|
|
97
|
+
return [parsed, { status: "invalid" }];
|
|
98
|
+
}
|
|
99
|
+
const payload = parsed.value;
|
|
100
|
+
const body = null;
|
|
101
|
+
|
|
102
|
+
const pathParams = {
|
|
103
|
+
customer_id: encodeSimple("customer_id", payload.customer_id, {
|
|
104
|
+
explode: false,
|
|
105
|
+
charEncoding: "percent",
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const path = pathToFunc("/customers/{customer_id}/payment-methods")(
|
|
110
|
+
pathParams,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const headers = new Headers(compactMap({
|
|
114
|
+
Accept: "application/json",
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
const secConfig = await extractSecurity(client._options.authorization);
|
|
118
|
+
const securityInput = secConfig == null ? {} : { authorization: secConfig };
|
|
119
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
120
|
+
|
|
121
|
+
const context = {
|
|
122
|
+
options: client._options,
|
|
123
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
124
|
+
operationID: "list-saved-payment-methods",
|
|
125
|
+
oAuth2Scopes: null,
|
|
126
|
+
|
|
127
|
+
resolvedSecurity: requestSecurity,
|
|
128
|
+
|
|
129
|
+
securitySource: client._options.authorization,
|
|
130
|
+
retryConfig: options?.retries
|
|
131
|
+
|| client._options.retryConfig
|
|
132
|
+
|| { strategy: "none" },
|
|
133
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const requestRes = client._createRequest(context, {
|
|
137
|
+
security: requestSecurity,
|
|
138
|
+
method: "GET",
|
|
139
|
+
baseURL: options?.serverURL,
|
|
140
|
+
path: path,
|
|
141
|
+
headers: headers,
|
|
142
|
+
body: body,
|
|
143
|
+
userAgent: client._options.userAgent,
|
|
144
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
145
|
+
}, options);
|
|
146
|
+
if (!requestRes.ok) {
|
|
147
|
+
return [requestRes, { status: "invalid" }];
|
|
148
|
+
}
|
|
149
|
+
const req = requestRes.value;
|
|
150
|
+
|
|
151
|
+
const doResult = await client._do(req, {
|
|
152
|
+
context,
|
|
153
|
+
errorCodes: ["401", "404", "4XX", "5XX"],
|
|
154
|
+
retryConfig: context.retryConfig,
|
|
155
|
+
retryCodes: context.retryCodes,
|
|
156
|
+
});
|
|
157
|
+
if (!doResult.ok) {
|
|
158
|
+
return [doResult, { status: "request-error", request: req }];
|
|
159
|
+
}
|
|
160
|
+
const response = doResult.value;
|
|
161
|
+
|
|
162
|
+
const responseFields = {
|
|
163
|
+
HttpMeta: { Response: response, Request: req },
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const [result] = await M.match<
|
|
167
|
+
operations.ListSavedPaymentMethodsResponseBody,
|
|
168
|
+
| errors.Unauthorized
|
|
169
|
+
| errors.NotFound
|
|
170
|
+
| CeStorefrontError
|
|
171
|
+
| ResponseValidationError
|
|
172
|
+
| ConnectionError
|
|
173
|
+
| RequestAbortedError
|
|
174
|
+
| RequestTimeoutError
|
|
175
|
+
| InvalidRequestError
|
|
176
|
+
| UnexpectedClientError
|
|
177
|
+
| SDKValidationError
|
|
178
|
+
>(
|
|
179
|
+
M.json(200, operations.ListSavedPaymentMethodsResponseBody$inboundSchema),
|
|
180
|
+
M.jsonErr(401, errors.Unauthorized$inboundSchema),
|
|
181
|
+
M.jsonErr(404, errors.NotFound$inboundSchema),
|
|
182
|
+
M.fail("4XX"),
|
|
183
|
+
M.fail("5XX"),
|
|
184
|
+
)(response, req, { extraFields: responseFields });
|
|
185
|
+
if (!result.ok) {
|
|
186
|
+
return [result, { status: "complete", request: req, response }];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return [result, { status: "complete", request: req, response }];
|
|
190
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -80,7 +80,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
80
80
|
export const SDK_METADATA = {
|
|
81
81
|
language: "typescript",
|
|
82
82
|
openapiDocVersion: "1.0",
|
|
83
|
-
sdkVersion: "0.18.
|
|
84
|
-
genVersion: "2.
|
|
85
|
-
userAgent: "speakeasy-sdk/typescript 0.18.
|
|
83
|
+
sdkVersion: "0.18.2",
|
|
84
|
+
genVersion: "2.731.6",
|
|
85
|
+
userAgent: "speakeasy-sdk/typescript 0.18.2 2.731.6 1.0 ce-storefront",
|
|
86
86
|
} as const;
|
|
@@ -37,8 +37,15 @@ export * from "./fulfillmentpreferenceinput.js";
|
|
|
37
37
|
export * from "./generateotpwithemail.js";
|
|
38
38
|
export * from "./generateotpwithphone.js";
|
|
39
39
|
export * from "./item.js";
|
|
40
|
+
export * from "./juspaycard.js";
|
|
41
|
+
export * from "./juspayexpresscheckout.js";
|
|
42
|
+
export * from "./juspayhypercheckout.js";
|
|
43
|
+
export * from "./juspaynetbanking.js";
|
|
40
44
|
export * from "./juspaypaymentgatewayparams.js";
|
|
41
45
|
export * from "./juspaypaymentinfo.js";
|
|
46
|
+
export * from "./juspaysavedcardtoken.js";
|
|
47
|
+
export * from "./juspayupicollect.js";
|
|
48
|
+
export * from "./juspayupiintent.js";
|
|
42
49
|
export * from "./lotbatchdetail.js";
|
|
43
50
|
export * from "./multiselectattribute.js";
|
|
44
51
|
export * from "./netbankingpayment.js";
|
|
@@ -54,8 +61,8 @@ export * from "./ordershipment.js";
|
|
|
54
61
|
export * from "./pagination.js";
|
|
55
62
|
export * from "./partialcollectanddelivery.js";
|
|
56
63
|
export * from "./partialcollectanddeliveryinput.js";
|
|
57
|
-
export * from "./paymentgateway.js";
|
|
58
64
|
export * from "./paymentgatewayparams.js";
|
|
65
|
+
export * from "./paymentmethodpayload.js";
|
|
59
66
|
export * from "./payupaymentgatewayparams.js";
|
|
60
67
|
export * from "./payupaymentinfo.js";
|
|
61
68
|
export * from "./pincode.js";
|
|
@@ -72,6 +79,7 @@ export * from "./productreview.js";
|
|
|
72
79
|
export * from "./productshipping.js";
|
|
73
80
|
export * from "./productsubscription.js";
|
|
74
81
|
export * from "./productvideo.js";
|
|
82
|
+
export * from "./savedpaymentmethod.js";
|
|
75
83
|
export * from "./searchproduct.js";
|
|
76
84
|
export * from "./security.js";
|
|
77
85
|
export * from "./seo.js";
|
|
@@ -0,0 +1,185 @@
|
|
|
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 { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export const PaymentMethod = {
|
|
13
|
+
Visa: "VISA",
|
|
14
|
+
Master: "MASTER",
|
|
15
|
+
} as const;
|
|
16
|
+
export type PaymentMethod = ClosedEnum<typeof PaymentMethod>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/schemas/JusPayCard} - API reference for the JusPayCard schema
|
|
20
|
+
*/
|
|
21
|
+
export type JusPayCard = {
|
|
22
|
+
paymentMethodSlug: string;
|
|
23
|
+
integrationType?: "express-checkout" | undefined;
|
|
24
|
+
gatewayReferenceId: string;
|
|
25
|
+
returnUrl?: string | undefined;
|
|
26
|
+
redirectAfterPayment: boolean;
|
|
27
|
+
authType?: "OTP" | undefined;
|
|
28
|
+
tokenize: boolean;
|
|
29
|
+
saveToLocker: boolean;
|
|
30
|
+
paymentMethodType?: "CARD" | undefined;
|
|
31
|
+
paymentMethod: PaymentMethod;
|
|
32
|
+
cardNumber: string;
|
|
33
|
+
cardExpMonth: string;
|
|
34
|
+
cardExpYear: string;
|
|
35
|
+
nameOnCard: string;
|
|
36
|
+
cardSecurityCode: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const PaymentMethod$inboundSchema: z.ZodNativeEnum<
|
|
41
|
+
typeof PaymentMethod
|
|
42
|
+
> = z.nativeEnum(PaymentMethod);
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const PaymentMethod$outboundSchema: z.ZodNativeEnum<
|
|
46
|
+
typeof PaymentMethod
|
|
47
|
+
> = PaymentMethod$inboundSchema;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
52
|
+
*/
|
|
53
|
+
export namespace PaymentMethod$ {
|
|
54
|
+
/** @deprecated use `PaymentMethod$inboundSchema` instead. */
|
|
55
|
+
export const inboundSchema = PaymentMethod$inboundSchema;
|
|
56
|
+
/** @deprecated use `PaymentMethod$outboundSchema` instead. */
|
|
57
|
+
export const outboundSchema = PaymentMethod$outboundSchema;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const JusPayCard$inboundSchema: z.ZodType<
|
|
62
|
+
JusPayCard,
|
|
63
|
+
z.ZodTypeDef,
|
|
64
|
+
unknown
|
|
65
|
+
> = z.object({
|
|
66
|
+
payment_method_slug: z.string(),
|
|
67
|
+
integration_type: z.literal("express-checkout").default("express-checkout")
|
|
68
|
+
.optional(),
|
|
69
|
+
gateway_reference_id: z.string(),
|
|
70
|
+
return_url: z.string().optional(),
|
|
71
|
+
redirect_after_payment: z.boolean(),
|
|
72
|
+
auth_type: z.literal("OTP").default("OTP").optional(),
|
|
73
|
+
tokenize: z.boolean(),
|
|
74
|
+
save_to_locker: z.boolean(),
|
|
75
|
+
payment_method_type: z.literal("CARD").default("CARD").optional(),
|
|
76
|
+
payment_method: PaymentMethod$inboundSchema,
|
|
77
|
+
card_number: z.string(),
|
|
78
|
+
card_exp_month: z.string(),
|
|
79
|
+
card_exp_year: z.string(),
|
|
80
|
+
name_on_card: z.string(),
|
|
81
|
+
card_security_code: z.string(),
|
|
82
|
+
}).transform((v) => {
|
|
83
|
+
return remap$(v, {
|
|
84
|
+
"payment_method_slug": "paymentMethodSlug",
|
|
85
|
+
"integration_type": "integrationType",
|
|
86
|
+
"gateway_reference_id": "gatewayReferenceId",
|
|
87
|
+
"return_url": "returnUrl",
|
|
88
|
+
"redirect_after_payment": "redirectAfterPayment",
|
|
89
|
+
"auth_type": "authType",
|
|
90
|
+
"save_to_locker": "saveToLocker",
|
|
91
|
+
"payment_method_type": "paymentMethodType",
|
|
92
|
+
"payment_method": "paymentMethod",
|
|
93
|
+
"card_number": "cardNumber",
|
|
94
|
+
"card_exp_month": "cardExpMonth",
|
|
95
|
+
"card_exp_year": "cardExpYear",
|
|
96
|
+
"name_on_card": "nameOnCard",
|
|
97
|
+
"card_security_code": "cardSecurityCode",
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
/** @internal */
|
|
102
|
+
export type JusPayCard$Outbound = {
|
|
103
|
+
payment_method_slug: string;
|
|
104
|
+
integration_type: "express-checkout";
|
|
105
|
+
gateway_reference_id: string;
|
|
106
|
+
return_url?: string | undefined;
|
|
107
|
+
redirect_after_payment: boolean;
|
|
108
|
+
auth_type: "OTP";
|
|
109
|
+
tokenize: boolean;
|
|
110
|
+
save_to_locker: boolean;
|
|
111
|
+
payment_method_type: "CARD";
|
|
112
|
+
payment_method: string;
|
|
113
|
+
card_number: string;
|
|
114
|
+
card_exp_month: string;
|
|
115
|
+
card_exp_year: string;
|
|
116
|
+
name_on_card: string;
|
|
117
|
+
card_security_code: string;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/** @internal */
|
|
121
|
+
export const JusPayCard$outboundSchema: z.ZodType<
|
|
122
|
+
JusPayCard$Outbound,
|
|
123
|
+
z.ZodTypeDef,
|
|
124
|
+
JusPayCard
|
|
125
|
+
> = z.object({
|
|
126
|
+
paymentMethodSlug: z.string(),
|
|
127
|
+
integrationType: z.literal("express-checkout"),
|
|
128
|
+
gatewayReferenceId: z.string(),
|
|
129
|
+
returnUrl: z.string().optional(),
|
|
130
|
+
redirectAfterPayment: z.boolean(),
|
|
131
|
+
authType: z.literal("OTP"),
|
|
132
|
+
tokenize: z.boolean(),
|
|
133
|
+
saveToLocker: z.boolean(),
|
|
134
|
+
paymentMethodType: z.literal("CARD"),
|
|
135
|
+
paymentMethod: PaymentMethod$outboundSchema,
|
|
136
|
+
cardNumber: z.string(),
|
|
137
|
+
cardExpMonth: z.string(),
|
|
138
|
+
cardExpYear: z.string(),
|
|
139
|
+
nameOnCard: z.string(),
|
|
140
|
+
cardSecurityCode: z.string(),
|
|
141
|
+
}).transform((v) => {
|
|
142
|
+
return remap$(v, {
|
|
143
|
+
paymentMethodSlug: "payment_method_slug",
|
|
144
|
+
integrationType: "integration_type",
|
|
145
|
+
gatewayReferenceId: "gateway_reference_id",
|
|
146
|
+
returnUrl: "return_url",
|
|
147
|
+
redirectAfterPayment: "redirect_after_payment",
|
|
148
|
+
authType: "auth_type",
|
|
149
|
+
saveToLocker: "save_to_locker",
|
|
150
|
+
paymentMethodType: "payment_method_type",
|
|
151
|
+
paymentMethod: "payment_method",
|
|
152
|
+
cardNumber: "card_number",
|
|
153
|
+
cardExpMonth: "card_exp_month",
|
|
154
|
+
cardExpYear: "card_exp_year",
|
|
155
|
+
nameOnCard: "name_on_card",
|
|
156
|
+
cardSecurityCode: "card_security_code",
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @internal
|
|
162
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
163
|
+
*/
|
|
164
|
+
export namespace JusPayCard$ {
|
|
165
|
+
/** @deprecated use `JusPayCard$inboundSchema` instead. */
|
|
166
|
+
export const inboundSchema = JusPayCard$inboundSchema;
|
|
167
|
+
/** @deprecated use `JusPayCard$outboundSchema` instead. */
|
|
168
|
+
export const outboundSchema = JusPayCard$outboundSchema;
|
|
169
|
+
/** @deprecated use `JusPayCard$Outbound` instead. */
|
|
170
|
+
export type Outbound = JusPayCard$Outbound;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function jusPayCardToJSON(jusPayCard: JusPayCard): string {
|
|
174
|
+
return JSON.stringify(JusPayCard$outboundSchema.parse(jusPayCard));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function jusPayCardFromJSON(
|
|
178
|
+
jsonString: string,
|
|
179
|
+
): SafeParseResult<JusPayCard, SDKValidationError> {
|
|
180
|
+
return safeParse(
|
|
181
|
+
jsonString,
|
|
182
|
+
(x) => JusPayCard$inboundSchema.parse(JSON.parse(x)),
|
|
183
|
+
`Failed to parse 'JusPayCard' from JSON`,
|
|
184
|
+
);
|
|
185
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
JusPayCard,
|
|
11
|
+
JusPayCard$inboundSchema,
|
|
12
|
+
JusPayCard$Outbound,
|
|
13
|
+
JusPayCard$outboundSchema,
|
|
14
|
+
} from "./juspaycard.js";
|
|
15
|
+
import {
|
|
16
|
+
JuspayNetBanking,
|
|
17
|
+
JuspayNetBanking$inboundSchema,
|
|
18
|
+
JuspayNetBanking$Outbound,
|
|
19
|
+
JuspayNetBanking$outboundSchema,
|
|
20
|
+
} from "./juspaynetbanking.js";
|
|
21
|
+
import {
|
|
22
|
+
JusPaySavedCardToken,
|
|
23
|
+
JusPaySavedCardToken$inboundSchema,
|
|
24
|
+
JusPaySavedCardToken$Outbound,
|
|
25
|
+
JusPaySavedCardToken$outboundSchema,
|
|
26
|
+
} from "./juspaysavedcardtoken.js";
|
|
27
|
+
import {
|
|
28
|
+
JuspayUpiCollect,
|
|
29
|
+
JuspayUpiCollect$inboundSchema,
|
|
30
|
+
JuspayUpiCollect$Outbound,
|
|
31
|
+
JuspayUpiCollect$outboundSchema,
|
|
32
|
+
} from "./juspayupicollect.js";
|
|
33
|
+
import {
|
|
34
|
+
JuspayUpiIntent,
|
|
35
|
+
JuspayUpiIntent$inboundSchema,
|
|
36
|
+
JuspayUpiIntent$Outbound,
|
|
37
|
+
JuspayUpiIntent$outboundSchema,
|
|
38
|
+
} from "./juspayupiintent.js";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/schemas/JusPayExpressCheckout} - API reference for the JusPayExpressCheckout schema
|
|
42
|
+
*/
|
|
43
|
+
export type JusPayExpressCheckout =
|
|
44
|
+
| JusPayCard
|
|
45
|
+
| JusPaySavedCardToken
|
|
46
|
+
| JuspayUpiIntent
|
|
47
|
+
| JuspayUpiCollect
|
|
48
|
+
| JuspayNetBanking;
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const JusPayExpressCheckout$inboundSchema: z.ZodType<
|
|
52
|
+
JusPayExpressCheckout,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
unknown
|
|
55
|
+
> = z.union([
|
|
56
|
+
JusPayCard$inboundSchema,
|
|
57
|
+
JusPaySavedCardToken$inboundSchema,
|
|
58
|
+
JuspayUpiIntent$inboundSchema,
|
|
59
|
+
JuspayUpiCollect$inboundSchema,
|
|
60
|
+
JuspayNetBanking$inboundSchema,
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export type JusPayExpressCheckout$Outbound =
|
|
65
|
+
| JusPayCard$Outbound
|
|
66
|
+
| JusPaySavedCardToken$Outbound
|
|
67
|
+
| JuspayUpiIntent$Outbound
|
|
68
|
+
| JuspayUpiCollect$Outbound
|
|
69
|
+
| JuspayNetBanking$Outbound;
|
|
70
|
+
|
|
71
|
+
/** @internal */
|
|
72
|
+
export const JusPayExpressCheckout$outboundSchema: z.ZodType<
|
|
73
|
+
JusPayExpressCheckout$Outbound,
|
|
74
|
+
z.ZodTypeDef,
|
|
75
|
+
JusPayExpressCheckout
|
|
76
|
+
> = z.union([
|
|
77
|
+
JusPayCard$outboundSchema,
|
|
78
|
+
JusPaySavedCardToken$outboundSchema,
|
|
79
|
+
JuspayUpiIntent$outboundSchema,
|
|
80
|
+
JuspayUpiCollect$outboundSchema,
|
|
81
|
+
JuspayNetBanking$outboundSchema,
|
|
82
|
+
]);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
87
|
+
*/
|
|
88
|
+
export namespace JusPayExpressCheckout$ {
|
|
89
|
+
/** @deprecated use `JusPayExpressCheckout$inboundSchema` instead. */
|
|
90
|
+
export const inboundSchema = JusPayExpressCheckout$inboundSchema;
|
|
91
|
+
/** @deprecated use `JusPayExpressCheckout$outboundSchema` instead. */
|
|
92
|
+
export const outboundSchema = JusPayExpressCheckout$outboundSchema;
|
|
93
|
+
/** @deprecated use `JusPayExpressCheckout$Outbound` instead. */
|
|
94
|
+
export type Outbound = JusPayExpressCheckout$Outbound;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function jusPayExpressCheckoutToJSON(
|
|
98
|
+
jusPayExpressCheckout: JusPayExpressCheckout,
|
|
99
|
+
): string {
|
|
100
|
+
return JSON.stringify(
|
|
101
|
+
JusPayExpressCheckout$outboundSchema.parse(jusPayExpressCheckout),
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function jusPayExpressCheckoutFromJSON(
|
|
106
|
+
jsonString: string,
|
|
107
|
+
): SafeParseResult<JusPayExpressCheckout, SDKValidationError> {
|
|
108
|
+
return safeParse(
|
|
109
|
+
jsonString,
|
|
110
|
+
(x) => JusPayExpressCheckout$inboundSchema.parse(JSON.parse(x)),
|
|
111
|
+
`Failed to parse 'JusPayExpressCheckout' from JSON`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
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 { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export const Action = {
|
|
13
|
+
PaymentPage: "paymentPage",
|
|
14
|
+
} as const;
|
|
15
|
+
export type Action = ClosedEnum<typeof Action>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @see {@link https://llm-docs.commercengine.io/storefront/schemas/JusPayHyperCheckout} - API reference for the JusPayHyperCheckout schema
|
|
19
|
+
*/
|
|
20
|
+
export type JusPayHyperCheckout = {
|
|
21
|
+
paymentMethodSlug: string;
|
|
22
|
+
integrationType?: "hyper-checkout" | undefined;
|
|
23
|
+
gatewayReferenceId: string;
|
|
24
|
+
returnUrl: string;
|
|
25
|
+
action: Action;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const Action$inboundSchema: z.ZodNativeEnum<typeof Action> = z
|
|
30
|
+
.nativeEnum(Action);
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const Action$outboundSchema: z.ZodNativeEnum<typeof Action> =
|
|
34
|
+
Action$inboundSchema;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
39
|
+
*/
|
|
40
|
+
export namespace Action$ {
|
|
41
|
+
/** @deprecated use `Action$inboundSchema` instead. */
|
|
42
|
+
export const inboundSchema = Action$inboundSchema;
|
|
43
|
+
/** @deprecated use `Action$outboundSchema` instead. */
|
|
44
|
+
export const outboundSchema = Action$outboundSchema;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** @internal */
|
|
48
|
+
export const JusPayHyperCheckout$inboundSchema: z.ZodType<
|
|
49
|
+
JusPayHyperCheckout,
|
|
50
|
+
z.ZodTypeDef,
|
|
51
|
+
unknown
|
|
52
|
+
> = z.object({
|
|
53
|
+
payment_method_slug: z.string(),
|
|
54
|
+
integration_type: z.literal("hyper-checkout").default("hyper-checkout")
|
|
55
|
+
.optional(),
|
|
56
|
+
gateway_reference_id: z.string(),
|
|
57
|
+
return_url: z.string(),
|
|
58
|
+
action: Action$inboundSchema,
|
|
59
|
+
}).transform((v) => {
|
|
60
|
+
return remap$(v, {
|
|
61
|
+
"payment_method_slug": "paymentMethodSlug",
|
|
62
|
+
"integration_type": "integrationType",
|
|
63
|
+
"gateway_reference_id": "gatewayReferenceId",
|
|
64
|
+
"return_url": "returnUrl",
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/** @internal */
|
|
69
|
+
export type JusPayHyperCheckout$Outbound = {
|
|
70
|
+
payment_method_slug: string;
|
|
71
|
+
integration_type: "hyper-checkout";
|
|
72
|
+
gateway_reference_id: string;
|
|
73
|
+
return_url: string;
|
|
74
|
+
action: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** @internal */
|
|
78
|
+
export const JusPayHyperCheckout$outboundSchema: z.ZodType<
|
|
79
|
+
JusPayHyperCheckout$Outbound,
|
|
80
|
+
z.ZodTypeDef,
|
|
81
|
+
JusPayHyperCheckout
|
|
82
|
+
> = z.object({
|
|
83
|
+
paymentMethodSlug: z.string(),
|
|
84
|
+
integrationType: z.literal("hyper-checkout"),
|
|
85
|
+
gatewayReferenceId: z.string(),
|
|
86
|
+
returnUrl: z.string(),
|
|
87
|
+
action: Action$outboundSchema,
|
|
88
|
+
}).transform((v) => {
|
|
89
|
+
return remap$(v, {
|
|
90
|
+
paymentMethodSlug: "payment_method_slug",
|
|
91
|
+
integrationType: "integration_type",
|
|
92
|
+
gatewayReferenceId: "gateway_reference_id",
|
|
93
|
+
returnUrl: "return_url",
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
100
|
+
*/
|
|
101
|
+
export namespace JusPayHyperCheckout$ {
|
|
102
|
+
/** @deprecated use `JusPayHyperCheckout$inboundSchema` instead. */
|
|
103
|
+
export const inboundSchema = JusPayHyperCheckout$inboundSchema;
|
|
104
|
+
/** @deprecated use `JusPayHyperCheckout$outboundSchema` instead. */
|
|
105
|
+
export const outboundSchema = JusPayHyperCheckout$outboundSchema;
|
|
106
|
+
/** @deprecated use `JusPayHyperCheckout$Outbound` instead. */
|
|
107
|
+
export type Outbound = JusPayHyperCheckout$Outbound;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function jusPayHyperCheckoutToJSON(
|
|
111
|
+
jusPayHyperCheckout: JusPayHyperCheckout,
|
|
112
|
+
): string {
|
|
113
|
+
return JSON.stringify(
|
|
114
|
+
JusPayHyperCheckout$outboundSchema.parse(jusPayHyperCheckout),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function jusPayHyperCheckoutFromJSON(
|
|
119
|
+
jsonString: string,
|
|
120
|
+
): SafeParseResult<JusPayHyperCheckout, SDKValidationError> {
|
|
121
|
+
return safeParse(
|
|
122
|
+
jsonString,
|
|
123
|
+
(x) => JusPayHyperCheckout$inboundSchema.parse(JSON.parse(x)),
|
|
124
|
+
`Failed to parse 'JusPayHyperCheckout' from JSON`,
|
|
125
|
+
);
|
|
126
|
+
}
|