@gofynd/fdk-client-javascript 1.0.2 → 1.0.4

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 (346) hide show
  1. package/README.md +31 -2
  2. package/index.d.ts +4 -4
  3. package/index.js +9 -10
  4. package/package.json +14 -14
  5. package/sdk/APIClient.d.ts +11 -0
  6. package/sdk/APIClient.js +35 -0
  7. package/sdk/Client.d.ts +6 -0
  8. package/sdk/Client.js +17 -0
  9. package/sdk/Config.d.ts +9 -0
  10. package/sdk/Config.js +17 -0
  11. package/sdk/application/Cart/CartApplicationClient.d.ts +243 -243
  12. package/sdk/application/Cart/CartApplicationClient.js +595 -594
  13. package/sdk/application/Cart/CartApplicationModel.d.ts +64 -63
  14. package/sdk/application/Cart/CartApplicationModel.js +490 -885
  15. package/sdk/application/Cart/CartApplicationValidator.d.ts +17 -17
  16. package/sdk/application/Cart/CartApplicationValidator.js +98 -98
  17. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +358 -358
  18. package/sdk/application/Catalog/CatalogApplicationClient.js +1079 -1078
  19. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +90 -90
  20. package/sdk/application/Catalog/CatalogApplicationModel.js +683 -1249
  21. package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +19 -19
  22. package/sdk/application/Catalog/CatalogApplicationValidator.js +110 -110
  23. package/sdk/application/Common/CommonApplicationClient.d.ts +13 -13
  24. package/sdk/application/Common/CommonApplicationClient.js +43 -42
  25. package/sdk/application/Common/CommonApplicationModel.d.ts +12 -12
  26. package/sdk/application/Common/CommonApplicationModel.js +83 -160
  27. package/sdk/application/Common/CommonApplicationValidator.d.ts +1 -1
  28. package/sdk/application/Common/CommonApplicationValidator.js +6 -6
  29. package/sdk/application/Communication/CommunicationApplicationClient.d.ts +11 -11
  30. package/sdk/application/Communication/CommunicationApplicationClient.js +32 -31
  31. package/sdk/application/Communication/CommunicationApplicationModel.d.ts +6 -6
  32. package/sdk/application/Communication/CommunicationApplicationModel.js +38 -83
  33. package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +1 -1
  34. package/sdk/application/Communication/CommunicationApplicationValidator.js +4 -4
  35. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +116 -116
  36. package/sdk/application/Configuration/ConfigurationApplicationClient.js +350 -349
  37. package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +85 -85
  38. package/sdk/application/Configuration/ConfigurationApplicationModel.js +480 -851
  39. package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +8 -8
  40. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +33 -33
  41. package/sdk/application/Content/ContentApplicationClient.d.ts +67 -67
  42. package/sdk/application/Content/ContentApplicationClient.js +216 -215
  43. package/sdk/application/Content/ContentApplicationModel.d.ts +76 -76
  44. package/sdk/application/Content/ContentApplicationModel.js +468 -884
  45. package/sdk/application/Content/ContentApplicationValidator.d.ts +5 -5
  46. package/sdk/application/Content/ContentApplicationValidator.js +24 -24
  47. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +25 -25
  48. package/sdk/application/FileStorage/FileStorageApplicationClient.js +65 -64
  49. package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +13 -13
  50. package/sdk/application/FileStorage/FileStorageApplicationModel.js +86 -169
  51. package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +1 -1
  52. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +7 -7
  53. package/sdk/application/Lead/LeadApplicationClient.d.ts +24 -24
  54. package/sdk/application/Lead/LeadApplicationClient.js +109 -108
  55. package/sdk/application/Lead/LeadApplicationModel.d.ts +35 -35
  56. package/sdk/application/Lead/LeadApplicationModel.js +267 -474
  57. package/sdk/application/Lead/LeadApplicationValidator.d.ts +2 -2
  58. package/sdk/application/Lead/LeadApplicationValidator.js +11 -11
  59. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +31 -22
  60. package/sdk/application/Logistic/LogisticApplicationClient.js +115 -49
  61. package/sdk/application/Logistic/LogisticApplicationModel.d.ts +17 -14
  62. package/sdk/application/Logistic/LogisticApplicationModel.js +133 -201
  63. package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +3 -2
  64. package/sdk/application/Logistic/LogisticApplicationValidator.js +14 -9
  65. package/sdk/application/Order/OrderApplicationClient.d.ts +85 -85
  66. package/sdk/application/Order/OrderApplicationClient.js +247 -246
  67. package/sdk/application/Order/OrderApplicationModel.d.ts +50 -50
  68. package/sdk/application/Order/OrderApplicationModel.js +361 -656
  69. package/sdk/application/Order/OrderApplicationValidator.d.ts +7 -7
  70. package/sdk/application/Order/OrderApplicationValidator.js +28 -28
  71. package/sdk/application/Payment/PaymentApplicationClient.d.ts +318 -318
  72. package/sdk/application/Payment/PaymentApplicationClient.js +781 -780
  73. package/sdk/application/Payment/PaymentApplicationModel.d.ts +72 -72
  74. package/sdk/application/Payment/PaymentApplicationModel.js +570 -1038
  75. package/sdk/application/Payment/PaymentApplicationValidator.d.ts +28 -28
  76. package/sdk/application/Payment/PaymentApplicationValidator.js +107 -107
  77. package/sdk/application/PosCart/PosCartApplicationClient.d.ts +254 -254
  78. package/sdk/application/PosCart/PosCartApplicationClient.js +646 -645
  79. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +64 -63
  80. package/sdk/application/PosCart/PosCartApplicationModel.js +476 -870
  81. package/sdk/application/PosCart/PosCartApplicationValidator.d.ts +18 -18
  82. package/sdk/application/PosCart/PosCartApplicationValidator.js +103 -103
  83. package/sdk/application/Rewards/RewardsApplicationClient.d.ts +27 -27
  84. package/sdk/application/Rewards/RewardsApplicationClient.js +122 -121
  85. package/sdk/application/Rewards/RewardsApplicationModel.d.ts +14 -14
  86. package/sdk/application/Rewards/RewardsApplicationModel.js +96 -191
  87. package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +3 -3
  88. package/sdk/application/Rewards/RewardsApplicationValidator.js +12 -12
  89. package/sdk/application/Share/ShareApplicationClient.d.ts +37 -37
  90. package/sdk/application/Share/ShareApplicationClient.js +94 -93
  91. package/sdk/application/Share/ShareApplicationModel.d.ts +8 -8
  92. package/sdk/application/Share/ShareApplicationModel.js +63 -123
  93. package/sdk/application/Share/ShareApplicationValidator.d.ts +4 -4
  94. package/sdk/application/Share/ShareApplicationValidator.js +12 -12
  95. package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -8
  96. package/sdk/application/Theme/ThemeApplicationClient.js +38 -37
  97. package/sdk/application/Theme/ThemeApplicationModel.d.ts +34 -34
  98. package/sdk/application/Theme/ThemeApplicationModel.js +190 -336
  99. package/sdk/application/Theme/ThemeApplicationValidator.d.ts +1 -1
  100. package/sdk/application/Theme/ThemeApplicationValidator.js +4 -4
  101. package/sdk/application/User/UserApplicationClient.d.ts +280 -280
  102. package/sdk/application/User/UserApplicationClient.js +619 -618
  103. package/sdk/application/User/UserApplicationModel.d.ts +79 -72
  104. package/sdk/application/User/UserApplicationModel.js +440 -689
  105. package/sdk/application/User/UserApplicationValidator.d.ts +24 -24
  106. package/sdk/application/User/UserApplicationValidator.js +89 -89
  107. package/sdk/common/AxiosHelper.js +18 -7
  108. package/sdk/constructUrl.d.ts +5 -0
  109. package/sdk/constructUrl.js +13 -0
  110. package/sdk/index.d.ts +3 -0
  111. package/sdk/index.js +5 -0
  112. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +51 -51
  113. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +182 -180
  114. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +6 -6
  115. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +21 -21
  116. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +5 -4
  117. package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +11 -11
  118. package/sdk/platform/Analytics/AnalyticsPlatformModel.js +95 -178
  119. package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +1 -0
  120. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +10 -10
  121. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +44 -43
  122. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +10 -10
  123. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +50 -89
  124. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +1 -1
  125. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +7 -6
  126. package/sdk/platform/Billing/BillingPlatformClient.d.ts +60 -60
  127. package/sdk/platform/Billing/BillingPlatformClient.js +184 -183
  128. package/sdk/platform/Billing/BillingPlatformModel.d.ts +40 -40
  129. package/sdk/platform/Billing/BillingPlatformModel.js +342 -668
  130. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +8 -8
  131. package/sdk/platform/Billing/BillingPlatformValidator.js +26 -25
  132. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +192 -165
  133. package/sdk/platform/Cart/CartPlatformApplicationClient.js +686 -510
  134. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +14 -11
  135. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +77 -61
  136. package/sdk/platform/Cart/CartPlatformModel.d.ts +84 -83
  137. package/sdk/platform/Cart/CartPlatformModel.js +676 -1206
  138. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +632 -632
  139. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1558 -1556
  140. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +40 -40
  141. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +175 -175
  142. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +688 -688
  143. package/sdk/platform/Catalog/CatalogPlatformClient.js +1556 -1559
  144. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +291 -291
  145. package/sdk/platform/Catalog/CatalogPlatformModel.js +2133 -3910
  146. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +66 -66
  147. package/sdk/platform/Catalog/CatalogPlatformValidator.js +229 -228
  148. package/sdk/platform/Common/CommonPlatformClient.d.ts +12 -12
  149. package/sdk/platform/Common/CommonPlatformClient.js +40 -51
  150. package/sdk/platform/Common/CommonPlatformModel.d.ts +12 -12
  151. package/sdk/platform/Common/CommonPlatformModel.js +83 -160
  152. package/sdk/platform/Common/CommonPlatformValidator.d.ts +1 -1
  153. package/sdk/platform/Common/CommonPlatformValidator.js +7 -6
  154. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +326 -326
  155. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +945 -943
  156. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +30 -30
  157. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +88 -88
  158. package/sdk/platform/Communication/CommunicationPlatformClient.js +4 -3
  159. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +67 -67
  160. package/sdk/platform/Communication/CommunicationPlatformModel.js +522 -974
  161. package/sdk/platform/Communication/CommunicationPlatformValidator.js +1 -0
  162. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +55 -55
  163. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +217 -216
  164. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +27 -27
  165. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +279 -542
  166. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +7 -7
  167. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +25 -24
  168. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +163 -153
  169. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +617 -552
  170. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +22 -21
  171. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +70 -64
  172. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +125 -125
  173. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +348 -347
  174. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +148 -146
  175. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +854 -1508
  176. package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +9 -9
  177. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +39 -38
  178. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +524 -534
  179. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1287 -1346
  180. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +49 -50
  181. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +153 -159
  182. package/sdk/platform/Content/ContentPlatformModel.d.ts +78 -78
  183. package/sdk/platform/Content/ContentPlatformModel.js +485 -907
  184. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +65 -65
  185. package/sdk/platform/Discount/DiscountPlatformClient.js +219 -218
  186. package/sdk/platform/Discount/DiscountPlatformModel.d.ts +7 -7
  187. package/sdk/platform/Discount/DiscountPlatformModel.js +60 -121
  188. package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +6 -6
  189. package/sdk/platform/Discount/DiscountPlatformValidator.js +30 -29
  190. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +25 -25
  191. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +83 -61
  192. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -1
  193. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +9 -9
  194. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +53 -53
  195. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +147 -125
  196. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +13 -13
  197. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +86 -169
  198. package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +3 -3
  199. package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +12 -11
  200. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +63 -63
  201. package/sdk/platform/Inventory/InventoryPlatformClient.js +231 -230
  202. package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +30 -30
  203. package/sdk/platform/Inventory/InventoryPlatformModel.js +497 -964
  204. package/sdk/platform/Inventory/InventoryPlatformValidator.d.ts +7 -7
  205. package/sdk/platform/Inventory/InventoryPlatformValidator.js +29 -28
  206. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +73 -73
  207. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +203 -201
  208. package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +7 -7
  209. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +29 -29
  210. package/sdk/platform/Lead/LeadPlatformClient.d.ts +80 -80
  211. package/sdk/platform/Lead/LeadPlatformClient.js +215 -214
  212. package/sdk/platform/Lead/LeadPlatformModel.d.ts +35 -35
  213. package/sdk/platform/Lead/LeadPlatformModel.js +267 -474
  214. package/sdk/platform/Lead/LeadPlatformValidator.d.ts +6 -6
  215. package/sdk/platform/Lead/LeadPlatformValidator.js +25 -24
  216. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +10 -10
  217. package/sdk/platform/Order/OrderPlatformApplicationClient.js +68 -66
  218. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -1
  219. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +7 -7
  220. package/sdk/platform/Order/OrderPlatformClient.d.ts +357 -357
  221. package/sdk/platform/Order/OrderPlatformClient.js +1046 -1033
  222. package/sdk/platform/Order/OrderPlatformModel.d.ts +198 -196
  223. package/sdk/platform/Order/OrderPlatformModel.js +1575 -2861
  224. package/sdk/platform/Order/OrderPlatformValidator.d.ts +32 -32
  225. package/sdk/platform/Order/OrderPlatformValidator.js +161 -160
  226. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +3 -1
  227. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +1 -1
  228. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  229. package/sdk/platform/Partner/PartnerPlatformModel.js +10 -26
  230. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +58 -58
  231. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +178 -178
  232. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +6 -6
  233. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +24 -24
  234. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +42 -42
  235. package/sdk/platform/Payment/PaymentPlatformClient.js +156 -155
  236. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +27 -27
  237. package/sdk/platform/Payment/PaymentPlatformModel.js +222 -410
  238. package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +4 -4
  239. package/sdk/platform/Payment/PaymentPlatformValidator.js +22 -21
  240. package/sdk/platform/PlatformApplicationClient.d.ts +1496 -10325
  241. package/sdk/platform/PlatformApplicationClient.js +1584 -13899
  242. package/sdk/platform/PlatformClient.d.ts +7972 -7888
  243. package/sdk/platform/PlatformClient.js +8678 -10107
  244. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +85 -85
  245. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +299 -280
  246. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +8 -8
  247. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +35 -35
  248. package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +15 -15
  249. package/sdk/platform/Rewards/RewardsPlatformModel.js +92 -194
  250. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +10 -10
  251. package/sdk/platform/Share/SharePlatformApplicationClient.js +62 -60
  252. package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -1
  253. package/sdk/platform/Share/SharePlatformApplicationValidator.js +7 -7
  254. package/sdk/platform/Share/SharePlatformModel.d.ts +8 -8
  255. package/sdk/platform/Share/SharePlatformModel.js +60 -118
  256. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +132 -132
  257. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +314 -312
  258. package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +15 -15
  259. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +45 -45
  260. package/sdk/platform/Theme/ThemePlatformModel.d.ts +34 -34
  261. package/sdk/platform/Theme/ThemePlatformModel.js +190 -336
  262. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +136 -69
  263. package/sdk/platform/User/UserPlatformApplicationClient.js +507 -166
  264. package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +12 -7
  265. package/sdk/platform/User/UserPlatformApplicationValidator.js +62 -24
  266. package/sdk/platform/User/UserPlatformModel.d.ts +79 -72
  267. package/sdk/platform/User/UserPlatformModel.js +440 -689
  268. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +31 -31
  269. package/sdk/platform/Webhook/WebhookPlatformClient.js +91 -90
  270. package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +7 -7
  271. package/sdk/platform/Webhook/WebhookPlatformModel.js +68 -136
  272. package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +3 -3
  273. package/sdk/platform/Webhook/WebhookPlatformValidator.js +15 -14
  274. package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +13 -13
  275. package/sdk/public/Configuration/ConfigurationPublicClient.js +40 -38
  276. package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +12 -12
  277. package/sdk/public/Configuration/ConfigurationPublicModel.js +85 -162
  278. package/sdk/public/Configuration/ConfigurationPublicValidator.d.ts +1 -1
  279. package/sdk/public/Configuration/ConfigurationPublicValidator.js +6 -6
  280. package/sdk/public/Inventory/InventoryPublicClient.d.ts +34 -34
  281. package/sdk/public/Inventory/InventoryPublicClient.js +115 -113
  282. package/sdk/public/Inventory/InventoryPublicModel.d.ts +10 -10
  283. package/sdk/public/Inventory/InventoryPublicModel.js +119 -245
  284. package/sdk/public/Inventory/InventoryPublicValidator.d.ts +3 -3
  285. package/sdk/public/Inventory/InventoryPublicValidator.js +15 -15
  286. package/sdk/public/Webhook/WebhookPublicClient.js +2 -0
  287. package/sdk/public/Webhook/WebhookPublicModel.d.ts +7 -7
  288. package/sdk/public/Webhook/WebhookPublicModel.js +68 -136
  289. package/.github/workflows/on_create_release.yml +0 -23
  290. package/.github/workflows/on_merge_main.yml +0 -38
  291. package/.github/workflows/on_pull_request.yml +0 -35
  292. package/.prettierrc +0 -5
  293. package/documentation/application/CART.md +0 -7339
  294. package/documentation/application/CATALOG.md +0 -9597
  295. package/documentation/application/COMMON.md +0 -452
  296. package/documentation/application/COMMUNICATION.md +0 -467
  297. package/documentation/application/CONFIGURATION.md +0 -2906
  298. package/documentation/application/CONTENT.md +0 -3351
  299. package/documentation/application/FILESTORAGE.md +0 -578
  300. package/documentation/application/LEAD.md +0 -1895
  301. package/documentation/application/LOGISTIC.md +0 -765
  302. package/documentation/application/ORDER.md +0 -3432
  303. package/documentation/application/PAYMENT.md +0 -5221
  304. package/documentation/application/POSCART.md +0 -7938
  305. package/documentation/application/README.md +0 -21
  306. package/documentation/application/REWARDS.md +0 -708
  307. package/documentation/application/SHARE.md +0 -733
  308. package/documentation/application/THEME.md +0 -5800
  309. package/documentation/application/USER.md +0 -4335
  310. package/documentation/platform/ANALYTICS.md +0 -1154
  311. package/documentation/platform/AUDITTRAIL.md +0 -576
  312. package/documentation/platform/BILLING.md +0 -2400
  313. package/documentation/platform/CART.md +0 -5559
  314. package/documentation/platform/CATALOG.md +0 -23261
  315. package/documentation/platform/COMMON.md +0 -452
  316. package/documentation/platform/COMMUNICATION.md +0 -5718
  317. package/documentation/platform/COMPANYPROFILE.md +0 -2031
  318. package/documentation/platform/CONFIGURATION.md +0 -7339
  319. package/documentation/platform/CONTENT.md +0 -9098
  320. package/documentation/platform/DISCOUNT.md +0 -863
  321. package/documentation/platform/FILESTORAGE.md +0 -1081
  322. package/documentation/platform/INVENTORY.md +0 -1779
  323. package/documentation/platform/LEAD.md +0 -4740
  324. package/documentation/platform/ORDER.md +0 -8486
  325. package/documentation/platform/PARTNER.md +0 -220
  326. package/documentation/platform/PAYMENT.md +0 -3448
  327. package/documentation/platform/README.md +0 -27
  328. package/documentation/platform/REWARDS.md +0 -1083
  329. package/documentation/platform/SHARE.md +0 -606
  330. package/documentation/platform/THEME.md +0 -35729
  331. package/documentation/platform/USER.md +0 -2319
  332. package/documentation/platform/WEBHOOK.md +0 -591
  333. package/documentation/public/CONFIGURATION.md +0 -452
  334. package/documentation/public/INVENTORY.md +0 -690
  335. package/documentation/public/WEBHOOK.md +0 -352
  336. package/jest.config.d.ts +0 -4
  337. package/jest.config.js +0 -6
  338. package/tests/application/catalog.spec.js +0 -47
  339. package/tests/common/action-url.spec.js +0 -35
  340. package/tests/common/schema/action-url.json +0 -178
  341. package/tests/common/schema/url-action.json +0 -683
  342. package/tests/common/url-action.spec.js +0 -48
  343. package/tests/helpers/cookie.helper.js +0 -31
  344. package/tests/helpers/oauth.helper.js +0 -43
  345. package/tests/platform/catalog.spec.js +0 -49
  346. package/tests/public/location.spec.js +0 -39
