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.
Files changed (255) hide show
  1. package/README.md +7 -2
  2. package/RUNTIMES.md +27 -1
  3. package/docs/sdks/cestorefrontreviews/README.md +2 -2
  4. package/docs/sdks/paymentsapi/README.md +90 -0
  5. package/funcs/analyticsTrack.js +4 -4
  6. package/funcs/analyticsTrack.js.map +1 -1
  7. package/funcs/authGenerateOtp.js +4 -4
  8. package/funcs/authGenerateOtp.js.map +1 -1
  9. package/funcs/authLoginAnonymously.js +5 -5
  10. package/funcs/authLoginAnonymously.js.map +1 -1
  11. package/funcs/authLoginWithEmail.js +4 -4
  12. package/funcs/authLoginWithEmail.js.map +1 -1
  13. package/funcs/authLoginWithPassword.js +4 -4
  14. package/funcs/authLoginWithPassword.js.map +1 -1
  15. package/funcs/authLoginWithPhone.js +4 -4
  16. package/funcs/authLoginWithPhone.js.map +1 -1
  17. package/funcs/authLoginWithWhatsapp.js +4 -4
  18. package/funcs/authLoginWithWhatsapp.js.map +1 -1
  19. package/funcs/authRefreshToken.js +4 -4
  20. package/funcs/authRefreshToken.js.map +1 -1
  21. package/funcs/authRegisterWithEmail.js +4 -4
  22. package/funcs/authRegisterWithEmail.js.map +1 -1
  23. package/funcs/authRegisterWithPassword.js +4 -4
  24. package/funcs/authRegisterWithPassword.js.map +1 -1
  25. package/funcs/authRegisterWithPhone.js +4 -4
  26. package/funcs/authRegisterWithPhone.js.map +1 -1
  27. package/funcs/authRegisterWithWhatsapp.js +4 -4
  28. package/funcs/authRegisterWithWhatsapp.js.map +1 -1
  29. package/funcs/authUserAddProfileImage.js +4 -4
  30. package/funcs/authUserAddProfileImage.js.map +1 -1
  31. package/funcs/authUserChangePassword.js +4 -4
  32. package/funcs/authUserChangePassword.js.map +1 -1
  33. package/funcs/authUserDeactivateAccount.js +4 -4
  34. package/funcs/authUserDeactivateAccount.js.map +1 -1
  35. package/funcs/authUserDeleteProfileImage.js +4 -4
  36. package/funcs/authUserDeleteProfileImage.js.map +1 -1
  37. package/funcs/authUserForgotPassword.js +4 -4
  38. package/funcs/authUserForgotPassword.js.map +1 -1
  39. package/funcs/authUserGet.js +4 -4
  40. package/funcs/authUserGet.js.map +1 -1
  41. package/funcs/authUserGetProfileImage.js +4 -4
  42. package/funcs/authUserGetProfileImage.js.map +1 -1
  43. package/funcs/authUserLogout.js +4 -4
  44. package/funcs/authUserLogout.js.map +1 -1
  45. package/funcs/authUserResetPassword.js +4 -4
  46. package/funcs/authUserResetPassword.js.map +1 -1
  47. package/funcs/authUserUpdate.js +4 -4
  48. package/funcs/authUserUpdate.js.map +1 -1
  49. package/funcs/authUserUpdateProfileImage.js +4 -4
  50. package/funcs/authUserUpdateProfileImage.js.map +1 -1
  51. package/funcs/authVerifyEmailPhone.js +4 -4
  52. package/funcs/authVerifyEmailPhone.js.map +1 -1
  53. package/funcs/authVerifyOtp.js +4 -4
  54. package/funcs/authVerifyOtp.js.map +1 -1
  55. package/funcs/campaignsNewsletterSubscribe.js +4 -4
  56. package/funcs/campaignsNewsletterSubscribe.js.map +1 -1
  57. package/funcs/cartsAddItem.js +4 -4
  58. package/funcs/cartsAddItem.js.map +1 -1
  59. package/funcs/cartsCreate.js +4 -4
  60. package/funcs/cartsCreate.js.map +1 -1
  61. package/funcs/cartsDelete.js +4 -4
  62. package/funcs/cartsDelete.js.map +1 -1
  63. package/funcs/cartsGet.js +4 -4
  64. package/funcs/cartsGet.js.map +1 -1
  65. package/funcs/catalogCategoriesList.js +4 -4
  66. package/funcs/catalogCategoriesList.js.map +1 -1
  67. package/funcs/catalogProductsGet.js +4 -4
  68. package/funcs/catalogProductsGet.js.map +1 -1
  69. package/funcs/catalogProductsGetCrossSells.js +4 -4
  70. package/funcs/catalogProductsGetCrossSells.js.map +1 -1
  71. package/funcs/catalogProductsGetSimilar.js +4 -4
  72. package/funcs/catalogProductsGetSimilar.js.map +1 -1
  73. package/funcs/catalogProductsGetUpsells.js +4 -4
  74. package/funcs/catalogProductsGetUpsells.js.map +1 -1
  75. package/funcs/catalogProductsList.js +4 -4
  76. package/funcs/catalogProductsList.js.map +1 -1
  77. package/funcs/catalogProductsReviewsCreate.js +4 -4
  78. package/funcs/catalogProductsReviewsCreate.js.map +1 -1
  79. package/funcs/catalogProductsReviewsList.d.ts +2 -2
  80. package/funcs/catalogProductsReviewsList.js +6 -6
  81. package/funcs/catalogProductsReviewsList.js.map +1 -1
  82. package/funcs/catalogProductsVariantsGet.js +4 -4
  83. package/funcs/catalogProductsVariantsGet.js.map +1 -1
  84. package/funcs/catalogProductsVariantsList.js +4 -4
  85. package/funcs/catalogProductsVariantsList.js.map +1 -1
  86. package/funcs/catalogSkusList.js +4 -4
  87. package/funcs/catalogSkusList.js.map +1 -1
  88. package/funcs/checkoutApplyCoupon.js +4 -4
  89. package/funcs/checkoutApplyCoupon.js.map +1 -1
  90. package/funcs/checkoutRedeemGiftCard.js +4 -4
  91. package/funcs/checkoutRedeemGiftCard.js.map +1 -1
  92. package/funcs/checkoutRedeemLoyaltyPoints.js +4 -4
  93. package/funcs/checkoutRedeemLoyaltyPoints.js.map +1 -1
  94. package/funcs/checkoutRemoveCoupon.js +4 -4
  95. package/funcs/checkoutRemoveCoupon.js.map +1 -1
  96. package/funcs/checkoutRemoveCreditBalance.js +4 -4
  97. package/funcs/checkoutRemoveCreditBalance.js.map +1 -1
  98. package/funcs/checkoutRemoveLoyaltyPoints.js +4 -4
  99. package/funcs/checkoutRemoveLoyaltyPoints.js.map +1 -1
  100. package/funcs/checkoutUpdateAddress.js +4 -4
  101. package/funcs/checkoutUpdateAddress.js.map +1 -1
  102. package/funcs/checkoutUseCreditBalance.js +4 -4
  103. package/funcs/checkoutUseCreditBalance.js.map +1 -1
  104. package/funcs/customersAPIGetCustomersId.js +4 -4
  105. package/funcs/customersAPIGetCustomersId.js.map +1 -1
  106. package/funcs/customersAPIGetRecommendedProducts.js +4 -4
  107. package/funcs/customersAPIGetRecommendedProducts.js.map +1 -1
  108. package/funcs/customersAPIPostCustomers.js +4 -4
  109. package/funcs/customersAPIPostCustomers.js.map +1 -1
  110. package/funcs/customersAPIPutCustomersId.js +4 -4
  111. package/funcs/customersAPIPutCustomersId.js.map +1 -1
  112. package/funcs/customersAddressesAdd.js +4 -4
  113. package/funcs/customersAddressesAdd.js.map +1 -1
  114. package/funcs/customersAddressesDelete.js +4 -4
  115. package/funcs/customersAddressesDelete.js.map +1 -1
  116. package/funcs/customersAddressesGet.js +4 -4
  117. package/funcs/customersAddressesGet.js.map +1 -1
  118. package/funcs/customersAddressesList.js +4 -4
  119. package/funcs/customersAddressesList.js.map +1 -1
  120. package/funcs/customersAddressesUpdate.js +4 -4
  121. package/funcs/customersAddressesUpdate.js.map +1 -1
  122. package/funcs/customersLoyaltyGet.js +4 -4
  123. package/funcs/customersLoyaltyGet.js.map +1 -1
  124. package/funcs/customersLoyaltyListActivities.js +4 -4
  125. package/funcs/customersLoyaltyListActivities.js.map +1 -1
  126. package/funcs/customersReviewsList.js +4 -4
  127. package/funcs/customersReviewsList.js.map +1 -1
  128. package/funcs/offersCouponsList.js +4 -4
  129. package/funcs/offersCouponsList.js.map +1 -1
  130. package/funcs/offersPromotionsList.js +4 -4
  131. package/funcs/offersPromotionsList.js.map +1 -1
  132. package/funcs/ordersCancel.js +4 -4
  133. package/funcs/ordersCancel.js.map +1 -1
  134. package/funcs/ordersCreate.js +4 -4
  135. package/funcs/ordersCreate.js.map +1 -1
  136. package/funcs/ordersGet.js +4 -4
  137. package/funcs/ordersGet.js.map +1 -1
  138. package/funcs/ordersList.js +4 -4
  139. package/funcs/ordersList.js.map +1 -1
  140. package/funcs/ordersPaymentsList.js +4 -4
  141. package/funcs/ordersPaymentsList.js.map +1 -1
  142. package/funcs/ordersRefundsList.js +4 -4
  143. package/funcs/ordersRefundsList.js.map +1 -1
  144. package/funcs/ordersRetryPayment.js +4 -4
  145. package/funcs/ordersRetryPayment.js.map +1 -1
  146. package/funcs/ordersShipmentsList.js +4 -4
  147. package/funcs/ordersShipmentsList.js.map +1 -1
  148. package/funcs/paymentsAPIPostPaymentsSession.d.ts +15 -0
  149. package/funcs/paymentsAPIPostPaymentsSession.d.ts.map +1 -0
  150. package/funcs/paymentsAPIPostPaymentsSession.js +96 -0
  151. package/funcs/paymentsAPIPostPaymentsSession.js.map +1 -0
  152. package/funcs/paymentsGenerateHash.js +4 -4
  153. package/funcs/paymentsGenerateHash.js.map +1 -1
  154. package/funcs/paymentsGetMethods.js +4 -4
  155. package/funcs/paymentsGetMethods.js.map +1 -1
  156. package/funcs/shippingCheckPincodeServiceability.js +4 -4
  157. package/funcs/shippingCheckPincodeServiceability.js.map +1 -1
  158. package/funcs/userNotificationPreferencesCreate.js +4 -4
  159. package/funcs/userNotificationPreferencesCreate.js.map +1 -1
  160. package/funcs/userNotificationPreferencesGet.js +4 -4
  161. package/funcs/userNotificationPreferencesGet.js.map +1 -1
  162. package/funcs/userNotificationPreferencesUpdate.js +4 -4
  163. package/funcs/userNotificationPreferencesUpdate.js.map +1 -1
  164. package/funcs/utilsGetCountries.js +4 -4
  165. package/funcs/utilsGetCountries.js.map +1 -1
  166. package/funcs/utilsGetPincodes.js +4 -4
  167. package/funcs/utilsGetPincodes.js.map +1 -1
  168. package/funcs/utilsGetStates.js +4 -4
  169. package/funcs/utilsGetStates.js.map +1 -1
  170. package/funcs/wishlistAdd.js +4 -4
  171. package/funcs/wishlistAdd.js.map +1 -1
  172. package/funcs/wishlistDelete.js +4 -4
  173. package/funcs/wishlistDelete.js.map +1 -1
  174. package/funcs/wishlistGet.js +4 -4
  175. package/funcs/wishlistGet.js.map +1 -1
  176. package/lib/config.d.ts +3 -3
  177. package/lib/config.js +6 -7
  178. package/lib/config.js.map +1 -1
  179. package/lib/encodings.js +18 -19
  180. package/lib/encodings.js.map +1 -1
  181. package/lib/http.js +1 -2
  182. package/lib/http.js.map +1 -1
  183. package/lib/matchers.js +5 -6
  184. package/lib/matchers.js.map +1 -1
  185. package/lib/primitives.js +1 -1
  186. package/lib/primitives.js.map +1 -1
  187. package/lib/retries.js +3 -4
  188. package/lib/retries.js.map +1 -1
  189. package/lib/sdks.js +15 -16
  190. package/lib/sdks.js.map +1 -1
  191. package/lib/security.js +2 -2
  192. package/lib/security.js.map +1 -1
  193. package/lib/url.js +1 -1
  194. package/lib/url.js.map +1 -1
  195. package/models/components/index.d.ts +1 -0
  196. package/models/components/index.d.ts.map +1 -1
  197. package/models/components/index.js +1 -0
  198. package/models/components/index.js.map +1 -1
  199. package/models/components/paymentsessionresponse.d.ts +146 -0
  200. package/models/components/paymentsessionresponse.d.ts.map +1 -0
  201. package/models/components/paymentsessionresponse.js +195 -0
  202. package/models/components/paymentsessionresponse.js.map +1 -0
  203. package/models/errors/httpclienterrors.js +2 -2
  204. package/models/errors/httpclienterrors.js.map +1 -1
  205. package/models/operations/index.d.ts +1 -0
  206. package/models/operations/index.d.ts.map +1 -1
  207. package/models/operations/index.js +1 -0
  208. package/models/operations/index.js.map +1 -1
  209. package/models/operations/postorder.d.ts +15 -0
  210. package/models/operations/postorder.d.ts.map +1 -1
  211. package/models/operations/postorder.js +12 -0
  212. package/models/operations/postorder.js.map +1 -1
  213. package/models/operations/postpaymentssession.d.ts +120 -0
  214. package/models/operations/postpaymentssession.d.ts.map +1 -0
  215. package/models/operations/postpaymentssession.js +161 -0
  216. package/models/operations/postpaymentssession.js.map +1 -0
  217. package/package.json +1 -1
  218. package/sdk/auth.js +1 -2
  219. package/sdk/auth.js.map +1 -1
  220. package/sdk/campaigns.js +1 -2
  221. package/sdk/campaigns.js.map +1 -1
  222. package/sdk/catalog.js +3 -6
  223. package/sdk/catalog.js.map +1 -1
  224. package/sdk/cestorefrontreviews.d.ts +2 -2
  225. package/sdk/cestorefrontreviews.js +2 -2
  226. package/sdk/customers.js +3 -6
  227. package/sdk/customers.js.map +1 -1
  228. package/sdk/offers.js +2 -4
  229. package/sdk/offers.js.map +1 -1
  230. package/sdk/orders.js +3 -6
  231. package/sdk/orders.js.map +1 -1
  232. package/sdk/paymentsapi.d.ts +12 -0
  233. package/sdk/paymentsapi.d.ts.map +1 -0
  234. package/sdk/paymentsapi.js +22 -0
  235. package/sdk/paymentsapi.js.map +1 -0
  236. package/sdk/products.js +2 -4
  237. package/sdk/products.js.map +1 -1
  238. package/sdk/sdk.d.ts +3 -0
  239. package/sdk/sdk.d.ts.map +1 -1
  240. package/sdk/sdk.js +19 -30
  241. package/sdk/sdk.js.map +1 -1
  242. package/sdk/user.js +1 -2
  243. package/sdk/user.js.map +1 -1
  244. package/src/funcs/catalogProductsReviewsList.ts +2 -2
  245. package/src/funcs/paymentsAPIPostPaymentsSession.ts +125 -0
  246. package/src/lib/config.ts +3 -3
  247. package/src/lib/security.ts +1 -1
  248. package/src/models/components/index.ts +1 -0
  249. package/src/models/components/paymentsessionresponse.ts +322 -0
  250. package/src/models/operations/index.ts +1 -0
  251. package/src/models/operations/postorder.ts +27 -0
  252. package/src/models/operations/postpaymentssession.ts +254 -0
  253. package/src/sdk/cestorefrontreviews.ts +2 -2
  254. package/src/sdk/paymentsapi.ts +27 -0
  255. 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.4",
78
- genVersion: "2.480.1",
79
- userAgent: "speakeasy-sdk/typescript 0.2.4 2.480.1 1.0 ce-storefront",
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;
@@ -117,7 +117,7 @@ export function resolveSecurity(
117
117
  ...options: SecurityInput[][]
118
118
  ): SecurityState | null {
119
119
  const state: SecurityState = {
120
- basic: { username: "", password: "" },
120
+ basic: {},
121
121
  headers: {},
122
122
  queryParams: {},
123
123
  cookies: {},
@@ -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