ce-storefront 0.2.5 → 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 (249) hide show
  1. package/README.md +5 -0
  2. package/RUNTIMES.md +27 -1
  3. package/docs/sdks/paymentsapi/README.md +90 -0
  4. package/funcs/analyticsTrack.js +4 -4
  5. package/funcs/analyticsTrack.js.map +1 -1
  6. package/funcs/authGenerateOtp.js +4 -4
  7. package/funcs/authGenerateOtp.js.map +1 -1
  8. package/funcs/authLoginAnonymously.js +5 -5
  9. package/funcs/authLoginAnonymously.js.map +1 -1
  10. package/funcs/authLoginWithEmail.js +4 -4
  11. package/funcs/authLoginWithEmail.js.map +1 -1
  12. package/funcs/authLoginWithPassword.js +4 -4
  13. package/funcs/authLoginWithPassword.js.map +1 -1
  14. package/funcs/authLoginWithPhone.js +4 -4
  15. package/funcs/authLoginWithPhone.js.map +1 -1
  16. package/funcs/authLoginWithWhatsapp.js +4 -4
  17. package/funcs/authLoginWithWhatsapp.js.map +1 -1
  18. package/funcs/authRefreshToken.js +4 -4
  19. package/funcs/authRefreshToken.js.map +1 -1
  20. package/funcs/authRegisterWithEmail.js +4 -4
  21. package/funcs/authRegisterWithEmail.js.map +1 -1
  22. package/funcs/authRegisterWithPassword.js +4 -4
  23. package/funcs/authRegisterWithPassword.js.map +1 -1
  24. package/funcs/authRegisterWithPhone.js +4 -4
  25. package/funcs/authRegisterWithPhone.js.map +1 -1
  26. package/funcs/authRegisterWithWhatsapp.js +4 -4
  27. package/funcs/authRegisterWithWhatsapp.js.map +1 -1
  28. package/funcs/authUserAddProfileImage.js +4 -4
  29. package/funcs/authUserAddProfileImage.js.map +1 -1
  30. package/funcs/authUserChangePassword.js +4 -4
  31. package/funcs/authUserChangePassword.js.map +1 -1
  32. package/funcs/authUserDeactivateAccount.js +4 -4
  33. package/funcs/authUserDeactivateAccount.js.map +1 -1
  34. package/funcs/authUserDeleteProfileImage.js +4 -4
  35. package/funcs/authUserDeleteProfileImage.js.map +1 -1
  36. package/funcs/authUserForgotPassword.js +4 -4
  37. package/funcs/authUserForgotPassword.js.map +1 -1
  38. package/funcs/authUserGet.js +4 -4
  39. package/funcs/authUserGet.js.map +1 -1
  40. package/funcs/authUserGetProfileImage.js +4 -4
  41. package/funcs/authUserGetProfileImage.js.map +1 -1
  42. package/funcs/authUserLogout.js +4 -4
  43. package/funcs/authUserLogout.js.map +1 -1
  44. package/funcs/authUserResetPassword.js +4 -4
  45. package/funcs/authUserResetPassword.js.map +1 -1
  46. package/funcs/authUserUpdate.js +4 -4
  47. package/funcs/authUserUpdate.js.map +1 -1
  48. package/funcs/authUserUpdateProfileImage.js +4 -4
  49. package/funcs/authUserUpdateProfileImage.js.map +1 -1
  50. package/funcs/authVerifyEmailPhone.js +4 -4
  51. package/funcs/authVerifyEmailPhone.js.map +1 -1
  52. package/funcs/authVerifyOtp.js +4 -4
  53. package/funcs/authVerifyOtp.js.map +1 -1
  54. package/funcs/campaignsNewsletterSubscribe.js +4 -4
  55. package/funcs/campaignsNewsletterSubscribe.js.map +1 -1
  56. package/funcs/cartsAddItem.js +4 -4
  57. package/funcs/cartsAddItem.js.map +1 -1
  58. package/funcs/cartsCreate.js +4 -4
  59. package/funcs/cartsCreate.js.map +1 -1
  60. package/funcs/cartsDelete.js +4 -4
  61. package/funcs/cartsDelete.js.map +1 -1
  62. package/funcs/cartsGet.js +4 -4
  63. package/funcs/cartsGet.js.map +1 -1
  64. package/funcs/catalogCategoriesList.js +4 -4
  65. package/funcs/catalogCategoriesList.js.map +1 -1
  66. package/funcs/catalogProductsGet.js +4 -4
  67. package/funcs/catalogProductsGet.js.map +1 -1
  68. package/funcs/catalogProductsGetCrossSells.js +4 -4
  69. package/funcs/catalogProductsGetCrossSells.js.map +1 -1
  70. package/funcs/catalogProductsGetSimilar.js +4 -4
  71. package/funcs/catalogProductsGetSimilar.js.map +1 -1
  72. package/funcs/catalogProductsGetUpsells.js +4 -4
  73. package/funcs/catalogProductsGetUpsells.js.map +1 -1
  74. package/funcs/catalogProductsList.js +4 -4
  75. package/funcs/catalogProductsList.js.map +1 -1
  76. package/funcs/catalogProductsReviewsCreate.js +4 -4
  77. package/funcs/catalogProductsReviewsCreate.js.map +1 -1
  78. package/funcs/catalogProductsReviewsList.js +4 -4
  79. package/funcs/catalogProductsReviewsList.js.map +1 -1
  80. package/funcs/catalogProductsVariantsGet.js +4 -4
  81. package/funcs/catalogProductsVariantsGet.js.map +1 -1
  82. package/funcs/catalogProductsVariantsList.js +4 -4
  83. package/funcs/catalogProductsVariantsList.js.map +1 -1
  84. package/funcs/catalogSkusList.js +4 -4
  85. package/funcs/catalogSkusList.js.map +1 -1
  86. package/funcs/checkoutApplyCoupon.js +4 -4
  87. package/funcs/checkoutApplyCoupon.js.map +1 -1
  88. package/funcs/checkoutRedeemGiftCard.js +4 -4
  89. package/funcs/checkoutRedeemGiftCard.js.map +1 -1
  90. package/funcs/checkoutRedeemLoyaltyPoints.js +4 -4
  91. package/funcs/checkoutRedeemLoyaltyPoints.js.map +1 -1
  92. package/funcs/checkoutRemoveCoupon.js +4 -4
  93. package/funcs/checkoutRemoveCoupon.js.map +1 -1
  94. package/funcs/checkoutRemoveCreditBalance.js +4 -4
  95. package/funcs/checkoutRemoveCreditBalance.js.map +1 -1
  96. package/funcs/checkoutRemoveLoyaltyPoints.js +4 -4
  97. package/funcs/checkoutRemoveLoyaltyPoints.js.map +1 -1
  98. package/funcs/checkoutUpdateAddress.js +4 -4
  99. package/funcs/checkoutUpdateAddress.js.map +1 -1
  100. package/funcs/checkoutUseCreditBalance.js +4 -4
  101. package/funcs/checkoutUseCreditBalance.js.map +1 -1
  102. package/funcs/customersAPIGetCustomersId.js +4 -4
  103. package/funcs/customersAPIGetCustomersId.js.map +1 -1
  104. package/funcs/customersAPIGetRecommendedProducts.js +4 -4
  105. package/funcs/customersAPIGetRecommendedProducts.js.map +1 -1
  106. package/funcs/customersAPIPostCustomers.js +4 -4
  107. package/funcs/customersAPIPostCustomers.js.map +1 -1
  108. package/funcs/customersAPIPutCustomersId.js +4 -4
  109. package/funcs/customersAPIPutCustomersId.js.map +1 -1
  110. package/funcs/customersAddressesAdd.js +4 -4
  111. package/funcs/customersAddressesAdd.js.map +1 -1
  112. package/funcs/customersAddressesDelete.js +4 -4
  113. package/funcs/customersAddressesDelete.js.map +1 -1
  114. package/funcs/customersAddressesGet.js +4 -4
  115. package/funcs/customersAddressesGet.js.map +1 -1
  116. package/funcs/customersAddressesList.js +4 -4
  117. package/funcs/customersAddressesList.js.map +1 -1
  118. package/funcs/customersAddressesUpdate.js +4 -4
  119. package/funcs/customersAddressesUpdate.js.map +1 -1
  120. package/funcs/customersLoyaltyGet.js +4 -4
  121. package/funcs/customersLoyaltyGet.js.map +1 -1
  122. package/funcs/customersLoyaltyListActivities.js +4 -4
  123. package/funcs/customersLoyaltyListActivities.js.map +1 -1
  124. package/funcs/customersReviewsList.js +4 -4
  125. package/funcs/customersReviewsList.js.map +1 -1
  126. package/funcs/offersCouponsList.js +4 -4
  127. package/funcs/offersCouponsList.js.map +1 -1
  128. package/funcs/offersPromotionsList.js +4 -4
  129. package/funcs/offersPromotionsList.js.map +1 -1
  130. package/funcs/ordersCancel.js +4 -4
  131. package/funcs/ordersCancel.js.map +1 -1
  132. package/funcs/ordersCreate.js +4 -4
  133. package/funcs/ordersCreate.js.map +1 -1
  134. package/funcs/ordersGet.js +4 -4
  135. package/funcs/ordersGet.js.map +1 -1
  136. package/funcs/ordersList.js +4 -4
  137. package/funcs/ordersList.js.map +1 -1
  138. package/funcs/ordersPaymentsList.js +4 -4
  139. package/funcs/ordersPaymentsList.js.map +1 -1
  140. package/funcs/ordersRefundsList.js +4 -4
  141. package/funcs/ordersRefundsList.js.map +1 -1
  142. package/funcs/ordersRetryPayment.js +4 -4
  143. package/funcs/ordersRetryPayment.js.map +1 -1
  144. package/funcs/ordersShipmentsList.js +4 -4
  145. package/funcs/ordersShipmentsList.js.map +1 -1
  146. package/funcs/paymentsAPIPostPaymentsSession.d.ts +15 -0
  147. package/funcs/paymentsAPIPostPaymentsSession.d.ts.map +1 -0
  148. package/funcs/paymentsAPIPostPaymentsSession.js +96 -0
  149. package/funcs/paymentsAPIPostPaymentsSession.js.map +1 -0
  150. package/funcs/paymentsGenerateHash.js +4 -4
  151. package/funcs/paymentsGenerateHash.js.map +1 -1
  152. package/funcs/paymentsGetMethods.js +4 -4
  153. package/funcs/paymentsGetMethods.js.map +1 -1
  154. package/funcs/shippingCheckPincodeServiceability.js +4 -4
  155. package/funcs/shippingCheckPincodeServiceability.js.map +1 -1
  156. package/funcs/userNotificationPreferencesCreate.js +4 -4
  157. package/funcs/userNotificationPreferencesCreate.js.map +1 -1
  158. package/funcs/userNotificationPreferencesGet.js +4 -4
  159. package/funcs/userNotificationPreferencesGet.js.map +1 -1
  160. package/funcs/userNotificationPreferencesUpdate.js +4 -4
  161. package/funcs/userNotificationPreferencesUpdate.js.map +1 -1
  162. package/funcs/utilsGetCountries.js +4 -4
  163. package/funcs/utilsGetCountries.js.map +1 -1
  164. package/funcs/utilsGetPincodes.js +4 -4
  165. package/funcs/utilsGetPincodes.js.map +1 -1
  166. package/funcs/utilsGetStates.js +4 -4
  167. package/funcs/utilsGetStates.js.map +1 -1
  168. package/funcs/wishlistAdd.js +4 -4
  169. package/funcs/wishlistAdd.js.map +1 -1
  170. package/funcs/wishlistDelete.js +4 -4
  171. package/funcs/wishlistDelete.js.map +1 -1
  172. package/funcs/wishlistGet.js +4 -4
  173. package/funcs/wishlistGet.js.map +1 -1
  174. package/lib/config.d.ts +3 -3
  175. package/lib/config.js +6 -7
  176. package/lib/config.js.map +1 -1
  177. package/lib/encodings.js +18 -19
  178. package/lib/encodings.js.map +1 -1
  179. package/lib/http.js +1 -2
  180. package/lib/http.js.map +1 -1
  181. package/lib/matchers.js +5 -6
  182. package/lib/matchers.js.map +1 -1
  183. package/lib/primitives.js +1 -1
  184. package/lib/primitives.js.map +1 -1
  185. package/lib/retries.js +3 -4
  186. package/lib/retries.js.map +1 -1
  187. package/lib/sdks.js +15 -16
  188. package/lib/sdks.js.map +1 -1
  189. package/lib/security.js +2 -2
  190. package/lib/security.js.map +1 -1
  191. package/lib/url.js +1 -1
  192. package/lib/url.js.map +1 -1
  193. package/models/components/index.d.ts +1 -0
  194. package/models/components/index.d.ts.map +1 -1
  195. package/models/components/index.js +1 -0
  196. package/models/components/index.js.map +1 -1
  197. package/models/components/paymentsessionresponse.d.ts +146 -0
  198. package/models/components/paymentsessionresponse.d.ts.map +1 -0
  199. package/models/components/paymentsessionresponse.js +195 -0
  200. package/models/components/paymentsessionresponse.js.map +1 -0
  201. package/models/errors/httpclienterrors.js +2 -2
  202. package/models/errors/httpclienterrors.js.map +1 -1
  203. package/models/operations/index.d.ts +1 -0
  204. package/models/operations/index.d.ts.map +1 -1
  205. package/models/operations/index.js +1 -0
  206. package/models/operations/index.js.map +1 -1
  207. package/models/operations/postorder.d.ts +15 -0
  208. package/models/operations/postorder.d.ts.map +1 -1
  209. package/models/operations/postorder.js +12 -0
  210. package/models/operations/postorder.js.map +1 -1
  211. package/models/operations/postpaymentssession.d.ts +120 -0
  212. package/models/operations/postpaymentssession.d.ts.map +1 -0
  213. package/models/operations/postpaymentssession.js +161 -0
  214. package/models/operations/postpaymentssession.js.map +1 -0
  215. package/package.json +1 -1
  216. package/sdk/auth.js +1 -2
  217. package/sdk/auth.js.map +1 -1
  218. package/sdk/campaigns.js +1 -2
  219. package/sdk/campaigns.js.map +1 -1
  220. package/sdk/catalog.js +3 -6
  221. package/sdk/catalog.js.map +1 -1
  222. package/sdk/customers.js +3 -6
  223. package/sdk/customers.js.map +1 -1
  224. package/sdk/offers.js +2 -4
  225. package/sdk/offers.js.map +1 -1
  226. package/sdk/orders.js +3 -6
  227. package/sdk/orders.js.map +1 -1
  228. package/sdk/paymentsapi.d.ts +12 -0
  229. package/sdk/paymentsapi.d.ts.map +1 -0
  230. package/sdk/paymentsapi.js +22 -0
  231. package/sdk/paymentsapi.js.map +1 -0
  232. package/sdk/products.js +2 -4
  233. package/sdk/products.js.map +1 -1
  234. package/sdk/sdk.d.ts +3 -0
  235. package/sdk/sdk.d.ts.map +1 -1
  236. package/sdk/sdk.js +19 -30
  237. package/sdk/sdk.js.map +1 -1
  238. package/sdk/user.js +1 -2
  239. package/sdk/user.js.map +1 -1
  240. package/src/funcs/paymentsAPIPostPaymentsSession.ts +125 -0
  241. package/src/lib/config.ts +3 -3
  242. package/src/lib/security.ts +1 -1
  243. package/src/models/components/index.ts +1 -0
  244. package/src/models/components/paymentsessionresponse.ts +322 -0
  245. package/src/models/operations/index.ts +1 -0
  246. package/src/models/operations/postorder.ts +27 -0
  247. package/src/models/operations/postpaymentssession.ts +254 -0
  248. package/src/sdk/paymentsapi.ts +27 -0
  249. package/src/sdk/sdk.ts +6 -0