@@ -1,46 +1,47 @@
1
- const APIClient = require("../ApplicationAPIClient");
1
+ const ApplicationAPIClient = require("../ApplicationAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
2
3
  const constructUrl = require("../constructUrl");
3
4
  const Paginator = require("../../common/Paginator");
4
- const { FDKClientValidationError } = require("../../common/FDKError");
5
5
  const PosCartValidator = require("./PosCartApplicationValidator");
6
6
  const PosCartModel = require("./PosCartApplicationModel");
7
7
  const { Logger } = require("./../../common/Logger");
8
+ const Joi = require("joi");
8
9
 
9
10
  class PosCart {
10
11
  constructor(_conf) {
11
12
  this._conf = _conf;
12
13
  this._relativeUrls = {
13
- getCart: "/service/application/pos/cart/v1.0/detail",
14
- getCartLastModified: "/service/application/pos/cart/v1.0/detail",
14
+ addAddress: "/service/application/pos/cart/v1.0/address",
15
15
  addItems: "/service/application/pos/cart/v1.0/detail",
16
- updateCart: "/service/application/pos/cart/v1.0/detail",
17
- getItemCount: "/service/application/pos/cart/v1.0/basic",
18
- getCoupons: "/service/application/pos/cart/v1.0/coupon",
19
16
  applyCoupon: "/service/application/pos/cart/v1.0/coupon",
20
- removeCoupon: "/service/application/pos/cart/v1.0/coupon",
21
- getBulkDiscountOffers: "/service/application/pos/cart/v1.0/bulk-price",
22
17
  applyRewardPoints: "/service/application/pos/cart/v1.0/redeem/points/",
23
- getAddresses: "/service/application/pos/cart/v1.0/address",
24
- addAddress: "/service/application/pos/cart/v1.0/address",
25
- getAddressById: "/service/application/pos/cart/v1.0/address/{id}",
26
- updateAddress: "/service/application/pos/cart/v1.0/address/{id}",
27
- removeAddress: "/service/application/pos/cart/v1.0/address/{id}",
28
- selectAddress: "/service/application/pos/cart/v1.0/select-address",
29
- selectPaymentMode: "/service/application/pos/cart/v1.0/payment",
30
- validateCouponForPayment:
31
- "/service/application/pos/cart/v1.0/payment/validate/",
32
- getShipments: "/service/application/pos/cart/v1.0/shipment",
33
- updateShipments: "/service/application/pos/cart/v1.0/shipment",
34
18
  checkoutCart: "/service/application/pos/cart/v1.0/checkout",
35
- updateCartMeta: "/service/application/pos/cart/v1.0/meta",
19
+ getAddressById: "/service/application/pos/cart/v1.0/address/{id}",
20
+ getAddresses: "/service/application/pos/cart/v1.0/address",
36
21
  getAvailableDeliveryModes:
37
22
  "/service/application/pos/cart/v1.0/available-delivery-mode",
38
- getStoreAddressByUid: "/service/application/pos/cart/v1.0/store-address",
23
+ getBulkDiscountOffers: "/service/application/pos/cart/v1.0/bulk-price",
24
+ getCart: "/service/application/pos/cart/v1.0/detail",
25
+ getCartLastModified: "/service/application/pos/cart/v1.0/detail",
39
26
  getCartShareLink: "/service/application/pos/cart/v1.0/share-cart",
40
27
  getCartSharedItems:
41
28
  "/service/application/pos/cart/v1.0/share-cart/{token}",
29
+ getCoupons: "/service/application/pos/cart/v1.0/coupon",
30
+ getItemCount: "/service/application/pos/cart/v1.0/basic",
31
+ getShipments: "/service/application/pos/cart/v1.0/shipment",
32
+ getStoreAddressByUid: "/service/application/pos/cart/v1.0/store-address",
33
+ removeAddress: "/service/application/pos/cart/v1.0/address/{id}",
34
+ removeCoupon: "/service/application/pos/cart/v1.0/coupon",
35
+ selectAddress: "/service/application/pos/cart/v1.0/select-address",
36
+ selectPaymentMode: "/service/application/pos/cart/v1.0/payment",
37
+ updateAddress: "/service/application/pos/cart/v1.0/address/{id}",
38
+ updateCart: "/service/application/pos/cart/v1.0/detail",
39
+ updateCartMeta: "/service/application/pos/cart/v1.0/meta",
42
40
  updateCartWithSharedItems:
43
41
  "/service/application/pos/cart/v1.0/share-cart/{token}/{action}",
42
+ updateShipments: "/service/application/pos/cart/v1.0/shipment",
43
+ validateCouponForPayment:
44
+ "/service/application/pos/cart/v1.0/payment/validate/",
44
45
  };
45
46
  this._urls = Object.entries(this._relativeUrls).reduce(
46
47
  (urls, [method, relativeUrl]) => {
@@ -60,19 +61,14 @@ class PosCart {
60
61
 
61
62
  /**
62
63
  * @param {Object} arg - Arg object.
63
- * @param {string} [arg.id] -
64
- * @param {boolean} [arg.i] -
65
- * @param {boolean} [arg.b] -
66
- * @param {number} [arg.assignCardId] -
67
- * @param {string} [arg.areaCode] -
68
- * @param {boolean} [arg.buyNow] -
69
- * @returns {Promise<CartDetailResponse>} - Success response
70
- * @summary: Fetch all items added to the cart
71
- * @description: Use this API to get details of all the items added to a cart.
64
+ * @param {Address} arg.body
65
+ * @returns {Promise<SaveAddressResponse>} - Success response
66
+ * @summary: Add address to an account
67
+ * @description: Use this API to add an address to an account.
72
68
  */
73
- async getCart({ id, i, b, assignCardId, areaCode, buyNow } = {}) {
74
- const { error } = PosCartValidator.getCart().validate(
75
- { id, i, b, assignCardId, areaCode, buyNow },
69
+ async addAddress({ body } = {}) {
70
+ const { error } = PosCartValidator.addAddress().validate(
71
+ { body },
76
72
  { abortEarly: false, allowUnknown: true }
77
73
  );
78
74
  if (error) {
@@ -80,43 +76,37 @@ class PosCart {
80
76
  }
81
77
 
82
78
  // Showing warrnings if extra unknown parameters are found
83
- const { error: warrning } = PosCartValidator.getCart().validate(
84
- { id, i, b, assignCardId, areaCode, buyNow },
79
+ const { error: warrning } = PosCartValidator.addAddress().validate(
80
+ { body },
85
81
  { abortEarly: false, allowUnknown: false }
86
82
  );
87
83
  if (warrning) {
88
84
  Logger({
89
85
  level: "WARN",
90
- message: "Parameter Validation warrnings for getCart",
86
+ message: "Parameter Validation warrnings for addAddress",
91
87
  });
92
88
  Logger({ level: "WARN", message: warrning });
93
89
  }
94
90
 
95
91
  const query_params = {};
96
- query_params["id"] = id;
97
- query_params["i"] = i;
98
- query_params["b"] = b;
99
- query_params["assign_card_id"] = assignCardId;
100
- query_params["area_code"] = areaCode;
101
- query_params["buy_now"] = buyNow;
102
92
 
103
93
  const xHeaders = {};
104
94
 
105
- const response = await APIClient.execute(
95
+ const response = await ApplicationAPIClient.execute(
106
96
  this._conf,
107
- "get",
97
+ "post",
108
98
  constructUrl({
109
- url: this._urls["getCart"],
99
+ url: this._urls["addAddress"],
110
100
  params: {},
111
101
  }),
112
102
  query_params,
113
- undefined,
103
+ body,
114
104
  xHeaders
115
105
  );
116
106
 
117
107
  const {
118
108
  error: res_error,
119
- } = PosCartModel.CartDetailResponse().validate(response, {
109
+ } = PosCartModel.SaveAddressResponse().validate(response, {
120
110
  abortEarly: false,
121
111
  allowUnknown: false,
122
112
  });
@@ -124,68 +114,7 @@ class PosCart {
124
114
  if (res_error) {
125
115
  Logger({
126
116
  level: "WARN",
127
- message: "Response Validation Warnnings for getCart",
128
- });
129
- Logger({ level: "WARN", message: res_error });
130
- }
131
-
132
- return response;
133
- }
134
-
135
- /**
136
- * @param {Object} arg - Arg object.
137
- * @param {string} [arg.id] -
138
- * @returns {Promise<any>} - Success response
139
- * @summary: Fetch last-modified timestamp
140
- * @description: Use this API to fetch Last-Modified timestamp in header metadata.
141
- */
142
- async getCartLastModified({ id } = {}) {
143
- const { error } = PosCartValidator.getCartLastModified().validate(
144
- { id },
145
- { abortEarly: false, allowUnknown: true }
146
- );
147
- if (error) {
148
- return Promise.reject(new FDKClientValidationError(error));
149
- }
150
-
151
- // Showing warrnings if extra unknown parameters are found
152
- const { error: warrning } = PosCartValidator.getCartLastModified().validate(
153
- { id },
154
- { abortEarly: false, allowUnknown: false }
155
- );
156
- if (warrning) {
157
- Logger({
158
- level: "WARN",
159
- message: "Parameter Validation warrnings for getCartLastModified",
160
- });
161
- Logger({ level: "WARN", message: warrning });
162
- }
163
-
164
- const query_params = {};
165
- query_params["id"] = id;
166
-
167
- const xHeaders = {};
168
-
169
- const response = await APIClient.execute(
170
- this._conf,
171
- "head",
172
- constructUrl({
173
- url: this._urls["getCartLastModified"],
174
- params: {},
175
- }),
176
- query_params,
177
- undefined,
178
- xHeaders
179
- );
180
-
181
- const { error: res_error } = Joi.string()
182
- .allow("")
183
- .validate(response, { abortEarly: false, allowUnknown: false });
184
-
185
- if (res_error) {
186
- Logger({
187
- level: "WARN",
188
- message: "Response Validation Warnnings for getCartLastModified",
117
+ message: "Response Validation Warnnings for addAddress",
189
118
  });
190
119
  Logger({ level: "WARN", message: res_error });
191
120
  }
@@ -234,7 +163,7 @@ class PosCart {
234
163
 
235
164
  const xHeaders = {};
236
165
 
237
- const response = await APIClient.execute(
166
+ const response = await ApplicationAPIClient.execute(
238
167
  this._conf,
239
168
  "post",
240
169
  constructUrl({
@@ -266,19 +195,19 @@ class PosCart {
266
195
 
267
196
  /**
268
197
  * @param {Object} arg - Arg object.
269
- * @param {string} [arg.id] -
270
198
  * @param {boolean} [arg.i] -
271
199
  * @param {boolean} [arg.b] -
272
- * @param {string} [arg.areaCode] -
200
+ * @param {boolean} [arg.p] -
201
+ * @param {string} [arg.id] -
273
202
  * @param {boolean} [arg.buyNow] -
274
- * @param {UpdateCartRequest} arg.body
275
- * @returns {Promise<UpdateCartDetailResponse>} - Success response
276
- * @summary: Update items in the cart
277
- * @description: <p>Use this API to update items added to the cart with the help of a request object containing attributes like item_quantity and item_size. These attributes will be fetched from the following APIs</p> <ul> <li><font color="monochrome">operation</font> Operation for current api call. <b>update_item</b> for update items. <b>remove_item</b> for removing items.</li> <li> <font color="monochrome">item_id</font> "/platform/content/v1/products/"</li> <li> <font color="monochrome">item_size</font> "/platform/content/v1/products/:slug/sizes/"</li> <li> <font color="monochrome">quantity</font> item quantity (must be greater than or equal to 1)</li> <li> <font color="monochrome">article_id</font> "/content​/v1​/products​/:identifier​/sizes​/price​/"</li> <li> <font color="monochrome">item_index</font> item position in the cart (must be greater than or equal to 0)</li> </ul>
203
+ * @param {ApplyCouponRequest} arg.body
204
+ * @returns {Promise<CartDetailResponse>} - Success response
205
+ * @summary: Apply Coupon
206
+ * @description: Use this API to apply coupons on items in the cart.
278
207
  */
279
- async updateCart({ body, id, i, b, areaCode, buyNow } = {}) {
280
- const { error } = PosCartValidator.updateCart().validate(
281
- { body, id, i, b, areaCode, buyNow },
208
+ async applyCoupon({ body, i, b, p, id, buyNow } = {}) {
209
+ const { error } = PosCartValidator.applyCoupon().validate(
210
+ { body, i, b, p, id, buyNow },
282
211
  { abortEarly: false, allowUnknown: true }
283
212
  );
284
213
  if (error) {
@@ -286,32 +215,32 @@ class PosCart {
286
215
  }
287
216
 
288
217
  // Showing warrnings if extra unknown parameters are found
289
- const { error: warrning } = PosCartValidator.updateCart().validate(
290
- { body, id, i, b, areaCode, buyNow },
218
+ const { error: warrning } = PosCartValidator.applyCoupon().validate(
219
+ { body, i, b, p, id, buyNow },
291
220
  { abortEarly: false, allowUnknown: false }
292
221
  );
293
222
  if (warrning) {
294
223
  Logger({
295
224
  level: "WARN",
296
- message: "Parameter Validation warrnings for updateCart",
225
+ message: "Parameter Validation warrnings for applyCoupon",
297
226
  });
298
227
  Logger({ level: "WARN", message: warrning });
299
228
  }
300
229
 
301
230
  const query_params = {};
302
- query_params["id"] = id;
303
231
  query_params["i"] = i;
304
232
  query_params["b"] = b;
305
- query_params["area_code"] = areaCode;
233
+ query_params["p"] = p;
234
+ query_params["id"] = id;
306
235
  query_params["buy_now"] = buyNow;
307
236
 
308
237
  const xHeaders = {};
309
238
 
310
- const response = await APIClient.execute(
239
+ const response = await ApplicationAPIClient.execute(
311
240
  this._conf,
312
- "put",
241
+ "post",
313
242
  constructUrl({
314
- url: this._urls["updateCart"],
243
+ url: this._urls["applyCoupon"],
315
244
  params: {},
316
245
  }),
317
246
  query_params,
@@ -321,7 +250,7 @@ class PosCart {
321
250
 
322
251
  const {
323
252
  error: res_error,
324
- } = PosCartModel.UpdateCartDetailResponse().validate(response, {
253
+ } = PosCartModel.CartDetailResponse().validate(response, {
325
254
  abortEarly: false,
326
255
  allowUnknown: false,
327
256
  });
@@ -329,7 +258,7 @@ class PosCart {
329
258
  if (res_error) {
330
259
  Logger({
331
260
  level: "WARN",
332
- message: "Response Validation Warnnings for updateCart",
261
+ message: "Response Validation Warnnings for applyCoupon",
333
262
  });
334
263
  Logger({ level: "WARN", message: res_error });
335
264
  }
@@ -339,15 +268,18 @@ class PosCart {
339
268
 
340
269
  /**
341
270
  * @param {Object} arg - Arg object.
342
- * @param {string} [arg.id] - The unique identifier of the cart.
271
+ * @param {string} [arg.id] -
272
+ * @param {boolean} [arg.i] -
273
+ * @param {boolean} [arg.b] -
343
274
  * @param {boolean} [arg.buyNow] -
344
- * @returns {Promise<CartItemCountResponse>} - Success response
345
- * @summary: Count items in the cart
346
- * @description: Use this API to get the total number of items present in cart.
275
+ * @param {RewardPointRequest} arg.body
276
+ * @returns {Promise<CartDetailResponse>} - Success response
277
+ * @summary: Apply reward points at cart
278
+ * @description: Use this API to redeem a fixed no. of reward points by applying it to the cart.
347
279
  */
348
- async getItemCount({ id, buyNow } = {}) {
349
- const { error } = PosCartValidator.getItemCount().validate(
350
- { id, buyNow },
280
+ async applyRewardPoints({ body, id, i, b, buyNow } = {}) {
281
+ const { error } = PosCartValidator.applyRewardPoints().validate(
282
+ { body, id, i, b, buyNow },
351
283
  { abortEarly: false, allowUnknown: true }
352
284
  );
353
285
  if (error) {
@@ -355,39 +287,41 @@ class PosCart {
355
287
  }
356
288
 
357
289
  // Showing warrnings if extra unknown parameters are found
358
- const { error: warrning } = PosCartValidator.getItemCount().validate(
359
- { id, buyNow },
290
+ const { error: warrning } = PosCartValidator.applyRewardPoints().validate(
291
+ { body, id, i, b, buyNow },
360
292
  { abortEarly: false, allowUnknown: false }
361
293
  );
362
294
  if (warrning) {
363
295
  Logger({
364
296
  level: "WARN",
365
- message: "Parameter Validation warrnings for getItemCount",
297
+ message: "Parameter Validation warrnings for applyRewardPoints",
366
298
  });
367
299
  Logger({ level: "WARN", message: warrning });
368
300
  }
369
301
 
370
302
  const query_params = {};
371
303
  query_params["id"] = id;
304
+ query_params["i"] = i;
305
+ query_params["b"] = b;
372
306
  query_params["buy_now"] = buyNow;
373
307
 
374
308
  const xHeaders = {};
375
309
 
376
- const response = await APIClient.execute(
310
+ const response = await ApplicationAPIClient.execute(
377
311
  this._conf,
378
- "get",
312
+ "post",
379
313
  constructUrl({
380
- url: this._urls["getItemCount"],
314
+ url: this._urls["applyRewardPoints"],
381
315
  params: {},
382
316
  }),
383
317
  query_params,
384
- undefined,
318
+ body,
385
319
  xHeaders
386
320
  );
387
321
 
388
322
  const {
389
323
  error: res_error,
390
- } = PosCartModel.CartItemCountResponse().validate(response, {
324
+ } = PosCartModel.CartDetailResponse().validate(response, {
391
325
  abortEarly: false,
392
326
  allowUnknown: false,
393
327
  });
@@ -395,7 +329,7 @@ class PosCart {
395
329
  if (res_error) {
396
330
  Logger({
397
331
  level: "WARN",
398
- message: "Response Validation Warnnings for getItemCount",
332
+ message: "Response Validation Warnnings for applyRewardPoints",
399
333
  });
400
334
  Logger({ level: "WARN", message: res_error });
401
335
  }
@@ -406,14 +340,14 @@ class PosCart {
406
340
  /**
407
341
  * @param {Object} arg - Arg object.
408
342
  * @param {string} [arg.id] -
409
- * @param {boolean} [arg.buyNow] -
410
- * @returns {Promise<GetCouponResponse>} - Success response
411
- * @summary: Fetch Coupon
412
- * @description: Use this API to get a list of available coupons along with their details.
343
+ * @param {CartPosCheckoutDetailRequest} arg.body
344
+ * @returns {Promise<CartCheckoutResponse>} - Success response
345
+ * @summary: Checkout all items in the cart
346
+ * @description: Use this API to checkout all items in the cart for payment and order generation. For COD, order will be generated directly, whereas for other checkout modes, user will be redirected to a payment gateway.
413
347
  */
414
- async getCoupons({ id, buyNow } = {}) {
415
- const { error } = PosCartValidator.getCoupons().validate(
416
- { id, buyNow },
348
+ async checkoutCart({ body, id } = {}) {
349
+ const { error } = PosCartValidator.checkoutCart().validate(
350
+ { body, id },
417
351
  { abortEarly: false, allowUnknown: true }
418
352
  );
419
353
  if (error) {
@@ -421,39 +355,38 @@ class PosCart {
421
355
  }
422
356
 
423
357
  // Showing warrnings if extra unknown parameters are found
424
- const { error: warrning } = PosCartValidator.getCoupons().validate(
425
- { id, buyNow },
358
+ const { error: warrning } = PosCartValidator.checkoutCart().validate(
359
+ { body, id },
426
360
  { abortEarly: false, allowUnknown: false }
427
361
  );
428
362
  if (warrning) {
429
363
  Logger({
430
364
  level: "WARN",
431
- message: "Parameter Validation warrnings for getCoupons",
365
+ message: "Parameter Validation warrnings for checkoutCart",
432
366
  });
433
367
  Logger({ level: "WARN", message: warrning });
434
368
  }
435
369
 
436
370
  const query_params = {};
437
371
  query_params["id"] = id;
438
- query_params["buy_now"] = buyNow;
439
372
 
440
373
  const xHeaders = {};
441
374
 
442
- const response = await APIClient.execute(
375
+ const response = await ApplicationAPIClient.execute(
443
376
  this._conf,
444
- "get",
377
+ "post",
445
378
  constructUrl({
446
- url: this._urls["getCoupons"],
379
+ url: this._urls["checkoutCart"],
447
380
  params: {},
448
381
  }),
449
382
  query_params,
450
- undefined,
383
+ body,
451
384
  xHeaders
452
385
  );
453
386
 
454
387
  const {
455
388
  error: res_error,
456
- } = PosCartModel.GetCouponResponse().validate(response, {
389
+ } = PosCartModel.CartCheckoutResponse().validate(response, {
457
390
  abortEarly: false,
458
391
  allowUnknown: false,
459
392
  });
@@ -461,7 +394,7 @@ class PosCart {
461
394
  if (res_error) {
462
395
  Logger({
463
396
  level: "WARN",
464
- message: "Response Validation Warnnings for getCoupons",
397
+ message: "Response Validation Warnnings for checkoutCart",
465
398
  });
466
399
  Logger({ level: "WARN", message: res_error });
467
400
  }
@@ -471,19 +404,28 @@ class PosCart {
471
404
 
472
405
  /**
473
406
  * @param {Object} arg - Arg object.
474
- * @param {boolean} [arg.i] -
475
- * @param {boolean} [arg.b] -
476
- * @param {boolean} [arg.p] -
477
- * @param {string} [arg.id] -
407
+ * @param {string} arg.id -
408
+ * @param {string} [arg.cartId] -
478
409
  * @param {boolean} [arg.buyNow] -
479
- * @param {ApplyCouponRequest} arg.body
480
- * @returns {Promise<CartDetailResponse>} - Success response
481
- * @summary: Apply Coupon
482
- * @description: Use this API to apply coupons on items in the cart.
483
- */
484
- async applyCoupon({ body, i, b, p, id, buyNow } = {}) {
485
- const { error } = PosCartValidator.applyCoupon().validate(
486
- { body, i, b, p, id, buyNow },
410
+ * @param {string} [arg.mobileNo] -
411
+ * @param {string} [arg.checkoutMode] -
412
+ * @param {string} [arg.tags] -
413
+ * @param {boolean} [arg.isDefault] -
414
+ * @returns {Promise<Address>} - Success response
415
+ * @summary: Fetch a single address by its ID
416
+ * @description: Use this API to get an addresses using its ID. If successful, returns a Address resource in the response body specified in `Address`. Attibutes listed below are optional <ul> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
417
+ */
418
+ async getAddressById({
419
+ id,
420
+ cartId,
421
+ buyNow,
422
+ mobileNo,
423
+ checkoutMode,
424
+ tags,
425
+ isDefault,
426
+ } = {}) {
427
+ const { error } = PosCartValidator.getAddressById().validate(
428
+ { id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
487
429
  { abortEarly: false, allowUnknown: true }
488
430
  );
489
431
  if (error) {
@@ -491,42 +433,122 @@ class PosCart {
491
433
  }
492
434
 
493
435
  // Showing warrnings if extra unknown parameters are found
494
- const { error: warrning } = PosCartValidator.applyCoupon().validate(
495
- { body, i, b, p, id, buyNow },
436
+ const { error: warrning } = PosCartValidator.getAddressById().validate(
437
+ { id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
496
438
  { abortEarly: false, allowUnknown: false }
497
439
  );
498
440
  if (warrning) {
499
441
  Logger({
500
442
  level: "WARN",
501
- message: "Parameter Validation warrnings for applyCoupon",
443
+ message: "Parameter Validation warrnings for getAddressById",
502
444
  });
503
445
  Logger({ level: "WARN", message: warrning });
504
446
  }
505
447
 
506
448
  const query_params = {};
507
- query_params["i"] = i;
508
- query_params["b"] = b;
509
- query_params["p"] = p;
510
- query_params["id"] = id;
449
+ query_params["cart_id"] = cartId;
511
450
  query_params["buy_now"] = buyNow;
451
+ query_params["mobile_no"] = mobileNo;
452
+ query_params["checkout_mode"] = checkoutMode;
453
+ query_params["tags"] = tags;
454
+ query_params["is_default"] = isDefault;
512
455
 
513
456
  const xHeaders = {};
514
457
 
515
- const response = await APIClient.execute(
458
+ const response = await ApplicationAPIClient.execute(
516
459
  this._conf,
517
- "post",
460
+ "get",
518
461
  constructUrl({
519
- url: this._urls["applyCoupon"],
462
+ url: this._urls["getAddressById"],
463
+ params: { id },
464
+ }),
465
+ query_params,
466
+ undefined,
467
+ xHeaders
468
+ );
469
+
470
+ const { error: res_error } = PosCartModel.Address().validate(response, {
471
+ abortEarly: false,
472
+ allowUnknown: false,
473
+ });
474
+
475
+ if (res_error) {
476
+ Logger({
477
+ level: "WARN",
478
+ message: "Response Validation Warnnings for getAddressById",
479
+ });
480
+ Logger({ level: "WARN", message: res_error });
481
+ }
482
+
483
+ return response;
484
+ }
485
+
486
+ /**
487
+ * @param {Object} arg - Arg object.
488
+ * @param {string} [arg.cartId] -
489
+ * @param {boolean} [arg.buyNow] -
490
+ * @param {string} [arg.mobileNo] -
491
+ * @param {string} [arg.checkoutMode] -
492
+ * @param {string} [arg.tags] -
493
+ * @param {boolean} [arg.isDefault] -
494
+ * @returns {Promise<GetAddressesResponse>} - Success response
495
+ * @summary: Fetch address
496
+ * @description: Use this API to get all the addresses associated with an account. If successful, returns a Address resource in the response body specified in GetAddressesResponse.attibutes listed below are optional <ul> <li> <font color="monochrome">uid</font></li> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
497
+ */
498
+ async getAddresses({
499
+ cartId,
500
+ buyNow,
501
+ mobileNo,
502
+ checkoutMode,
503
+ tags,
504
+ isDefault,
505
+ } = {}) {
506
+ const { error } = PosCartValidator.getAddresses().validate(
507
+ { cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
508
+ { abortEarly: false, allowUnknown: true }
509
+ );
510
+ if (error) {
511
+ return Promise.reject(new FDKClientValidationError(error));
512
+ }
513
+
514
+ // Showing warrnings if extra unknown parameters are found
515
+ const { error: warrning } = PosCartValidator.getAddresses().validate(
516
+ { cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
517
+ { abortEarly: false, allowUnknown: false }
518
+ );
519
+ if (warrning) {
520
+ Logger({
521
+ level: "WARN",
522
+ message: "Parameter Validation warrnings for getAddresses",
523
+ });
524
+ Logger({ level: "WARN", message: warrning });
525
+ }
526
+
527
+ const query_params = {};
528
+ query_params["cart_id"] = cartId;
529
+ query_params["buy_now"] = buyNow;
530
+ query_params["mobile_no"] = mobileNo;
531
+ query_params["checkout_mode"] = checkoutMode;
532
+ query_params["tags"] = tags;
533
+ query_params["is_default"] = isDefault;
534
+
535
+ const xHeaders = {};
536
+
537
+ const response = await ApplicationAPIClient.execute(
538
+ this._conf,
539
+ "get",
540
+ constructUrl({
541
+ url: this._urls["getAddresses"],
520
542
  params: {},
521
543
  }),
522
544
  query_params,
523
- body,
545
+ undefined,
524
546
  xHeaders
525
547
  );
526
548
 
527
549
  const {
528
550
  error: res_error,
529
- } = PosCartModel.CartDetailResponse().validate(response, {
551
+ } = PosCartModel.GetAddressesResponse().validate(response, {
530
552
  abortEarly: false,
531
553
  allowUnknown: false,
532
554
  });
@@ -534,7 +556,7 @@ class PosCart {
534
556
  if (res_error) {
535
557
  Logger({
536
558
  level: "WARN",
537
- message: "Response Validation Warnnings for applyCoupon",
559
+ message: "Response Validation Warnnings for getAddresses",
538
560
  });
539
561
  Logger({ level: "WARN", message: res_error });
540
562
  }
@@ -544,15 +566,15 @@ class PosCart {
544
566
 
545
567
  /**
546
568
  * @param {Object} arg - Arg object.
569
+ * @param {string} arg.areaCode -
547
570
  * @param {string} [arg.id] -
548
- * @param {boolean} [arg.buyNow] -
549
- * @returns {Promise<CartDetailResponse>} - Success response
550
- * @summary: Remove Coupon Applied
551
- * @description: Remove Coupon applied on the cart by passing uid in request body.
571
+ * @returns {Promise<CartDeliveryModesResponse>} - Success response
572
+ * @summary: Get available delivery modes for cart
573
+ * @description: Use this API to get the delivery modes (home-delivery/store-pickup) along with a list of pickup stores available for a given cart at a given PIN Code. User can then view the address of a pickup store with the help of store-address API.
552
574
  */
553
- async removeCoupon({ id, buyNow } = {}) {
554
- const { error } = PosCartValidator.removeCoupon().validate(
555
- { id, buyNow },
575
+ async getAvailableDeliveryModes({ areaCode, id } = {}) {
576
+ const { error } = PosCartValidator.getAvailableDeliveryModes().validate(
577
+ { areaCode, id },
556
578
  { abortEarly: false, allowUnknown: true }
557
579
  );
558
580
  if (error) {
@@ -560,29 +582,31 @@ class PosCart {
560
582
  }
561
583
 
562
584
  // Showing warrnings if extra unknown parameters are found
563
- const { error: warrning } = PosCartValidator.removeCoupon().validate(
564
- { id, buyNow },
585
+ const {
586
+ error: warrning,
587
+ } = PosCartValidator.getAvailableDeliveryModes().validate(
588
+ { areaCode, id },
565
589
  { abortEarly: false, allowUnknown: false }
566
590
  );
567
591
  if (warrning) {
568
592
  Logger({
569
593
  level: "WARN",
570
- message: "Parameter Validation warrnings for removeCoupon",
594
+ message: "Parameter Validation warrnings for getAvailableDeliveryModes",
571
595
  });
572
596
  Logger({ level: "WARN", message: warrning });
573
597
  }
574
598
 
575
599
  const query_params = {};
600
+ query_params["area_code"] = areaCode;
576
601
  query_params["id"] = id;
577
- query_params["buy_now"] = buyNow;
578
602
 
579
603
  const xHeaders = {};
580
604
 
581
- const response = await APIClient.execute(
605
+ const response = await ApplicationAPIClient.execute(
582
606
  this._conf,
583
- "delete",
607
+ "get",
584
608
  constructUrl({
585
- url: this._urls["removeCoupon"],
609
+ url: this._urls["getAvailableDeliveryModes"],
586
610
  params: {},
587
611
  }),
588
612
  query_params,
@@ -592,7 +616,7 @@ class PosCart {
592
616
 
593
617
  const {
594
618
  error: res_error,
595
- } = PosCartModel.CartDetailResponse().validate(response, {
619
+ } = PosCartModel.CartDeliveryModesResponse().validate(response, {
596
620
  abortEarly: false,
597
621
  allowUnknown: false,
598
622
  });
@@ -600,7 +624,7 @@ class PosCart {
600
624
  if (res_error) {
601
625
  Logger({
602
626
  level: "WARN",
603
- message: "Response Validation Warnnings for removeCoupon",
627
+ message: "Response Validation Warnnings for getAvailableDeliveryModes",
604
628
  });
605
629
  Logger({ level: "WARN", message: res_error });
606
630
  }
@@ -652,7 +676,7 @@ class PosCart {
652
676
 
653
677
  const xHeaders = {};
654
678
 
655
- const response = await APIClient.execute(
679
+ const response = await ApplicationAPIClient.execute(
656
680
  this._conf,
657
681
  "get",
658
682
  constructUrl({
@@ -687,15 +711,16 @@ class PosCart {
687
711
  * @param {string} [arg.id] -
688
712
  * @param {boolean} [arg.i] -
689
713
  * @param {boolean} [arg.b] -
714
+ * @param {number} [arg.assignCardId] -
715
+ * @param {string} [arg.areaCode] -
690
716
  * @param {boolean} [arg.buyNow] -
691
- * @param {RewardPointRequest} arg.body
692
717
  * @returns {Promise<CartDetailResponse>} - Success response
693
- * @summary: Apply reward points at cart
694
- * @description: Use this API to redeem a fixed no. of reward points by applying it to the cart.
718
+ * @summary: Fetch all items added to the cart
719
+ * @description: Use this API to get details of all the items added to a cart.
695
720
  */
696
- async applyRewardPoints({ body, id, i, b, buyNow } = {}) {
697
- const { error } = PosCartValidator.applyRewardPoints().validate(
698
- { body, id, i, b, buyNow },
721
+ async getCart({ id, i, b, assignCardId, areaCode, buyNow } = {}) {
722
+ const { error } = PosCartValidator.getCart().validate(
723
+ { id, i, b, assignCardId, areaCode, buyNow },
699
724
  { abortEarly: false, allowUnknown: true }
700
725
  );
701
726
  if (error) {
@@ -703,14 +728,14 @@ class PosCart {
703
728
  }
704
729
 
705
730
  // Showing warrnings if extra unknown parameters are found
706
- const { error: warrning } = PosCartValidator.applyRewardPoints().validate(
707
- { body, id, i, b, buyNow },
731
+ const { error: warrning } = PosCartValidator.getCart().validate(
732
+ { id, i, b, assignCardId, areaCode, buyNow },
708
733
  { abortEarly: false, allowUnknown: false }
709
734
  );
710
735
  if (warrning) {
711
736
  Logger({
712
737
  level: "WARN",
713
- message: "Parameter Validation warrnings for applyRewardPoints",
738
+ message: "Parameter Validation warrnings for getCart",
714
739
  });
715
740
  Logger({ level: "WARN", message: warrning });
716
741
  }
@@ -719,19 +744,21 @@ class PosCart {
719
744
  query_params["id"] = id;
720
745
  query_params["i"] = i;
721
746
  query_params["b"] = b;
747
+ query_params["assign_card_id"] = assignCardId;
748
+ query_params["area_code"] = areaCode;
722
749
  query_params["buy_now"] = buyNow;
723
750
 
724
751
  const xHeaders = {};
725
752
 
726
- const response = await APIClient.execute(
753
+ const response = await ApplicationAPIClient.execute(
727
754
  this._conf,
728
- "post",
755
+ "get",
729
756
  constructUrl({
730
- url: this._urls["applyRewardPoints"],
757
+ url: this._urls["getCart"],
731
758
  params: {},
732
759
  }),
733
760
  query_params,
734
- body,
761
+ undefined,
735
762
  xHeaders
736
763
  );
737
764
 
@@ -745,7 +772,7 @@ class PosCart {
745
772
  if (res_error) {
746
773
  Logger({
747
774
  level: "WARN",
748
- message: "Response Validation Warnnings for applyRewardPoints",
775
+ message: "Response Validation Warnnings for getCart",
749
776
  });
750
777
  Logger({ level: "WARN", message: res_error });
751
778
  }
@@ -755,26 +782,14 @@ class PosCart {
755
782
 
756
783
  /**
757
784
  * @param {Object} arg - Arg object.
758
- * @param {string} [arg.cartId] -
759
- * @param {boolean} [arg.buyNow] -
760
- * @param {string} [arg.mobileNo] -
761
- * @param {string} [arg.checkoutMode] -
762
- * @param {string} [arg.tags] -
763
- * @param {boolean} [arg.isDefault] -
764
- * @returns {Promise<GetAddressesResponse>} - Success response
765
- * @summary: Fetch address
766
- * @description: Use this API to get all the addresses associated with an account. If successful, returns a Address resource in the response body specified in GetAddressesResponse.attibutes listed below are optional <ul> <li> <font color="monochrome">uid</font></li> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
785
+ * @param {string} [arg.id] -
786
+ * @returns {Promise<any>} - Success response
787
+ * @summary: Fetch last-modified timestamp
788
+ * @description: Use this API to fetch Last-Modified timestamp in header metadata.
767
789
  */
768
- async getAddresses({
769
- cartId,
770
- buyNow,
771
- mobileNo,
772
- checkoutMode,
773
- tags,
774
- isDefault,
775
- } = {}) {
776
- const { error } = PosCartValidator.getAddresses().validate(
777
- { cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
790
+ async getCartLastModified({ id } = {}) {
791
+ const { error } = PosCartValidator.getCartLastModified().validate(
792
+ { id },
778
793
  { abortEarly: false, allowUnknown: true }
779
794
  );
780
795
  if (error) {
@@ -782,33 +797,28 @@ class PosCart {
782
797
  }
783
798
 
784
799
  // Showing warrnings if extra unknown parameters are found
785
- const { error: warrning } = PosCartValidator.getAddresses().validate(
786
- { cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
800
+ const { error: warrning } = PosCartValidator.getCartLastModified().validate(
801
+ { id },
787
802
  { abortEarly: false, allowUnknown: false }
788
803
  );
789
804
  if (warrning) {
790
805
  Logger({
791
806
  level: "WARN",
792
- message: "Parameter Validation warrnings for getAddresses",
807
+ message: "Parameter Validation warrnings for getCartLastModified",
793
808
  });
794
809
  Logger({ level: "WARN", message: warrning });
795
810
  }
796
811
 
797
812
  const query_params = {};
798
- query_params["cart_id"] = cartId;
799
- query_params["buy_now"] = buyNow;
800
- query_params["mobile_no"] = mobileNo;
801
- query_params["checkout_mode"] = checkoutMode;
802
- query_params["tags"] = tags;
803
- query_params["is_default"] = isDefault;
813
+ query_params["id"] = id;
804
814
 
805
815
  const xHeaders = {};
806
816
 
807
- const response = await APIClient.execute(
817
+ const response = await ApplicationAPIClient.execute(
808
818
  this._conf,
809
- "get",
819
+ "head",
810
820
  constructUrl({
811
- url: this._urls["getAddresses"],
821
+ url: this._urls["getCartLastModified"],
812
822
  params: {},
813
823
  }),
814
824
  query_params,
@@ -816,17 +826,14 @@ class PosCart {
816
826
  xHeaders
817
827
  );
818
828
 
819
- const {
820
- error: res_error,
821
- } = PosCartModel.GetAddressesResponse().validate(response, {
822
- abortEarly: false,
823
- allowUnknown: false,
824
- });
829
+ const { error: res_error } = Joi.string()
830
+ .allow("")
831
+ .validate(response, { abortEarly: false, allowUnknown: false });
825
832
 
826
833
  if (res_error) {
827
834
  Logger({
828
835
  level: "WARN",
829
- message: "Response Validation Warnnings for getAddresses",
836
+ message: "Response Validation Warnnings for getCartLastModified",
830
837
  });
831
838
  Logger({ level: "WARN", message: res_error });
832
839
  }
@@ -836,13 +843,13 @@ class PosCart {
836
843
 
837
844
  /**
838
845
  * @param {Object} arg - Arg object.
839
- * @param {Address} arg.body
840
- * @returns {Promise<SaveAddressResponse>} - Success response
841
- * @summary: Add address to an account
842
- * @description: Use this API to add an address to an account.
846
+ * @param {GetShareCartLinkRequest} arg.body
847
+ * @returns {Promise<GetShareCartLinkResponse>} - Success response
848
+ * @summary: Generate token for sharing the cart
849
+ * @description: Use this API to generate a shared cart snapshot and return a shortlink token. The link can be shared with other users for getting the same items in their cart.
843
850
  */
844
- async addAddress({ body } = {}) {
845
- const { error } = PosCartValidator.addAddress().validate(
851
+ async getCartShareLink({ body } = {}) {
852
+ const { error } = PosCartValidator.getCartShareLink().validate(
846
853
  { body },
847
854
  { abortEarly: false, allowUnknown: true }
848
855
  );
@@ -851,14 +858,14 @@ class PosCart {
851
858
  }
852
859
 
853
860
  // Showing warrnings if extra unknown parameters are found
854
- const { error: warrning } = PosCartValidator.addAddress().validate(
861
+ const { error: warrning } = PosCartValidator.getCartShareLink().validate(
855
862
  { body },
856
863
  { abortEarly: false, allowUnknown: false }
857
864
  );
858
865
  if (warrning) {
859
866
  Logger({
860
867
  level: "WARN",
861
- message: "Parameter Validation warrnings for addAddress",
868
+ message: "Parameter Validation warrnings for getCartShareLink",
862
869
  });
863
870
  Logger({ level: "WARN", message: warrning });
864
871
  }
@@ -867,11 +874,11 @@ class PosCart {
867
874
 
868
875
  const xHeaders = {};
869
876
 
870
- const response = await APIClient.execute(
877
+ const response = await ApplicationAPIClient.execute(
871
878
  this._conf,
872
879
  "post",
873
880
  constructUrl({
874
- url: this._urls["addAddress"],
881
+ url: this._urls["getCartShareLink"],
875
882
  params: {},
876
883
  }),
877
884
  query_params,
@@ -881,7 +888,7 @@ class PosCart {
881
888
 
882
889
  const {
883
890
  error: res_error,
884
- } = PosCartModel.SaveAddressResponse().validate(response, {
891
+ } = PosCartModel.GetShareCartLinkResponse().validate(response, {
885
892
  abortEarly: false,
886
893
  allowUnknown: false,
887
894
  });
@@ -889,7 +896,7 @@ class PosCart {
889
896
  if (res_error) {
890
897
  Logger({
891
898
  level: "WARN",
892
- message: "Response Validation Warnnings for addAddress",
899
+ message: "Response Validation Warnnings for getCartShareLink",
893
900
  });
894
901
  Logger({ level: "WARN", message: res_error });
895
902
  }
@@ -899,28 +906,14 @@ class PosCart {
899
906
 
900
907
  /**
901
908
  * @param {Object} arg - Arg object.
902
- * @param {string} arg.id -
903
- * @param {string} [arg.cartId] -
904
- * @param {boolean} [arg.buyNow] -
905
- * @param {string} [arg.mobileNo] -
906
- * @param {string} [arg.checkoutMode] -
907
- * @param {string} [arg.tags] -
908
- * @param {boolean} [arg.isDefault] -
909
- * @returns {Promise<Address>} - Success response
910
- * @summary: Fetch a single address by its ID
911
- * @description: Use this API to get an addresses using its ID. If successful, returns a Address resource in the response body specified in `Address`. Attibutes listed below are optional <ul> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
909
+ * @param {string} arg.token - Token of the shared short link
910
+ * @returns {Promise<SharedCartResponse>} - Success response
911
+ * @summary: Get details of a shared cart
912
+ * @description: Use this API to get the shared cart details as per the token generated using the share-cart API.
912
913
  */
913
- async getAddressById({
914
- id,
915
- cartId,
916
- buyNow,
917
- mobileNo,
918
- checkoutMode,
919
- tags,
920
- isDefault,
921
- } = {}) {
922
- const { error } = PosCartValidator.getAddressById().validate(
923
- { id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
914
+ async getCartSharedItems({ token } = {}) {
915
+ const { error } = PosCartValidator.getCartSharedItems().validate(
916
+ { token },
924
917
  { abortEarly: false, allowUnknown: true }
925
918
  );
926
919
  if (error) {
@@ -928,41 +921,37 @@ class PosCart {
928
921
  }
929
922
 
930
923
  // Showing warrnings if extra unknown parameters are found
931
- const { error: warrning } = PosCartValidator.getAddressById().validate(
932
- { id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
924
+ const { error: warrning } = PosCartValidator.getCartSharedItems().validate(
925
+ { token },
933
926
  { abortEarly: false, allowUnknown: false }
934
927
  );
935
928
  if (warrning) {
936
929
  Logger({
937
930
  level: "WARN",
938
- message: "Parameter Validation warrnings for getAddressById",
931
+ message: "Parameter Validation warrnings for getCartSharedItems",
939
932
  });
940
933
  Logger({ level: "WARN", message: warrning });
941
934
  }
942
935
 
943
936
  const query_params = {};
944
- query_params["cart_id"] = cartId;
945
- query_params["buy_now"] = buyNow;
946
- query_params["mobile_no"] = mobileNo;
947
- query_params["checkout_mode"] = checkoutMode;
948
- query_params["tags"] = tags;
949
- query_params["is_default"] = isDefault;
950
937
 
951
938
  const xHeaders = {};
952
939
 
953
- const response = await APIClient.execute(
940
+ const response = await ApplicationAPIClient.execute(
954
941
  this._conf,
955
942
  "get",
956
943
  constructUrl({
957
- url: this._urls["getAddressById"],
958
- params: { id },
944
+ url: this._urls["getCartSharedItems"],
945
+ params: { token },
959
946
  }),
960
947
  query_params,
961
948
  undefined,
962
949
  xHeaders
963
950
  );
964
951
 
965
- const { error: res_error } = PosCartModel.Address().validate(response, {
952
+ const {
953
+ error: res_error,
954
+ } = PosCartModel.SharedCartResponse().validate(response, {
966
955
  abortEarly: false,
967
956
  allowUnknown: false,
968
957
  });
@@ -970,7 +959,7 @@ class PosCart {
970
959
  if (res_error) {
971
960
  Logger({
972
961
  level: "WARN",
973
- message: "Response Validation Warnnings for getAddressById",
962
+ message: "Response Validation Warnnings for getCartSharedItems",
974
963
  });
975
964
  Logger({ level: "WARN", message: res_error });
976
965
  }
@@ -980,15 +969,15 @@ class PosCart {
980
969
 
981
970
  /**
982
971
  * @param {Object} arg - Arg object.
983
- * @param {string} arg.id - ID allotted to the selected address
984
- * @param {Address} arg.body
985
- * @returns {Promise<UpdateAddressResponse>} - Success response
986
- * @summary: Update address added to an account
987
- * @description: <p>Use this API to update an existing address in the account. Request object should contain attributes mentioned in <font color="blue">Address </font> can be updated. These attributes are:</p> <ul> <li> <font color="monochrome">is_default_address</font></li> <li> <font color="monochrome">landmark</font></li> <li> <font color="monochrome">area</font></li> <li> <font color="monochrome">pincode</font></li> <li> <font color="monochrome">email</font></li> <li> <font color="monochrome">address_type</font></li> <li> <font color="monochrome">name</font></li> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">address</font></li> </ul>
972
+ * @param {string} [arg.id] -
973
+ * @param {boolean} [arg.buyNow] -
974
+ * @returns {Promise<GetCouponResponse>} - Success response
975
+ * @summary: Fetch Coupon
976
+ * @description: Use this API to get a list of available coupons along with their details.
988
977
  */
989
- async updateAddress({ id, body } = {}) {
990
- const { error } = PosCartValidator.updateAddress().validate(
991
- { id, body },
978
+ async getCoupons({ id, buyNow } = {}) {
979
+ const { error } = PosCartValidator.getCoupons().validate(
980
+ { id, buyNow },
992
981
  { abortEarly: false, allowUnknown: true }
993
982
  );
994
983
  if (error) {
@@ -996,37 +985,39 @@ class PosCart {
996
985
  }
997
986
 
998
987
  // Showing warrnings if extra unknown parameters are found
999
- const { error: warrning } = PosCartValidator.updateAddress().validate(
1000
- { id, body },
988
+ const { error: warrning } = PosCartValidator.getCoupons().validate(
989
+ { id, buyNow },
1001
990
  { abortEarly: false, allowUnknown: false }
1002
991
  );
1003
992
  if (warrning) {
1004
993
  Logger({
1005
994
  level: "WARN",
1006
- message: "Parameter Validation warrnings for updateAddress",
995
+ message: "Parameter Validation warrnings for getCoupons",
1007
996
  });
1008
997
  Logger({ level: "WARN", message: warrning });
1009
998
  }
1010
999
 
1011
1000
  const query_params = {};
1001
+ query_params["id"] = id;
1002
+ query_params["buy_now"] = buyNow;
1012
1003
 
1013
1004
  const xHeaders = {};
1014
1005
 
1015
- const response = await APIClient.execute(
1006
+ const response = await ApplicationAPIClient.execute(
1016
1007
  this._conf,
1017
- "put",
1008
+ "get",
1018
1009
  constructUrl({
1019
- url: this._urls["updateAddress"],
1020
- params: { id },
1010
+ url: this._urls["getCoupons"],
1011
+ params: {},
1021
1012
  }),
1022
1013
  query_params,
1023
- body,
1014
+ undefined,
1024
1015
  xHeaders
1025
1016
  );
1026
1017
 
1027
1018
  const {
1028
1019
  error: res_error,
1029
- } = PosCartModel.UpdateAddressResponse().validate(response, {
1020
+ } = PosCartModel.GetCouponResponse().validate(response, {
1030
1021
  abortEarly: false,
1031
1022
  allowUnknown: false,
1032
1023
  });
@@ -1034,7 +1025,7 @@ class PosCart {
1034
1025
  if (res_error) {
1035
1026
  Logger({
1036
1027
  level: "WARN",
1037
- message: "Response Validation Warnnings for updateAddress",
1028
+ message: "Response Validation Warnnings for getCoupons",
1038
1029
  });
1039
1030
  Logger({ level: "WARN", message: res_error });
1040
1031
  }
@@ -1044,14 +1035,15 @@ class PosCart {
1044
1035
 
1045
1036
  /**
1046
1037
  * @param {Object} arg - Arg object.
1047
- * @param {string} arg.id - ID allotted to the selected address
1048
- * @returns {Promise<DeleteAddressResponse>} - Success response
1049
- * @summary: Remove address associated with an account
1050
- * @description: Use this API to delete an address by its ID. This will returns an object that will indicate whether the address was deleted successfully or not.
1038
+ * @param {string} [arg.id] - The unique identifier of the cart.
1039
+ * @param {boolean} [arg.buyNow] -
1040
+ * @returns {Promise<CartItemCountResponse>} - Success response
1041
+ * @summary: Count items in the cart
1042
+ * @description: Use this API to get the total number of items present in cart.
1051
1043
  */
1052
- async removeAddress({ id } = {}) {
1053
- const { error } = PosCartValidator.removeAddress().validate(
1054
- { id },
1044
+ async getItemCount({ id, buyNow } = {}) {
1045
+ const { error } = PosCartValidator.getItemCount().validate(
1046
+ { id, buyNow },
1055
1047
  { abortEarly: false, allowUnknown: true }
1056
1048
  );
1057
1049
  if (error) {
@@ -1059,28 +1051,30 @@ class PosCart {
1059
1051
  }
1060
1052
 
1061
1053
  // Showing warrnings if extra unknown parameters are found
1062
- const { error: warrning } = PosCartValidator.removeAddress().validate(
1063
- { id },
1054
+ const { error: warrning } = PosCartValidator.getItemCount().validate(
1055
+ { id, buyNow },
1064
1056
  { abortEarly: false, allowUnknown: false }
1065
1057
  );
1066
1058
  if (warrning) {
1067
1059
  Logger({
1068
1060
  level: "WARN",
1069
- message: "Parameter Validation warrnings for removeAddress",
1061
+ message: "Parameter Validation warrnings for getItemCount",
1070
1062
  });
1071
1063
  Logger({ level: "WARN", message: warrning });
1072
1064
  }
1073
1065
 
1074
1066
  const query_params = {};
1067
+ query_params["id"] = id;
1068
+ query_params["buy_now"] = buyNow;
1075
1069
 
1076
1070
  const xHeaders = {};
1077
1071
 
1078
- const response = await APIClient.execute(
1072
+ const response = await ApplicationAPIClient.execute(
1079
1073
  this._conf,
1080
- "delete",
1074
+ "get",
1081
1075
  constructUrl({
1082
- url: this._urls["removeAddress"],
1083
- params: { id },
1076
+ url: this._urls["getItemCount"],
1077
+ params: {},
1084
1078
  }),
1085
1079
  query_params,
1086
1080
  undefined,
@@ -1089,7 +1083,7 @@ class PosCart {
1089
1083
 
1090
1084
  const {
1091
1085
  error: res_error,
1092
- } = PosCartModel.DeleteAddressResponse().validate(response, {
1086
+ } = PosCartModel.CartItemCountResponse().validate(response, {
1093
1087
  abortEarly: false,
1094
1088
  allowUnknown: false,
1095
1089
  });
@@ -1097,7 +1091,7 @@ class PosCart {
1097
1091
  if (res_error) {
1098
1092
  Logger({
1099
1093
  level: "WARN",
1100
- message: "Response Validation Warnnings for removeAddress",
1094
+ message: "Response Validation Warnnings for getItemCount",
1101
1095
  });
1102
1096
  Logger({ level: "WARN", message: res_error });
1103
1097
  }
@@ -1107,18 +1101,40 @@ class PosCart {
1107
1101
 
1108
1102
  /**
1109
1103
  * @param {Object} arg - Arg object.
1110
- * @param {string} [arg.cartId] -
1111
- * @param {boolean} [arg.buyNow] -
1112
- * @param {boolean} [arg.i] -
1113
- * @param {boolean} [arg.b] -
1114
- * @param {SelectCartAddressRequest} arg.body
1115
- * @returns {Promise<CartDetailResponse>} - Success response
1116
- * @summary: Select an address from available addresses
1117
- * @description: <p>Select Address from all addresses associated with the account in order to ship the cart items to that address, otherwise default address will be selected implicitly. See `SelectCartAddressRequest` in schema of request body for the list of attributes needed to select Address from account. On successful request, this API returns a Cart object. Below address attributes are required. <ul> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">billing_address_id</font></li> <li> <font color="monochrome">uid</font></li> </ul></p>
1104
+ * @param {number} [arg.pickAtStoreUid] -
1105
+ * @param {number} [arg.orderingStoreId] -
1106
+ * @param {boolean} [arg.p] - This is a boolean value. Select `true` for
1107
+ * getting a payment option in response.
1108
+ * @param {string} [arg.id] - The unique identifier of the cart
1109
+ * @param {string} [arg.addressId] - ID allotted to the selected address
1110
+ * @param {string} [arg.areaCode] - The PIN Code of the destination address,
1111
+ * e.g. 400059
1112
+ * @param {string} [arg.orderType] - The order type of shipment HomeDelivery
1113
+ * - If the customer wants the order home-delivered PickAtStore - If the
1114
+ * customer wants the handover of an order at the store itself.
1115
+ * @returns {Promise<CartShipmentsResponse>} - Success response
1116
+ * @summary: Get delivery date and options before checkout
1117
+ * @description: Use this API to get shipment details, expected delivery date, items and price breakup of the shipment.
1118
1118
  */
1119
- async selectAddress({ body, cartId, buyNow, i, b } = {}) {
1120
- const { error } = PosCartValidator.selectAddress().validate(
1121
- { body, cartId, buyNow, i, b },
1119
+ async getShipments({
1120
+ pickAtStoreUid,
1121
+ orderingStoreId,
1122
+ p,
1123
+ id,
1124
+ addressId,
1125
+ areaCode,
1126
+ orderType,
1127
+ } = {}) {
1128
+ const { error } = PosCartValidator.getShipments().validate(
1129
+ {
1130
+ pickAtStoreUid,
1131
+ orderingStoreId,
1132
+ p,
1133
+ id,
1134
+ addressId,
1135
+ areaCode,
1136
+ orderType,
1137
+ },
1122
1138
  { abortEarly: false, allowUnknown: true }
1123
1139
  );
1124
1140
  if (error) {
@@ -1126,41 +1142,52 @@ class PosCart {
1126
1142
  }
1127
1143
 
1128
1144
  // Showing warrnings if extra unknown parameters are found
1129
- const { error: warrning } = PosCartValidator.selectAddress().validate(
1130
- { body, cartId, buyNow, i, b },
1145
+ const { error: warrning } = PosCartValidator.getShipments().validate(
1146
+ {
1147
+ pickAtStoreUid,
1148
+ orderingStoreId,
1149
+ p,
1150
+ id,
1151
+ addressId,
1152
+ areaCode,
1153
+ orderType,
1154
+ },
1131
1155
  { abortEarly: false, allowUnknown: false }
1132
1156
  );
1133
1157
  if (warrning) {
1134
1158
  Logger({
1135
1159
  level: "WARN",
1136
- message: "Parameter Validation warrnings for selectAddress",
1160
+ message: "Parameter Validation warrnings for getShipments",
1137
1161
  });
1138
1162
  Logger({ level: "WARN", message: warrning });
1139
1163
  }
1140
1164
 
1141
1165
  const query_params = {};
1142
- query_params["cart_id"] = cartId;
1143
- query_params["buy_now"] = buyNow;
1144
- query_params["i"] = i;
1145
- query_params["b"] = b;
1166
+ query_params["pick_at_store_uid"] = pickAtStoreUid;
1167
+ query_params["ordering_store_id"] = orderingStoreId;
1168
+ query_params["p"] = p;
1169
+ query_params["id"] = id;
1170
+ query_params["address_id"] = addressId;
1171
+ query_params["area_code"] = areaCode;
1172
+ query_params["order_type"] = orderType;
1146
1173
 
1147
1174
  const xHeaders = {};
1148
1175
 
1149
- const response = await APIClient.execute(
1176
+ const response = await ApplicationAPIClient.execute(
1150
1177
  this._conf,
1151
- "post",
1178
+ "get",
1152
1179
  constructUrl({
1153
- url: this._urls["selectAddress"],
1180
+ url: this._urls["getShipments"],
1154
1181
  params: {},
1155
1182
  }),
1156
1183
  query_params,
1157
- body,
1184
+ undefined,
1158
1185
  xHeaders
1159
1186
  );
1160
1187
 
1161
1188
  const {
1162
1189
  error: res_error,
1163
- } = PosCartModel.CartDetailResponse().validate(response, {
1190
+ } = PosCartModel.CartShipmentsResponse().validate(response, {
1164
1191
  abortEarly: false,
1165
1192
  allowUnknown: false,
1166
1193
  });
@@ -1168,7 +1195,7 @@ class PosCart {
1168
1195
  if (res_error) {
1169
1196
  Logger({
1170
1197
  level: "WARN",
1171
- message: "Response Validation Warnnings for selectAddress",
1198
+ message: "Response Validation Warnnings for getShipments",
1172
1199
  });
1173
1200
  Logger({ level: "WARN", message: res_error });
1174
1201
  }
@@ -1178,16 +1205,14 @@ class PosCart {
1178
1205
 
1179
1206
  /**
1180
1207
  * @param {Object} arg - Arg object.
1181
- * @param {string} [arg.id] -
1182
- * @param {boolean} [arg.buyNow] -
1183
- * @param {UpdateCartPaymentRequest} arg.body
1184
- * @returns {Promise<CartDetailResponse>} - Success response
1185
- * @summary: Update cart payment
1186
- * @description: Use this API to update cart payment.
1208
+ * @param {number} arg.storeUid -
1209
+ * @returns {Promise<StoreDetailsResponse>} - Success response
1210
+ * @summary: Get list of stores for give uids
1211
+ * @description: Use this API to get the store details by entering the unique identifier of the pickup stores shown in the response of available-delivery-mode API.
1187
1212
  */
1188
- async selectPaymentMode({ body, id, buyNow } = {}) {
1189
- const { error } = PosCartValidator.selectPaymentMode().validate(
1190
- { body, id, buyNow },
1213
+ async getStoreAddressByUid({ storeUid } = {}) {
1214
+ const { error } = PosCartValidator.getStoreAddressByUid().validate(
1215
+ { storeUid },
1191
1216
  { abortEarly: false, allowUnknown: true }
1192
1217
  );
1193
1218
  if (error) {
@@ -1195,39 +1220,40 @@ class PosCart {
1195
1220
  }
1196
1221
 
1197
1222
  // Showing warrnings if extra unknown parameters are found
1198
- const { error: warrning } = PosCartValidator.selectPaymentMode().validate(
1199
- { body, id, buyNow },
1223
+ const {
1224
+ error: warrning,
1225
+ } = PosCartValidator.getStoreAddressByUid().validate(
1226
+ { storeUid },
1200
1227
  { abortEarly: false, allowUnknown: false }
1201
1228
  );
1202
1229
  if (warrning) {
1203
1230
  Logger({
1204
1231
  level: "WARN",
1205
- message: "Parameter Validation warrnings for selectPaymentMode",
1232
+ message: "Parameter Validation warrnings for getStoreAddressByUid",
1206
1233
  });
1207
1234
  Logger({ level: "WARN", message: warrning });
1208
1235
  }
1209
1236
 
1210
1237
  const query_params = {};
1211
- query_params["id"] = id;
1212
- query_params["buy_now"] = buyNow;
1238
+ query_params["store_uid"] = storeUid;
1213
1239
 
1214
1240
  const xHeaders = {};
1215
1241
 
1216
- const response = await APIClient.execute(
1242
+ const response = await ApplicationAPIClient.execute(
1217
1243
  this._conf,
1218
- "put",
1244
+ "get",
1219
1245
  constructUrl({
1220
- url: this._urls["selectPaymentMode"],
1246
+ url: this._urls["getStoreAddressByUid"],
1221
1247
  params: {},
1222
1248
  }),
1223
1249
  query_params,
1224
- body,
1250
+ undefined,
1225
1251
  xHeaders
1226
1252
  );
1227
1253
 
1228
1254
  const {
1229
1255
  error: res_error,
1230
- } = PosCartModel.CartDetailResponse().validate(response, {
1256
+ } = PosCartModel.StoreDetailsResponse().validate(response, {
1231
1257
  abortEarly: false,
1232
1258
  allowUnknown: false,
1233
1259
  });
@@ -1235,7 +1261,7 @@ class PosCart {
1235
1261
  if (res_error) {
1236
1262
  Logger({
1237
1263
  level: "WARN",
1238
- message: "Response Validation Warnnings for selectPaymentMode",
1264
+ message: "Response Validation Warnnings for getStoreAddressByUid",
1239
1265
  });
1240
1266
  Logger({ level: "WARN", message: res_error });
1241
1267
  }
@@ -1245,36 +1271,14 @@ class PosCart {
1245
1271
 
1246
1272
  /**
1247
1273
  * @param {Object} arg - Arg object.
1248
- * @param {string} [arg.id] -
1249
- * @param {boolean} [arg.buyNow] -
1250
- * @param {string} [arg.addressId] -
1251
- * @param {string} [arg.paymentMode] -
1252
- * @param {string} [arg.paymentIdentifier] -
1253
- * @param {string} [arg.aggregatorName] -
1254
- * @param {string} [arg.merchantCode] -
1255
- * @returns {Promise<PaymentCouponValidate>} - Success response
1256
- * @summary: Verify the coupon eligibility against the payment mode
1257
- * @description: Use this API to validate a coupon against the payment mode such as NetBanking, Wallet, UPI etc.
1274
+ * @param {string} arg.id - ID allotted to the selected address
1275
+ * @returns {Promise<DeleteAddressResponse>} - Success response
1276
+ * @summary: Remove address associated with an account
1277
+ * @description: Use this API to delete an address by its ID. This will returns an object that will indicate whether the address was deleted successfully or not.
1258
1278
  */
1259
- async validateCouponForPayment({
1260
- id,
1261
- buyNow,
1262
- addressId,
1263
- paymentMode,
1264
- paymentIdentifier,
1265
- aggregatorName,
1266
- merchantCode,
1267
- } = {}) {
1268
- const { error } = PosCartValidator.validateCouponForPayment().validate(
1269
- {
1270
- id,
1271
- buyNow,
1272
- addressId,
1273
- paymentMode,
1274
- paymentIdentifier,
1275
- aggregatorName,
1276
- merchantCode,
1277
- },
1279
+ async removeAddress({ id } = {}) {
1280
+ const { error } = PosCartValidator.removeAddress().validate(
1281
+ { id },
1278
1282
  { abortEarly: false, allowUnknown: true }
1279
1283
  );
1280
1284
  if (error) {
@@ -1282,45 +1286,28 @@ class PosCart {
1282
1286
  }
1283
1287
 
1284
1288
  // Showing warrnings if extra unknown parameters are found
1285
- const {
1286
- error: warrning,
1287
- } = PosCartValidator.validateCouponForPayment().validate(
1288
- {
1289
- id,
1290
- buyNow,
1291
- addressId,
1292
- paymentMode,
1293
- paymentIdentifier,
1294
- aggregatorName,
1295
- merchantCode,
1296
- },
1289
+ const { error: warrning } = PosCartValidator.removeAddress().validate(
1290
+ { id },
1297
1291
  { abortEarly: false, allowUnknown: false }
1298
1292
  );
1299
1293
  if (warrning) {
1300
1294
  Logger({
1301
1295
  level: "WARN",
1302
- message: "Parameter Validation warrnings for validateCouponForPayment",
1296
+ message: "Parameter Validation warrnings for removeAddress",
1303
1297
  });
1304
1298
  Logger({ level: "WARN", message: warrning });
1305
1299
  }
1306
1300
 
1307
1301
  const query_params = {};
1308
- query_params["id"] = id;
1309
- query_params["buy_now"] = buyNow;
1310
- query_params["address_id"] = addressId;
1311
- query_params["payment_mode"] = paymentMode;
1312
- query_params["payment_identifier"] = paymentIdentifier;
1313
- query_params["aggregator_name"] = aggregatorName;
1314
- query_params["merchant_code"] = merchantCode;
1315
1302
 
1316
1303
  const xHeaders = {};
1317
1304
 
1318
- const response = await APIClient.execute(
1305
+ const response = await ApplicationAPIClient.execute(
1319
1306
  this._conf,
1320
- "get",
1307
+ "delete",
1321
1308
  constructUrl({
1322
- url: this._urls["validateCouponForPayment"],
1323
- params: {},
1309
+ url: this._urls["removeAddress"],
1310
+ params: { id },
1324
1311
  }),
1325
1312
  query_params,
1326
1313
  undefined,
@@ -1329,7 +1316,7 @@ class PosCart {
1329
1316
 
1330
1317
  const {
1331
1318
  error: res_error,
1332
- } = PosCartModel.PaymentCouponValidate().validate(response, {
1319
+ } = PosCartModel.DeleteAddressResponse().validate(response, {
1333
1320
  abortEarly: false,
1334
1321
  allowUnknown: false,
1335
1322
  });
@@ -1337,7 +1324,7 @@ class PosCart {
1337
1324
  if (res_error) {
1338
1325
  Logger({
1339
1326
  level: "WARN",
1340
- message: "Response Validation Warnnings for validateCouponForPayment",
1327
+ message: "Response Validation Warnnings for removeAddress",
1341
1328
  });
1342
1329
  Logger({ level: "WARN", message: res_error });
1343
1330
  }
@@ -1347,40 +1334,15 @@ class PosCart {
1347
1334
 
1348
1335
  /**
1349
1336
  * @param {Object} arg - Arg object.
1350
- * @param {number} [arg.pickAtStoreUid] -
1351
- * @param {number} [arg.orderingStoreId] -
1352
- * @param {boolean} [arg.p] - This is a boolean value. Select `true` for
1353
- * getting a payment option in response.
1354
- * @param {string} [arg.id] - The unique identifier of the cart
1355
- * @param {string} [arg.addressId] - ID allotted to the selected address
1356
- * @param {string} [arg.areaCode] - The PIN Code of the destination address,
1357
- * e.g. 400059
1358
- * @param {string} [arg.orderType] - The order type of shipment HomeDelivery
1359
- * - If the customer wants the order home-delivered PickAtStore - If the
1360
- * customer wants the handover of an order at the store itself.
1361
- * @returns {Promise<CartShipmentsResponse>} - Success response
1362
- * @summary: Get delivery date and options before checkout
1363
- * @description: Use this API to get shipment details, expected delivery date, items and price breakup of the shipment.
1337
+ * @param {string} [arg.id] -
1338
+ * @param {boolean} [arg.buyNow] -
1339
+ * @returns {Promise<CartDetailResponse>} - Success response
1340
+ * @summary: Remove Coupon Applied
1341
+ * @description: Remove Coupon applied on the cart by passing uid in request body.
1364
1342
  */
1365
- async getShipments({
1366
- pickAtStoreUid,
1367
- orderingStoreId,
1368
- p,
1369
- id,
1370
- addressId,
1371
- areaCode,
1372
- orderType,
1373
- } = {}) {
1374
- const { error } = PosCartValidator.getShipments().validate(
1375
- {
1376
- pickAtStoreUid,
1377
- orderingStoreId,
1378
- p,
1379
- id,
1380
- addressId,
1381
- areaCode,
1382
- orderType,
1383
- },
1343
+ async removeCoupon({ id, buyNow } = {}) {
1344
+ const { error } = PosCartValidator.removeCoupon().validate(
1345
+ { id, buyNow },
1384
1346
  { abortEarly: false, allowUnknown: true }
1385
1347
  );
1386
1348
  if (error) {
@@ -1388,42 +1350,29 @@ class PosCart {
1388
1350
  }
1389
1351
 
1390
1352
  // Showing warrnings if extra unknown parameters are found
1391
- const { error: warrning } = PosCartValidator.getShipments().validate(
1392
- {
1393
- pickAtStoreUid,
1394
- orderingStoreId,
1395
- p,
1396
- id,
1397
- addressId,
1398
- areaCode,
1399
- orderType,
1400
- },
1353
+ const { error: warrning } = PosCartValidator.removeCoupon().validate(
1354
+ { id, buyNow },
1401
1355
  { abortEarly: false, allowUnknown: false }
1402
1356
  );
1403
1357
  if (warrning) {
1404
1358
  Logger({
1405
1359
  level: "WARN",
1406
- message: "Parameter Validation warrnings for getShipments",
1360
+ message: "Parameter Validation warrnings for removeCoupon",
1407
1361
  });
1408
1362
  Logger({ level: "WARN", message: warrning });
1409
1363
  }
1410
1364
 
1411
1365
  const query_params = {};
1412
- query_params["pick_at_store_uid"] = pickAtStoreUid;
1413
- query_params["ordering_store_id"] = orderingStoreId;
1414
- query_params["p"] = p;
1415
1366
  query_params["id"] = id;
1416
- query_params["address_id"] = addressId;
1417
- query_params["area_code"] = areaCode;
1418
- query_params["order_type"] = orderType;
1367
+ query_params["buy_now"] = buyNow;
1419
1368
 
1420
1369
  const xHeaders = {};
1421
1370
 
1422
- const response = await APIClient.execute(
1371
+ const response = await ApplicationAPIClient.execute(
1423
1372
  this._conf,
1424
- "get",
1373
+ "delete",
1425
1374
  constructUrl({
1426
- url: this._urls["getShipments"],
1375
+ url: this._urls["removeCoupon"],
1427
1376
  params: {},
1428
1377
  }),
1429
1378
  query_params,
@@ -1433,7 +1382,7 @@ class PosCart {
1433
1382
 
1434
1383
  const {
1435
1384
  error: res_error,
1436
- } = PosCartModel.CartShipmentsResponse().validate(response, {
1385
+ } = PosCartModel.CartDetailResponse().validate(response, {
1437
1386
  abortEarly: false,
1438
1387
  allowUnknown: false,
1439
1388
  });
@@ -1441,7 +1390,7 @@ class PosCart {
1441
1390
  if (res_error) {
1442
1391
  Logger({
1443
1392
  level: "WARN",
1444
- message: "Response Validation Warnnings for getShipments",
1393
+ message: "Response Validation Warnnings for removeCoupon",
1445
1394
  });
1446
1395
  Logger({ level: "WARN", message: res_error });
1447
1396
  }
@@ -1451,23 +1400,18 @@ class PosCart {
1451
1400
 
1452
1401
  /**
1453
1402
  * @param {Object} arg - Arg object.
1454
- * @param {boolean} [arg.i] - This is a boolean value. Select `true` to
1455
- * retrieve all the items added in the cart.
1456
- * @param {boolean} [arg.p] - This is a boolean value. Select `true` for
1457
- * getting a payment option in response.
1458
- * @param {string} [arg.id] - The unique identifier of the cart
1459
- * @param {string} [arg.addressId] - ID allotted to an address
1460
- * @param {string} [arg.orderType] - The order type of shipment HomeDelivery
1461
- * - If the customer wants the order home-delivered PickAtStore - If the
1462
- * customer wants the handover of an order at the store itself.
1463
- * @param {UpdateCartShipmentRequest} arg.body
1464
- * @returns {Promise<CartShipmentsResponse>} - Success response
1465
- * @summary: Update shipment delivery type and quantity before checkout
1466
- * @description: Use this API to update the delivery type and quantity as per customer's preference for either store pick-up or home-delivery.
1403
+ * @param {string} [arg.cartId] -
1404
+ * @param {boolean} [arg.buyNow] -
1405
+ * @param {boolean} [arg.i] -
1406
+ * @param {boolean} [arg.b] -
1407
+ * @param {SelectCartAddressRequest} arg.body
1408
+ * @returns {Promise<CartDetailResponse>} - Success response
1409
+ * @summary: Select an address from available addresses
1410
+ * @description: <p>Select Address from all addresses associated with the account in order to ship the cart items to that address, otherwise default address will be selected implicitly. See `SelectCartAddressRequest` in schema of request body for the list of attributes needed to select Address from account. On successful request, this API returns a Cart object. Below address attributes are required. <ul> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">billing_address_id</font></li> <li> <font color="monochrome">uid</font></li> </ul></p>
1467
1411
  */
1468
- async updateShipments({ body, i, p, id, addressId, orderType } = {}) {
1469
- const { error } = PosCartValidator.updateShipments().validate(
1470
- { body, i, p, id, addressId, orderType },
1412
+ async selectAddress({ body, cartId, buyNow, i, b } = {}) {
1413
+ const { error } = PosCartValidator.selectAddress().validate(
1414
+ { body, cartId, buyNow, i, b },
1471
1415
  { abortEarly: false, allowUnknown: true }
1472
1416
  );
1473
1417
  if (error) {
@@ -1475,32 +1419,31 @@ class PosCart {
1475
1419
  }
1476
1420
 
1477
1421
  // Showing warrnings if extra unknown parameters are found
1478
- const { error: warrning } = PosCartValidator.updateShipments().validate(
1479
- { body, i, p, id, addressId, orderType },
1422
+ const { error: warrning } = PosCartValidator.selectAddress().validate(
1423
+ { body, cartId, buyNow, i, b },
1480
1424
  { abortEarly: false, allowUnknown: false }
1481
1425
  );
1482
1426
  if (warrning) {
1483
1427
  Logger({
1484
1428
  level: "WARN",
1485
- message: "Parameter Validation warrnings for updateShipments",
1429
+ message: "Parameter Validation warrnings for selectAddress",
1486
1430
  });
1487
1431
  Logger({ level: "WARN", message: warrning });
1488
1432
  }
1489
1433
 
1490
1434
  const query_params = {};
1435
+ query_params["cart_id"] = cartId;
1436
+ query_params["buy_now"] = buyNow;
1491
1437
  query_params["i"] = i;
1492
- query_params["p"] = p;
1493
- query_params["id"] = id;
1494
- query_params["address_id"] = addressId;
1495
- query_params["order_type"] = orderType;
1438
+ query_params["b"] = b;
1496
1439
 
1497
1440
  const xHeaders = {};
1498
1441
 
1499
- const response = await APIClient.execute(
1442
+ const response = await ApplicationAPIClient.execute(
1500
1443
  this._conf,
1501
- "put",
1444
+ "post",
1502
1445
  constructUrl({
1503
- url: this._urls["updateShipments"],
1446
+ url: this._urls["selectAddress"],
1504
1447
  params: {},
1505
1448
  }),
1506
1449
  query_params,
@@ -1510,7 +1453,7 @@ class PosCart {
1510
1453
 
1511
1454
  const {
1512
1455
  error: res_error,
1513
- } = PosCartModel.CartShipmentsResponse().validate(response, {
1456
+ } = PosCartModel.CartDetailResponse().validate(response, {
1514
1457
  abortEarly: false,
1515
1458
  allowUnknown: false,
1516
1459
  });
@@ -1518,7 +1461,7 @@ class PosCart {
1518
1461
  if (res_error) {
1519
1462
  Logger({
1520
1463
  level: "WARN",
1521
- message: "Response Validation Warnnings for updateShipments",
1464
+ message: "Response Validation Warnnings for selectAddress",
1522
1465
  });
1523
1466
  Logger({ level: "WARN", message: res_error });
1524
1467
  }
@@ -1529,14 +1472,15 @@ class PosCart {
1529
1472
  /**
1530
1473
  * @param {Object} arg - Arg object.
1531
1474
  * @param {string} [arg.id] -
1532
- * @param {CartPosCheckoutDetailRequest} arg.body
1533
- * @returns {Promise<CartCheckoutResponse>} - Success response
1534
- * @summary: Checkout all items in the cart
1535
- * @description: Use this API to checkout all items in the cart for payment and order generation. For COD, order will be generated directly, whereas for other checkout modes, user will be redirected to a payment gateway.
1475
+ * @param {boolean} [arg.buyNow] -
1476
+ * @param {UpdateCartPaymentRequest} arg.body
1477
+ * @returns {Promise<CartDetailResponse>} - Success response
1478
+ * @summary: Update cart payment
1479
+ * @description: Use this API to update cart payment.
1536
1480
  */
1537
- async checkoutCart({ body, id } = {}) {
1538
- const { error } = PosCartValidator.checkoutCart().validate(
1539
- { body, id },
1481
+ async selectPaymentMode({ body, id, buyNow } = {}) {
1482
+ const { error } = PosCartValidator.selectPaymentMode().validate(
1483
+ { body, id, buyNow },
1540
1484
  { abortEarly: false, allowUnknown: true }
1541
1485
  );
1542
1486
  if (error) {
@@ -1544,28 +1488,29 @@ class PosCart {
1544
1488
  }
1545
1489
 
1546
1490
  // Showing warrnings if extra unknown parameters are found
1547
- const { error: warrning } = PosCartValidator.checkoutCart().validate(
1548
- { body, id },
1491
+ const { error: warrning } = PosCartValidator.selectPaymentMode().validate(
1492
+ { body, id, buyNow },
1549
1493
  { abortEarly: false, allowUnknown: false }
1550
1494
  );
1551
1495
  if (warrning) {
1552
1496
  Logger({
1553
1497
  level: "WARN",
1554
- message: "Parameter Validation warrnings for checkoutCart",
1498
+ message: "Parameter Validation warrnings for selectPaymentMode",
1555
1499
  });
1556
1500
  Logger({ level: "WARN", message: warrning });
1557
1501
  }
1558
1502
 
1559
1503
  const query_params = {};
1560
1504
  query_params["id"] = id;
1505
+ query_params["buy_now"] = buyNow;
1561
1506
 
1562
1507
  const xHeaders = {};
1563
1508
 
1564
- const response = await APIClient.execute(
1509
+ const response = await ApplicationAPIClient.execute(
1565
1510
  this._conf,
1566
- "post",
1511
+ "put",
1567
1512
  constructUrl({
1568
- url: this._urls["checkoutCart"],
1513
+ url: this._urls["selectPaymentMode"],
1569
1514
  params: {},
1570
1515
  }),
1571
1516
  query_params,
@@ -1575,7 +1520,7 @@ class PosCart {
1575
1520
 
1576
1521
  const {
1577
1522
  error: res_error,
1578
- } = PosCartModel.CartCheckoutResponse().validate(response, {
1523
+ } = PosCartModel.CartDetailResponse().validate(response, {
1579
1524
  abortEarly: false,
1580
1525
  allowUnknown: false,
1581
1526
  });
@@ -1583,7 +1528,7 @@ class PosCart {
1583
1528
  if (res_error) {
1584
1529
  Logger({
1585
1530
  level: "WARN",
1586
- message: "Response Validation Warnnings for checkoutCart",
1531
+ message: "Response Validation Warnnings for selectPaymentMode",
1587
1532
  });
1588
1533
  Logger({ level: "WARN", message: res_error });
1589
1534
  }
@@ -1591,18 +1536,17 @@ class PosCart {
1591
1536
  return response;
1592
1537
  }
1593
1538
 
1594
- /**
1595
- * @param {Object} arg - Arg object.
1596
- * @param {string} [arg.id] -
1597
- * @param {boolean} [arg.buyNow] -
1598
- * @param {CartMetaRequest} arg.body
1599
- * @returns {Promise<CartMetaResponse>} - Success response
1600
- * @summary: Update the cart meta
1601
- * @description: Use this API to update cart meta like checkout_mode and gstin.
1539
+ /**
1540
+ * @param {Object} arg - Arg object.
1541
+ * @param {string} arg.id - ID allotted to the selected address
1542
+ * @param {Address} arg.body
1543
+ * @returns {Promise<UpdateAddressResponse>} - Success response
1544
+ * @summary: Update address added to an account
1545
+ * @description: <p>Use this API to update an existing address in the account. Request object should contain attributes mentioned in <font color="blue">Address </font> can be updated. These attributes are:</p> <ul> <li> <font color="monochrome">is_default_address</font></li> <li> <font color="monochrome">landmark</font></li> <li> <font color="monochrome">area</font></li> <li> <font color="monochrome">pincode</font></li> <li> <font color="monochrome">email</font></li> <li> <font color="monochrome">address_type</font></li> <li> <font color="monochrome">name</font></li> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">address</font></li> </ul>
1602
1546
  */
1603
- async updateCartMeta({ body, id, buyNow } = {}) {
1604
- const { error } = PosCartValidator.updateCartMeta().validate(
1605
- { body, id, buyNow },
1547
+ async updateAddress({ id, body } = {}) {
1548
+ const { error } = PosCartValidator.updateAddress().validate(
1549
+ { id, body },
1606
1550
  { abortEarly: false, allowUnknown: true }
1607
1551
  );
1608
1552
  if (error) {
@@ -1610,30 +1554,28 @@ class PosCart {
1610
1554
  }
1611
1555
 
1612
1556
  // Showing warrnings if extra unknown parameters are found
1613
- const { error: warrning } = PosCartValidator.updateCartMeta().validate(
1614
- { body, id, buyNow },
1557
+ const { error: warrning } = PosCartValidator.updateAddress().validate(
1558
+ { id, body },
1615
1559
  { abortEarly: false, allowUnknown: false }
1616
1560
  );
1617
1561
  if (warrning) {
1618
1562
  Logger({
1619
1563
  level: "WARN",
1620
- message: "Parameter Validation warrnings for updateCartMeta",
1564
+ message: "Parameter Validation warrnings for updateAddress",
1621
1565
  });
1622
1566
  Logger({ level: "WARN", message: warrning });
1623
1567
  }
1624
1568
 
1625
1569
  const query_params = {};
1626
- query_params["id"] = id;
1627
- query_params["buy_now"] = buyNow;
1628
1570
 
1629
1571
  const xHeaders = {};
1630
1572
 
1631
- const response = await APIClient.execute(
1573
+ const response = await ApplicationAPIClient.execute(
1632
1574
  this._conf,
1633
1575
  "put",
1634
1576
  constructUrl({
1635
- url: this._urls["updateCartMeta"],
1636
- params: {},
1577
+ url: this._urls["updateAddress"],
1578
+ params: { id },
1637
1579
  }),
1638
1580
  query_params,
1639
1581
  body,
@@ -1642,7 +1584,7 @@ class PosCart {
1642
1584
 
1643
1585
  const {
1644
1586
  error: res_error,
1645
- } = PosCartModel.CartMetaResponse().validate(response, {
1587
+ } = PosCartModel.UpdateAddressResponse().validate(response, {
1646
1588
  abortEarly: false,
1647
1589
  allowUnknown: false,
1648
1590
  });
@@ -1650,7 +1592,7 @@ class PosCart {
1650
1592
  if (res_error) {
1651
1593
  Logger({
1652
1594
  level: "WARN",
1653
- message: "Response Validation Warnnings for updateCartMeta",
1595
+ message: "Response Validation Warnnings for updateAddress",
1654
1596
  });
1655
1597
  Logger({ level: "WARN", message: res_error });
1656
1598
  }
@@ -1660,15 +1602,19 @@ class PosCart {
1660
1602
 
1661
1603
  /**
1662
1604
  * @param {Object} arg - Arg object.
1663
- * @param {string} arg.areaCode -
1664
1605
  * @param {string} [arg.id] -
1665
- * @returns {Promise<CartDeliveryModesResponse>} - Success response
1666
- * @summary: Get available delivery modes for cart
1667
- * @description: Use this API to get the delivery modes (home-delivery/store-pickup) along with a list of pickup stores available for a given cart at a given PIN Code. User can then view the address of a pickup store with the help of store-address API.
1606
+ * @param {boolean} [arg.i] -
1607
+ * @param {boolean} [arg.b] -
1608
+ * @param {string} [arg.areaCode] -
1609
+ * @param {boolean} [arg.buyNow] -
1610
+ * @param {UpdateCartRequest} arg.body
1611
+ * @returns {Promise<UpdateCartDetailResponse>} - Success response
1612
+ * @summary: Update items in the cart
1613
+ * @description: <p>Use this API to update items added to the cart with the help of a request object containing attributes like item_quantity and item_size. These attributes will be fetched from the following APIs</p> <ul> <li><font color="monochrome">operation</font> Operation for current api call. <b>update_item</b> for update items. <b>remove_item</b> for removing items.</li> <li> <font color="monochrome">item_id</font> "/platform/content/v1/products/"</li> <li> <font color="monochrome">item_size</font> "/platform/content/v1/products/:slug/sizes/"</li> <li> <font color="monochrome">quantity</font> item quantity (must be greater than or equal to 1)</li> <li> <font color="monochrome">article_id</font> "/content​/v1​/products​/:identifier​/sizes​/price​/"</li> <li> <font color="monochrome">item_index</font> item position in the cart (must be greater than or equal to 0)</li> </ul>
1668
1614
  */
1669
- async getAvailableDeliveryModes({ areaCode, id } = {}) {
1670
- const { error } = PosCartValidator.getAvailableDeliveryModes().validate(
1671
- { areaCode, id },
1615
+ async updateCart({ body, id, i, b, areaCode, buyNow } = {}) {
1616
+ const { error } = PosCartValidator.updateCart().validate(
1617
+ { body, id, i, b, areaCode, buyNow },
1672
1618
  { abortEarly: false, allowUnknown: true }
1673
1619
  );
1674
1620
  if (error) {
@@ -1676,41 +1622,42 @@ class PosCart {
1676
1622
  }
1677
1623
 
1678
1624
  // Showing warrnings if extra unknown parameters are found
1679
- const {
1680
- error: warrning,
1681
- } = PosCartValidator.getAvailableDeliveryModes().validate(
1682
- { areaCode, id },
1625
+ const { error: warrning } = PosCartValidator.updateCart().validate(
1626
+ { body, id, i, b, areaCode, buyNow },
1683
1627
  { abortEarly: false, allowUnknown: false }
1684
1628
  );
1685
1629
  if (warrning) {
1686
1630
  Logger({
1687
1631
  level: "WARN",
1688
- message: "Parameter Validation warrnings for getAvailableDeliveryModes",
1632
+ message: "Parameter Validation warrnings for updateCart",
1689
1633
  });
1690
1634
  Logger({ level: "WARN", message: warrning });
1691
1635
  }
1692
1636
 
1693
1637
  const query_params = {};
1694
- query_params["area_code"] = areaCode;
1695
1638
  query_params["id"] = id;
1639
+ query_params["i"] = i;
1640
+ query_params["b"] = b;
1641
+ query_params["area_code"] = areaCode;
1642
+ query_params["buy_now"] = buyNow;
1696
1643
 
1697
1644
  const xHeaders = {};
1698
1645
 
1699
- const response = await APIClient.execute(
1646
+ const response = await ApplicationAPIClient.execute(
1700
1647
  this._conf,
1701
- "get",
1648
+ "put",
1702
1649
  constructUrl({
1703
- url: this._urls["getAvailableDeliveryModes"],
1650
+ url: this._urls["updateCart"],
1704
1651
  params: {},
1705
1652
  }),
1706
1653
  query_params,
1707
- undefined,
1654
+ body,
1708
1655
  xHeaders
1709
1656
  );
1710
1657
 
1711
1658
  const {
1712
1659
  error: res_error,
1713
- } = PosCartModel.CartDeliveryModesResponse().validate(response, {
1660
+ } = PosCartModel.UpdateCartDetailResponse().validate(response, {
1714
1661
  abortEarly: false,
1715
1662
  allowUnknown: false,
1716
1663
  });
@@ -1718,7 +1665,7 @@ class PosCart {
1718
1665
  if (res_error) {
1719
1666
  Logger({
1720
1667
  level: "WARN",
1721
- message: "Response Validation Warnnings for getAvailableDeliveryModes",
1668
+ message: "Response Validation Warnnings for updateCart",
1722
1669
  });
1723
1670
  Logger({ level: "WARN", message: res_error });
1724
1671
  }
@@ -1728,14 +1675,16 @@ class PosCart {
1728
1675
 
1729
1676
  /**
1730
1677
  * @param {Object} arg - Arg object.
1731
- * @param {number} arg.storeUid -
1732
- * @returns {Promise<StoreDetailsResponse>} - Success response
1733
- * @summary: Get list of stores for give uids
1734
- * @description: Use this API to get the store details by entering the unique identifier of the pickup stores shown in the response of available-delivery-mode API.
1678
+ * @param {string} [arg.id] -
1679
+ * @param {boolean} [arg.buyNow] -
1680
+ * @param {CartMetaRequest} arg.body
1681
+ * @returns {Promise<CartMetaResponse>} - Success response
1682
+ * @summary: Update the cart meta
1683
+ * @description: Use this API to update cart meta like checkout_mode and gstin.
1735
1684
  */
1736
- async getStoreAddressByUid({ storeUid } = {}) {
1737
- const { error } = PosCartValidator.getStoreAddressByUid().validate(
1738
- { storeUid },
1685
+ async updateCartMeta({ body, id, buyNow } = {}) {
1686
+ const { error } = PosCartValidator.updateCartMeta().validate(
1687
+ { body, id, buyNow },
1739
1688
  { abortEarly: false, allowUnknown: true }
1740
1689
  );
1741
1690
  if (error) {
@@ -1743,40 +1692,39 @@ class PosCart {
1743
1692
  }
1744
1693
 
1745
1694
  // Showing warrnings if extra unknown parameters are found
1746
- const {
1747
- error: warrning,
1748
- } = PosCartValidator.getStoreAddressByUid().validate(
1749
- { storeUid },
1695
+ const { error: warrning } = PosCartValidator.updateCartMeta().validate(
1696
+ { body, id, buyNow },
1750
1697
  { abortEarly: false, allowUnknown: false }
1751
1698
  );
1752
1699
  if (warrning) {
1753
1700
  Logger({
1754
1701
  level: "WARN",
1755
- message: "Parameter Validation warrnings for getStoreAddressByUid",
1702
+ message: "Parameter Validation warrnings for updateCartMeta",
1756
1703
  });
1757
1704
  Logger({ level: "WARN", message: warrning });
1758
1705
  }
1759
1706
 
1760
1707
  const query_params = {};
1761
- query_params["store_uid"] = storeUid;
1708
+ query_params["id"] = id;
1709
+ query_params["buy_now"] = buyNow;
1762
1710
 
1763
1711
  const xHeaders = {};
1764
1712
 
1765
- const response = await APIClient.execute(
1713
+ const response = await ApplicationAPIClient.execute(
1766
1714
  this._conf,
1767
- "get",
1715
+ "put",
1768
1716
  constructUrl({
1769
- url: this._urls["getStoreAddressByUid"],
1717
+ url: this._urls["updateCartMeta"],
1770
1718
  params: {},
1771
1719
  }),
1772
1720
  query_params,
1773
- undefined,
1721
+ body,
1774
1722
  xHeaders
1775
1723
  );
1776
1724
 
1777
1725
  const {
1778
1726
  error: res_error,
1779
- } = PosCartModel.StoreDetailsResponse().validate(response, {
1727
+ } = PosCartModel.CartMetaResponse().validate(response, {
1780
1728
  abortEarly: false,
1781
1729
  allowUnknown: false,
1782
1730
  });
@@ -1784,7 +1732,7 @@ class PosCart {
1784
1732
  if (res_error) {
1785
1733
  Logger({
1786
1734
  level: "WARN",
1787
- message: "Response Validation Warnnings for getStoreAddressByUid",
1735
+ message: "Response Validation Warnnings for updateCartMeta",
1788
1736
  });
1789
1737
  Logger({ level: "WARN", message: res_error });
1790
1738
  }
@@ -1794,14 +1742,16 @@ class PosCart {
1794
1742
 
1795
1743
  /**
1796
1744
  * @param {Object} arg - Arg object.
1797
- * @param {GetShareCartLinkRequest} arg.body
1798
- * @returns {Promise<GetShareCartLinkResponse>} - Success response
1799
- * @summary: Generate token for sharing the cart
1800
- * @description: Use this API to generate a shared cart snapshot and return a shortlink token. The link can be shared with other users for getting the same items in their cart.
1745
+ * @param {string} arg.token - Token of the shared short link
1746
+ * @param {string} arg.action - Operation to perform on the existing cart
1747
+ * merge or replace.
1748
+ * @returns {Promise<SharedCartResponse>} - Success response
1749
+ * @summary: Merge or replace existing cart
1750
+ * @description: Use this API to merge the shared cart with existing cart, or replace the existing cart with the shared cart. The `action` parameter is used to indicate the operation Merge or Replace.
1801
1751
  */
1802
- async getCartShareLink({ body } = {}) {
1803
- const { error } = PosCartValidator.getCartShareLink().validate(
1804
- { body },
1752
+ async updateCartWithSharedItems({ token, action } = {}) {
1753
+ const { error } = PosCartValidator.updateCartWithSharedItems().validate(
1754
+ { token, action },
1805
1755
  { abortEarly: false, allowUnknown: true }
1806
1756
  );
1807
1757
  if (error) {
@@ -1809,14 +1759,16 @@ class PosCart {
1809
1759
  }
1810
1760
 
1811
1761
  // Showing warrnings if extra unknown parameters are found
1812
- const { error: warrning } = PosCartValidator.getCartShareLink().validate(
1813
- { body },
1762
+ const {
1763
+ error: warrning,
1764
+ } = PosCartValidator.updateCartWithSharedItems().validate(
1765
+ { token, action },
1814
1766
  { abortEarly: false, allowUnknown: false }
1815
1767
  );
1816
1768
  if (warrning) {
1817
1769
  Logger({
1818
1770
  level: "WARN",
1819
- message: "Parameter Validation warrnings for getCartShareLink",
1771
+ message: "Parameter Validation warrnings for updateCartWithSharedItems",
1820
1772
  });
1821
1773
  Logger({ level: "WARN", message: warrning });
1822
1774
  }
@@ -1825,21 +1777,21 @@ class PosCart {
1825
1777
 
1826
1778
  const xHeaders = {};
1827
1779
 
1828
- const response = await APIClient.execute(
1780
+ const response = await ApplicationAPIClient.execute(
1829
1781
  this._conf,
1830
1782
  "post",
1831
1783
  constructUrl({
1832
- url: this._urls["getCartShareLink"],
1833
- params: {},
1784
+ url: this._urls["updateCartWithSharedItems"],
1785
+ params: { token, action },
1834
1786
  }),
1835
1787
  query_params,
1836
- body,
1788
+ undefined,
1837
1789
  xHeaders
1838
1790
  );
1839
1791
 
1840
1792
  const {
1841
1793
  error: res_error,
1842
- } = PosCartModel.GetShareCartLinkResponse().validate(response, {
1794
+ } = PosCartModel.SharedCartResponse().validate(response, {
1843
1795
  abortEarly: false,
1844
1796
  allowUnknown: false,
1845
1797
  });
@@ -1847,7 +1799,7 @@ class PosCart {
1847
1799
  if (res_error) {
1848
1800
  Logger({
1849
1801
  level: "WARN",
1850
- message: "Response Validation Warnnings for getCartShareLink",
1802
+ message: "Response Validation Warnnings for updateCartWithSharedItems",
1851
1803
  });
1852
1804
  Logger({ level: "WARN", message: res_error });
1853
1805
  }
@@ -1857,14 +1809,23 @@ class PosCart {
1857
1809
 
1858
1810
  /**
1859
1811
  * @param {Object} arg - Arg object.
1860
- * @param {string} arg.token - Token of the shared short link
1861
- * @returns {Promise<SharedCartResponse>} - Success response
1862
- * @summary: Get details of a shared cart
1863
- * @description: Use this API to get the shared cart details as per the token generated using the share-cart API.
1812
+ * @param {boolean} [arg.i] - This is a boolean value. Select `true` to
1813
+ * retrieve all the items added in the cart.
1814
+ * @param {boolean} [arg.p] - This is a boolean value. Select `true` for
1815
+ * getting a payment option in response.
1816
+ * @param {string} [arg.id] - The unique identifier of the cart
1817
+ * @param {string} [arg.addressId] - ID allotted to an address
1818
+ * @param {string} [arg.orderType] - The order type of shipment HomeDelivery
1819
+ * - If the customer wants the order home-delivered PickAtStore - If the
1820
+ * customer wants the handover of an order at the store itself.
1821
+ * @param {UpdateCartShipmentRequest} arg.body
1822
+ * @returns {Promise<CartShipmentsResponse>} - Success response
1823
+ * @summary: Update shipment delivery type and quantity before checkout
1824
+ * @description: Use this API to update the delivery type and quantity as per customer's preference for either store pick-up or home-delivery.
1864
1825
  */
1865
- async getCartSharedItems({ token } = {}) {
1866
- const { error } = PosCartValidator.getCartSharedItems().validate(
1867
- { token },
1826
+ async updateShipments({ body, i, p, id, addressId, orderType } = {}) {
1827
+ const { error } = PosCartValidator.updateShipments().validate(
1828
+ { body, i, p, id, addressId, orderType },
1868
1829
  { abortEarly: false, allowUnknown: true }
1869
1830
  );
1870
1831
  if (error) {
@@ -1872,37 +1833,42 @@ class PosCart {
1872
1833
  }
1873
1834
 
1874
1835
  // Showing warrnings if extra unknown parameters are found
1875
- const { error: warrning } = PosCartValidator.getCartSharedItems().validate(
1876
- { token },
1836
+ const { error: warrning } = PosCartValidator.updateShipments().validate(
1837
+ { body, i, p, id, addressId, orderType },
1877
1838
  { abortEarly: false, allowUnknown: false }
1878
1839
  );
1879
1840
  if (warrning) {
1880
1841
  Logger({
1881
1842
  level: "WARN",
1882
- message: "Parameter Validation warrnings for getCartSharedItems",
1843
+ message: "Parameter Validation warrnings for updateShipments",
1883
1844
  });
1884
1845
  Logger({ level: "WARN", message: warrning });
1885
1846
  }
1886
1847
 
1887
1848
  const query_params = {};
1849
+ query_params["i"] = i;
1850
+ query_params["p"] = p;
1851
+ query_params["id"] = id;
1852
+ query_params["address_id"] = addressId;
1853
+ query_params["order_type"] = orderType;
1888
1854
 
1889
1855
  const xHeaders = {};
1890
1856
 
1891
- const response = await APIClient.execute(
1857
+ const response = await ApplicationAPIClient.execute(
1892
1858
  this._conf,
1893
- "get",
1859
+ "put",
1894
1860
  constructUrl({
1895
- url: this._urls["getCartSharedItems"],
1896
- params: { token },
1861
+ url: this._urls["updateShipments"],
1862
+ params: {},
1897
1863
  }),
1898
1864
  query_params,
1899
- undefined,
1865
+ body,
1900
1866
  xHeaders
1901
1867
  );
1902
1868
 
1903
1869
  const {
1904
1870
  error: res_error,
1905
- } = PosCartModel.SharedCartResponse().validate(response, {
1871
+ } = PosCartModel.CartShipmentsResponse().validate(response, {
1906
1872
  abortEarly: false,
1907
1873
  allowUnknown: false,
1908
1874
  });
@@ -1910,7 +1876,7 @@ class PosCart {
1910
1876
  if (res_error) {
1911
1877
  Logger({
1912
1878
  level: "WARN",
1913
- message: "Response Validation Warnnings for getCartSharedItems",
1879
+ message: "Response Validation Warnnings for updateShipments",
1914
1880
  });
1915
1881
  Logger({ level: "WARN", message: res_error });
1916
1882
  }
@@ -1920,16 +1886,36 @@ class PosCart {
1920
1886
 
1921
1887
  /**
1922
1888
  * @param {Object} arg - Arg object.
1923
- * @param {string} arg.token - Token of the shared short link
1924
- * @param {string} arg.action - Operation to perform on the existing cart
1925
- * merge or replace.
1926
- * @returns {Promise<SharedCartResponse>} - Success response
1927
- * @summary: Merge or replace existing cart
1928
- * @description: Use this API to merge the shared cart with existing cart, or replace the existing cart with the shared cart. The `action` parameter is used to indicate the operation Merge or Replace.
1889
+ * @param {string} [arg.id] -
1890
+ * @param {boolean} [arg.buyNow] -
1891
+ * @param {string} [arg.addressId] -
1892
+ * @param {string} [arg.paymentMode] -
1893
+ * @param {string} [arg.paymentIdentifier] -
1894
+ * @param {string} [arg.aggregatorName] -
1895
+ * @param {string} [arg.merchantCode] -
1896
+ * @returns {Promise<PaymentCouponValidate>} - Success response
1897
+ * @summary: Verify the coupon eligibility against the payment mode
1898
+ * @description: Use this API to validate a coupon against the payment mode such as NetBanking, Wallet, UPI etc.
1929
1899
  */
1930
- async updateCartWithSharedItems({ token, action } = {}) {
1931
- const { error } = PosCartValidator.updateCartWithSharedItems().validate(
1932
- { token, action },
1900
+ async validateCouponForPayment({
1901
+ id,
1902
+ buyNow,
1903
+ addressId,
1904
+ paymentMode,
1905
+ paymentIdentifier,
1906
+ aggregatorName,
1907
+ merchantCode,
1908
+ } = {}) {
1909
+ const { error } = PosCartValidator.validateCouponForPayment().validate(
1910
+ {
1911
+ id,
1912
+ buyNow,
1913
+ addressId,
1914
+ paymentMode,
1915
+ paymentIdentifier,
1916
+ aggregatorName,
1917
+ merchantCode,
1918
+ },
1933
1919
  { abortEarly: false, allowUnknown: true }
1934
1920
  );
1935
1921
  if (error) {
@@ -1939,28 +1925,43 @@ class PosCart {
1939
1925
  // Showing warrnings if extra unknown parameters are found
1940
1926
  const {
1941
1927
  error: warrning,
1942
- } = PosCartValidator.updateCartWithSharedItems().validate(
1943
- { token, action },
1928
+ } = PosCartValidator.validateCouponForPayment().validate(
1929
+ {
1930
+ id,
1931
+ buyNow,
1932
+ addressId,
1933
+ paymentMode,
1934
+ paymentIdentifier,
1935
+ aggregatorName,
1936
+ merchantCode,
1937
+ },
1944
1938
  { abortEarly: false, allowUnknown: false }
1945
1939
  );
1946
1940
  if (warrning) {
1947
1941
  Logger({
1948
1942
  level: "WARN",
1949
- message: "Parameter Validation warrnings for updateCartWithSharedItems",
1943
+ message: "Parameter Validation warrnings for validateCouponForPayment",
1950
1944
  });
1951
1945
  Logger({ level: "WARN", message: warrning });
1952
1946
  }
1953
1947
 
1954
1948
  const query_params = {};
1949
+ query_params["id"] = id;
1950
+ query_params["buy_now"] = buyNow;
1951
+ query_params["address_id"] = addressId;
1952
+ query_params["payment_mode"] = paymentMode;
1953
+ query_params["payment_identifier"] = paymentIdentifier;
1954
+ query_params["aggregator_name"] = aggregatorName;
1955
+ query_params["merchant_code"] = merchantCode;
1955
1956
 
1956
1957
  const xHeaders = {};
1957
1958
 
1958
- const response = await APIClient.execute(
1959
+ const response = await ApplicationAPIClient.execute(
1959
1960
  this._conf,
1960
- "post",
1961
+ "get",
1961
1962
  constructUrl({
1962
- url: this._urls["updateCartWithSharedItems"],
1963
- params: { token, action },
1963
+ url: this._urls["validateCouponForPayment"],
1964
+ params: {},
1964
1965
  }),
1965
1966
  query_params,
1966
1967
  undefined,
@@ -1969,7 +1970,7 @@ class PosCart {
1969
1970
 
1970
1971
  const {
1971
1972
  error: res_error,
1972
- } = PosCartModel.SharedCartResponse().validate(response, {
1973
+ } = PosCartModel.PaymentCouponValidate().validate(response, {
1973
1974
  abortEarly: false,
1974
1975
  allowUnknown: false,
1975
1976
  });
@@ -1977,7 +1978,7 @@ class PosCart {
1977
1978
  if (res_error) {
1978
1979
  Logger({
1979
1980
  level: "WARN",
1980
- message: "Response Validation Warnnings for updateCartWithSharedItems",
1981
+ message: "Response Validation Warnnings for validateCouponForPayment",
1981
1982
  });
1982
1983
  Logger({ level: "WARN", message: res_error });
1983
1984
  }