ce-storefront 0.2.4 → 0.2.6
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 +7 -2
- package/RUNTIMES.md +27 -1
- package/docs/sdks/cestorefrontreviews/README.md +2 -2
- package/docs/sdks/paymentsapi/README.md +90 -0
- package/funcs/analyticsTrack.js +4 -4
- package/funcs/analyticsTrack.js.map +1 -1
- package/funcs/authGenerateOtp.js +4 -4
- package/funcs/authGenerateOtp.js.map +1 -1
- package/funcs/authLoginAnonymously.js +5 -5
- package/funcs/authLoginAnonymously.js.map +1 -1
- package/funcs/authLoginWithEmail.js +4 -4
- package/funcs/authLoginWithEmail.js.map +1 -1
- package/funcs/authLoginWithPassword.js +4 -4
- package/funcs/authLoginWithPassword.js.map +1 -1
- package/funcs/authLoginWithPhone.js +4 -4
- package/funcs/authLoginWithPhone.js.map +1 -1
- package/funcs/authLoginWithWhatsapp.js +4 -4
- package/funcs/authLoginWithWhatsapp.js.map +1 -1
- package/funcs/authRefreshToken.js +4 -4
- package/funcs/authRefreshToken.js.map +1 -1
- package/funcs/authRegisterWithEmail.js +4 -4
- package/funcs/authRegisterWithEmail.js.map +1 -1
- package/funcs/authRegisterWithPassword.js +4 -4
- package/funcs/authRegisterWithPassword.js.map +1 -1
- package/funcs/authRegisterWithPhone.js +4 -4
- package/funcs/authRegisterWithPhone.js.map +1 -1
- package/funcs/authRegisterWithWhatsapp.js +4 -4
- package/funcs/authRegisterWithWhatsapp.js.map +1 -1
- package/funcs/authUserAddProfileImage.js +4 -4
- package/funcs/authUserAddProfileImage.js.map +1 -1
- package/funcs/authUserChangePassword.js +4 -4
- package/funcs/authUserChangePassword.js.map +1 -1
- package/funcs/authUserDeactivateAccount.js +4 -4
- package/funcs/authUserDeactivateAccount.js.map +1 -1
- package/funcs/authUserDeleteProfileImage.js +4 -4
- package/funcs/authUserDeleteProfileImage.js.map +1 -1
- package/funcs/authUserForgotPassword.js +4 -4
- package/funcs/authUserForgotPassword.js.map +1 -1
- package/funcs/authUserGet.js +4 -4
- package/funcs/authUserGet.js.map +1 -1
- package/funcs/authUserGetProfileImage.js +4 -4
- package/funcs/authUserGetProfileImage.js.map +1 -1
- package/funcs/authUserLogout.js +4 -4
- package/funcs/authUserLogout.js.map +1 -1
- package/funcs/authUserResetPassword.js +4 -4
- package/funcs/authUserResetPassword.js.map +1 -1
- package/funcs/authUserUpdate.js +4 -4
- package/funcs/authUserUpdate.js.map +1 -1
- package/funcs/authUserUpdateProfileImage.js +4 -4
- package/funcs/authUserUpdateProfileImage.js.map +1 -1
- package/funcs/authVerifyEmailPhone.js +4 -4
- package/funcs/authVerifyEmailPhone.js.map +1 -1
- package/funcs/authVerifyOtp.js +4 -4
- package/funcs/authVerifyOtp.js.map +1 -1
- package/funcs/campaignsNewsletterSubscribe.js +4 -4
- package/funcs/campaignsNewsletterSubscribe.js.map +1 -1
- package/funcs/cartsAddItem.js +4 -4
- package/funcs/cartsAddItem.js.map +1 -1
- package/funcs/cartsCreate.js +4 -4
- package/funcs/cartsCreate.js.map +1 -1
- package/funcs/cartsDelete.js +4 -4
- package/funcs/cartsDelete.js.map +1 -1
- package/funcs/cartsGet.js +4 -4
- package/funcs/cartsGet.js.map +1 -1
- package/funcs/catalogCategoriesList.js +4 -4
- package/funcs/catalogCategoriesList.js.map +1 -1
- package/funcs/catalogProductsGet.js +4 -4
- package/funcs/catalogProductsGet.js.map +1 -1
- package/funcs/catalogProductsGetCrossSells.js +4 -4
- package/funcs/catalogProductsGetCrossSells.js.map +1 -1
- package/funcs/catalogProductsGetSimilar.js +4 -4
- package/funcs/catalogProductsGetSimilar.js.map +1 -1
- package/funcs/catalogProductsGetUpsells.js +4 -4
- package/funcs/catalogProductsGetUpsells.js.map +1 -1
- package/funcs/catalogProductsList.js +4 -4
- package/funcs/catalogProductsList.js.map +1 -1
- package/funcs/catalogProductsReviewsCreate.js +4 -4
- package/funcs/catalogProductsReviewsCreate.js.map +1 -1
- package/funcs/catalogProductsReviewsList.d.ts +2 -2
- package/funcs/catalogProductsReviewsList.js +6 -6
- package/funcs/catalogProductsReviewsList.js.map +1 -1
- package/funcs/catalogProductsVariantsGet.js +4 -4
- package/funcs/catalogProductsVariantsGet.js.map +1 -1
- package/funcs/catalogProductsVariantsList.js +4 -4
- package/funcs/catalogProductsVariantsList.js.map +1 -1
- package/funcs/catalogSkusList.js +4 -4
- package/funcs/catalogSkusList.js.map +1 -1
- package/funcs/checkoutApplyCoupon.js +4 -4
- package/funcs/checkoutApplyCoupon.js.map +1 -1
- package/funcs/checkoutRedeemGiftCard.js +4 -4
- package/funcs/checkoutRedeemGiftCard.js.map +1 -1
- package/funcs/checkoutRedeemLoyaltyPoints.js +4 -4
- package/funcs/checkoutRedeemLoyaltyPoints.js.map +1 -1
- package/funcs/checkoutRemoveCoupon.js +4 -4
- package/funcs/checkoutRemoveCoupon.js.map +1 -1
- package/funcs/checkoutRemoveCreditBalance.js +4 -4
- package/funcs/checkoutRemoveCreditBalance.js.map +1 -1
- package/funcs/checkoutRemoveLoyaltyPoints.js +4 -4
- package/funcs/checkoutRemoveLoyaltyPoints.js.map +1 -1
- package/funcs/checkoutUpdateAddress.js +4 -4
- package/funcs/checkoutUpdateAddress.js.map +1 -1
- package/funcs/checkoutUseCreditBalance.js +4 -4
- package/funcs/checkoutUseCreditBalance.js.map +1 -1
- package/funcs/customersAPIGetCustomersId.js +4 -4
- package/funcs/customersAPIGetCustomersId.js.map +1 -1
- package/funcs/customersAPIGetRecommendedProducts.js +4 -4
- package/funcs/customersAPIGetRecommendedProducts.js.map +1 -1
- package/funcs/customersAPIPostCustomers.js +4 -4
- package/funcs/customersAPIPostCustomers.js.map +1 -1
- package/funcs/customersAPIPutCustomersId.js +4 -4
- package/funcs/customersAPIPutCustomersId.js.map +1 -1
- package/funcs/customersAddressesAdd.js +4 -4
- package/funcs/customersAddressesAdd.js.map +1 -1
- package/funcs/customersAddressesDelete.js +4 -4
- package/funcs/customersAddressesDelete.js.map +1 -1
- package/funcs/customersAddressesGet.js +4 -4
- package/funcs/customersAddressesGet.js.map +1 -1
- package/funcs/customersAddressesList.js +4 -4
- package/funcs/customersAddressesList.js.map +1 -1
- package/funcs/customersAddressesUpdate.js +4 -4
- package/funcs/customersAddressesUpdate.js.map +1 -1
- package/funcs/customersLoyaltyGet.js +4 -4
- package/funcs/customersLoyaltyGet.js.map +1 -1
- package/funcs/customersLoyaltyListActivities.js +4 -4
- package/funcs/customersLoyaltyListActivities.js.map +1 -1
- package/funcs/customersReviewsList.js +4 -4
- package/funcs/customersReviewsList.js.map +1 -1
- package/funcs/offersCouponsList.js +4 -4
- package/funcs/offersCouponsList.js.map +1 -1
- package/funcs/offersPromotionsList.js +4 -4
- package/funcs/offersPromotionsList.js.map +1 -1
- package/funcs/ordersCancel.js +4 -4
- package/funcs/ordersCancel.js.map +1 -1
- package/funcs/ordersCreate.js +4 -4
- package/funcs/ordersCreate.js.map +1 -1
- package/funcs/ordersGet.js +4 -4
- package/funcs/ordersGet.js.map +1 -1
- package/funcs/ordersList.js +4 -4
- package/funcs/ordersList.js.map +1 -1
- package/funcs/ordersPaymentsList.js +4 -4
- package/funcs/ordersPaymentsList.js.map +1 -1
- package/funcs/ordersRefundsList.js +4 -4
- package/funcs/ordersRefundsList.js.map +1 -1
- package/funcs/ordersRetryPayment.js +4 -4
- package/funcs/ordersRetryPayment.js.map +1 -1
- package/funcs/ordersShipmentsList.js +4 -4
- package/funcs/ordersShipmentsList.js.map +1 -1
- package/funcs/paymentsAPIPostPaymentsSession.d.ts +15 -0
- package/funcs/paymentsAPIPostPaymentsSession.d.ts.map +1 -0
- package/funcs/paymentsAPIPostPaymentsSession.js +96 -0
- package/funcs/paymentsAPIPostPaymentsSession.js.map +1 -0
- package/funcs/paymentsGenerateHash.js +4 -4
- package/funcs/paymentsGenerateHash.js.map +1 -1
- package/funcs/paymentsGetMethods.js +4 -4
- package/funcs/paymentsGetMethods.js.map +1 -1
- package/funcs/shippingCheckPincodeServiceability.js +4 -4
- package/funcs/shippingCheckPincodeServiceability.js.map +1 -1
- package/funcs/userNotificationPreferencesCreate.js +4 -4
- package/funcs/userNotificationPreferencesCreate.js.map +1 -1
- package/funcs/userNotificationPreferencesGet.js +4 -4
- package/funcs/userNotificationPreferencesGet.js.map +1 -1
- package/funcs/userNotificationPreferencesUpdate.js +4 -4
- package/funcs/userNotificationPreferencesUpdate.js.map +1 -1
- package/funcs/utilsGetCountries.js +4 -4
- package/funcs/utilsGetCountries.js.map +1 -1
- package/funcs/utilsGetPincodes.js +4 -4
- package/funcs/utilsGetPincodes.js.map +1 -1
- package/funcs/utilsGetStates.js +4 -4
- package/funcs/utilsGetStates.js.map +1 -1
- package/funcs/wishlistAdd.js +4 -4
- package/funcs/wishlistAdd.js.map +1 -1
- package/funcs/wishlistDelete.js +4 -4
- package/funcs/wishlistDelete.js.map +1 -1
- package/funcs/wishlistGet.js +4 -4
- package/funcs/wishlistGet.js.map +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +6 -7
- package/lib/config.js.map +1 -1
- package/lib/encodings.js +18 -19
- package/lib/encodings.js.map +1 -1
- package/lib/http.js +1 -2
- package/lib/http.js.map +1 -1
- package/lib/matchers.js +5 -6
- package/lib/matchers.js.map +1 -1
- package/lib/primitives.js +1 -1
- package/lib/primitives.js.map +1 -1
- package/lib/retries.js +3 -4
- package/lib/retries.js.map +1 -1
- package/lib/sdks.js +15 -16
- package/lib/sdks.js.map +1 -1
- package/lib/security.js +2 -2
- package/lib/security.js.map +1 -1
- package/lib/url.js +1 -1
- package/lib/url.js.map +1 -1
- package/models/components/index.d.ts +1 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +1 -0
- package/models/components/index.js.map +1 -1
- package/models/components/paymentsessionresponse.d.ts +146 -0
- package/models/components/paymentsessionresponse.d.ts.map +1 -0
- package/models/components/paymentsessionresponse.js +195 -0
- package/models/components/paymentsessionresponse.js.map +1 -0
- package/models/errors/httpclienterrors.js +2 -2
- package/models/errors/httpclienterrors.js.map +1 -1
- package/models/operations/index.d.ts +1 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +1 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/postorder.d.ts +15 -0
- package/models/operations/postorder.d.ts.map +1 -1
- package/models/operations/postorder.js +12 -0
- package/models/operations/postorder.js.map +1 -1
- package/models/operations/postpaymentssession.d.ts +120 -0
- package/models/operations/postpaymentssession.d.ts.map +1 -0
- package/models/operations/postpaymentssession.js +161 -0
- package/models/operations/postpaymentssession.js.map +1 -0
- package/package.json +1 -1
- package/sdk/auth.js +1 -2
- package/sdk/auth.js.map +1 -1
- package/sdk/campaigns.js +1 -2
- package/sdk/campaigns.js.map +1 -1
- package/sdk/catalog.js +3 -6
- package/sdk/catalog.js.map +1 -1
- package/sdk/cestorefrontreviews.d.ts +2 -2
- package/sdk/cestorefrontreviews.js +2 -2
- package/sdk/customers.js +3 -6
- package/sdk/customers.js.map +1 -1
- package/sdk/offers.js +2 -4
- package/sdk/offers.js.map +1 -1
- package/sdk/orders.js +3 -6
- package/sdk/orders.js.map +1 -1
- package/sdk/paymentsapi.d.ts +12 -0
- package/sdk/paymentsapi.d.ts.map +1 -0
- package/sdk/paymentsapi.js +22 -0
- package/sdk/paymentsapi.js.map +1 -0
- package/sdk/products.js +2 -4
- package/sdk/products.js.map +1 -1
- package/sdk/sdk.d.ts +3 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +19 -30
- package/sdk/sdk.js.map +1 -1
- package/sdk/user.js +1 -2
- package/sdk/user.js.map +1 -1
- package/src/funcs/catalogProductsReviewsList.ts +2 -2
- package/src/funcs/paymentsAPIPostPaymentsSession.ts +125 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/security.ts +1 -1
- package/src/models/components/index.ts +1 -0
- package/src/models/components/paymentsessionresponse.ts +322 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/postorder.ts +27 -0
- package/src/models/operations/postpaymentssession.ts +254 -0
- package/src/sdk/cestorefrontreviews.ts +2 -2
- package/src/sdk/paymentsapi.ts +27 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CeStorefrontCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import {
|
|
13
|
+
ConnectionError,
|
|
14
|
+
InvalidRequestError,
|
|
15
|
+
RequestAbortedError,
|
|
16
|
+
RequestTimeoutError,
|
|
17
|
+
UnexpectedClientError,
|
|
18
|
+
} from "../models/errors/httpclienterrors.js";
|
|
19
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
20
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
21
|
+
import * as operations from "../models/operations/index.js";
|
|
22
|
+
import { Result } from "../types/fp.js";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Create payment session
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Create payment session
|
|
29
|
+
*/
|
|
30
|
+
export async function paymentsAPIPostPaymentsSession(
|
|
31
|
+
client: CeStorefrontCore,
|
|
32
|
+
request: operations.PostPaymentsSessionRequestBody,
|
|
33
|
+
options?: RequestOptions,
|
|
34
|
+
): Promise<
|
|
35
|
+
Result<
|
|
36
|
+
operations.PostPaymentsSessionResponseBody,
|
|
37
|
+
| SDKError
|
|
38
|
+
| SDKValidationError
|
|
39
|
+
| UnexpectedClientError
|
|
40
|
+
| InvalidRequestError
|
|
41
|
+
| RequestAbortedError
|
|
42
|
+
| RequestTimeoutError
|
|
43
|
+
| ConnectionError
|
|
44
|
+
>
|
|
45
|
+
> {
|
|
46
|
+
const parsed = safeParse(
|
|
47
|
+
request,
|
|
48
|
+
(value) =>
|
|
49
|
+
operations.PostPaymentsSessionRequestBody$outboundSchema.parse(value),
|
|
50
|
+
"Input validation failed",
|
|
51
|
+
);
|
|
52
|
+
if (!parsed.ok) {
|
|
53
|
+
return parsed;
|
|
54
|
+
}
|
|
55
|
+
const payload = parsed.value;
|
|
56
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
57
|
+
|
|
58
|
+
const path = pathToFunc("/payments/session")();
|
|
59
|
+
|
|
60
|
+
const headers = new Headers({
|
|
61
|
+
"Content-Type": "application/json",
|
|
62
|
+
Accept: "application/json",
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const secConfig = await extractSecurity(client._options.authorization);
|
|
66
|
+
const securityInput = secConfig == null ? {} : { authorization: secConfig };
|
|
67
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
68
|
+
|
|
69
|
+
const context = {
|
|
70
|
+
operationID: "post-payments-session",
|
|
71
|
+
oAuth2Scopes: [],
|
|
72
|
+
|
|
73
|
+
resolvedSecurity: requestSecurity,
|
|
74
|
+
|
|
75
|
+
securitySource: client._options.authorization,
|
|
76
|
+
retryConfig: options?.retries
|
|
77
|
+
|| client._options.retryConfig
|
|
78
|
+
|| { strategy: "none" },
|
|
79
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const requestRes = client._createRequest(context, {
|
|
83
|
+
security: requestSecurity,
|
|
84
|
+
method: "POST",
|
|
85
|
+
baseURL: options?.serverURL,
|
|
86
|
+
path: path,
|
|
87
|
+
headers: headers,
|
|
88
|
+
body: body,
|
|
89
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
90
|
+
}, options);
|
|
91
|
+
if (!requestRes.ok) {
|
|
92
|
+
return requestRes;
|
|
93
|
+
}
|
|
94
|
+
const req = requestRes.value;
|
|
95
|
+
|
|
96
|
+
const doResult = await client._do(req, {
|
|
97
|
+
context,
|
|
98
|
+
errorCodes: ["4XX", "5XX"],
|
|
99
|
+
retryConfig: context.retryConfig,
|
|
100
|
+
retryCodes: context.retryCodes,
|
|
101
|
+
});
|
|
102
|
+
if (!doResult.ok) {
|
|
103
|
+
return doResult;
|
|
104
|
+
}
|
|
105
|
+
const response = doResult.value;
|
|
106
|
+
|
|
107
|
+
const [result] = await M.match<
|
|
108
|
+
operations.PostPaymentsSessionResponseBody,
|
|
109
|
+
| SDKError
|
|
110
|
+
| SDKValidationError
|
|
111
|
+
| UnexpectedClientError
|
|
112
|
+
| InvalidRequestError
|
|
113
|
+
| RequestAbortedError
|
|
114
|
+
| RequestTimeoutError
|
|
115
|
+
| ConnectionError
|
|
116
|
+
>(
|
|
117
|
+
M.json(200, operations.PostPaymentsSessionResponseBody$inboundSchema),
|
|
118
|
+
M.fail(["4XX", "5XX"]),
|
|
119
|
+
)(response);
|
|
120
|
+
if (!result.ok) {
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return result;
|
|
125
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -74,7 +74,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
74
74
|
export const SDK_METADATA = {
|
|
75
75
|
language: "typescript",
|
|
76
76
|
openapiDocVersion: "1.0",
|
|
77
|
-
sdkVersion: "0.2.
|
|
78
|
-
genVersion: "2.
|
|
79
|
-
userAgent: "speakeasy-sdk/typescript 0.2.
|
|
77
|
+
sdkVersion: "0.2.6",
|
|
78
|
+
genVersion: "2.492.3",
|
|
79
|
+
userAgent: "speakeasy-sdk/typescript 0.2.6 2.492.3 1.0 ce-storefront",
|
|
80
80
|
} as const;
|
package/src/lib/security.ts
CHANGED
|
@@ -33,6 +33,7 @@ export * from "./orderpayment.js";
|
|
|
33
33
|
export * from "./orderrefund.js";
|
|
34
34
|
export * from "./ordershipment.js";
|
|
35
35
|
export * from "./pagination.js";
|
|
36
|
+
export * from "./paymentsessionresponse.js";
|
|
36
37
|
export * from "./pincode.js";
|
|
37
38
|
export * from "./productattribute.js";
|
|
38
39
|
export * from "./productbundleitem.js";
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type PaymentLinks = {
|
|
12
|
+
web?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type Payload = {
|
|
16
|
+
clientId?: string | undefined;
|
|
17
|
+
merchantId?: string | undefined;
|
|
18
|
+
clientAuthToken?: string | undefined;
|
|
19
|
+
clientAuthTokenExpiry?: string | undefined;
|
|
20
|
+
environment?: string | undefined;
|
|
21
|
+
orderId?: string | undefined;
|
|
22
|
+
amount?: string | undefined;
|
|
23
|
+
action?: string | undefined;
|
|
24
|
+
customerId?: string | undefined;
|
|
25
|
+
firstName?: string | undefined;
|
|
26
|
+
lastName?: string | undefined;
|
|
27
|
+
returnUrl?: string | undefined;
|
|
28
|
+
customerPhone?: string | undefined;
|
|
29
|
+
customerEmail?: string | undefined;
|
|
30
|
+
currency?: string | undefined;
|
|
31
|
+
description?: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type SDKPayload = {
|
|
35
|
+
requestId?: string | undefined;
|
|
36
|
+
service?: string | undefined;
|
|
37
|
+
payload?: Payload | undefined;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type PaymentSessionResponse = {
|
|
41
|
+
id?: string | undefined;
|
|
42
|
+
status?: string | undefined;
|
|
43
|
+
orderId?: string | undefined;
|
|
44
|
+
paymentLinks?: PaymentLinks | undefined;
|
|
45
|
+
sdkPayload?: SDKPayload | undefined;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** @internal */
|
|
49
|
+
export const PaymentLinks$inboundSchema: z.ZodType<
|
|
50
|
+
PaymentLinks,
|
|
51
|
+
z.ZodTypeDef,
|
|
52
|
+
unknown
|
|
53
|
+
> = z.object({
|
|
54
|
+
web: z.string().optional(),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
export type PaymentLinks$Outbound = {
|
|
59
|
+
web?: string | undefined;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** @internal */
|
|
63
|
+
export const PaymentLinks$outboundSchema: z.ZodType<
|
|
64
|
+
PaymentLinks$Outbound,
|
|
65
|
+
z.ZodTypeDef,
|
|
66
|
+
PaymentLinks
|
|
67
|
+
> = z.object({
|
|
68
|
+
web: z.string().optional(),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
74
|
+
*/
|
|
75
|
+
export namespace PaymentLinks$ {
|
|
76
|
+
/** @deprecated use `PaymentLinks$inboundSchema` instead. */
|
|
77
|
+
export const inboundSchema = PaymentLinks$inboundSchema;
|
|
78
|
+
/** @deprecated use `PaymentLinks$outboundSchema` instead. */
|
|
79
|
+
export const outboundSchema = PaymentLinks$outboundSchema;
|
|
80
|
+
/** @deprecated use `PaymentLinks$Outbound` instead. */
|
|
81
|
+
export type Outbound = PaymentLinks$Outbound;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function paymentLinksToJSON(paymentLinks: PaymentLinks): string {
|
|
85
|
+
return JSON.stringify(PaymentLinks$outboundSchema.parse(paymentLinks));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function paymentLinksFromJSON(
|
|
89
|
+
jsonString: string,
|
|
90
|
+
): SafeParseResult<PaymentLinks, SDKValidationError> {
|
|
91
|
+
return safeParse(
|
|
92
|
+
jsonString,
|
|
93
|
+
(x) => PaymentLinks$inboundSchema.parse(JSON.parse(x)),
|
|
94
|
+
`Failed to parse 'PaymentLinks' from JSON`,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** @internal */
|
|
99
|
+
export const Payload$inboundSchema: z.ZodType<Payload, z.ZodTypeDef, unknown> =
|
|
100
|
+
z.object({
|
|
101
|
+
clientId: z.string().optional(),
|
|
102
|
+
merchantId: z.string().optional(),
|
|
103
|
+
clientAuthToken: z.string().optional(),
|
|
104
|
+
clientAuthTokenExpiry: z.string().optional(),
|
|
105
|
+
environment: z.string().optional(),
|
|
106
|
+
orderId: z.string().optional(),
|
|
107
|
+
amount: z.string().optional(),
|
|
108
|
+
action: z.string().optional(),
|
|
109
|
+
customerId: z.string().optional(),
|
|
110
|
+
firstName: z.string().optional(),
|
|
111
|
+
lastName: z.string().optional(),
|
|
112
|
+
returnUrl: z.string().optional(),
|
|
113
|
+
customerPhone: z.string().optional(),
|
|
114
|
+
customerEmail: z.string().optional(),
|
|
115
|
+
currency: z.string().optional(),
|
|
116
|
+
description: z.string().optional(),
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
/** @internal */
|
|
120
|
+
export type Payload$Outbound = {
|
|
121
|
+
clientId?: string | undefined;
|
|
122
|
+
merchantId?: string | undefined;
|
|
123
|
+
clientAuthToken?: string | undefined;
|
|
124
|
+
clientAuthTokenExpiry?: string | undefined;
|
|
125
|
+
environment?: string | undefined;
|
|
126
|
+
orderId?: string | undefined;
|
|
127
|
+
amount?: string | undefined;
|
|
128
|
+
action?: string | undefined;
|
|
129
|
+
customerId?: string | undefined;
|
|
130
|
+
firstName?: string | undefined;
|
|
131
|
+
lastName?: string | undefined;
|
|
132
|
+
returnUrl?: string | undefined;
|
|
133
|
+
customerPhone?: string | undefined;
|
|
134
|
+
customerEmail?: string | undefined;
|
|
135
|
+
currency?: string | undefined;
|
|
136
|
+
description?: string | undefined;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/** @internal */
|
|
140
|
+
export const Payload$outboundSchema: z.ZodType<
|
|
141
|
+
Payload$Outbound,
|
|
142
|
+
z.ZodTypeDef,
|
|
143
|
+
Payload
|
|
144
|
+
> = z.object({
|
|
145
|
+
clientId: z.string().optional(),
|
|
146
|
+
merchantId: z.string().optional(),
|
|
147
|
+
clientAuthToken: z.string().optional(),
|
|
148
|
+
clientAuthTokenExpiry: z.string().optional(),
|
|
149
|
+
environment: z.string().optional(),
|
|
150
|
+
orderId: z.string().optional(),
|
|
151
|
+
amount: z.string().optional(),
|
|
152
|
+
action: z.string().optional(),
|
|
153
|
+
customerId: z.string().optional(),
|
|
154
|
+
firstName: z.string().optional(),
|
|
155
|
+
lastName: z.string().optional(),
|
|
156
|
+
returnUrl: z.string().optional(),
|
|
157
|
+
customerPhone: z.string().optional(),
|
|
158
|
+
customerEmail: z.string().optional(),
|
|
159
|
+
currency: z.string().optional(),
|
|
160
|
+
description: z.string().optional(),
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @internal
|
|
165
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
166
|
+
*/
|
|
167
|
+
export namespace Payload$ {
|
|
168
|
+
/** @deprecated use `Payload$inboundSchema` instead. */
|
|
169
|
+
export const inboundSchema = Payload$inboundSchema;
|
|
170
|
+
/** @deprecated use `Payload$outboundSchema` instead. */
|
|
171
|
+
export const outboundSchema = Payload$outboundSchema;
|
|
172
|
+
/** @deprecated use `Payload$Outbound` instead. */
|
|
173
|
+
export type Outbound = Payload$Outbound;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function payloadToJSON(payload: Payload): string {
|
|
177
|
+
return JSON.stringify(Payload$outboundSchema.parse(payload));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function payloadFromJSON(
|
|
181
|
+
jsonString: string,
|
|
182
|
+
): SafeParseResult<Payload, SDKValidationError> {
|
|
183
|
+
return safeParse(
|
|
184
|
+
jsonString,
|
|
185
|
+
(x) => Payload$inboundSchema.parse(JSON.parse(x)),
|
|
186
|
+
`Failed to parse 'Payload' from JSON`,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** @internal */
|
|
191
|
+
export const SDKPayload$inboundSchema: z.ZodType<
|
|
192
|
+
SDKPayload,
|
|
193
|
+
z.ZodTypeDef,
|
|
194
|
+
unknown
|
|
195
|
+
> = z.object({
|
|
196
|
+
requestId: z.string().optional(),
|
|
197
|
+
service: z.string().optional(),
|
|
198
|
+
payload: z.lazy(() => Payload$inboundSchema).optional(),
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
/** @internal */
|
|
202
|
+
export type SDKPayload$Outbound = {
|
|
203
|
+
requestId?: string | undefined;
|
|
204
|
+
service?: string | undefined;
|
|
205
|
+
payload?: Payload$Outbound | undefined;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/** @internal */
|
|
209
|
+
export const SDKPayload$outboundSchema: z.ZodType<
|
|
210
|
+
SDKPayload$Outbound,
|
|
211
|
+
z.ZodTypeDef,
|
|
212
|
+
SDKPayload
|
|
213
|
+
> = z.object({
|
|
214
|
+
requestId: z.string().optional(),
|
|
215
|
+
service: z.string().optional(),
|
|
216
|
+
payload: z.lazy(() => Payload$outboundSchema).optional(),
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @internal
|
|
221
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
222
|
+
*/
|
|
223
|
+
export namespace SDKPayload$ {
|
|
224
|
+
/** @deprecated use `SDKPayload$inboundSchema` instead. */
|
|
225
|
+
export const inboundSchema = SDKPayload$inboundSchema;
|
|
226
|
+
/** @deprecated use `SDKPayload$outboundSchema` instead. */
|
|
227
|
+
export const outboundSchema = SDKPayload$outboundSchema;
|
|
228
|
+
/** @deprecated use `SDKPayload$Outbound` instead. */
|
|
229
|
+
export type Outbound = SDKPayload$Outbound;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export function sdkPayloadToJSON(sdkPayload: SDKPayload): string {
|
|
233
|
+
return JSON.stringify(SDKPayload$outboundSchema.parse(sdkPayload));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function sdkPayloadFromJSON(
|
|
237
|
+
jsonString: string,
|
|
238
|
+
): SafeParseResult<SDKPayload, SDKValidationError> {
|
|
239
|
+
return safeParse(
|
|
240
|
+
jsonString,
|
|
241
|
+
(x) => SDKPayload$inboundSchema.parse(JSON.parse(x)),
|
|
242
|
+
`Failed to parse 'SDKPayload' from JSON`,
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** @internal */
|
|
247
|
+
export const PaymentSessionResponse$inboundSchema: z.ZodType<
|
|
248
|
+
PaymentSessionResponse,
|
|
249
|
+
z.ZodTypeDef,
|
|
250
|
+
unknown
|
|
251
|
+
> = z.object({
|
|
252
|
+
id: z.string().optional(),
|
|
253
|
+
status: z.string().optional(),
|
|
254
|
+
order_id: z.string().optional(),
|
|
255
|
+
payment_links: z.lazy(() => PaymentLinks$inboundSchema).optional(),
|
|
256
|
+
sdk_payload: z.lazy(() => SDKPayload$inboundSchema).optional(),
|
|
257
|
+
}).transform((v) => {
|
|
258
|
+
return remap$(v, {
|
|
259
|
+
"order_id": "orderId",
|
|
260
|
+
"payment_links": "paymentLinks",
|
|
261
|
+
"sdk_payload": "sdkPayload",
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
/** @internal */
|
|
266
|
+
export type PaymentSessionResponse$Outbound = {
|
|
267
|
+
id?: string | undefined;
|
|
268
|
+
status?: string | undefined;
|
|
269
|
+
order_id?: string | undefined;
|
|
270
|
+
payment_links?: PaymentLinks$Outbound | undefined;
|
|
271
|
+
sdk_payload?: SDKPayload$Outbound | undefined;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
/** @internal */
|
|
275
|
+
export const PaymentSessionResponse$outboundSchema: z.ZodType<
|
|
276
|
+
PaymentSessionResponse$Outbound,
|
|
277
|
+
z.ZodTypeDef,
|
|
278
|
+
PaymentSessionResponse
|
|
279
|
+
> = z.object({
|
|
280
|
+
id: z.string().optional(),
|
|
281
|
+
status: z.string().optional(),
|
|
282
|
+
orderId: z.string().optional(),
|
|
283
|
+
paymentLinks: z.lazy(() => PaymentLinks$outboundSchema).optional(),
|
|
284
|
+
sdkPayload: z.lazy(() => SDKPayload$outboundSchema).optional(),
|
|
285
|
+
}).transform((v) => {
|
|
286
|
+
return remap$(v, {
|
|
287
|
+
orderId: "order_id",
|
|
288
|
+
paymentLinks: "payment_links",
|
|
289
|
+
sdkPayload: "sdk_payload",
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* @internal
|
|
295
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
296
|
+
*/
|
|
297
|
+
export namespace PaymentSessionResponse$ {
|
|
298
|
+
/** @deprecated use `PaymentSessionResponse$inboundSchema` instead. */
|
|
299
|
+
export const inboundSchema = PaymentSessionResponse$inboundSchema;
|
|
300
|
+
/** @deprecated use `PaymentSessionResponse$outboundSchema` instead. */
|
|
301
|
+
export const outboundSchema = PaymentSessionResponse$outboundSchema;
|
|
302
|
+
/** @deprecated use `PaymentSessionResponse$Outbound` instead. */
|
|
303
|
+
export type Outbound = PaymentSessionResponse$Outbound;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export function paymentSessionResponseToJSON(
|
|
307
|
+
paymentSessionResponse: PaymentSessionResponse,
|
|
308
|
+
): string {
|
|
309
|
+
return JSON.stringify(
|
|
310
|
+
PaymentSessionResponse$outboundSchema.parse(paymentSessionResponse),
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export function paymentSessionResponseFromJSON(
|
|
315
|
+
jsonString: string,
|
|
316
|
+
): SafeParseResult<PaymentSessionResponse, SDKValidationError> {
|
|
317
|
+
return safeParse(
|
|
318
|
+
jsonString,
|
|
319
|
+
(x) => PaymentSessionResponse$inboundSchema.parse(JSON.parse(x)),
|
|
320
|
+
`Failed to parse 'PaymentSessionResponse' from JSON`,
|
|
321
|
+
);
|
|
322
|
+
}
|
|
@@ -76,6 +76,7 @@ export * from "./postloyaltypoints.js";
|
|
|
76
76
|
export * from "./postorder.js";
|
|
77
77
|
export * from "./postordersordernumber.js";
|
|
78
78
|
export * from "./postpaymentsgeneratehash.js";
|
|
79
|
+
export * from "./postpaymentssession.js";
|
|
79
80
|
export * from "./postproductsidreviews.js";
|
|
80
81
|
export * from "./postretrypaymentorderid.js";
|
|
81
82
|
export * from "./postwishtlist.js";
|
|
@@ -16,6 +16,11 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
16
16
|
*/
|
|
17
17
|
export type PostOrderRequestBody = {
|
|
18
18
|
cartId: string;
|
|
19
|
+
createPaymentSession?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Required if create_payment_session = True.
|
|
22
|
+
*/
|
|
23
|
+
paymentReturnUrl?: string | undefined;
|
|
19
24
|
};
|
|
20
25
|
|
|
21
26
|
export const BillingCurrency = {
|
|
@@ -40,6 +45,9 @@ export type SiDetails = {
|
|
|
40
45
|
paymentEndDate?: RFCDate | undefined;
|
|
41
46
|
};
|
|
42
47
|
|
|
48
|
+
/**
|
|
49
|
+
* for PAYU payment support.
|
|
50
|
+
*/
|
|
43
51
|
export type PaymentInfo = {
|
|
44
52
|
key?: string | undefined;
|
|
45
53
|
txnid?: string | undefined;
|
|
@@ -70,7 +78,11 @@ export type PaymentInfo = {
|
|
|
70
78
|
export type PostOrderContent = {
|
|
71
79
|
order?: components.OrderDetail | undefined;
|
|
72
80
|
paymentRequired?: boolean | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* for PAYU payment support.
|
|
83
|
+
*/
|
|
73
84
|
paymentInfo?: PaymentInfo | undefined;
|
|
85
|
+
paymentSession?: components.PaymentSessionResponse | undefined;
|
|
74
86
|
};
|
|
75
87
|
|
|
76
88
|
/**
|
|
@@ -89,15 +101,21 @@ export const PostOrderRequestBody$inboundSchema: z.ZodType<
|
|
|
89
101
|
unknown
|
|
90
102
|
> = z.object({
|
|
91
103
|
cart_id: z.string(),
|
|
104
|
+
create_payment_session: z.boolean().default(true),
|
|
105
|
+
payment_return_url: z.string().optional(),
|
|
92
106
|
}).transform((v) => {
|
|
93
107
|
return remap$(v, {
|
|
94
108
|
"cart_id": "cartId",
|
|
109
|
+
"create_payment_session": "createPaymentSession",
|
|
110
|
+
"payment_return_url": "paymentReturnUrl",
|
|
95
111
|
});
|
|
96
112
|
});
|
|
97
113
|
|
|
98
114
|
/** @internal */
|
|
99
115
|
export type PostOrderRequestBody$Outbound = {
|
|
100
116
|
cart_id: string;
|
|
117
|
+
create_payment_session: boolean;
|
|
118
|
+
payment_return_url?: string | undefined;
|
|
101
119
|
};
|
|
102
120
|
|
|
103
121
|
/** @internal */
|
|
@@ -107,9 +125,13 @@ export const PostOrderRequestBody$outboundSchema: z.ZodType<
|
|
|
107
125
|
PostOrderRequestBody
|
|
108
126
|
> = z.object({
|
|
109
127
|
cartId: z.string(),
|
|
128
|
+
createPaymentSession: z.boolean().default(true),
|
|
129
|
+
paymentReturnUrl: z.string().optional(),
|
|
110
130
|
}).transform((v) => {
|
|
111
131
|
return remap$(v, {
|
|
112
132
|
cartId: "cart_id",
|
|
133
|
+
createPaymentSession: "create_payment_session",
|
|
134
|
+
paymentReturnUrl: "payment_return_url",
|
|
113
135
|
});
|
|
114
136
|
});
|
|
115
137
|
|
|
@@ -350,10 +372,12 @@ export const PostOrderContent$inboundSchema: z.ZodType<
|
|
|
350
372
|
order: components.OrderDetail$inboundSchema.optional(),
|
|
351
373
|
payment_required: z.boolean().optional(),
|
|
352
374
|
payment_info: z.lazy(() => PaymentInfo$inboundSchema).optional(),
|
|
375
|
+
payment_session: components.PaymentSessionResponse$inboundSchema.optional(),
|
|
353
376
|
}).transform((v) => {
|
|
354
377
|
return remap$(v, {
|
|
355
378
|
"payment_required": "paymentRequired",
|
|
356
379
|
"payment_info": "paymentInfo",
|
|
380
|
+
"payment_session": "paymentSession",
|
|
357
381
|
});
|
|
358
382
|
});
|
|
359
383
|
|
|
@@ -362,6 +386,7 @@ export type PostOrderContent$Outbound = {
|
|
|
362
386
|
order?: components.OrderDetail$Outbound | undefined;
|
|
363
387
|
payment_required?: boolean | undefined;
|
|
364
388
|
payment_info?: PaymentInfo$Outbound | undefined;
|
|
389
|
+
payment_session?: components.PaymentSessionResponse$Outbound | undefined;
|
|
365
390
|
};
|
|
366
391
|
|
|
367
392
|
/** @internal */
|
|
@@ -373,10 +398,12 @@ export const PostOrderContent$outboundSchema: z.ZodType<
|
|
|
373
398
|
order: components.OrderDetail$outboundSchema.optional(),
|
|
374
399
|
paymentRequired: z.boolean().optional(),
|
|
375
400
|
paymentInfo: z.lazy(() => PaymentInfo$outboundSchema).optional(),
|
|
401
|
+
paymentSession: components.PaymentSessionResponse$outboundSchema.optional(),
|
|
376
402
|
}).transform((v) => {
|
|
377
403
|
return remap$(v, {
|
|
378
404
|
paymentRequired: "payment_required",
|
|
379
405
|
paymentInfo: "payment_info",
|
|
406
|
+
paymentSession: "payment_session",
|
|
380
407
|
});
|
|
381
408
|
});
|
|
382
409
|
|