@@ -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
 
@@ -0,0 +1,254 @@
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 { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export const Action = {
14
+ PaymentPage: "paymentPage",
15
+ PaymentManagement: "paymentManagement",
16
+ } as const;
17
+ export type Action = ClosedEnum<typeof Action>;
18
+
19
+ export type PostPaymentsSessionRequestBody = {
20
+ orderId: string;
21
+ action: Action;
22
+ /**
23
+ * A Payment Return URL is a specific URL to which users are redirected after completing a payment process.
24
+ */
25
+ returnUrl: string;
26
+ };
27
+
28
+ export type PostPaymentsSessionContent = {
29
+ paymentSession?: components.PaymentSessionResponse | undefined;
30
+ };
31
+
32
+ /**
33
+ * OK
34
+ */
35
+ export type PostPaymentsSessionResponseBody = {
36
+ message?: string | undefined;
37
+ success?: boolean | undefined;
38
+ content?: PostPaymentsSessionContent | undefined;
39
+ };
40
+
41
+ /** @internal */
42
+ export const Action$inboundSchema: z.ZodNativeEnum<typeof Action> = z
43
+ .nativeEnum(Action);
44
+
45
+ /** @internal */
46
+ export const Action$outboundSchema: z.ZodNativeEnum<typeof Action> =
47
+ Action$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 Action$ {
54
+ /** @deprecated use `Action$inboundSchema` instead. */
55
+ export const inboundSchema = Action$inboundSchema;
56
+ /** @deprecated use `Action$outboundSchema` instead. */
57
+ export const outboundSchema = Action$outboundSchema;
58
+ }
59
+
60
+ /** @internal */
61
+ export const PostPaymentsSessionRequestBody$inboundSchema: z.ZodType<
62
+ PostPaymentsSessionRequestBody,
63
+ z.ZodTypeDef,
64
+ unknown
65
+ > = z.object({
66
+ order_id: z.string(),
67
+ action: Action$inboundSchema,
68
+ return_url: z.string(),
69
+ }).transform((v) => {
70
+ return remap$(v, {
71
+ "order_id": "orderId",
72
+ "return_url": "returnUrl",
73
+ });
74
+ });
75
+
76
+ /** @internal */
77
+ export type PostPaymentsSessionRequestBody$Outbound = {
78
+ order_id: string;
79
+ action: string;
80
+ return_url: string;
81
+ };
82
+
83
+ /** @internal */
84
+ export const PostPaymentsSessionRequestBody$outboundSchema: z.ZodType<
85
+ PostPaymentsSessionRequestBody$Outbound,
86
+ z.ZodTypeDef,
87
+ PostPaymentsSessionRequestBody
88
+ > = z.object({
89
+ orderId: z.string(),
90
+ action: Action$outboundSchema,
91
+ returnUrl: z.string(),
92
+ }).transform((v) => {
93
+ return remap$(v, {
94
+ orderId: "order_id",
95
+ returnUrl: "return_url",
96
+ });
97
+ });
98
+
99
+ /**
100
+ * @internal
101
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
102
+ */
103
+ export namespace PostPaymentsSessionRequestBody$ {
104
+ /** @deprecated use `PostPaymentsSessionRequestBody$inboundSchema` instead. */
105
+ export const inboundSchema = PostPaymentsSessionRequestBody$inboundSchema;
106
+ /** @deprecated use `PostPaymentsSessionRequestBody$outboundSchema` instead. */
107
+ export const outboundSchema = PostPaymentsSessionRequestBody$outboundSchema;
108
+ /** @deprecated use `PostPaymentsSessionRequestBody$Outbound` instead. */
109
+ export type Outbound = PostPaymentsSessionRequestBody$Outbound;
110
+ }
111
+
112
+ export function postPaymentsSessionRequestBodyToJSON(
113
+ postPaymentsSessionRequestBody: PostPaymentsSessionRequestBody,
114
+ ): string {
115
+ return JSON.stringify(
116
+ PostPaymentsSessionRequestBody$outboundSchema.parse(
117
+ postPaymentsSessionRequestBody,
118
+ ),
119
+ );
120
+ }
121
+
122
+ export function postPaymentsSessionRequestBodyFromJSON(
123
+ jsonString: string,
124
+ ): SafeParseResult<PostPaymentsSessionRequestBody, SDKValidationError> {
125
+ return safeParse(
126
+ jsonString,
127
+ (x) => PostPaymentsSessionRequestBody$inboundSchema.parse(JSON.parse(x)),
128
+ `Failed to parse 'PostPaymentsSessionRequestBody' from JSON`,
129
+ );
130
+ }
131
+
132
+ /** @internal */
133
+ export const PostPaymentsSessionContent$inboundSchema: z.ZodType<
134
+ PostPaymentsSessionContent,
135
+ z.ZodTypeDef,
136
+ unknown
137
+ > = z.object({
138
+ payment_session: components.PaymentSessionResponse$inboundSchema.optional(),
139
+ }).transform((v) => {
140
+ return remap$(v, {
141
+ "payment_session": "paymentSession",
142
+ });
143
+ });
144
+
145
+ /** @internal */
146
+ export type PostPaymentsSessionContent$Outbound = {
147
+ payment_session?: components.PaymentSessionResponse$Outbound | undefined;
148
+ };
149
+
150
+ /** @internal */
151
+ export const PostPaymentsSessionContent$outboundSchema: z.ZodType<
152
+ PostPaymentsSessionContent$Outbound,
153
+ z.ZodTypeDef,
154
+ PostPaymentsSessionContent
155
+ > = z.object({
156
+ paymentSession: components.PaymentSessionResponse$outboundSchema.optional(),
157
+ }).transform((v) => {
158
+ return remap$(v, {
159
+ paymentSession: "payment_session",
160
+ });
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 PostPaymentsSessionContent$ {
168
+ /** @deprecated use `PostPaymentsSessionContent$inboundSchema` instead. */
169
+ export const inboundSchema = PostPaymentsSessionContent$inboundSchema;
170
+ /** @deprecated use `PostPaymentsSessionContent$outboundSchema` instead. */
171
+ export const outboundSchema = PostPaymentsSessionContent$outboundSchema;
172
+ /** @deprecated use `PostPaymentsSessionContent$Outbound` instead. */
173
+ export type Outbound = PostPaymentsSessionContent$Outbound;
174
+ }
175
+
176
+ export function postPaymentsSessionContentToJSON(
177
+ postPaymentsSessionContent: PostPaymentsSessionContent,
178
+ ): string {
179
+ return JSON.stringify(
180
+ PostPaymentsSessionContent$outboundSchema.parse(postPaymentsSessionContent),
181
+ );
182
+ }
183
+
184
+ export function postPaymentsSessionContentFromJSON(
185
+ jsonString: string,
186
+ ): SafeParseResult<PostPaymentsSessionContent, SDKValidationError> {
187
+ return safeParse(
188
+ jsonString,
189
+ (x) => PostPaymentsSessionContent$inboundSchema.parse(JSON.parse(x)),
190
+ `Failed to parse 'PostPaymentsSessionContent' from JSON`,
191
+ );
192
+ }
193
+
194
+ /** @internal */
195
+ export const PostPaymentsSessionResponseBody$inboundSchema: z.ZodType<
196
+ PostPaymentsSessionResponseBody,
197
+ z.ZodTypeDef,
198
+ unknown
199
+ > = z.object({
200
+ message: z.string().optional(),
201
+ success: z.boolean().optional(),
202
+ content: z.lazy(() => PostPaymentsSessionContent$inboundSchema).optional(),
203
+ });
204
+
205
+ /** @internal */
206
+ export type PostPaymentsSessionResponseBody$Outbound = {
207
+ message?: string | undefined;
208
+ success?: boolean | undefined;
209
+ content?: PostPaymentsSessionContent$Outbound | undefined;
210
+ };
211
+
212
+ /** @internal */
213
+ export const PostPaymentsSessionResponseBody$outboundSchema: z.ZodType<
214
+ PostPaymentsSessionResponseBody$Outbound,
215
+ z.ZodTypeDef,
216
+ PostPaymentsSessionResponseBody
217
+ > = z.object({
218
+ message: z.string().optional(),
219
+ success: z.boolean().optional(),
220
+ content: z.lazy(() => PostPaymentsSessionContent$outboundSchema).optional(),
221
+ });
222
+
223
+ /**
224
+ * @internal
225
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
226
+ */
227
+ export namespace PostPaymentsSessionResponseBody$ {
228
+ /** @deprecated use `PostPaymentsSessionResponseBody$inboundSchema` instead. */
229
+ export const inboundSchema = PostPaymentsSessionResponseBody$inboundSchema;
230
+ /** @deprecated use `PostPaymentsSessionResponseBody$outboundSchema` instead. */
231
+ export const outboundSchema = PostPaymentsSessionResponseBody$outboundSchema;
232
+ /** @deprecated use `PostPaymentsSessionResponseBody$Outbound` instead. */
233
+ export type Outbound = PostPaymentsSessionResponseBody$Outbound;
234
+ }
235
+
236
+ export function postPaymentsSessionResponseBodyToJSON(
237
+ postPaymentsSessionResponseBody: PostPaymentsSessionResponseBody,
238
+ ): string {
239
+ return JSON.stringify(
240
+ PostPaymentsSessionResponseBody$outboundSchema.parse(
241
+ postPaymentsSessionResponseBody,
242
+ ),
243
+ );
244
+ }
245
+
246
+ export function postPaymentsSessionResponseBodyFromJSON(
247
+ jsonString: string,
248
+ ): SafeParseResult<PostPaymentsSessionResponseBody, SDKValidationError> {
249
+ return safeParse(
250
+ jsonString,
251
+ (x) => PostPaymentsSessionResponseBody$inboundSchema.parse(JSON.parse(x)),
252
+ `Failed to parse 'PostPaymentsSessionResponseBody' from JSON`,
253
+ );
254
+ }