@gofynd/fdk-client-javascript 1.0.1 → 1.0.3

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 (318) hide show
  1. package/documentation/application/CART.md +5934 -4502
  2. package/documentation/application/CATALOG.md +6338 -7245
  3. package/documentation/application/COMMON.md +95 -222
  4. package/documentation/application/COMMUNICATION.md +106 -186
  5. package/documentation/application/CONFIGURATION.md +903 -1597
  6. package/documentation/application/CONTENT.md +562 -1270
  7. package/documentation/application/FILESTORAGE.md +84 -220
  8. package/documentation/application/LEAD.md +314 -660
  9. package/documentation/application/LOGISTIC.md +229 -305
  10. package/documentation/application/ORDER.md +642 -1137
  11. package/documentation/application/PAYMENT.md +2285 -3031
  12. package/documentation/application/POSCART.md +6079 -4642
  13. package/documentation/application/REWARDS.md +94 -248
  14. package/documentation/application/SHARE.md +152 -250
  15. package/documentation/application/THEME.md +952 -1235
  16. package/documentation/application/USER.md +1228 -1765
  17. package/documentation/platform/ANALYTICS.md +207 -349
  18. package/documentation/platform/AUDITTRAIL.md +121 -204
  19. package/documentation/platform/BILLING.md +865 -1376
  20. package/documentation/platform/CART.md +2814 -3662
  21. package/documentation/platform/CATALOG.md +15266 -17619
  22. package/documentation/platform/COMMON.md +95 -222
  23. package/documentation/platform/COMMUNICATION.md +1632 -2380
  24. package/documentation/platform/COMPANYPROFILE.md +572 -957
  25. package/documentation/platform/CONFIGURATION.md +3050 -4073
  26. package/documentation/platform/CONTENT.md +3509 -4121
  27. package/documentation/platform/DISCOUNT.md +140 -236
  28. package/documentation/platform/FILESTORAGE.md +187 -323
  29. package/documentation/platform/INVENTORY.md +268 -911
  30. package/documentation/platform/LEAD.md +2195 -2541
  31. package/documentation/platform/ORDER.md +3750 -5636
  32. package/documentation/platform/PARTNER.md +9 -36
  33. package/documentation/platform/PAYMENT.md +903 -1213
  34. package/documentation/platform/REWARDS.md +183 -347
  35. package/documentation/platform/SHARE.md +120 -213
  36. package/documentation/platform/THEME.md +12956 -13239
  37. package/documentation/platform/USER.md +975 -1120
  38. package/documentation/platform/WEBHOOK.md +78 -184
  39. package/documentation/public/CONFIGURATION.md +95 -222
  40. package/documentation/public/INVENTORY.md +100 -282
  41. package/documentation/public/WEBHOOK.md +27 -133
  42. package/package.json +1 -1
  43. package/sdk/application/ApplicationConfig.js +1 -1
  44. package/sdk/application/Cart/CartApplicationClient.d.ts +243 -243
  45. package/sdk/application/Cart/CartApplicationClient.js +1058 -547
  46. package/sdk/application/Cart/CartApplicationModel.d.ts +64 -63
  47. package/sdk/application/Cart/CartApplicationModel.js +489 -886
  48. package/sdk/application/Cart/CartApplicationValidator.d.ts +17 -17
  49. package/sdk/application/Cart/CartApplicationValidator.js +98 -98
  50. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +358 -358
  51. package/sdk/application/Catalog/CatalogApplicationClient.js +1545 -949
  52. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +90 -90
  53. package/sdk/application/Catalog/CatalogApplicationModel.js +692 -1258
  54. package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +19 -19
  55. package/sdk/application/Catalog/CatalogApplicationValidator.js +110 -110
  56. package/sdk/application/Common/CommonApplicationClient.d.ts +13 -13
  57. package/sdk/application/Common/CommonApplicationClient.js +76 -36
  58. package/sdk/application/Common/CommonApplicationModel.d.ts +12 -12
  59. package/sdk/application/Common/CommonApplicationModel.js +83 -160
  60. package/sdk/application/Common/CommonApplicationValidator.d.ts +1 -1
  61. package/sdk/application/Common/CommonApplicationValidator.js +6 -6
  62. package/sdk/application/Communication/CommunicationApplicationClient.d.ts +11 -11
  63. package/sdk/application/Communication/CommunicationApplicationClient.js +92 -31
  64. package/sdk/application/Communication/CommunicationApplicationModel.d.ts +6 -6
  65. package/sdk/application/Communication/CommunicationApplicationModel.js +38 -83
  66. package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +1 -1
  67. package/sdk/application/Communication/CommunicationApplicationValidator.js +4 -4
  68. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +116 -116
  69. package/sdk/application/Configuration/ConfigurationApplicationClient.js +638 -312
  70. package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +85 -85
  71. package/sdk/application/Configuration/ConfigurationApplicationModel.js +480 -851
  72. package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +8 -8
  73. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +33 -33
  74. package/sdk/application/Content/ContentApplicationClient.d.ts +67 -67
  75. package/sdk/application/Content/ContentApplicationClient.js +581 -213
  76. package/sdk/application/Content/ContentApplicationModel.d.ts +76 -75
  77. package/sdk/application/Content/ContentApplicationModel.js +468 -875
  78. package/sdk/application/Content/ContentApplicationValidator.d.ts +5 -5
  79. package/sdk/application/Content/ContentApplicationValidator.js +24 -24
  80. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +25 -25
  81. package/sdk/application/FileStorage/FileStorageApplicationClient.js +121 -59
  82. package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +13 -13
  83. package/sdk/application/FileStorage/FileStorageApplicationModel.js +86 -169
  84. package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +1 -1
  85. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +7 -7
  86. package/sdk/application/Lead/LeadApplicationClient.d.ts +24 -24
  87. package/sdk/application/Lead/LeadApplicationClient.js +230 -96
  88. package/sdk/application/Lead/LeadApplicationModel.d.ts +35 -35
  89. package/sdk/application/Lead/LeadApplicationModel.js +267 -474
  90. package/sdk/application/Lead/LeadApplicationValidator.d.ts +2 -2
  91. package/sdk/application/Lead/LeadApplicationValidator.js +11 -11
  92. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +30 -19
  93. package/sdk/application/Logistic/LogisticApplicationClient.js +196 -47
  94. package/sdk/application/Logistic/LogisticApplicationModel.d.ts +17 -14
  95. package/sdk/application/Logistic/LogisticApplicationModel.js +133 -201
  96. package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +3 -2
  97. package/sdk/application/Logistic/LogisticApplicationValidator.js +14 -8
  98. package/sdk/application/Order/OrderApplicationClient.d.ts +86 -86
  99. package/sdk/application/Order/OrderApplicationClient.js +448 -215
  100. package/sdk/application/Order/OrderApplicationModel.d.ts +50 -50
  101. package/sdk/application/Order/OrderApplicationModel.js +357 -661
  102. package/sdk/application/Order/OrderApplicationValidator.d.ts +7 -7
  103. package/sdk/application/Order/OrderApplicationValidator.js +28 -28
  104. package/sdk/application/Payment/PaymentApplicationClient.d.ts +318 -318
  105. package/sdk/application/Payment/PaymentApplicationClient.js +1525 -750
  106. package/sdk/application/Payment/PaymentApplicationModel.d.ts +72 -72
  107. package/sdk/application/Payment/PaymentApplicationModel.js +565 -1033
  108. package/sdk/application/Payment/PaymentApplicationValidator.d.ts +28 -28
  109. package/sdk/application/Payment/PaymentApplicationValidator.js +107 -107
  110. package/sdk/application/PosCart/PosCartApplicationClient.d.ts +254 -254
  111. package/sdk/application/PosCart/PosCartApplicationClient.js +1137 -606
  112. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +61 -60
  113. package/sdk/application/PosCart/PosCartApplicationModel.js +477 -873
  114. package/sdk/application/PosCart/PosCartApplicationValidator.d.ts +18 -18
  115. package/sdk/application/PosCart/PosCartApplicationValidator.js +103 -103
  116. package/sdk/application/Rewards/RewardsApplicationClient.d.ts +27 -27
  117. package/sdk/application/Rewards/RewardsApplicationClient.js +253 -113
  118. package/sdk/application/Rewards/RewardsApplicationModel.d.ts +14 -14
  119. package/sdk/application/Rewards/RewardsApplicationModel.js +96 -191
  120. package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +3 -3
  121. package/sdk/application/Rewards/RewardsApplicationValidator.js +12 -12
  122. package/sdk/application/Share/ShareApplicationClient.d.ts +37 -37
  123. package/sdk/application/Share/ShareApplicationClient.js +221 -96
  124. package/sdk/application/Share/ShareApplicationModel.d.ts +8 -8
  125. package/sdk/application/Share/ShareApplicationModel.js +63 -123
  126. package/sdk/application/Share/ShareApplicationValidator.d.ts +4 -4
  127. package/sdk/application/Share/ShareApplicationValidator.js +12 -12
  128. package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -8
  129. package/sdk/application/Theme/ThemeApplicationClient.js +115 -37
  130. package/sdk/application/Theme/ThemeApplicationModel.d.ts +34 -34
  131. package/sdk/application/Theme/ThemeApplicationModel.js +190 -336
  132. package/sdk/application/Theme/ThemeApplicationValidator.d.ts +1 -1
  133. package/sdk/application/Theme/ThemeApplicationValidator.js +4 -4
  134. package/sdk/application/User/UserApplicationClient.d.ts +280 -280
  135. package/sdk/application/User/UserApplicationClient.js +1201 -543
  136. package/sdk/application/User/UserApplicationModel.d.ts +79 -72
  137. package/sdk/application/User/UserApplicationModel.js +440 -689
  138. package/sdk/application/User/UserApplicationValidator.d.ts +24 -24
  139. package/sdk/application/User/UserApplicationValidator.js +89 -89
  140. package/sdk/common/AxiosHelper.js +1 -1
  141. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +55 -47
  142. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +308 -151
  143. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +6 -6
  144. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +20 -20
  145. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  146. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
  147. package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +11 -11
  148. package/sdk/platform/Analytics/AnalyticsPlatformModel.js +95 -178
  149. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +16 -12
  150. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +131 -44
  151. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +10 -10
  152. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +50 -89
  153. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +1 -1
  154. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +6 -6
  155. package/sdk/platform/Billing/BillingPlatformClient.d.ts +68 -56
  156. package/sdk/platform/Billing/BillingPlatformClient.js +416 -171
  157. package/sdk/platform/Billing/BillingPlatformModel.d.ts +40 -40
  158. package/sdk/platform/Billing/BillingPlatformModel.js +342 -668
  159. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +8 -8
  160. package/sdk/platform/Billing/BillingPlatformValidator.js +25 -25
  161. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +176 -159
  162. package/sdk/platform/Cart/CartPlatformApplicationClient.js +837 -500
  163. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +11 -11
  164. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +63 -63
  165. package/sdk/platform/Cart/CartPlatformModel.d.ts +86 -85
  166. package/sdk/platform/Cart/CartPlatformModel.js +677 -1211
  167. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +582 -529
  168. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2642 -1533
  169. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +40 -40
  170. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +175 -175
  171. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +708 -590
  172. package/sdk/platform/Catalog/CatalogPlatformClient.js +3103 -1362
  173. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +293 -284
  174. package/sdk/platform/Catalog/CatalogPlatformModel.js +2149 -3660
  175. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +66 -64
  176. package/sdk/platform/Catalog/CatalogPlatformValidator.js +235 -216
  177. package/sdk/platform/Common/CommonPlatformClient.d.ts +14 -12
  178. package/sdk/platform/Common/CommonPlatformClient.js +80 -37
  179. package/sdk/platform/Common/CommonPlatformModel.d.ts +12 -12
  180. package/sdk/platform/Common/CommonPlatformModel.js +83 -160
  181. package/sdk/platform/Common/CommonPlatformValidator.d.ts +1 -1
  182. package/sdk/platform/Common/CommonPlatformValidator.js +6 -6
  183. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +333 -293
  184. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1687 -855
  185. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +30 -30
  186. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +87 -87
  187. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  188. package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
  189. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +67 -67
  190. package/sdk/platform/Communication/CommunicationPlatformModel.js +522 -974
  191. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +70 -57
  192. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +463 -182
  193. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +28 -28
  194. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +294 -557
  195. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +7 -7
  196. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +24 -24
  197. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +175 -137
  198. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1168 -521
  199. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +22 -21
  200. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +69 -63
  201. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +137 -119
  202. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +691 -316
  203. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +148 -146
  204. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +854 -1508
  205. package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +9 -9
  206. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +38 -38
  207. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +542 -461
  208. package/sdk/platform/Content/ContentPlatformApplicationClient.js +2600 -1160
  209. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +50 -49
  210. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +159 -152
  211. package/sdk/platform/Content/ContentPlatformModel.d.ts +79 -75
  212. package/sdk/platform/Content/ContentPlatformModel.js +486 -867
  213. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +72 -61
  214. package/sdk/platform/Discount/DiscountPlatformClient.js +424 -198
  215. package/sdk/platform/Discount/DiscountPlatformModel.d.ts +7 -7
  216. package/sdk/platform/Discount/DiscountPlatformModel.js +60 -121
  217. package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +6 -6
  218. package/sdk/platform/Discount/DiscountPlatformValidator.js +29 -29
  219. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +26 -22
  220. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +145 -59
  221. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -1
  222. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +8 -8
  223. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +58 -52
  224. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +240 -114
  225. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +13 -13
  226. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +86 -169
  227. package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +3 -3
  228. package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +11 -11
  229. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +76 -63
  230. package/sdk/platform/Inventory/InventoryPlatformClient.js +461 -197
  231. package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +30 -30
  232. package/sdk/platform/Inventory/InventoryPlatformModel.js +497 -964
  233. package/sdk/platform/Inventory/InventoryPlatformValidator.d.ts +7 -7
  234. package/sdk/platform/Inventory/InventoryPlatformValidator.js +28 -28
  235. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +84 -71
  236. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +441 -182
  237. package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +7 -7
  238. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +28 -28
  239. package/sdk/platform/Lead/LeadPlatformClient.d.ts +86 -75
  240. package/sdk/platform/Lead/LeadPlatformClient.js +434 -212
  241. package/sdk/platform/Lead/LeadPlatformModel.d.ts +35 -35
  242. package/sdk/platform/Lead/LeadPlatformModel.js +267 -474
  243. package/sdk/platform/Lead/LeadPlatformValidator.d.ts +6 -6
  244. package/sdk/platform/Lead/LeadPlatformValidator.js +24 -24
  245. package/sdk/platform/OAuthClient.js +8 -8
  246. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +14 -11
  247. package/sdk/platform/Order/OrderPlatformApplicationClient.js +113 -49
  248. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -1
  249. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +6 -6
  250. package/sdk/platform/Order/OrderPlatformClient.d.ts +367 -315
  251. package/sdk/platform/Order/OrderPlatformClient.js +1775 -893
  252. package/sdk/platform/Order/OrderPlatformModel.d.ts +198 -192
  253. package/sdk/platform/Order/OrderPlatformModel.js +1591 -2822
  254. package/sdk/platform/Order/OrderPlatformValidator.d.ts +32 -32
  255. package/sdk/platform/Order/OrderPlatformValidator.js +160 -155
  256. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  257. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
  258. package/sdk/platform/Partner/PartnerPlatformModel.js +6 -22
  259. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +65 -54
  260. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +395 -164
  261. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +6 -6
  262. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +23 -23
  263. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +55 -45
  264. package/sdk/platform/Payment/PaymentPlatformClient.js +362 -147
  265. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +27 -27
  266. package/sdk/platform/Payment/PaymentPlatformModel.js +220 -408
  267. package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +4 -4
  268. package/sdk/platform/Payment/PaymentPlatformValidator.js +21 -21
  269. package/sdk/platform/PlatformApplicationClient.d.ts +1496 -10153
  270. package/sdk/platform/PlatformApplicationClient.js +1584 -13691
  271. package/sdk/platform/PlatformClient.d.ts +7918 -7666
  272. package/sdk/platform/PlatformClient.js +8701 -9926
  273. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +91 -78
  274. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +507 -253
  275. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +8 -8
  276. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +34 -34
  277. package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +15 -15
  278. package/sdk/platform/Rewards/RewardsPlatformModel.js +92 -194
  279. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +16 -12
  280. package/sdk/platform/Share/SharePlatformApplicationClient.js +130 -52
  281. package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -1
  282. package/sdk/platform/Share/SharePlatformApplicationValidator.js +6 -6
  283. package/sdk/platform/Share/SharePlatformModel.d.ts +8 -8
  284. package/sdk/platform/Share/SharePlatformModel.js +60 -118
  285. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +148 -124
  286. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +770 -295
  287. package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +15 -15
  288. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +44 -44
  289. package/sdk/platform/Theme/ThemePlatformModel.d.ts +34 -34
  290. package/sdk/platform/Theme/ThemePlatformModel.js +190 -336
  291. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +146 -67
  292. package/sdk/platform/User/UserPlatformApplicationClient.js +742 -155
  293. package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +12 -7
  294. package/sdk/platform/User/UserPlatformApplicationValidator.js +61 -23
  295. package/sdk/platform/User/UserPlatformModel.d.ts +79 -72
  296. package/sdk/platform/User/UserPlatformModel.js +440 -689
  297. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +35 -29
  298. package/sdk/platform/Webhook/WebhookPlatformClient.js +218 -91
  299. package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +7 -7
  300. package/sdk/platform/Webhook/WebhookPlatformModel.js +68 -136
  301. package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +3 -3
  302. package/sdk/platform/Webhook/WebhookPlatformValidator.js +14 -14
  303. package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +13 -13
  304. package/sdk/public/Configuration/ConfigurationPublicClient.js +81 -38
  305. package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +12 -12
  306. package/sdk/public/Configuration/ConfigurationPublicModel.js +85 -162
  307. package/sdk/public/Configuration/ConfigurationPublicValidator.d.ts +1 -1
  308. package/sdk/public/Configuration/ConfigurationPublicValidator.js +6 -6
  309. package/sdk/public/Inventory/InventoryPublicClient.d.ts +34 -34
  310. package/sdk/public/Inventory/InventoryPublicClient.js +228 -105
  311. package/sdk/public/Inventory/InventoryPublicModel.d.ts +10 -10
  312. package/sdk/public/Inventory/InventoryPublicModel.js +119 -245
  313. package/sdk/public/Inventory/InventoryPublicValidator.d.ts +3 -3
  314. package/sdk/public/Inventory/InventoryPublicValidator.js +15 -15
  315. package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
  316. package/sdk/public/Webhook/WebhookPublicModel.d.ts +7 -7
  317. package/sdk/public/Webhook/WebhookPublicModel.js +68 -136
  318. package/tests/application/catalog.spec.js +7 -0
@@ -3,76 +3,78 @@ const constructUrl = require("../constructUrl");
3
3
  const Paginator = require("../../common/Paginator");
4
4
  const { FDKClientValidationError } = require("../../common/FDKError");
5
5
  const PaymentValidator = require("./PaymentApplicationValidator");
6
+ const PaymentModel = require("./PaymentApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class Payment {
8
10
  constructor(_conf) {
9
11
  this._conf = _conf;
10
12
  this._relativeUrls = {
11
- getAggregatorsConfig:
12
- "/service/application/payment/v1.0/config/aggregators/key",
13
+ addBeneficiaryDetails: "/service/application/payment/v1.0/refund/account",
14
+ addRefundBankAccountUsingOTP:
15
+ "/service/application/payment/v1.0/refund/account/otp",
13
16
  attachCardToCustomer: "/service/application/payment/v1.0/card/attach",
17
+ cancelPaymentLink:
18
+ "/service/application/payment/v1.0/cancel-payment-link/",
19
+ checkAndUpdatePaymentStatus:
20
+ "/service/application/payment/v1.0/payment/confirm/polling",
21
+ checkAndUpdatePaymentStatusPaymentLink:
22
+ "/service/application/payment/v1.0/payment/confirm/polling/link/",
23
+ checkCredit: "/service/application/payment/v1.0/check-credits/",
24
+ createOrderHandlerPaymentLink:
25
+ "/service/application/payment/v1.0/create-order/link/",
26
+ createPaymentLink:
27
+ "/service/application/payment/v1.0/create-payment-link/",
28
+ customerCreditSummary:
29
+ "/service/application/payment/v1.0/payment/credit-summary/",
30
+ customerOnboard: "/service/application/payment/v1.0/credit-onboard/",
31
+ deleteUserCard: "/service/application/payment/v1.0/card/remove",
32
+ enableOrDisableRefundTransferMode:
33
+ "/service/application/payment/v1.0/refund/transfer-mode",
14
34
  getActiveCardAggregator:
15
35
  "/service/application/payment/v1.0/card/aggregator",
36
+ getActiveRefundTransferModes:
37
+ "/service/application/payment/v1.0/refund/transfer-mode",
16
38
  getActiveUserCards: "/service/application/payment/v1.0/cards",
17
- deleteUserCard: "/service/application/payment/v1.0/card/remove",
18
- verifyCustomerForPayment:
19
- "/service/application/payment/v1.0/payment/customer/validation",
20
- verifyAndChargePayment:
21
- "/service/application/payment/v1.0/payment/confirm/charge",
22
- initialisePayment: "/service/application/payment/v1.0/payment/request",
23
- checkAndUpdatePaymentStatus:
24
- "/service/application/payment/v1.0/payment/confirm/polling",
39
+ getAggregatorsConfig:
40
+ "/service/application/payment/v1.0/config/aggregators/key",
41
+ getEpaylaterBannerDetails:
42
+ "/service/application/payment/v1.0/epaylater/banner",
43
+ getOrderBeneficiariesDetail:
44
+ "/service/application/payment/v1.0/refund/order/beneficiaries",
45
+ getPaymentLink: "/service/application/payment/v1.0/create-payment-link/",
25
46
  getPaymentModeRoutes: "/service/application/payment/v1.0/payment/options",
47
+ getPaymentModeRoutesPaymentLink:
48
+ "/service/application/payment/v1.0/payment/options/link/",
26
49
  getPosPaymentModeRoutes:
27
50
  "/service/application/payment/v1.0/payment/options/pos",
28
51
  getRupifiBannerDetails: "/service/application/payment/v1.0/rupifi/banner",
29
- getEpaylaterBannerDetails:
30
- "/service/application/payment/v1.0/epaylater/banner",
52
+ getUserBeneficiariesDetail:
53
+ "/service/application/payment/v1.0/refund/user/beneficiary",
54
+ initialisePayment: "/service/application/payment/v1.0/payment/request",
55
+ initialisePaymentPaymentLink:
56
+ "/service/application/payment/v1.0/payment/request/link/",
57
+ pollingPaymentLink:
58
+ "/service/application/payment/v1.0/polling-payment-link/",
59
+ redirectToAggregator:
60
+ "/service/application/payment/v1.0/payment/redirect-to-aggregator/",
61
+ renderHTML: "/service/application/payment/v1.0/payment/html/render/",
31
62
  resendOrCancelPayment:
32
63
  "/service/application/payment/v1.0/payment/resend_or_cancel",
33
- renderHTML: "/service/application/payment/v1.0/payment/html/render/",
64
+ resendPaymentLink:
65
+ "/service/application/payment/v1.0/resend-payment-link/",
66
+ updateDefaultBeneficiary:
67
+ "/service/application/payment/v1.0/refund/beneficiary/default",
34
68
  validateVPA: "/service/application/payment/v1.0/validate-vpa",
35
- getActiveRefundTransferModes:
36
- "/service/application/payment/v1.0/refund/transfer-mode",
37
- enableOrDisableRefundTransferMode:
38
- "/service/application/payment/v1.0/refund/transfer-mode",
39
- getUserBeneficiariesDetail:
40
- "/service/application/payment/v1.0/refund/user/beneficiary",
69
+ verifyAndChargePayment:
70
+ "/service/application/payment/v1.0/payment/confirm/charge",
71
+ verifyCustomerForPayment:
72
+ "/service/application/payment/v1.0/payment/customer/validation",
41
73
  verifyIfscCode: "/service/application/payment/v1.0/ifsc-code/verify",
42
- getOrderBeneficiariesDetail:
43
- "/service/application/payment/v1.0/refund/order/beneficiaries",
44
74
  verifyOtpAndAddBeneficiaryForBank:
45
75
  "/service/application/payment/v1.0/refund/verification/bank",
46
- addBeneficiaryDetails: "/service/application/payment/v1.0/refund/account",
47
- addRefundBankAccountUsingOTP:
48
- "/service/application/payment/v1.0/refund/account/otp",
49
76
  verifyOtpAndAddBeneficiaryForWallet:
50
77
  "/service/application/payment/v1.0/refund/verification/wallet",
51
- updateDefaultBeneficiary:
52
- "/service/application/payment/v1.0/refund/beneficiary/default",
53
- getPaymentLink: "/service/application/payment/v1.0/create-payment-link/",
54
- createPaymentLink:
55
- "/service/application/payment/v1.0/create-payment-link/",
56
- resendPaymentLink:
57
- "/service/application/payment/v1.0/resend-payment-link/",
58
- cancelPaymentLink:
59
- "/service/application/payment/v1.0/cancel-payment-link/",
60
- getPaymentModeRoutesPaymentLink:
61
- "/service/application/payment/v1.0/payment/options/link/",
62
- pollingPaymentLink:
63
- "/service/application/payment/v1.0/polling-payment-link/",
64
- createOrderHandlerPaymentLink:
65
- "/service/application/payment/v1.0/create-order/link/",
66
- initialisePaymentPaymentLink:
67
- "/service/application/payment/v1.0/payment/request/link/",
68
- checkAndUpdatePaymentStatusPaymentLink:
69
- "/service/application/payment/v1.0/payment/confirm/polling/link/",
70
- customerCreditSummary:
71
- "/service/application/payment/v1.0/payment/credit-summary/",
72
- redirectToAggregator:
73
- "/service/application/payment/v1.0/payment/redirect-to-aggregator/",
74
- checkCredit: "/service/application/payment/v1.0/check-credits/",
75
- customerOnboard: "/service/application/payment/v1.0/credit-onboard/",
76
78
  };
77
79
  this._urls = Object.entries(this._relativeUrls).reduce(
78
80
  (urls, [method, relativeUrl]) => {
@@ -92,17 +94,14 @@ class Payment {
92
94
 
93
95
  /**
94
96
  * @param {Object} arg - Arg object.
95
- * @param {string} [arg.xApiToken] - Used for basic authentication.
96
- * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
97
- * to remove temporary cache files on payment gateway and replace with the
98
- * latest one.
99
- * @returns {Promise<AggregatorsConfigDetailResponse>} - Success response
100
- * @summary: Get payment gateway keys
101
- * @description: Use this API to retrieve the payment gateway key, secrets, merchant, SDK/API details to complete a payment at front-end.
97
+ * @param {AddBeneficiaryDetailsRequest} arg.body
98
+ * @returns {Promise<RefundAccountResponse>} - Success response
99
+ * @summary: Save bank details for cancelled/returned order
100
+ * @description: Use this API to save the bank details for a returned or cancelled order to refund the amount.
102
101
  */
103
- getAggregatorsConfig({ xApiToken, refresh } = {}) {
104
- const { error } = PaymentValidator.getAggregatorsConfig().validate(
105
- { xApiToken, refresh },
102
+ async addBeneficiaryDetails({ body } = {}) {
103
+ const { error } = PaymentValidator.addBeneficiaryDetails().validate(
104
+ { body },
106
105
  { abortEarly: false, allowUnknown: true }
107
106
  );
108
107
  if (error) {
@@ -112,43 +111,61 @@ class Payment {
112
111
  // Showing warrnings if extra unknown parameters are found
113
112
  const {
114
113
  error: warrning,
115
- } = PaymentValidator.getAggregatorsConfig().validate(
116
- { xApiToken, refresh },
114
+ } = PaymentValidator.addBeneficiaryDetails().validate(
115
+ { body },
117
116
  { abortEarly: false, allowUnknown: false }
118
117
  );
119
118
  if (warrning) {
120
- console.log("Parameter Validation warrnings for getAggregatorsConfig");
121
- console.log(warrning);
119
+ Logger({
120
+ level: "WARN",
121
+ message: "Parameter Validation warrnings for addBeneficiaryDetails",
122
+ });
123
+ Logger({ level: "WARN", message: warrning });
122
124
  }
123
125
 
124
126
  const query_params = {};
125
- query_params["refresh"] = refresh;
126
127
 
127
128
  const xHeaders = {};
128
- xHeaders["x-api-token"] = xApiToken;
129
129
 
130
- return APIClient.execute(
130
+ const response = await APIClient.execute(
131
131
  this._conf,
132
- "get",
132
+ "post",
133
133
  constructUrl({
134
- url: this._urls["getAggregatorsConfig"],
134
+ url: this._urls["addBeneficiaryDetails"],
135
135
  params: {},
136
136
  }),
137
137
  query_params,
138
- undefined,
138
+ body,
139
139
  xHeaders
140
140
  );
141
+
142
+ const {
143
+ error: res_error,
144
+ } = PaymentModel.RefundAccountResponse().validate(response, {
145
+ abortEarly: false,
146
+ allowUnknown: false,
147
+ });
148
+
149
+ if (res_error) {
150
+ Logger({
151
+ level: "WARN",
152
+ message: "Response Validation Warnnings for addBeneficiaryDetails",
153
+ });
154
+ Logger({ level: "WARN", message: res_error });
155
+ }
156
+
157
+ return response;
141
158
  }
142
159
 
143
160
  /**
144
161
  * @param {Object} arg - Arg object.
145
- * @param {AttachCardRequest} arg.body
146
- * @returns {Promise<AttachCardsResponse>} - Success response
147
- * @summary: Attach a saved card to customer.
148
- * @description: Use this API to attach a customer's saved card at the payment gateway, such as Stripe, Juspay.
162
+ * @param {AddBeneficiaryDetailsOTPRequest} arg.body
163
+ * @returns {Promise<RefundAccountResponse>} - Success response
164
+ * @summary: Save bank details for cancelled/returned order
165
+ * @description: Use this API to save bank details for returned/cancelled order to refund amount in his account.
149
166
  */
150
- attachCardToCustomer({ body } = {}) {
151
- const { error } = PaymentValidator.attachCardToCustomer().validate(
167
+ async addRefundBankAccountUsingOTP({ body } = {}) {
168
+ const { error } = PaymentValidator.addRefundBankAccountUsingOTP().validate(
152
169
  { body },
153
170
  { abortEarly: false, allowUnknown: true }
154
171
  );
@@ -159,42 +176,64 @@ class Payment {
159
176
  // Showing warrnings if extra unknown parameters are found
160
177
  const {
161
178
  error: warrning,
162
- } = PaymentValidator.attachCardToCustomer().validate(
179
+ } = PaymentValidator.addRefundBankAccountUsingOTP().validate(
163
180
  { body },
164
181
  { abortEarly: false, allowUnknown: false }
165
182
  );
166
183
  if (warrning) {
167
- console.log("Parameter Validation warrnings for attachCardToCustomer");
168
- console.log(warrning);
184
+ Logger({
185
+ level: "WARN",
186
+ message:
187
+ "Parameter Validation warrnings for addRefundBankAccountUsingOTP",
188
+ });
189
+ Logger({ level: "WARN", message: warrning });
169
190
  }
170
191
 
171
192
  const query_params = {};
172
193
 
173
194
  const xHeaders = {};
174
195
 
175
- return APIClient.execute(
196
+ const response = await APIClient.execute(
176
197
  this._conf,
177
198
  "post",
178
199
  constructUrl({
179
- url: this._urls["attachCardToCustomer"],
200
+ url: this._urls["addRefundBankAccountUsingOTP"],
180
201
  params: {},
181
202
  }),
182
203
  query_params,
183
204
  body,
184
205
  xHeaders
185
206
  );
207
+
208
+ const {
209
+ error: res_error,
210
+ } = PaymentModel.RefundAccountResponse().validate(response, {
211
+ abortEarly: false,
212
+ allowUnknown: false,
213
+ });
214
+
215
+ if (res_error) {
216
+ Logger({
217
+ level: "WARN",
218
+ message:
219
+ "Response Validation Warnnings for addRefundBankAccountUsingOTP",
220
+ });
221
+ Logger({ level: "WARN", message: res_error });
222
+ }
223
+
224
+ return response;
186
225
  }
187
226
 
188
227
  /**
189
228
  * @param {Object} arg - Arg object.
190
- * @param {boolean} [arg.refresh] -
191
- * @returns {Promise<ActiveCardPaymentGatewayResponse>} - Success response
192
- * @summary: Fetch active payment gateway for card payments
193
- * @description: Use this API to retrieve an active payment aggregator along with the Customer ID. This is applicable for cards payments only.
229
+ * @param {AttachCardRequest} arg.body
230
+ * @returns {Promise<AttachCardsResponse>} - Success response
231
+ * @summary: Attach a saved card to customer.
232
+ * @description: Use this API to attach a customer's saved card at the payment gateway, such as Stripe, Juspay.
194
233
  */
195
- getActiveCardAggregator({ refresh } = {}) {
196
- const { error } = PaymentValidator.getActiveCardAggregator().validate(
197
- { refresh },
234
+ async attachCardToCustomer({ body } = {}) {
235
+ const { error } = PaymentValidator.attachCardToCustomer().validate(
236
+ { body },
198
237
  { abortEarly: false, allowUnknown: true }
199
238
  );
200
239
  if (error) {
@@ -204,43 +243,62 @@ class Payment {
204
243
  // Showing warrnings if extra unknown parameters are found
205
244
  const {
206
245
  error: warrning,
207
- } = PaymentValidator.getActiveCardAggregator().validate(
208
- { refresh },
246
+ } = PaymentValidator.attachCardToCustomer().validate(
247
+ { body },
209
248
  { abortEarly: false, allowUnknown: false }
210
249
  );
211
250
  if (warrning) {
212
- console.log("Parameter Validation warrnings for getActiveCardAggregator");
213
- console.log(warrning);
251
+ Logger({
252
+ level: "WARN",
253
+ message: "Parameter Validation warrnings for attachCardToCustomer",
254
+ });
255
+ Logger({ level: "WARN", message: warrning });
214
256
  }
215
257
 
216
258
  const query_params = {};
217
- query_params["refresh"] = refresh;
218
259
 
219
260
  const xHeaders = {};
220
261
 
221
- return APIClient.execute(
262
+ const response = await APIClient.execute(
222
263
  this._conf,
223
- "get",
264
+ "post",
224
265
  constructUrl({
225
- url: this._urls["getActiveCardAggregator"],
266
+ url: this._urls["attachCardToCustomer"],
226
267
  params: {},
227
268
  }),
228
269
  query_params,
229
- undefined,
270
+ body,
230
271
  xHeaders
231
272
  );
273
+
274
+ const {
275
+ error: res_error,
276
+ } = PaymentModel.AttachCardsResponse().validate(response, {
277
+ abortEarly: false,
278
+ allowUnknown: false,
279
+ });
280
+
281
+ if (res_error) {
282
+ Logger({
283
+ level: "WARN",
284
+ message: "Response Validation Warnnings for attachCardToCustomer",
285
+ });
286
+ Logger({ level: "WARN", message: res_error });
287
+ }
288
+
289
+ return response;
232
290
  }
233
291
 
234
292
  /**
235
293
  * @param {Object} arg - Arg object.
236
- * @param {boolean} [arg.forceRefresh] -
237
- * @returns {Promise<ListCardsResponse>} - Success response
238
- * @summary: Fetch the list of cards saved by the user
239
- * @description: Use this API to retrieve a list of cards stored by user from an active payment gateway.
294
+ * @param {CancelOrResendPaymentLinkRequest} arg.body
295
+ * @returns {Promise<CancelPaymentLinkResponse>} - Success response
296
+ * @summary: Cancel payment link
297
+ * @description: Use this API to cancel a payment link for the customer
240
298
  */
241
- getActiveUserCards({ forceRefresh } = {}) {
242
- const { error } = PaymentValidator.getActiveUserCards().validate(
243
- { forceRefresh },
299
+ async cancelPaymentLink({ body } = {}) {
300
+ const { error } = PaymentValidator.cancelPaymentLink().validate(
301
+ { body },
244
302
  { abortEarly: false, allowUnknown: true }
245
303
  );
246
304
  if (error) {
@@ -248,42 +306,61 @@ class Payment {
248
306
  }
249
307
 
250
308
  // Showing warrnings if extra unknown parameters are found
251
- const { error: warrning } = PaymentValidator.getActiveUserCards().validate(
252
- { forceRefresh },
309
+ const { error: warrning } = PaymentValidator.cancelPaymentLink().validate(
310
+ { body },
253
311
  { abortEarly: false, allowUnknown: false }
254
312
  );
255
313
  if (warrning) {
256
- console.log("Parameter Validation warrnings for getActiveUserCards");
257
- console.log(warrning);
314
+ Logger({
315
+ level: "WARN",
316
+ message: "Parameter Validation warrnings for cancelPaymentLink",
317
+ });
318
+ Logger({ level: "WARN", message: warrning });
258
319
  }
259
320
 
260
321
  const query_params = {};
261
- query_params["force_refresh"] = forceRefresh;
262
322
 
263
323
  const xHeaders = {};
264
324
 
265
- return APIClient.execute(
325
+ const response = await APIClient.execute(
266
326
  this._conf,
267
- "get",
327
+ "post",
268
328
  constructUrl({
269
- url: this._urls["getActiveUserCards"],
329
+ url: this._urls["cancelPaymentLink"],
270
330
  params: {},
271
331
  }),
272
332
  query_params,
273
- undefined,
333
+ body,
274
334
  xHeaders
275
335
  );
336
+
337
+ const {
338
+ error: res_error,
339
+ } = PaymentModel.CancelPaymentLinkResponse().validate(response, {
340
+ abortEarly: false,
341
+ allowUnknown: false,
342
+ });
343
+
344
+ if (res_error) {
345
+ Logger({
346
+ level: "WARN",
347
+ message: "Response Validation Warnnings for cancelPaymentLink",
348
+ });
349
+ Logger({ level: "WARN", message: res_error });
350
+ }
351
+
352
+ return response;
276
353
  }
277
354
 
278
355
  /**
279
356
  * @param {Object} arg - Arg object.
280
- * @param {DeletehCardRequest} arg.body
281
- * @returns {Promise<DeleteCardsResponse>} - Success response
282
- * @summary: Delete a card
283
- * @description: Use this API to delete a card added by a user on the payment gateway and clear the cache.
357
+ * @param {PaymentStatusUpdateRequest} arg.body
358
+ * @returns {Promise<PaymentStatusUpdateResponse>} - Success response
359
+ * @summary: Performs continuous polling to check status of payment on the server
360
+ * @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
284
361
  */
285
- deleteUserCard({ body } = {}) {
286
- const { error } = PaymentValidator.deleteUserCard().validate(
362
+ async checkAndUpdatePaymentStatus({ body } = {}) {
363
+ const { error } = PaymentValidator.checkAndUpdatePaymentStatus().validate(
287
364
  { body },
288
365
  { abortEarly: false, allowUnknown: true }
289
366
  );
@@ -292,41 +369,67 @@ class Payment {
292
369
  }
293
370
 
294
371
  // Showing warrnings if extra unknown parameters are found
295
- const { error: warrning } = PaymentValidator.deleteUserCard().validate(
372
+ const {
373
+ error: warrning,
374
+ } = PaymentValidator.checkAndUpdatePaymentStatus().validate(
296
375
  { body },
297
376
  { abortEarly: false, allowUnknown: false }
298
377
  );
299
378
  if (warrning) {
300
- console.log("Parameter Validation warrnings for deleteUserCard");
301
- console.log(warrning);
379
+ Logger({
380
+ level: "WARN",
381
+ message:
382
+ "Parameter Validation warrnings for checkAndUpdatePaymentStatus",
383
+ });
384
+ Logger({ level: "WARN", message: warrning });
302
385
  }
303
386
 
304
387
  const query_params = {};
305
388
 
306
389
  const xHeaders = {};
307
390
 
308
- return APIClient.execute(
391
+ const response = await APIClient.execute(
309
392
  this._conf,
310
393
  "post",
311
394
  constructUrl({
312
- url: this._urls["deleteUserCard"],
395
+ url: this._urls["checkAndUpdatePaymentStatus"],
313
396
  params: {},
314
397
  }),
315
398
  query_params,
316
399
  body,
317
400
  xHeaders
318
401
  );
402
+
403
+ const {
404
+ error: res_error,
405
+ } = PaymentModel.PaymentStatusUpdateResponse().validate(response, {
406
+ abortEarly: false,
407
+ allowUnknown: false,
408
+ });
409
+
410
+ if (res_error) {
411
+ Logger({
412
+ level: "WARN",
413
+ message:
414
+ "Response Validation Warnnings for checkAndUpdatePaymentStatus",
415
+ });
416
+ Logger({ level: "WARN", message: res_error });
417
+ }
418
+
419
+ return response;
319
420
  }
320
421
 
321
422
  /**
322
423
  * @param {Object} arg - Arg object.
323
- * @param {ValidateCustomerRequest} arg.body
324
- * @returns {Promise<ValidateCustomerResponse>} - Success response
325
- * @summary: Validate customer for payment
326
- * @description: Use this API to check if the customer is eligible to use credit-line facilities such as Simpl Pay Later and Rupifi.
424
+ * @param {PaymentStatusUpdateRequest} arg.body
425
+ * @returns {Promise<PaymentStatusUpdateResponse>} - Success response
426
+ * @summary: Performs continuous polling to check status of payment on the server
427
+ * @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
327
428
  */
328
- verifyCustomerForPayment({ body } = {}) {
329
- const { error } = PaymentValidator.verifyCustomerForPayment().validate(
429
+ async checkAndUpdatePaymentStatusPaymentLink({ body } = {}) {
430
+ const {
431
+ error,
432
+ } = PaymentValidator.checkAndUpdatePaymentStatusPaymentLink().validate(
330
433
  { body },
331
434
  { abortEarly: false, allowUnknown: true }
332
435
  );
@@ -337,44 +440,64 @@ class Payment {
337
440
  // Showing warrnings if extra unknown parameters are found
338
441
  const {
339
442
  error: warrning,
340
- } = PaymentValidator.verifyCustomerForPayment().validate(
443
+ } = PaymentValidator.checkAndUpdatePaymentStatusPaymentLink().validate(
341
444
  { body },
342
445
  { abortEarly: false, allowUnknown: false }
343
446
  );
344
447
  if (warrning) {
345
- console.log(
346
- "Parameter Validation warrnings for verifyCustomerForPayment"
347
- );
348
- console.log(warrning);
448
+ Logger({
449
+ level: "WARN",
450
+ message:
451
+ "Parameter Validation warrnings for checkAndUpdatePaymentStatusPaymentLink",
452
+ });
453
+ Logger({ level: "WARN", message: warrning });
349
454
  }
350
455
 
351
456
  const query_params = {};
352
457
 
353
458
  const xHeaders = {};
354
459
 
355
- return APIClient.execute(
460
+ const response = await APIClient.execute(
356
461
  this._conf,
357
462
  "post",
358
463
  constructUrl({
359
- url: this._urls["verifyCustomerForPayment"],
464
+ url: this._urls["checkAndUpdatePaymentStatusPaymentLink"],
360
465
  params: {},
361
466
  }),
362
467
  query_params,
363
468
  body,
364
469
  xHeaders
365
470
  );
471
+
472
+ const {
473
+ error: res_error,
474
+ } = PaymentModel.PaymentStatusUpdateResponse().validate(response, {
475
+ abortEarly: false,
476
+ allowUnknown: false,
477
+ });
478
+
479
+ if (res_error) {
480
+ Logger({
481
+ level: "WARN",
482
+ message:
483
+ "Response Validation Warnnings for checkAndUpdatePaymentStatusPaymentLink",
484
+ });
485
+ Logger({ level: "WARN", message: res_error });
486
+ }
487
+
488
+ return response;
366
489
  }
367
490
 
368
491
  /**
369
492
  * @param {Object} arg - Arg object.
370
- * @param {ChargeCustomerRequest} arg.body
371
- * @returns {Promise<ChargeCustomerResponse>} - Success response
372
- * @summary: Verify and charge payment
373
- * @description: Use this API to verify and check the status of a payment transaction (server-to-server) made through aggregators like Simpl and Mswipe.
493
+ * @param {string} [arg.aggregator] -
494
+ * @returns {Promise<CheckCreditResponse>} - Success response
495
+ * @summary: API to fetch the customer credit summary
496
+ * @description: Use this API to fetch the customer credit summary.
374
497
  */
375
- verifyAndChargePayment({ body } = {}) {
376
- const { error } = PaymentValidator.verifyAndChargePayment().validate(
377
- { body },
498
+ async checkCredit({ aggregator } = {}) {
499
+ const { error } = PaymentValidator.checkCredit().validate(
500
+ { aggregator },
378
501
  { abortEarly: false, allowUnknown: true }
379
502
  );
380
503
  if (error) {
@@ -382,43 +505,62 @@ class Payment {
382
505
  }
383
506
 
384
507
  // Showing warrnings if extra unknown parameters are found
385
- const {
386
- error: warrning,
387
- } = PaymentValidator.verifyAndChargePayment().validate(
388
- { body },
508
+ const { error: warrning } = PaymentValidator.checkCredit().validate(
509
+ { aggregator },
389
510
  { abortEarly: false, allowUnknown: false }
390
511
  );
391
512
  if (warrning) {
392
- console.log("Parameter Validation warrnings for verifyAndChargePayment");
393
- console.log(warrning);
513
+ Logger({
514
+ level: "WARN",
515
+ message: "Parameter Validation warrnings for checkCredit",
516
+ });
517
+ Logger({ level: "WARN", message: warrning });
394
518
  }
395
519
 
396
520
  const query_params = {};
521
+ query_params["aggregator"] = aggregator;
397
522
 
398
523
  const xHeaders = {};
399
524
 
400
- return APIClient.execute(
525
+ const response = await APIClient.execute(
401
526
  this._conf,
402
- "post",
527
+ "get",
403
528
  constructUrl({
404
- url: this._urls["verifyAndChargePayment"],
529
+ url: this._urls["checkCredit"],
405
530
  params: {},
406
531
  }),
407
532
  query_params,
408
- body,
533
+ undefined,
409
534
  xHeaders
410
535
  );
536
+
537
+ const {
538
+ error: res_error,
539
+ } = PaymentModel.CheckCreditResponse().validate(response, {
540
+ abortEarly: false,
541
+ allowUnknown: false,
542
+ });
543
+
544
+ if (res_error) {
545
+ Logger({
546
+ level: "WARN",
547
+ message: "Response Validation Warnnings for checkCredit",
548
+ });
549
+ Logger({ level: "WARN", message: res_error });
550
+ }
551
+
552
+ return response;
411
553
  }
412
554
 
413
555
  /**
414
556
  * @param {Object} arg - Arg object.
415
- * @param {PaymentInitializationRequest} arg.body
416
- * @returns {Promise<PaymentInitializationResponse>} - Success response
417
- * @summary: Initialize a payment (server-to-server) for UPI and BharatQR
418
- * @description: PUse this API to inititate payment using UPI, BharatQR, wherein the UPI requests are send to the app and QR code is displayed on the screen.
557
+ * @param {CreateOrderUserRequest} arg.body
558
+ * @returns {Promise<CreateOrderUserResponse>} - Success response
559
+ * @summary: Create Order user
560
+ * @description: Use this API to create a order and payment on aggregator side
419
561
  */
420
- initialisePayment({ body } = {}) {
421
- const { error } = PaymentValidator.initialisePayment().validate(
562
+ async createOrderHandlerPaymentLink({ body } = {}) {
563
+ const { error } = PaymentValidator.createOrderHandlerPaymentLink().validate(
422
564
  { body },
423
565
  { abortEarly: false, allowUnknown: true }
424
566
  );
@@ -427,41 +569,65 @@ class Payment {
427
569
  }
428
570
 
429
571
  // Showing warrnings if extra unknown parameters are found
430
- const { error: warrning } = PaymentValidator.initialisePayment().validate(
572
+ const {
573
+ error: warrning,
574
+ } = PaymentValidator.createOrderHandlerPaymentLink().validate(
431
575
  { body },
432
576
  { abortEarly: false, allowUnknown: false }
433
577
  );
434
578
  if (warrning) {
435
- console.log("Parameter Validation warrnings for initialisePayment");
436
- console.log(warrning);
579
+ Logger({
580
+ level: "WARN",
581
+ message:
582
+ "Parameter Validation warrnings for createOrderHandlerPaymentLink",
583
+ });
584
+ Logger({ level: "WARN", message: warrning });
437
585
  }
438
586
 
439
587
  const query_params = {};
440
588
 
441
589
  const xHeaders = {};
442
590
 
443
- return APIClient.execute(
591
+ const response = await APIClient.execute(
444
592
  this._conf,
445
593
  "post",
446
594
  constructUrl({
447
- url: this._urls["initialisePayment"],
595
+ url: this._urls["createOrderHandlerPaymentLink"],
448
596
  params: {},
449
597
  }),
450
598
  query_params,
451
599
  body,
452
600
  xHeaders
453
601
  );
602
+
603
+ const {
604
+ error: res_error,
605
+ } = PaymentModel.CreateOrderUserResponse().validate(response, {
606
+ abortEarly: false,
607
+ allowUnknown: false,
608
+ });
609
+
610
+ if (res_error) {
611
+ Logger({
612
+ level: "WARN",
613
+ message:
614
+ "Response Validation Warnnings for createOrderHandlerPaymentLink",
615
+ });
616
+ Logger({ level: "WARN", message: res_error });
617
+ }
618
+
619
+ return response;
454
620
  }
455
621
 
456
622
  /**
457
623
  * @param {Object} arg - Arg object.
458
- * @param {PaymentStatusUpdateRequest} arg.body
459
- * @returns {Promise<PaymentStatusUpdateResponse>} - Success response
460
- * @summary: Performs continuous polling to check status of payment on the server
461
- * @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
624
+ * @param {CreatePaymentLinkRequest} arg.body
625
+ * @returns {Promise<CreatePaymentLinkResponse>} - Success response
626
+ * @summary: Create payment link
627
+ * @description: Use this API to create a payment link for the customer
462
628
  */
463
- checkAndUpdatePaymentStatus({ body } = {}) {
464
- const { error } = PaymentValidator.checkAndUpdatePaymentStatus().validate(
629
+ async createPaymentLink({ body } = {}) {
630
+ const { error } = PaymentValidator.createPaymentLink().validate(
465
631
  { body },
466
632
  { abortEarly: false, allowUnknown: true }
467
633
  );
@@ -470,72 +636,62 @@ class Payment {
470
636
  }
471
637
 
472
638
  // Showing warrnings if extra unknown parameters are found
473
- const {
474
- error: warrning,
475
- } = PaymentValidator.checkAndUpdatePaymentStatus().validate(
639
+ const { error: warrning } = PaymentValidator.createPaymentLink().validate(
476
640
  { body },
477
641
  { abortEarly: false, allowUnknown: false }
478
642
  );
479
643
  if (warrning) {
480
- console.log(
481
- "Parameter Validation warrnings for checkAndUpdatePaymentStatus"
482
- );
483
- console.log(warrning);
644
+ Logger({
645
+ level: "WARN",
646
+ message: "Parameter Validation warrnings for createPaymentLink",
647
+ });
648
+ Logger({ level: "WARN", message: warrning });
484
649
  }
485
650
 
486
651
  const query_params = {};
487
652
 
488
653
  const xHeaders = {};
489
654
 
490
- return APIClient.execute(
655
+ const response = await APIClient.execute(
491
656
  this._conf,
492
657
  "post",
493
658
  constructUrl({
494
- url: this._urls["checkAndUpdatePaymentStatus"],
659
+ url: this._urls["createPaymentLink"],
495
660
  params: {},
496
661
  }),
497
662
  query_params,
498
663
  body,
499
664
  xHeaders
500
665
  );
666
+
667
+ const {
668
+ error: res_error,
669
+ } = PaymentModel.CreatePaymentLinkResponse().validate(response, {
670
+ abortEarly: false,
671
+ allowUnknown: false,
672
+ });
673
+
674
+ if (res_error) {
675
+ Logger({
676
+ level: "WARN",
677
+ message: "Response Validation Warnnings for createPaymentLink",
678
+ });
679
+ Logger({ level: "WARN", message: res_error });
680
+ }
681
+
682
+ return response;
501
683
  }
502
684
 
503
685
  /**
504
686
  * @param {Object} arg - Arg object.
505
- * @param {number} arg.amount - Payable amount.
506
- * @param {string} arg.cartId - Identifier of the cart.
507
- * @param {string} arg.pincode - The PIN Code of the destination address, e.g. 400059
508
- * @param {string} arg.checkoutMode - Option to checkout for self or for others.
509
- * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
510
- * to remove temporary cache files on payment gateway and replace with the
511
- * latest one.
512
- * @param {string} [arg.cardReference] - Card reference id of user's debit
513
- * or credit card.
514
- * @param {string} [arg.userDetails] - URIencoded JSON containing details of
515
- * an anonymous user.
516
- * @returns {Promise<PaymentModeRouteResponse>} - Success response
517
- * @summary: Get applicable payment options
518
- * @description: Use this API to get all valid payment options for doing a payment.
687
+ * @param {string} [arg.aggregator] -
688
+ * @returns {Promise<CustomerCreditSummaryResponse>} - Success response
689
+ * @summary: API to fetch the customer credit summary
690
+ * @description: Use this API to fetch the customer credit summary.
519
691
  */
520
- getPaymentModeRoutes({
521
- amount,
522
- cartId,
523
- pincode,
524
- checkoutMode,
525
- refresh,
526
- cardReference,
527
- userDetails,
528
- } = {}) {
529
- const { error } = PaymentValidator.getPaymentModeRoutes().validate(
530
- {
531
- amount,
532
- cartId,
533
- pincode,
534
- checkoutMode,
535
- refresh,
536
- cardReference,
537
- userDetails,
538
- },
692
+ async customerCreditSummary({ aggregator } = {}) {
693
+ const { error } = PaymentValidator.customerCreditSummary().validate(
694
+ { aggregator },
539
695
  { abortEarly: false, allowUnknown: true }
540
696
  );
541
697
  if (error) {
@@ -545,88 +701,63 @@ class Payment {
545
701
  // Showing warrnings if extra unknown parameters are found
546
702
  const {
547
703
  error: warrning,
548
- } = PaymentValidator.getPaymentModeRoutes().validate(
549
- {
550
- amount,
551
- cartId,
552
- pincode,
553
- checkoutMode,
554
- refresh,
555
- cardReference,
556
- userDetails,
557
- },
704
+ } = PaymentValidator.customerCreditSummary().validate(
705
+ { aggregator },
558
706
  { abortEarly: false, allowUnknown: false }
559
707
  );
560
708
  if (warrning) {
561
- console.log("Parameter Validation warrnings for getPaymentModeRoutes");
562
- console.log(warrning);
709
+ Logger({
710
+ level: "WARN",
711
+ message: "Parameter Validation warrnings for customerCreditSummary",
712
+ });
713
+ Logger({ level: "WARN", message: warrning });
563
714
  }
564
715
 
565
716
  const query_params = {};
566
- query_params["amount"] = amount;
567
- query_params["cart_id"] = cartId;
568
- query_params["pincode"] = pincode;
569
- query_params["checkout_mode"] = checkoutMode;
570
- query_params["refresh"] = refresh;
571
- query_params["card_reference"] = cardReference;
572
- query_params["user_details"] = userDetails;
717
+ query_params["aggregator"] = aggregator;
573
718
 
574
719
  const xHeaders = {};
575
720
 
576
- return APIClient.execute(
721
+ const response = await APIClient.execute(
577
722
  this._conf,
578
723
  "get",
579
724
  constructUrl({
580
- url: this._urls["getPaymentModeRoutes"],
725
+ url: this._urls["customerCreditSummary"],
581
726
  params: {},
582
727
  }),
583
728
  query_params,
584
729
  undefined,
585
730
  xHeaders
586
731
  );
732
+
733
+ const {
734
+ error: res_error,
735
+ } = PaymentModel.CustomerCreditSummaryResponse().validate(response, {
736
+ abortEarly: false,
737
+ allowUnknown: false,
738
+ });
739
+
740
+ if (res_error) {
741
+ Logger({
742
+ level: "WARN",
743
+ message: "Response Validation Warnnings for customerCreditSummary",
744
+ });
745
+ Logger({ level: "WARN", message: res_error });
746
+ }
747
+
748
+ return response;
587
749
  }
588
750
 
589
751
  /**
590
752
  * @param {Object} arg - Arg object.
591
- * @param {number} arg.amount - Payable amount.
592
- * @param {string} arg.cartId - Identifier of the cart.
593
- * @param {string} arg.pincode - The PIN Code of the destination address, e.g. 400059
594
- * @param {string} arg.checkoutMode - Option to checkout for self or for others.
595
- * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
596
- * to remove temporary cache files on payment gateway and replace with the
597
- * latest one.
598
- * @param {string} [arg.cardReference] - Card reference id of user's debit
599
- * or credit card.
600
- * @param {string} arg.orderType - The order type of shipment * HomeDelivery
601
- * - If the customer wants the order home-delivered * PickAtStore - If the
602
- * customer wants the handover of an order at the store itself.
603
- * @param {string} [arg.userDetails] - URIencoded JSON containing details of
604
- * an anonymous user.
605
- * @returns {Promise<PaymentModeRouteResponse>} - Success response
606
- * @summary: Get applicable payment options for Point-of-Sale (POS)
607
- * @description: Use this API to get all valid payment options for doing a payment in POS.
753
+ * @param {CustomerOnboardingRequest} arg.body
754
+ * @returns {Promise<CustomerOnboardingResponse>} - Success response
755
+ * @summary: API to fetch the customer credit summary
756
+ * @description: Use this API to fetch the customer credit summary.
608
757
  */
609
- getPosPaymentModeRoutes({
610
- amount,
611
- cartId,
612
- pincode,
613
- checkoutMode,
614
- orderType,
615
- refresh,
616
- cardReference,
617
- userDetails,
618
- } = {}) {
619
- const { error } = PaymentValidator.getPosPaymentModeRoutes().validate(
620
- {
621
- amount,
622
- cartId,
623
- pincode,
624
- checkoutMode,
625
- orderType,
626
- refresh,
627
- cardReference,
628
- userDetails,
629
- },
758
+ async customerOnboard({ body } = {}) {
759
+ const { error } = PaymentValidator.customerOnboard().validate(
760
+ { body },
630
761
  { abortEarly: false, allowUnknown: true }
631
762
  );
632
763
  if (error) {
@@ -634,60 +765,127 @@ class Payment {
634
765
  }
635
766
 
636
767
  // Showing warrnings if extra unknown parameters are found
768
+ const { error: warrning } = PaymentValidator.customerOnboard().validate(
769
+ { body },
770
+ { abortEarly: false, allowUnknown: false }
771
+ );
772
+ if (warrning) {
773
+ Logger({
774
+ level: "WARN",
775
+ message: "Parameter Validation warrnings for customerOnboard",
776
+ });
777
+ Logger({ level: "WARN", message: warrning });
778
+ }
779
+
780
+ const query_params = {};
781
+
782
+ const xHeaders = {};
783
+
784
+ const response = await APIClient.execute(
785
+ this._conf,
786
+ "post",
787
+ constructUrl({
788
+ url: this._urls["customerOnboard"],
789
+ params: {},
790
+ }),
791
+ query_params,
792
+ body,
793
+ xHeaders
794
+ );
795
+
637
796
  const {
638
- error: warrning,
639
- } = PaymentValidator.getPosPaymentModeRoutes().validate(
640
- {
641
- amount,
642
- cartId,
643
- pincode,
644
- checkoutMode,
645
- orderType,
646
- refresh,
647
- cardReference,
648
- userDetails,
649
- },
797
+ error: res_error,
798
+ } = PaymentModel.CustomerOnboardingResponse().validate(response, {
799
+ abortEarly: false,
800
+ allowUnknown: false,
801
+ });
802
+
803
+ if (res_error) {
804
+ Logger({
805
+ level: "WARN",
806
+ message: "Response Validation Warnnings for customerOnboard",
807
+ });
808
+ Logger({ level: "WARN", message: res_error });
809
+ }
810
+
811
+ return response;
812
+ }
813
+
814
+ /**
815
+ * @param {Object} arg - Arg object.
816
+ * @param {DeletehCardRequest} arg.body
817
+ * @returns {Promise<DeleteCardsResponse>} - Success response
818
+ * @summary: Delete a card
819
+ * @description: Use this API to delete a card added by a user on the payment gateway and clear the cache.
820
+ */
821
+ async deleteUserCard({ body } = {}) {
822
+ const { error } = PaymentValidator.deleteUserCard().validate(
823
+ { body },
824
+ { abortEarly: false, allowUnknown: true }
825
+ );
826
+ if (error) {
827
+ return Promise.reject(new FDKClientValidationError(error));
828
+ }
829
+
830
+ // Showing warrnings if extra unknown parameters are found
831
+ const { error: warrning } = PaymentValidator.deleteUserCard().validate(
832
+ { body },
650
833
  { abortEarly: false, allowUnknown: false }
651
834
  );
652
835
  if (warrning) {
653
- console.log("Parameter Validation warrnings for getPosPaymentModeRoutes");
654
- console.log(warrning);
836
+ Logger({
837
+ level: "WARN",
838
+ message: "Parameter Validation warrnings for deleteUserCard",
839
+ });
840
+ Logger({ level: "WARN", message: warrning });
655
841
  }
656
842
 
657
843
  const query_params = {};
658
- query_params["amount"] = amount;
659
- query_params["cart_id"] = cartId;
660
- query_params["pincode"] = pincode;
661
- query_params["checkout_mode"] = checkoutMode;
662
- query_params["refresh"] = refresh;
663
- query_params["card_reference"] = cardReference;
664
- query_params["order_type"] = orderType;
665
- query_params["user_details"] = userDetails;
666
844
 
667
845
  const xHeaders = {};
668
846
 
669
- return APIClient.execute(
847
+ const response = await APIClient.execute(
670
848
  this._conf,
671
- "get",
849
+ "post",
672
850
  constructUrl({
673
- url: this._urls["getPosPaymentModeRoutes"],
851
+ url: this._urls["deleteUserCard"],
674
852
  params: {},
675
853
  }),
676
854
  query_params,
677
- undefined,
855
+ body,
678
856
  xHeaders
679
857
  );
858
+
859
+ const {
860
+ error: res_error,
861
+ } = PaymentModel.DeleteCardsResponse().validate(response, {
862
+ abortEarly: false,
863
+ allowUnknown: false,
864
+ });
865
+
866
+ if (res_error) {
867
+ Logger({
868
+ level: "WARN",
869
+ message: "Response Validation Warnnings for deleteUserCard",
870
+ });
871
+ Logger({ level: "WARN", message: res_error });
872
+ }
873
+
874
+ return response;
680
875
  }
681
876
 
682
877
  /**
683
878
  * @param {Object} arg - Arg object.
684
- * @returns {Promise<RupifiBannerResponse>} - Success response
685
- * @summary: Get CreditLine Offer
686
- * @description: Get CreditLine Offer if user is tentatively approved by rupifi
879
+ * @param {UpdateRefundTransferModeRequest} arg.body
880
+ * @returns {Promise<UpdateRefundTransferModeResponse>} - Success response
881
+ * @summary: Enable/Disable a mode for transferring a refund
882
+ * @description: Activate or Deactivate Transfer Mode to collect Beneficiary Details for Refund
687
883
  */
688
- getRupifiBannerDetails({} = {}) {
689
- const { error } = PaymentValidator.getRupifiBannerDetails().validate(
690
- {},
884
+ async enableOrDisableRefundTransferMode({ body } = {}) {
885
+ const {
886
+ error,
887
+ } = PaymentValidator.enableOrDisableRefundTransferMode().validate(
888
+ { body },
691
889
  { abortEarly: false, allowUnknown: true }
692
890
  );
693
891
  if (error) {
@@ -697,41 +895,64 @@ class Payment {
697
895
  // Showing warrnings if extra unknown parameters are found
698
896
  const {
699
897
  error: warrning,
700
- } = PaymentValidator.getRupifiBannerDetails().validate(
701
- {},
898
+ } = PaymentValidator.enableOrDisableRefundTransferMode().validate(
899
+ { body },
702
900
  { abortEarly: false, allowUnknown: false }
703
901
  );
704
902
  if (warrning) {
705
- console.log("Parameter Validation warrnings for getRupifiBannerDetails");
706
- console.log(warrning);
903
+ Logger({
904
+ level: "WARN",
905
+ message:
906
+ "Parameter Validation warrnings for enableOrDisableRefundTransferMode",
907
+ });
908
+ Logger({ level: "WARN", message: warrning });
707
909
  }
708
910
 
709
911
  const query_params = {};
710
912
 
711
913
  const xHeaders = {};
712
914
 
713
- return APIClient.execute(
915
+ const response = await APIClient.execute(
714
916
  this._conf,
715
- "get",
917
+ "put",
716
918
  constructUrl({
717
- url: this._urls["getRupifiBannerDetails"],
919
+ url: this._urls["enableOrDisableRefundTransferMode"],
718
920
  params: {},
719
921
  }),
720
922
  query_params,
721
- undefined,
923
+ body,
722
924
  xHeaders
723
925
  );
926
+
927
+ const {
928
+ error: res_error,
929
+ } = PaymentModel.UpdateRefundTransferModeResponse().validate(response, {
930
+ abortEarly: false,
931
+ allowUnknown: false,
932
+ });
933
+
934
+ if (res_error) {
935
+ Logger({
936
+ level: "WARN",
937
+ message:
938
+ "Response Validation Warnnings for enableOrDisableRefundTransferMode",
939
+ });
940
+ Logger({ level: "WARN", message: res_error });
941
+ }
942
+
943
+ return response;
724
944
  }
725
945
 
726
946
  /**
727
947
  * @param {Object} arg - Arg object.
728
- * @returns {Promise<EpaylaterBannerResponse>} - Success response
729
- * @summary: Get Epaylater Enabled
730
- * @description: Get Epaylater Enabled if user is tentatively approved by epaylater
948
+ * @param {boolean} [arg.refresh] -
949
+ * @returns {Promise<ActiveCardPaymentGatewayResponse>} - Success response
950
+ * @summary: Fetch active payment gateway for card payments
951
+ * @description: Use this API to retrieve an active payment aggregator along with the Customer ID. This is applicable for cards payments only.
731
952
  */
732
- getEpaylaterBannerDetails({} = {}) {
733
- const { error } = PaymentValidator.getEpaylaterBannerDetails().validate(
734
- {},
953
+ async getActiveCardAggregator({ refresh } = {}) {
954
+ const { error } = PaymentValidator.getActiveCardAggregator().validate(
955
+ { refresh },
735
956
  { abortEarly: false, allowUnknown: true }
736
957
  );
737
958
  if (error) {
@@ -741,44 +962,62 @@ class Payment {
741
962
  // Showing warrnings if extra unknown parameters are found
742
963
  const {
743
964
  error: warrning,
744
- } = PaymentValidator.getEpaylaterBannerDetails().validate(
745
- {},
965
+ } = PaymentValidator.getActiveCardAggregator().validate(
966
+ { refresh },
746
967
  { abortEarly: false, allowUnknown: false }
747
968
  );
748
969
  if (warrning) {
749
- console.log(
750
- "Parameter Validation warrnings for getEpaylaterBannerDetails"
751
- );
752
- console.log(warrning);
970
+ Logger({
971
+ level: "WARN",
972
+ message: "Parameter Validation warrnings for getActiveCardAggregator",
973
+ });
974
+ Logger({ level: "WARN", message: warrning });
753
975
  }
754
976
 
755
977
  const query_params = {};
978
+ query_params["refresh"] = refresh;
756
979
 
757
980
  const xHeaders = {};
758
981
 
759
- return APIClient.execute(
982
+ const response = await APIClient.execute(
760
983
  this._conf,
761
984
  "get",
762
985
  constructUrl({
763
- url: this._urls["getEpaylaterBannerDetails"],
986
+ url: this._urls["getActiveCardAggregator"],
764
987
  params: {},
765
988
  }),
766
989
  query_params,
767
990
  undefined,
768
991
  xHeaders
769
992
  );
993
+
994
+ const {
995
+ error: res_error,
996
+ } = PaymentModel.ActiveCardPaymentGatewayResponse().validate(response, {
997
+ abortEarly: false,
998
+ allowUnknown: false,
999
+ });
1000
+
1001
+ if (res_error) {
1002
+ Logger({
1003
+ level: "WARN",
1004
+ message: "Response Validation Warnnings for getActiveCardAggregator",
1005
+ });
1006
+ Logger({ level: "WARN", message: res_error });
1007
+ }
1008
+
1009
+ return response;
770
1010
  }
771
1011
 
772
1012
  /**
773
1013
  * @param {Object} arg - Arg object.
774
- * @param {ResendOrCancelPaymentRequest} arg.body
775
- * @returns {Promise<ResendOrCancelPaymentResponse>} - Success response
776
- * @summary: API to resend and cancel a payment link which was already generated.
777
- * @description: Use this API to perform resend or cancel a payment link based on request payload.
1014
+ * @returns {Promise<TransferModeResponse>} - Success response
1015
+ * @summary: Lists the mode of refund
1016
+ * @description: Use this API to retrieve eligible refund modes (such as Netbanking) and add the beneficiary details.
778
1017
  */
779
- resendOrCancelPayment({ body } = {}) {
780
- const { error } = PaymentValidator.resendOrCancelPayment().validate(
781
- { body },
1018
+ async getActiveRefundTransferModes({} = {}) {
1019
+ const { error } = PaymentValidator.getActiveRefundTransferModes().validate(
1020
+ {},
782
1021
  { abortEarly: false, allowUnknown: true }
783
1022
  );
784
1023
  if (error) {
@@ -788,42 +1027,64 @@ class Payment {
788
1027
  // Showing warrnings if extra unknown parameters are found
789
1028
  const {
790
1029
  error: warrning,
791
- } = PaymentValidator.resendOrCancelPayment().validate(
792
- { body },
1030
+ } = PaymentValidator.getActiveRefundTransferModes().validate(
1031
+ {},
793
1032
  { abortEarly: false, allowUnknown: false }
794
1033
  );
795
1034
  if (warrning) {
796
- console.log("Parameter Validation warrnings for resendOrCancelPayment");
797
- console.log(warrning);
1035
+ Logger({
1036
+ level: "WARN",
1037
+ message:
1038
+ "Parameter Validation warrnings for getActiveRefundTransferModes",
1039
+ });
1040
+ Logger({ level: "WARN", message: warrning });
798
1041
  }
799
1042
 
800
1043
  const query_params = {};
801
1044
 
802
1045
  const xHeaders = {};
803
1046
 
804
- return APIClient.execute(
1047
+ const response = await APIClient.execute(
805
1048
  this._conf,
806
- "post",
1049
+ "get",
807
1050
  constructUrl({
808
- url: this._urls["resendOrCancelPayment"],
1051
+ url: this._urls["getActiveRefundTransferModes"],
809
1052
  params: {},
810
1053
  }),
811
1054
  query_params,
812
- body,
1055
+ undefined,
813
1056
  xHeaders
814
1057
  );
1058
+
1059
+ const {
1060
+ error: res_error,
1061
+ } = PaymentModel.TransferModeResponse().validate(response, {
1062
+ abortEarly: false,
1063
+ allowUnknown: false,
1064
+ });
1065
+
1066
+ if (res_error) {
1067
+ Logger({
1068
+ level: "WARN",
1069
+ message:
1070
+ "Response Validation Warnnings for getActiveRefundTransferModes",
1071
+ });
1072
+ Logger({ level: "WARN", message: res_error });
1073
+ }
1074
+
1075
+ return response;
815
1076
  }
816
1077
 
817
1078
  /**
818
1079
  * @param {Object} arg - Arg object.
819
- * @param {renderHTMLRequest} arg.body
820
- * @returns {Promise<renderHTMLResponse>} - Success response
821
- * @summary: Convert base64 string to HTML form
822
- * @description: Use this API to decode base64 html form to plain HTML string.
1080
+ * @param {boolean} [arg.forceRefresh] -
1081
+ * @returns {Promise<ListCardsResponse>} - Success response
1082
+ * @summary: Fetch the list of cards saved by the user
1083
+ * @description: Use this API to retrieve a list of cards stored by user from an active payment gateway.
823
1084
  */
824
- renderHTML({ body } = {}) {
825
- const { error } = PaymentValidator.renderHTML().validate(
826
- { body },
1085
+ async getActiveUserCards({ forceRefresh } = {}) {
1086
+ const { error } = PaymentValidator.getActiveUserCards().validate(
1087
+ { forceRefresh },
827
1088
  { abortEarly: false, allowUnknown: true }
828
1089
  );
829
1090
  if (error) {
@@ -831,42 +1092,66 @@ class Payment {
831
1092
  }
832
1093
 
833
1094
  // Showing warrnings if extra unknown parameters are found
834
- const { error: warrning } = PaymentValidator.renderHTML().validate(
835
- { body },
1095
+ const { error: warrning } = PaymentValidator.getActiveUserCards().validate(
1096
+ { forceRefresh },
836
1097
  { abortEarly: false, allowUnknown: false }
837
1098
  );
838
1099
  if (warrning) {
839
- console.log("Parameter Validation warrnings for renderHTML");
840
- console.log(warrning);
1100
+ Logger({
1101
+ level: "WARN",
1102
+ message: "Parameter Validation warrnings for getActiveUserCards",
1103
+ });
1104
+ Logger({ level: "WARN", message: warrning });
841
1105
  }
842
1106
 
843
1107
  const query_params = {};
1108
+ query_params["force_refresh"] = forceRefresh;
844
1109
 
845
1110
  const xHeaders = {};
846
1111
 
847
- return APIClient.execute(
1112
+ const response = await APIClient.execute(
848
1113
  this._conf,
849
- "post",
1114
+ "get",
850
1115
  constructUrl({
851
- url: this._urls["renderHTML"],
1116
+ url: this._urls["getActiveUserCards"],
852
1117
  params: {},
853
1118
  }),
854
1119
  query_params,
855
- body,
1120
+ undefined,
856
1121
  xHeaders
857
1122
  );
1123
+
1124
+ const {
1125
+ error: res_error,
1126
+ } = PaymentModel.ListCardsResponse().validate(response, {
1127
+ abortEarly: false,
1128
+ allowUnknown: false,
1129
+ });
1130
+
1131
+ if (res_error) {
1132
+ Logger({
1133
+ level: "WARN",
1134
+ message: "Response Validation Warnnings for getActiveUserCards",
1135
+ });
1136
+ Logger({ level: "WARN", message: res_error });
1137
+ }
1138
+
1139
+ return response;
858
1140
  }
859
1141
 
860
1142
  /**
861
1143
  * @param {Object} arg - Arg object.
862
- * @param {ValidateVPARequest} arg.body
863
- * @returns {Promise<ValidateVPAResponse>} - Success response
864
- * @summary: API to Validate UPI ID
865
- * @description: API to Validate UPI ID
1144
+ * @param {string} [arg.xApiToken] - Used for basic authentication.
1145
+ * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
1146
+ * to remove temporary cache files on payment gateway and replace with the
1147
+ * latest one.
1148
+ * @returns {Promise<AggregatorsConfigDetailResponse>} - Success response
1149
+ * @summary: Get payment gateway keys
1150
+ * @description: Use this API to retrieve the payment gateway key, secrets, merchant, SDK/API details to complete a payment at front-end.
866
1151
  */
867
- validateVPA({ body } = {}) {
868
- const { error } = PaymentValidator.validateVPA().validate(
869
- { body },
1152
+ async getAggregatorsConfig({ xApiToken, refresh } = {}) {
1153
+ const { error } = PaymentValidator.getAggregatorsConfig().validate(
1154
+ { xApiToken, refresh },
870
1155
  { abortEarly: false, allowUnknown: true }
871
1156
  );
872
1157
  if (error) {
@@ -874,40 +1159,64 @@ class Payment {
874
1159
  }
875
1160
 
876
1161
  // Showing warrnings if extra unknown parameters are found
877
- const { error: warrning } = PaymentValidator.validateVPA().validate(
878
- { body },
1162
+ const {
1163
+ error: warrning,
1164
+ } = PaymentValidator.getAggregatorsConfig().validate(
1165
+ { xApiToken, refresh },
879
1166
  { abortEarly: false, allowUnknown: false }
880
1167
  );
881
1168
  if (warrning) {
882
- console.log("Parameter Validation warrnings for validateVPA");
883
- console.log(warrning);
1169
+ Logger({
1170
+ level: "WARN",
1171
+ message: "Parameter Validation warrnings for getAggregatorsConfig",
1172
+ });
1173
+ Logger({ level: "WARN", message: warrning });
884
1174
  }
885
1175
 
886
1176
  const query_params = {};
1177
+ query_params["refresh"] = refresh;
887
1178
 
888
1179
  const xHeaders = {};
1180
+ xHeaders["x-api-token"] = xApiToken;
889
1181
 
890
- return APIClient.execute(
1182
+ const response = await APIClient.execute(
891
1183
  this._conf,
892
- "post",
1184
+ "get",
893
1185
  constructUrl({
894
- url: this._urls["validateVPA"],
1186
+ url: this._urls["getAggregatorsConfig"],
895
1187
  params: {},
896
1188
  }),
897
1189
  query_params,
898
- body,
1190
+ undefined,
899
1191
  xHeaders
900
1192
  );
1193
+
1194
+ const {
1195
+ error: res_error,
1196
+ } = PaymentModel.AggregatorsConfigDetailResponse().validate(response, {
1197
+ abortEarly: false,
1198
+ allowUnknown: false,
1199
+ });
1200
+
1201
+ if (res_error) {
1202
+ Logger({
1203
+ level: "WARN",
1204
+ message: "Response Validation Warnnings for getAggregatorsConfig",
1205
+ });
1206
+ Logger({ level: "WARN", message: res_error });
1207
+ }
1208
+
1209
+ return response;
901
1210
  }
902
1211
 
903
1212
  /**
904
1213
  * @param {Object} arg - Arg object.
905
- * @returns {Promise<TransferModeResponse>} - Success response
906
- * @summary: Lists the mode of refund
907
- * @description: Use this API to retrieve eligible refund modes (such as Netbanking) and add the beneficiary details.
1214
+ * @returns {Promise<EpaylaterBannerResponse>} - Success response
1215
+ * @summary: Get Epaylater Enabled
1216
+ * @description: Get Epaylater Enabled if user is tentatively approved by epaylater
908
1217
  */
909
- getActiveRefundTransferModes({} = {}) {
910
- const { error } = PaymentValidator.getActiveRefundTransferModes().validate(
1218
+ async getEpaylaterBannerDetails({} = {}) {
1219
+ const { error } = PaymentValidator.getEpaylaterBannerDetails().validate(
911
1220
  {},
912
1221
  { abortEarly: false, allowUnknown: true }
913
1222
  );
@@ -918,46 +1227,63 @@ class Payment {
918
1227
  // Showing warrnings if extra unknown parameters are found
919
1228
  const {
920
1229
  error: warrning,
921
- } = PaymentValidator.getActiveRefundTransferModes().validate(
1230
+ } = PaymentValidator.getEpaylaterBannerDetails().validate(
922
1231
  {},
923
1232
  { abortEarly: false, allowUnknown: false }
924
1233
  );
925
1234
  if (warrning) {
926
- console.log(
927
- "Parameter Validation warrnings for getActiveRefundTransferModes"
928
- );
929
- console.log(warrning);
1235
+ Logger({
1236
+ level: "WARN",
1237
+ message: "Parameter Validation warrnings for getEpaylaterBannerDetails",
1238
+ });
1239
+ Logger({ level: "WARN", message: warrning });
930
1240
  }
931
1241
 
932
1242
  const query_params = {};
933
1243
 
934
1244
  const xHeaders = {};
935
1245
 
936
- return APIClient.execute(
1246
+ const response = await APIClient.execute(
937
1247
  this._conf,
938
1248
  "get",
939
1249
  constructUrl({
940
- url: this._urls["getActiveRefundTransferModes"],
1250
+ url: this._urls["getEpaylaterBannerDetails"],
941
1251
  params: {},
942
1252
  }),
943
1253
  query_params,
944
1254
  undefined,
945
1255
  xHeaders
946
1256
  );
1257
+
1258
+ const {
1259
+ error: res_error,
1260
+ } = PaymentModel.EpaylaterBannerResponse().validate(response, {
1261
+ abortEarly: false,
1262
+ allowUnknown: false,
1263
+ });
1264
+
1265
+ if (res_error) {
1266
+ Logger({
1267
+ level: "WARN",
1268
+ message: "Response Validation Warnnings for getEpaylaterBannerDetails",
1269
+ });
1270
+ Logger({ level: "WARN", message: res_error });
1271
+ }
1272
+
1273
+ return response;
947
1274
  }
948
1275
 
949
1276
  /**
950
1277
  * @param {Object} arg - Arg object.
951
- * @param {UpdateRefundTransferModeRequest} arg.body
952
- * @returns {Promise<UpdateRefundTransferModeResponse>} - Success response
953
- * @summary: Enable/Disable a mode for transferring a refund
954
- * @description: Activate or Deactivate Transfer Mode to collect Beneficiary Details for Refund
1278
+ * @param {string} arg.orderId - A unique number used for identifying and
1279
+ * tracking your orders.
1280
+ * @returns {Promise<OrderBeneficiaryResponse>} - Success response
1281
+ * @summary: Lists the beneficiary of a refund
1282
+ * @description: Use this API to get the details of all active beneficiary added by a user for refund.
955
1283
  */
956
- enableOrDisableRefundTransferMode({ body } = {}) {
957
- const {
958
- error,
959
- } = PaymentValidator.enableOrDisableRefundTransferMode().validate(
960
- { body },
1284
+ async getOrderBeneficiariesDetail({ orderId } = {}) {
1285
+ const { error } = PaymentValidator.getOrderBeneficiariesDetail().validate(
1286
+ { orderId },
961
1287
  { abortEarly: false, allowUnknown: true }
962
1288
  );
963
1289
  if (error) {
@@ -967,45 +1293,65 @@ class Payment {
967
1293
  // Showing warrnings if extra unknown parameters are found
968
1294
  const {
969
1295
  error: warrning,
970
- } = PaymentValidator.enableOrDisableRefundTransferMode().validate(
971
- { body },
1296
+ } = PaymentValidator.getOrderBeneficiariesDetail().validate(
1297
+ { orderId },
972
1298
  { abortEarly: false, allowUnknown: false }
973
1299
  );
974
1300
  if (warrning) {
975
- console.log(
976
- "Parameter Validation warrnings for enableOrDisableRefundTransferMode"
977
- );
978
- console.log(warrning);
1301
+ Logger({
1302
+ level: "WARN",
1303
+ message:
1304
+ "Parameter Validation warrnings for getOrderBeneficiariesDetail",
1305
+ });
1306
+ Logger({ level: "WARN", message: warrning });
979
1307
  }
980
1308
 
981
1309
  const query_params = {};
1310
+ query_params["order_id"] = orderId;
982
1311
 
983
1312
  const xHeaders = {};
984
1313
 
985
- return APIClient.execute(
1314
+ const response = await APIClient.execute(
986
1315
  this._conf,
987
- "put",
1316
+ "get",
988
1317
  constructUrl({
989
- url: this._urls["enableOrDisableRefundTransferMode"],
1318
+ url: this._urls["getOrderBeneficiariesDetail"],
990
1319
  params: {},
991
1320
  }),
992
1321
  query_params,
993
- body,
1322
+ undefined,
994
1323
  xHeaders
995
1324
  );
1325
+
1326
+ const {
1327
+ error: res_error,
1328
+ } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
1329
+ abortEarly: false,
1330
+ allowUnknown: false,
1331
+ });
1332
+
1333
+ if (res_error) {
1334
+ Logger({
1335
+ level: "WARN",
1336
+ message:
1337
+ "Response Validation Warnnings for getOrderBeneficiariesDetail",
1338
+ });
1339
+ Logger({ level: "WARN", message: res_error });
1340
+ }
1341
+
1342
+ return response;
996
1343
  }
997
1344
 
998
1345
  /**
999
1346
  * @param {Object} arg - Arg object.
1000
- * @param {string} arg.orderId - A unique number used for identifying and
1001
- * tracking your orders.
1002
- * @returns {Promise<OrderBeneficiaryResponse>} - Success response
1003
- * @summary: Lists the beneficiary of a refund
1004
- * @description: Use this API to get the details of all active beneficiary added by a user for refund.
1347
+ * @param {string} [arg.paymentLinkId] -
1348
+ * @returns {Promise<GetPaymentLinkResponse>} - Success response
1349
+ * @summary: Get payment link
1350
+ * @description: Use this API to get a payment link
1005
1351
  */
1006
- getUserBeneficiariesDetail({ orderId } = {}) {
1007
- const { error } = PaymentValidator.getUserBeneficiariesDetail().validate(
1008
- { orderId },
1352
+ async getPaymentLink({ paymentLinkId } = {}) {
1353
+ const { error } = PaymentValidator.getPaymentLink().validate(
1354
+ { paymentLinkId },
1009
1355
  { abortEarly: false, allowUnknown: true }
1010
1356
  );
1011
1357
  if (error) {
@@ -1013,48 +1359,89 @@ class Payment {
1013
1359
  }
1014
1360
 
1015
1361
  // Showing warrnings if extra unknown parameters are found
1016
- const {
1017
- error: warrning,
1018
- } = PaymentValidator.getUserBeneficiariesDetail().validate(
1019
- { orderId },
1362
+ const { error: warrning } = PaymentValidator.getPaymentLink().validate(
1363
+ { paymentLinkId },
1020
1364
  { abortEarly: false, allowUnknown: false }
1021
1365
  );
1022
1366
  if (warrning) {
1023
- console.log(
1024
- "Parameter Validation warrnings for getUserBeneficiariesDetail"
1025
- );
1026
- console.log(warrning);
1367
+ Logger({
1368
+ level: "WARN",
1369
+ message: "Parameter Validation warrnings for getPaymentLink",
1370
+ });
1371
+ Logger({ level: "WARN", message: warrning });
1027
1372
  }
1028
1373
 
1029
1374
  const query_params = {};
1030
- query_params["order_id"] = orderId;
1375
+ query_params["payment_link_id"] = paymentLinkId;
1031
1376
 
1032
1377
  const xHeaders = {};
1033
1378
 
1034
- return APIClient.execute(
1379
+ const response = await APIClient.execute(
1035
1380
  this._conf,
1036
1381
  "get",
1037
1382
  constructUrl({
1038
- url: this._urls["getUserBeneficiariesDetail"],
1383
+ url: this._urls["getPaymentLink"],
1039
1384
  params: {},
1040
1385
  }),
1041
1386
  query_params,
1042
1387
  undefined,
1043
1388
  xHeaders
1044
1389
  );
1390
+
1391
+ const {
1392
+ error: res_error,
1393
+ } = PaymentModel.GetPaymentLinkResponse().validate(response, {
1394
+ abortEarly: false,
1395
+ allowUnknown: false,
1396
+ });
1397
+
1398
+ if (res_error) {
1399
+ Logger({
1400
+ level: "WARN",
1401
+ message: "Response Validation Warnnings for getPaymentLink",
1402
+ });
1403
+ Logger({ level: "WARN", message: res_error });
1404
+ }
1405
+
1406
+ return response;
1045
1407
  }
1046
1408
 
1047
1409
  /**
1048
1410
  * @param {Object} arg - Arg object.
1049
- * @param {string} [arg.ifscCode] - A 11-digit alphanumeric code that
1050
- * uniquely identifies a bank branch.
1051
- * @returns {Promise<IfscCodeResponse>} - Success response
1052
- * @summary: Verify IFSC Code
1053
- * @description: Use this API to check whether the 11-digit IFSC code is valid and to fetch the bank details for refund.
1411
+ * @param {number} arg.amount - Payable amount.
1412
+ * @param {string} arg.cartId - Identifier of the cart.
1413
+ * @param {string} arg.pincode - The PIN Code of the destination address, e.g. 400059
1414
+ * @param {string} arg.checkoutMode - Option to checkout for self or for others.
1415
+ * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
1416
+ * to remove temporary cache files on payment gateway and replace with the
1417
+ * latest one.
1418
+ * @param {string} [arg.cardReference] - Card reference id of user's debit
1419
+ * or credit card.
1420
+ * @param {string} [arg.userDetails] - URIencoded JSON containing details of
1421
+ * an anonymous user.
1422
+ * @returns {Promise<PaymentModeRouteResponse>} - Success response
1423
+ * @summary: Get applicable payment options
1424
+ * @description: Use this API to get all valid payment options for doing a payment.
1054
1425
  */
1055
- verifyIfscCode({ ifscCode } = {}) {
1056
- const { error } = PaymentValidator.verifyIfscCode().validate(
1057
- { ifscCode },
1426
+ async getPaymentModeRoutes({
1427
+ amount,
1428
+ cartId,
1429
+ pincode,
1430
+ checkoutMode,
1431
+ refresh,
1432
+ cardReference,
1433
+ userDetails,
1434
+ } = {}) {
1435
+ const { error } = PaymentValidator.getPaymentModeRoutes().validate(
1436
+ {
1437
+ amount,
1438
+ cartId,
1439
+ pincode,
1440
+ checkoutMode,
1441
+ refresh,
1442
+ cardReference,
1443
+ userDetails,
1444
+ },
1058
1445
  { abortEarly: false, allowUnknown: true }
1059
1446
  );
1060
1447
  if (error) {
@@ -1062,44 +1449,81 @@ class Payment {
1062
1449
  }
1063
1450
 
1064
1451
  // Showing warrnings if extra unknown parameters are found
1065
- const { error: warrning } = PaymentValidator.verifyIfscCode().validate(
1066
- { ifscCode },
1452
+ const {
1453
+ error: warrning,
1454
+ } = PaymentValidator.getPaymentModeRoutes().validate(
1455
+ {
1456
+ amount,
1457
+ cartId,
1458
+ pincode,
1459
+ checkoutMode,
1460
+ refresh,
1461
+ cardReference,
1462
+ userDetails,
1463
+ },
1067
1464
  { abortEarly: false, allowUnknown: false }
1068
1465
  );
1069
1466
  if (warrning) {
1070
- console.log("Parameter Validation warrnings for verifyIfscCode");
1071
- console.log(warrning);
1467
+ Logger({
1468
+ level: "WARN",
1469
+ message: "Parameter Validation warrnings for getPaymentModeRoutes",
1470
+ });
1471
+ Logger({ level: "WARN", message: warrning });
1072
1472
  }
1073
1473
 
1074
1474
  const query_params = {};
1075
- query_params["ifsc_code"] = ifscCode;
1475
+ query_params["amount"] = amount;
1476
+ query_params["cart_id"] = cartId;
1477
+ query_params["pincode"] = pincode;
1478
+ query_params["checkout_mode"] = checkoutMode;
1479
+ query_params["refresh"] = refresh;
1480
+ query_params["card_reference"] = cardReference;
1481
+ query_params["user_details"] = userDetails;
1076
1482
 
1077
1483
  const xHeaders = {};
1078
1484
 
1079
- return APIClient.execute(
1485
+ const response = await APIClient.execute(
1080
1486
  this._conf,
1081
1487
  "get",
1082
1488
  constructUrl({
1083
- url: this._urls["verifyIfscCode"],
1489
+ url: this._urls["getPaymentModeRoutes"],
1084
1490
  params: {},
1085
1491
  }),
1086
1492
  query_params,
1087
1493
  undefined,
1088
1494
  xHeaders
1089
1495
  );
1496
+
1497
+ const {
1498
+ error: res_error,
1499
+ } = PaymentModel.PaymentModeRouteResponse().validate(response, {
1500
+ abortEarly: false,
1501
+ allowUnknown: false,
1502
+ });
1503
+
1504
+ if (res_error) {
1505
+ Logger({
1506
+ level: "WARN",
1507
+ message: "Response Validation Warnnings for getPaymentModeRoutes",
1508
+ });
1509
+ Logger({ level: "WARN", message: res_error });
1510
+ }
1511
+
1512
+ return response;
1090
1513
  }
1091
1514
 
1092
1515
  /**
1093
1516
  * @param {Object} arg - Arg object.
1094
- * @param {string} arg.orderId - A unique number used for identifying and
1095
- * tracking your orders.
1096
- * @returns {Promise<OrderBeneficiaryResponse>} - Success response
1097
- * @summary: Lists the beneficiary of a refund
1098
- * @description: Use this API to get the details of all active beneficiary added by a user for refund.
1517
+ * @param {string} arg.paymentLinkId - Payment link id
1518
+ * @returns {Promise<PaymentModeRouteResponse>} - Success response
1519
+ * @summary: Get applicable payment options for payment link
1520
+ * @description: Use this API to get all valid payment options for doing a payment through payment link
1099
1521
  */
1100
- getOrderBeneficiariesDetail({ orderId } = {}) {
1101
- const { error } = PaymentValidator.getOrderBeneficiariesDetail().validate(
1102
- { orderId },
1522
+ async getPaymentModeRoutesPaymentLink({ paymentLinkId } = {}) {
1523
+ const {
1524
+ error,
1525
+ } = PaymentValidator.getPaymentModeRoutesPaymentLink().validate(
1526
+ { paymentLinkId },
1103
1527
  { abortEarly: false, allowUnknown: true }
1104
1528
  );
1105
1529
  if (error) {
@@ -1109,47 +1533,96 @@ class Payment {
1109
1533
  // Showing warrnings if extra unknown parameters are found
1110
1534
  const {
1111
1535
  error: warrning,
1112
- } = PaymentValidator.getOrderBeneficiariesDetail().validate(
1113
- { orderId },
1536
+ } = PaymentValidator.getPaymentModeRoutesPaymentLink().validate(
1537
+ { paymentLinkId },
1114
1538
  { abortEarly: false, allowUnknown: false }
1115
1539
  );
1116
1540
  if (warrning) {
1117
- console.log(
1118
- "Parameter Validation warrnings for getOrderBeneficiariesDetail"
1119
- );
1120
- console.log(warrning);
1541
+ Logger({
1542
+ level: "WARN",
1543
+ message:
1544
+ "Parameter Validation warrnings for getPaymentModeRoutesPaymentLink",
1545
+ });
1546
+ Logger({ level: "WARN", message: warrning });
1121
1547
  }
1122
1548
 
1123
1549
  const query_params = {};
1124
- query_params["order_id"] = orderId;
1550
+ query_params["payment_link_id"] = paymentLinkId;
1125
1551
 
1126
1552
  const xHeaders = {};
1127
1553
 
1128
- return APIClient.execute(
1554
+ const response = await APIClient.execute(
1129
1555
  this._conf,
1130
1556
  "get",
1131
1557
  constructUrl({
1132
- url: this._urls["getOrderBeneficiariesDetail"],
1558
+ url: this._urls["getPaymentModeRoutesPaymentLink"],
1133
1559
  params: {},
1134
1560
  }),
1135
1561
  query_params,
1136
1562
  undefined,
1137
1563
  xHeaders
1138
1564
  );
1565
+
1566
+ const {
1567
+ error: res_error,
1568
+ } = PaymentModel.PaymentModeRouteResponse().validate(response, {
1569
+ abortEarly: false,
1570
+ allowUnknown: false,
1571
+ });
1572
+
1573
+ if (res_error) {
1574
+ Logger({
1575
+ level: "WARN",
1576
+ message:
1577
+ "Response Validation Warnnings for getPaymentModeRoutesPaymentLink",
1578
+ });
1579
+ Logger({ level: "WARN", message: res_error });
1580
+ }
1581
+
1582
+ return response;
1139
1583
  }
1140
1584
 
1141
1585
  /**
1142
1586
  * @param {Object} arg - Arg object.
1143
- * @param {AddBeneficiaryViaOtpVerificationRequest} arg.body
1144
- * @returns {Promise<AddBeneficiaryViaOtpVerificationResponse>} - Success response
1145
- * @summary: Verify the beneficiary details using OTP
1146
- * @description: Use this API to perform an OTP validation before saving the beneficiary details added for a refund.
1587
+ * @param {number} arg.amount - Payable amount.
1588
+ * @param {string} arg.cartId - Identifier of the cart.
1589
+ * @param {string} arg.pincode - The PIN Code of the destination address, e.g. 400059
1590
+ * @param {string} arg.checkoutMode - Option to checkout for self or for others.
1591
+ * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
1592
+ * to remove temporary cache files on payment gateway and replace with the
1593
+ * latest one.
1594
+ * @param {string} [arg.cardReference] - Card reference id of user's debit
1595
+ * or credit card.
1596
+ * @param {string} arg.orderType - The order type of shipment * HomeDelivery
1597
+ * - If the customer wants the order home-delivered * PickAtStore - If the
1598
+ * customer wants the handover of an order at the store itself.
1599
+ * @param {string} [arg.userDetails] - URIencoded JSON containing details of
1600
+ * an anonymous user.
1601
+ * @returns {Promise<PaymentModeRouteResponse>} - Success response
1602
+ * @summary: Get applicable payment options for Point-of-Sale (POS)
1603
+ * @description: Use this API to get all valid payment options for doing a payment in POS.
1147
1604
  */
1148
- verifyOtpAndAddBeneficiaryForBank({ body } = {}) {
1149
- const {
1150
- error,
1151
- } = PaymentValidator.verifyOtpAndAddBeneficiaryForBank().validate(
1152
- { body },
1605
+ async getPosPaymentModeRoutes({
1606
+ amount,
1607
+ cartId,
1608
+ pincode,
1609
+ checkoutMode,
1610
+ orderType,
1611
+ refresh,
1612
+ cardReference,
1613
+ userDetails,
1614
+ } = {}) {
1615
+ const { error } = PaymentValidator.getPosPaymentModeRoutes().validate(
1616
+ {
1617
+ amount,
1618
+ cartId,
1619
+ pincode,
1620
+ checkoutMode,
1621
+ orderType,
1622
+ refresh,
1623
+ cardReference,
1624
+ userDetails,
1625
+ },
1153
1626
  { abortEarly: false, allowUnknown: true }
1154
1627
  );
1155
1628
  if (error) {
@@ -1159,44 +1632,78 @@ class Payment {
1159
1632
  // Showing warrnings if extra unknown parameters are found
1160
1633
  const {
1161
1634
  error: warrning,
1162
- } = PaymentValidator.verifyOtpAndAddBeneficiaryForBank().validate(
1163
- { body },
1635
+ } = PaymentValidator.getPosPaymentModeRoutes().validate(
1636
+ {
1637
+ amount,
1638
+ cartId,
1639
+ pincode,
1640
+ checkoutMode,
1641
+ orderType,
1642
+ refresh,
1643
+ cardReference,
1644
+ userDetails,
1645
+ },
1164
1646
  { abortEarly: false, allowUnknown: false }
1165
1647
  );
1166
1648
  if (warrning) {
1167
- console.log(
1168
- "Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForBank"
1169
- );
1170
- console.log(warrning);
1649
+ Logger({
1650
+ level: "WARN",
1651
+ message: "Parameter Validation warrnings for getPosPaymentModeRoutes",
1652
+ });
1653
+ Logger({ level: "WARN", message: warrning });
1171
1654
  }
1172
1655
 
1173
1656
  const query_params = {};
1657
+ query_params["amount"] = amount;
1658
+ query_params["cart_id"] = cartId;
1659
+ query_params["pincode"] = pincode;
1660
+ query_params["checkout_mode"] = checkoutMode;
1661
+ query_params["refresh"] = refresh;
1662
+ query_params["card_reference"] = cardReference;
1663
+ query_params["order_type"] = orderType;
1664
+ query_params["user_details"] = userDetails;
1174
1665
 
1175
1666
  const xHeaders = {};
1176
1667
 
1177
- return APIClient.execute(
1668
+ const response = await APIClient.execute(
1178
1669
  this._conf,
1179
- "post",
1670
+ "get",
1180
1671
  constructUrl({
1181
- url: this._urls["verifyOtpAndAddBeneficiaryForBank"],
1672
+ url: this._urls["getPosPaymentModeRoutes"],
1182
1673
  params: {},
1183
1674
  }),
1184
1675
  query_params,
1185
- body,
1676
+ undefined,
1186
1677
  xHeaders
1187
1678
  );
1679
+
1680
+ const {
1681
+ error: res_error,
1682
+ } = PaymentModel.PaymentModeRouteResponse().validate(response, {
1683
+ abortEarly: false,
1684
+ allowUnknown: false,
1685
+ });
1686
+
1687
+ if (res_error) {
1688
+ Logger({
1689
+ level: "WARN",
1690
+ message: "Response Validation Warnnings for getPosPaymentModeRoutes",
1691
+ });
1692
+ Logger({ level: "WARN", message: res_error });
1693
+ }
1694
+
1695
+ return response;
1188
1696
  }
1189
1697
 
1190
1698
  /**
1191
1699
  * @param {Object} arg - Arg object.
1192
- * @param {AddBeneficiaryDetailsRequest} arg.body
1193
- * @returns {Promise<RefundAccountResponse>} - Success response
1194
- * @summary: Save bank details for cancelled/returned order
1195
- * @description: Use this API to save the bank details for a returned or cancelled order to refund the amount.
1700
+ * @returns {Promise<RupifiBannerResponse>} - Success response
1701
+ * @summary: Get CreditLine Offer
1702
+ * @description: Get CreditLine Offer if user is tentatively approved by rupifi
1196
1703
  */
1197
- addBeneficiaryDetails({ body } = {}) {
1198
- const { error } = PaymentValidator.addBeneficiaryDetails().validate(
1199
- { body },
1704
+ async getRupifiBannerDetails({} = {}) {
1705
+ const { error } = PaymentValidator.getRupifiBannerDetails().validate(
1706
+ {},
1200
1707
  { abortEarly: false, allowUnknown: true }
1201
1708
  );
1202
1709
  if (error) {
@@ -1206,42 +1713,63 @@ class Payment {
1206
1713
  // Showing warrnings if extra unknown parameters are found
1207
1714
  const {
1208
1715
  error: warrning,
1209
- } = PaymentValidator.addBeneficiaryDetails().validate(
1210
- { body },
1716
+ } = PaymentValidator.getRupifiBannerDetails().validate(
1717
+ {},
1211
1718
  { abortEarly: false, allowUnknown: false }
1212
1719
  );
1213
1720
  if (warrning) {
1214
- console.log("Parameter Validation warrnings for addBeneficiaryDetails");
1215
- console.log(warrning);
1721
+ Logger({
1722
+ level: "WARN",
1723
+ message: "Parameter Validation warrnings for getRupifiBannerDetails",
1724
+ });
1725
+ Logger({ level: "WARN", message: warrning });
1216
1726
  }
1217
1727
 
1218
1728
  const query_params = {};
1219
1729
 
1220
1730
  const xHeaders = {};
1221
1731
 
1222
- return APIClient.execute(
1732
+ const response = await APIClient.execute(
1223
1733
  this._conf,
1224
- "post",
1734
+ "get",
1225
1735
  constructUrl({
1226
- url: this._urls["addBeneficiaryDetails"],
1736
+ url: this._urls["getRupifiBannerDetails"],
1227
1737
  params: {},
1228
1738
  }),
1229
1739
  query_params,
1230
- body,
1740
+ undefined,
1231
1741
  xHeaders
1232
1742
  );
1743
+
1744
+ const {
1745
+ error: res_error,
1746
+ } = PaymentModel.RupifiBannerResponse().validate(response, {
1747
+ abortEarly: false,
1748
+ allowUnknown: false,
1749
+ });
1750
+
1751
+ if (res_error) {
1752
+ Logger({
1753
+ level: "WARN",
1754
+ message: "Response Validation Warnnings for getRupifiBannerDetails",
1755
+ });
1756
+ Logger({ level: "WARN", message: res_error });
1757
+ }
1758
+
1759
+ return response;
1233
1760
  }
1234
1761
 
1235
1762
  /**
1236
1763
  * @param {Object} arg - Arg object.
1237
- * @param {AddBeneficiaryDetailsOTPRequest} arg.body
1238
- * @returns {Promise<RefundAccountResponse>} - Success response
1239
- * @summary: Save bank details for cancelled/returned order
1240
- * @description: Use this API to save bank details for returned/cancelled order to refund amount in his account.
1764
+ * @param {string} arg.orderId - A unique number used for identifying and
1765
+ * tracking your orders.
1766
+ * @returns {Promise<OrderBeneficiaryResponse>} - Success response
1767
+ * @summary: Lists the beneficiary of a refund
1768
+ * @description: Use this API to get the details of all active beneficiary added by a user for refund.
1241
1769
  */
1242
- addRefundBankAccountUsingOTP({ body } = {}) {
1243
- const { error } = PaymentValidator.addRefundBankAccountUsingOTP().validate(
1244
- { body },
1770
+ async getUserBeneficiariesDetail({ orderId } = {}) {
1771
+ const { error } = PaymentValidator.getUserBeneficiariesDetail().validate(
1772
+ { orderId },
1245
1773
  { abortEarly: false, allowUnknown: true }
1246
1774
  );
1247
1775
  if (error) {
@@ -1251,45 +1779,63 @@ class Payment {
1251
1779
  // Showing warrnings if extra unknown parameters are found
1252
1780
  const {
1253
1781
  error: warrning,
1254
- } = PaymentValidator.addRefundBankAccountUsingOTP().validate(
1255
- { body },
1782
+ } = PaymentValidator.getUserBeneficiariesDetail().validate(
1783
+ { orderId },
1256
1784
  { abortEarly: false, allowUnknown: false }
1257
1785
  );
1258
1786
  if (warrning) {
1259
- console.log(
1260
- "Parameter Validation warrnings for addRefundBankAccountUsingOTP"
1261
- );
1262
- console.log(warrning);
1787
+ Logger({
1788
+ level: "WARN",
1789
+ message:
1790
+ "Parameter Validation warrnings for getUserBeneficiariesDetail",
1791
+ });
1792
+ Logger({ level: "WARN", message: warrning });
1263
1793
  }
1264
1794
 
1265
1795
  const query_params = {};
1796
+ query_params["order_id"] = orderId;
1266
1797
 
1267
1798
  const xHeaders = {};
1268
1799
 
1269
- return APIClient.execute(
1800
+ const response = await APIClient.execute(
1270
1801
  this._conf,
1271
- "post",
1802
+ "get",
1272
1803
  constructUrl({
1273
- url: this._urls["addRefundBankAccountUsingOTP"],
1804
+ url: this._urls["getUserBeneficiariesDetail"],
1274
1805
  params: {},
1275
1806
  }),
1276
1807
  query_params,
1277
- body,
1808
+ undefined,
1278
1809
  xHeaders
1279
1810
  );
1811
+
1812
+ const {
1813
+ error: res_error,
1814
+ } = PaymentModel.OrderBeneficiaryResponse().validate(response, {
1815
+ abortEarly: false,
1816
+ allowUnknown: false,
1817
+ });
1818
+
1819
+ if (res_error) {
1820
+ Logger({
1821
+ level: "WARN",
1822
+ message: "Response Validation Warnnings for getUserBeneficiariesDetail",
1823
+ });
1824
+ Logger({ level: "WARN", message: res_error });
1825
+ }
1826
+
1827
+ return response;
1280
1828
  }
1281
1829
 
1282
1830
  /**
1283
1831
  * @param {Object} arg - Arg object.
1284
- * @param {WalletOtpRequest} arg.body
1285
- * @returns {Promise<WalletOtpResponse>} - Success response
1286
- * @summary: Send OTP on adding a wallet beneficiary
1287
- * @description: Use this API to send an OTP while adding a wallet beneficiary by mobile no. verification.
1832
+ * @param {PaymentInitializationRequest} arg.body
1833
+ * @returns {Promise<PaymentInitializationResponse>} - Success response
1834
+ * @summary: Initialize a payment (server-to-server) for UPI and BharatQR
1835
+ * @description: PUse this API to inititate payment using UPI, BharatQR, wherein the UPI requests are send to the app and QR code is displayed on the screen.
1288
1836
  */
1289
- verifyOtpAndAddBeneficiaryForWallet({ body } = {}) {
1290
- const {
1291
- error,
1292
- } = PaymentValidator.verifyOtpAndAddBeneficiaryForWallet().validate(
1837
+ async initialisePayment({ body } = {}) {
1838
+ const { error } = PaymentValidator.initialisePayment().validate(
1293
1839
  { body },
1294
1840
  { abortEarly: false, allowUnknown: true }
1295
1841
  );
@@ -1298,45 +1844,61 @@ class Payment {
1298
1844
  }
1299
1845
 
1300
1846
  // Showing warrnings if extra unknown parameters are found
1301
- const {
1302
- error: warrning,
1303
- } = PaymentValidator.verifyOtpAndAddBeneficiaryForWallet().validate(
1847
+ const { error: warrning } = PaymentValidator.initialisePayment().validate(
1304
1848
  { body },
1305
1849
  { abortEarly: false, allowUnknown: false }
1306
1850
  );
1307
1851
  if (warrning) {
1308
- console.log(
1309
- "Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForWallet"
1310
- );
1311
- console.log(warrning);
1852
+ Logger({
1853
+ level: "WARN",
1854
+ message: "Parameter Validation warrnings for initialisePayment",
1855
+ });
1856
+ Logger({ level: "WARN", message: warrning });
1312
1857
  }
1313
1858
 
1314
1859
  const query_params = {};
1315
1860
 
1316
1861
  const xHeaders = {};
1317
1862
 
1318
- return APIClient.execute(
1863
+ const response = await APIClient.execute(
1319
1864
  this._conf,
1320
1865
  "post",
1321
1866
  constructUrl({
1322
- url: this._urls["verifyOtpAndAddBeneficiaryForWallet"],
1867
+ url: this._urls["initialisePayment"],
1323
1868
  params: {},
1324
1869
  }),
1325
1870
  query_params,
1326
1871
  body,
1327
1872
  xHeaders
1328
1873
  );
1874
+
1875
+ const {
1876
+ error: res_error,
1877
+ } = PaymentModel.PaymentInitializationResponse().validate(response, {
1878
+ abortEarly: false,
1879
+ allowUnknown: false,
1880
+ });
1881
+
1882
+ if (res_error) {
1883
+ Logger({
1884
+ level: "WARN",
1885
+ message: "Response Validation Warnnings for initialisePayment",
1886
+ });
1887
+ Logger({ level: "WARN", message: res_error });
1888
+ }
1889
+
1890
+ return response;
1329
1891
  }
1330
1892
 
1331
1893
  /**
1332
1894
  * @param {Object} arg - Arg object.
1333
- * @param {SetDefaultBeneficiaryRequest} arg.body
1334
- * @returns {Promise<SetDefaultBeneficiaryResponse>} - Success response
1335
- * @summary: Set a default beneficiary for a refund
1336
- * @description: Use this API to set a default beneficiary for getting a refund.
1895
+ * @param {PaymentInitializationRequest} arg.body
1896
+ * @returns {Promise<PaymentInitializationResponse>} - Success response
1897
+ * @summary: Initialize a payment (server-to-server) for UPI and BharatQR
1898
+ * @description: Use this API to inititate payment using UPI, BharatQR, wherein the UPI requests are send to the app and QR code is displayed on the screen.
1337
1899
  */
1338
- updateDefaultBeneficiary({ body } = {}) {
1339
- const { error } = PaymentValidator.updateDefaultBeneficiary().validate(
1900
+ async initialisePaymentPaymentLink({ body } = {}) {
1901
+ const { error } = PaymentValidator.initialisePaymentPaymentLink().validate(
1340
1902
  { body },
1341
1903
  { abortEarly: false, allowUnknown: true }
1342
1904
  );
@@ -1347,43 +1909,63 @@ class Payment {
1347
1909
  // Showing warrnings if extra unknown parameters are found
1348
1910
  const {
1349
1911
  error: warrning,
1350
- } = PaymentValidator.updateDefaultBeneficiary().validate(
1912
+ } = PaymentValidator.initialisePaymentPaymentLink().validate(
1351
1913
  { body },
1352
1914
  { abortEarly: false, allowUnknown: false }
1353
1915
  );
1354
1916
  if (warrning) {
1355
- console.log(
1356
- "Parameter Validation warrnings for updateDefaultBeneficiary"
1357
- );
1358
- console.log(warrning);
1917
+ Logger({
1918
+ level: "WARN",
1919
+ message:
1920
+ "Parameter Validation warrnings for initialisePaymentPaymentLink",
1921
+ });
1922
+ Logger({ level: "WARN", message: warrning });
1359
1923
  }
1360
1924
 
1361
1925
  const query_params = {};
1362
1926
 
1363
1927
  const xHeaders = {};
1364
1928
 
1365
- return APIClient.execute(
1929
+ const response = await APIClient.execute(
1366
1930
  this._conf,
1367
1931
  "post",
1368
1932
  constructUrl({
1369
- url: this._urls["updateDefaultBeneficiary"],
1933
+ url: this._urls["initialisePaymentPaymentLink"],
1370
1934
  params: {},
1371
1935
  }),
1372
1936
  query_params,
1373
1937
  body,
1374
1938
  xHeaders
1375
1939
  );
1940
+
1941
+ const {
1942
+ error: res_error,
1943
+ } = PaymentModel.PaymentInitializationResponse().validate(response, {
1944
+ abortEarly: false,
1945
+ allowUnknown: false,
1946
+ });
1947
+
1948
+ if (res_error) {
1949
+ Logger({
1950
+ level: "WARN",
1951
+ message:
1952
+ "Response Validation Warnnings for initialisePaymentPaymentLink",
1953
+ });
1954
+ Logger({ level: "WARN", message: res_error });
1955
+ }
1956
+
1957
+ return response;
1376
1958
  }
1377
1959
 
1378
1960
  /**
1379
1961
  * @param {Object} arg - Arg object.
1380
1962
  * @param {string} [arg.paymentLinkId] -
1381
- * @returns {Promise<GetPaymentLinkResponse>} - Success response
1382
- * @summary: Get payment link
1383
- * @description: Use this API to get a payment link
1963
+ * @returns {Promise<PollingPaymentLinkResponse>} - Success response
1964
+ * @summary: Used for polling if payment successful or not
1965
+ * @description: Use this API to poll if payment through payment was successful or not
1384
1966
  */
1385
- getPaymentLink({ paymentLinkId } = {}) {
1386
- const { error } = PaymentValidator.getPaymentLink().validate(
1967
+ async pollingPaymentLink({ paymentLinkId } = {}) {
1968
+ const { error } = PaymentValidator.pollingPaymentLink().validate(
1387
1969
  { paymentLinkId },
1388
1970
  { abortEarly: false, allowUnknown: true }
1389
1971
  );
@@ -1392,13 +1974,16 @@ class Payment {
1392
1974
  }
1393
1975
 
1394
1976
  // Showing warrnings if extra unknown parameters are found
1395
- const { error: warrning } = PaymentValidator.getPaymentLink().validate(
1977
+ const { error: warrning } = PaymentValidator.pollingPaymentLink().validate(
1396
1978
  { paymentLinkId },
1397
1979
  { abortEarly: false, allowUnknown: false }
1398
1980
  );
1399
1981
  if (warrning) {
1400
- console.log("Parameter Validation warrnings for getPaymentLink");
1401
- console.log(warrning);
1982
+ Logger({
1983
+ level: "WARN",
1984
+ message: "Parameter Validation warrnings for pollingPaymentLink",
1985
+ });
1986
+ Logger({ level: "WARN", message: warrning });
1402
1987
  }
1403
1988
 
1404
1989
  const query_params = {};
@@ -1406,72 +1991,49 @@ class Payment {
1406
1991
 
1407
1992
  const xHeaders = {};
1408
1993
 
1409
- return APIClient.execute(
1994
+ const response = await APIClient.execute(
1410
1995
  this._conf,
1411
1996
  "get",
1412
1997
  constructUrl({
1413
- url: this._urls["getPaymentLink"],
1998
+ url: this._urls["pollingPaymentLink"],
1414
1999
  params: {},
1415
2000
  }),
1416
2001
  query_params,
1417
2002
  undefined,
1418
2003
  xHeaders
1419
2004
  );
1420
- }
1421
2005
 
1422
- /**
1423
- * @param {Object} arg - Arg object.
1424
- * @param {CreatePaymentLinkRequest} arg.body
1425
- * @returns {Promise<CreatePaymentLinkResponse>} - Success response
1426
- * @summary: Create payment link
1427
- * @description: Use this API to create a payment link for the customer
1428
- */
1429
- createPaymentLink({ body } = {}) {
1430
- const { error } = PaymentValidator.createPaymentLink().validate(
1431
- { body },
1432
- { abortEarly: false, allowUnknown: true }
1433
- );
1434
- if (error) {
1435
- return Promise.reject(new FDKClientValidationError(error));
1436
- }
2006
+ const {
2007
+ error: res_error,
2008
+ } = PaymentModel.PollingPaymentLinkResponse().validate(response, {
2009
+ abortEarly: false,
2010
+ allowUnknown: false,
2011
+ });
1437
2012
 
1438
- // Showing warrnings if extra unknown parameters are found
1439
- const { error: warrning } = PaymentValidator.createPaymentLink().validate(
1440
- { body },
1441
- { abortEarly: false, allowUnknown: false }
1442
- );
1443
- if (warrning) {
1444
- console.log("Parameter Validation warrnings for createPaymentLink");
1445
- console.log(warrning);
2013
+ if (res_error) {
2014
+ Logger({
2015
+ level: "WARN",
2016
+ message: "Response Validation Warnnings for pollingPaymentLink",
2017
+ });
2018
+ Logger({ level: "WARN", message: res_error });
1446
2019
  }
1447
2020
 
1448
- const query_params = {};
1449
-
1450
- const xHeaders = {};
1451
-
1452
- return APIClient.execute(
1453
- this._conf,
1454
- "post",
1455
- constructUrl({
1456
- url: this._urls["createPaymentLink"],
1457
- params: {},
1458
- }),
1459
- query_params,
1460
- body,
1461
- xHeaders
1462
- );
2021
+ return response;
1463
2022
  }
1464
2023
 
1465
2024
  /**
1466
2025
  * @param {Object} arg - Arg object.
1467
- * @param {CancelOrResendPaymentLinkRequest} arg.body
1468
- * @returns {Promise<ResendPaymentLinkResponse>} - Success response
1469
- * @summary: Resend payment link
1470
- * @description: Use this API to resend a payment link for the customer
2026
+ * @param {string} [arg.source] - This is a String value that contains
2027
+ * callback URL as value.
2028
+ * @param {string} [arg.aggregator] - This is a String value that contains
2029
+ * aggregator name as value.
2030
+ * @returns {Promise<RedirectToAggregatorResponse>} - Success response
2031
+ * @summary: API to get the redirect url to redirect the user to aggregator's page
2032
+ * @description: Use this API to get the redirect url to redirect the user to aggregator's page
1471
2033
  */
1472
- resendPaymentLink({ body } = {}) {
1473
- const { error } = PaymentValidator.resendPaymentLink().validate(
1474
- { body },
2034
+ async redirectToAggregator({ source, aggregator } = {}) {
2035
+ const { error } = PaymentValidator.redirectToAggregator().validate(
2036
+ { source, aggregator },
1475
2037
  { abortEarly: false, allowUnknown: true }
1476
2038
  );
1477
2039
  if (error) {
@@ -1479,41 +2041,65 @@ class Payment {
1479
2041
  }
1480
2042
 
1481
2043
  // Showing warrnings if extra unknown parameters are found
1482
- const { error: warrning } = PaymentValidator.resendPaymentLink().validate(
1483
- { body },
2044
+ const {
2045
+ error: warrning,
2046
+ } = PaymentValidator.redirectToAggregator().validate(
2047
+ { source, aggregator },
1484
2048
  { abortEarly: false, allowUnknown: false }
1485
2049
  );
1486
2050
  if (warrning) {
1487
- console.log("Parameter Validation warrnings for resendPaymentLink");
1488
- console.log(warrning);
2051
+ Logger({
2052
+ level: "WARN",
2053
+ message: "Parameter Validation warrnings for redirectToAggregator",
2054
+ });
2055
+ Logger({ level: "WARN", message: warrning });
1489
2056
  }
1490
2057
 
1491
2058
  const query_params = {};
2059
+ query_params["source"] = source;
2060
+ query_params["aggregator"] = aggregator;
1492
2061
 
1493
2062
  const xHeaders = {};
1494
2063
 
1495
- return APIClient.execute(
2064
+ const response = await APIClient.execute(
1496
2065
  this._conf,
1497
- "post",
2066
+ "get",
1498
2067
  constructUrl({
1499
- url: this._urls["resendPaymentLink"],
2068
+ url: this._urls["redirectToAggregator"],
1500
2069
  params: {},
1501
2070
  }),
1502
2071
  query_params,
1503
- body,
2072
+ undefined,
1504
2073
  xHeaders
1505
2074
  );
2075
+
2076
+ const {
2077
+ error: res_error,
2078
+ } = PaymentModel.RedirectToAggregatorResponse().validate(response, {
2079
+ abortEarly: false,
2080
+ allowUnknown: false,
2081
+ });
2082
+
2083
+ if (res_error) {
2084
+ Logger({
2085
+ level: "WARN",
2086
+ message: "Response Validation Warnnings for redirectToAggregator",
2087
+ });
2088
+ Logger({ level: "WARN", message: res_error });
2089
+ }
2090
+
2091
+ return response;
1506
2092
  }
1507
2093
 
1508
2094
  /**
1509
2095
  * @param {Object} arg - Arg object.
1510
- * @param {CancelOrResendPaymentLinkRequest} arg.body
1511
- * @returns {Promise<CancelPaymentLinkResponse>} - Success response
1512
- * @summary: Cancel payment link
1513
- * @description: Use this API to cancel a payment link for the customer
2096
+ * @param {renderHTMLRequest} arg.body
2097
+ * @returns {Promise<renderHTMLResponse>} - Success response
2098
+ * @summary: Convert base64 string to HTML form
2099
+ * @description: Use this API to decode base64 html form to plain HTML string.
1514
2100
  */
1515
- cancelPaymentLink({ body } = {}) {
1516
- const { error } = PaymentValidator.cancelPaymentLink().validate(
2101
+ async renderHTML({ body } = {}) {
2102
+ const { error } = PaymentValidator.renderHTML().validate(
1517
2103
  { body },
1518
2104
  { abortEarly: false, allowUnknown: true }
1519
2105
  );
@@ -1522,44 +2108,62 @@ class Payment {
1522
2108
  }
1523
2109
 
1524
2110
  // Showing warrnings if extra unknown parameters are found
1525
- const { error: warrning } = PaymentValidator.cancelPaymentLink().validate(
2111
+ const { error: warrning } = PaymentValidator.renderHTML().validate(
1526
2112
  { body },
1527
2113
  { abortEarly: false, allowUnknown: false }
1528
2114
  );
1529
2115
  if (warrning) {
1530
- console.log("Parameter Validation warrnings for cancelPaymentLink");
1531
- console.log(warrning);
2116
+ Logger({
2117
+ level: "WARN",
2118
+ message: "Parameter Validation warrnings for renderHTML",
2119
+ });
2120
+ Logger({ level: "WARN", message: warrning });
1532
2121
  }
1533
2122
 
1534
2123
  const query_params = {};
1535
2124
 
1536
2125
  const xHeaders = {};
1537
2126
 
1538
- return APIClient.execute(
2127
+ const response = await APIClient.execute(
1539
2128
  this._conf,
1540
2129
  "post",
1541
2130
  constructUrl({
1542
- url: this._urls["cancelPaymentLink"],
2131
+ url: this._urls["renderHTML"],
1543
2132
  params: {},
1544
2133
  }),
1545
2134
  query_params,
1546
2135
  body,
1547
2136
  xHeaders
1548
2137
  );
2138
+
2139
+ const {
2140
+ error: res_error,
2141
+ } = PaymentModel.renderHTMLResponse().validate(response, {
2142
+ abortEarly: false,
2143
+ allowUnknown: false,
2144
+ });
2145
+
2146
+ if (res_error) {
2147
+ Logger({
2148
+ level: "WARN",
2149
+ message: "Response Validation Warnnings for renderHTML",
2150
+ });
2151
+ Logger({ level: "WARN", message: res_error });
2152
+ }
2153
+
2154
+ return response;
1549
2155
  }
1550
2156
 
1551
2157
  /**
1552
2158
  * @param {Object} arg - Arg object.
1553
- * @param {string} arg.paymentLinkId - Payment link id
1554
- * @returns {Promise<PaymentModeRouteResponse>} - Success response
1555
- * @summary: Get applicable payment options for payment link
1556
- * @description: Use this API to get all valid payment options for doing a payment through payment link
2159
+ * @param {ResendOrCancelPaymentRequest} arg.body
2160
+ * @returns {Promise<ResendOrCancelPaymentResponse>} - Success response
2161
+ * @summary: API to resend and cancel a payment link which was already generated.
2162
+ * @description: Use this API to perform resend or cancel a payment link based on request payload.
1557
2163
  */
1558
- getPaymentModeRoutesPaymentLink({ paymentLinkId } = {}) {
1559
- const {
1560
- error,
1561
- } = PaymentValidator.getPaymentModeRoutesPaymentLink().validate(
1562
- { paymentLinkId },
2164
+ async resendOrCancelPayment({ body } = {}) {
2165
+ const { error } = PaymentValidator.resendOrCancelPayment().validate(
2166
+ { body },
1563
2167
  { abortEarly: false, allowUnknown: true }
1564
2168
  );
1565
2169
  if (error) {
@@ -1569,45 +2173,62 @@ class Payment {
1569
2173
  // Showing warrnings if extra unknown parameters are found
1570
2174
  const {
1571
2175
  error: warrning,
1572
- } = PaymentValidator.getPaymentModeRoutesPaymentLink().validate(
1573
- { paymentLinkId },
2176
+ } = PaymentValidator.resendOrCancelPayment().validate(
2177
+ { body },
1574
2178
  { abortEarly: false, allowUnknown: false }
1575
2179
  );
1576
2180
  if (warrning) {
1577
- console.log(
1578
- "Parameter Validation warrnings for getPaymentModeRoutesPaymentLink"
1579
- );
1580
- console.log(warrning);
2181
+ Logger({
2182
+ level: "WARN",
2183
+ message: "Parameter Validation warrnings for resendOrCancelPayment",
2184
+ });
2185
+ Logger({ level: "WARN", message: warrning });
1581
2186
  }
1582
2187
 
1583
2188
  const query_params = {};
1584
- query_params["payment_link_id"] = paymentLinkId;
1585
2189
 
1586
2190
  const xHeaders = {};
1587
2191
 
1588
- return APIClient.execute(
2192
+ const response = await APIClient.execute(
1589
2193
  this._conf,
1590
- "get",
2194
+ "post",
1591
2195
  constructUrl({
1592
- url: this._urls["getPaymentModeRoutesPaymentLink"],
2196
+ url: this._urls["resendOrCancelPayment"],
1593
2197
  params: {},
1594
2198
  }),
1595
2199
  query_params,
1596
- undefined,
2200
+ body,
1597
2201
  xHeaders
1598
2202
  );
2203
+
2204
+ const {
2205
+ error: res_error,
2206
+ } = PaymentModel.ResendOrCancelPaymentResponse().validate(response, {
2207
+ abortEarly: false,
2208
+ allowUnknown: false,
2209
+ });
2210
+
2211
+ if (res_error) {
2212
+ Logger({
2213
+ level: "WARN",
2214
+ message: "Response Validation Warnnings for resendOrCancelPayment",
2215
+ });
2216
+ Logger({ level: "WARN", message: res_error });
2217
+ }
2218
+
2219
+ return response;
1599
2220
  }
1600
2221
 
1601
2222
  /**
1602
2223
  * @param {Object} arg - Arg object.
1603
- * @param {string} [arg.paymentLinkId] -
1604
- * @returns {Promise<PollingPaymentLinkResponse>} - Success response
1605
- * @summary: Used for polling if payment successful or not
1606
- * @description: Use this API to poll if payment through payment was successful or not
2224
+ * @param {CancelOrResendPaymentLinkRequest} arg.body
2225
+ * @returns {Promise<ResendPaymentLinkResponse>} - Success response
2226
+ * @summary: Resend payment link
2227
+ * @description: Use this API to resend a payment link for the customer
1607
2228
  */
1608
- pollingPaymentLink({ paymentLinkId } = {}) {
1609
- const { error } = PaymentValidator.pollingPaymentLink().validate(
1610
- { paymentLinkId },
2229
+ async resendPaymentLink({ body } = {}) {
2230
+ const { error } = PaymentValidator.resendPaymentLink().validate(
2231
+ { body },
1611
2232
  { abortEarly: false, allowUnknown: true }
1612
2233
  );
1613
2234
  if (error) {
@@ -1615,42 +2236,61 @@ class Payment {
1615
2236
  }
1616
2237
 
1617
2238
  // Showing warrnings if extra unknown parameters are found
1618
- const { error: warrning } = PaymentValidator.pollingPaymentLink().validate(
1619
- { paymentLinkId },
2239
+ const { error: warrning } = PaymentValidator.resendPaymentLink().validate(
2240
+ { body },
1620
2241
  { abortEarly: false, allowUnknown: false }
1621
2242
  );
1622
2243
  if (warrning) {
1623
- console.log("Parameter Validation warrnings for pollingPaymentLink");
1624
- console.log(warrning);
2244
+ Logger({
2245
+ level: "WARN",
2246
+ message: "Parameter Validation warrnings for resendPaymentLink",
2247
+ });
2248
+ Logger({ level: "WARN", message: warrning });
1625
2249
  }
1626
2250
 
1627
2251
  const query_params = {};
1628
- query_params["payment_link_id"] = paymentLinkId;
1629
2252
 
1630
2253
  const xHeaders = {};
1631
2254
 
1632
- return APIClient.execute(
2255
+ const response = await APIClient.execute(
1633
2256
  this._conf,
1634
- "get",
2257
+ "post",
1635
2258
  constructUrl({
1636
- url: this._urls["pollingPaymentLink"],
2259
+ url: this._urls["resendPaymentLink"],
1637
2260
  params: {},
1638
2261
  }),
1639
2262
  query_params,
1640
- undefined,
2263
+ body,
1641
2264
  xHeaders
1642
2265
  );
2266
+
2267
+ const {
2268
+ error: res_error,
2269
+ } = PaymentModel.ResendPaymentLinkResponse().validate(response, {
2270
+ abortEarly: false,
2271
+ allowUnknown: false,
2272
+ });
2273
+
2274
+ if (res_error) {
2275
+ Logger({
2276
+ level: "WARN",
2277
+ message: "Response Validation Warnnings for resendPaymentLink",
2278
+ });
2279
+ Logger({ level: "WARN", message: res_error });
2280
+ }
2281
+
2282
+ return response;
1643
2283
  }
1644
2284
 
1645
2285
  /**
1646
2286
  * @param {Object} arg - Arg object.
1647
- * @param {CreateOrderUserRequest} arg.body
1648
- * @returns {Promise<CreateOrderUserResponse>} - Success response
1649
- * @summary: Create Order user
1650
- * @description: Use this API to create a order and payment on aggregator side
2287
+ * @param {SetDefaultBeneficiaryRequest} arg.body
2288
+ * @returns {Promise<SetDefaultBeneficiaryResponse>} - Success response
2289
+ * @summary: Set a default beneficiary for a refund
2290
+ * @description: Use this API to set a default beneficiary for getting a refund.
1651
2291
  */
1652
- createOrderHandlerPaymentLink({ body } = {}) {
1653
- const { error } = PaymentValidator.createOrderHandlerPaymentLink().validate(
2292
+ async updateDefaultBeneficiary({ body } = {}) {
2293
+ const { error } = PaymentValidator.updateDefaultBeneficiary().validate(
1654
2294
  { body },
1655
2295
  { abortEarly: false, allowUnknown: true }
1656
2296
  );
@@ -1661,43 +2301,61 @@ class Payment {
1661
2301
  // Showing warrnings if extra unknown parameters are found
1662
2302
  const {
1663
2303
  error: warrning,
1664
- } = PaymentValidator.createOrderHandlerPaymentLink().validate(
2304
+ } = PaymentValidator.updateDefaultBeneficiary().validate(
1665
2305
  { body },
1666
2306
  { abortEarly: false, allowUnknown: false }
1667
2307
  );
1668
2308
  if (warrning) {
1669
- console.log(
1670
- "Parameter Validation warrnings for createOrderHandlerPaymentLink"
1671
- );
1672
- console.log(warrning);
2309
+ Logger({
2310
+ level: "WARN",
2311
+ message: "Parameter Validation warrnings for updateDefaultBeneficiary",
2312
+ });
2313
+ Logger({ level: "WARN", message: warrning });
1673
2314
  }
1674
2315
 
1675
2316
  const query_params = {};
1676
2317
 
1677
2318
  const xHeaders = {};
1678
2319
 
1679
- return APIClient.execute(
2320
+ const response = await APIClient.execute(
1680
2321
  this._conf,
1681
2322
  "post",
1682
2323
  constructUrl({
1683
- url: this._urls["createOrderHandlerPaymentLink"],
2324
+ url: this._urls["updateDefaultBeneficiary"],
1684
2325
  params: {},
1685
2326
  }),
1686
2327
  query_params,
1687
2328
  body,
1688
2329
  xHeaders
1689
2330
  );
2331
+
2332
+ const {
2333
+ error: res_error,
2334
+ } = PaymentModel.SetDefaultBeneficiaryResponse().validate(response, {
2335
+ abortEarly: false,
2336
+ allowUnknown: false,
2337
+ });
2338
+
2339
+ if (res_error) {
2340
+ Logger({
2341
+ level: "WARN",
2342
+ message: "Response Validation Warnnings for updateDefaultBeneficiary",
2343
+ });
2344
+ Logger({ level: "WARN", message: res_error });
2345
+ }
2346
+
2347
+ return response;
1690
2348
  }
1691
2349
 
1692
2350
  /**
1693
2351
  * @param {Object} arg - Arg object.
1694
- * @param {PaymentInitializationRequest} arg.body
1695
- * @returns {Promise<PaymentInitializationResponse>} - Success response
1696
- * @summary: Initialize a payment (server-to-server) for UPI and BharatQR
1697
- * @description: Use this API to inititate payment using UPI, BharatQR, wherein the UPI requests are send to the app and QR code is displayed on the screen.
2352
+ * @param {ValidateVPARequest} arg.body
2353
+ * @returns {Promise<ValidateVPAResponse>} - Success response
2354
+ * @summary: API to Validate UPI ID
2355
+ * @description: API to Validate UPI ID
1698
2356
  */
1699
- initialisePaymentPaymentLink({ body } = {}) {
1700
- const { error } = PaymentValidator.initialisePaymentPaymentLink().validate(
2357
+ async validateVPA({ body } = {}) {
2358
+ const { error } = PaymentValidator.validateVPA().validate(
1701
2359
  { body },
1702
2360
  { abortEarly: false, allowUnknown: true }
1703
2361
  );
@@ -1706,47 +2364,61 @@ class Payment {
1706
2364
  }
1707
2365
 
1708
2366
  // Showing warrnings if extra unknown parameters are found
1709
- const {
1710
- error: warrning,
1711
- } = PaymentValidator.initialisePaymentPaymentLink().validate(
2367
+ const { error: warrning } = PaymentValidator.validateVPA().validate(
1712
2368
  { body },
1713
2369
  { abortEarly: false, allowUnknown: false }
1714
2370
  );
1715
2371
  if (warrning) {
1716
- console.log(
1717
- "Parameter Validation warrnings for initialisePaymentPaymentLink"
1718
- );
1719
- console.log(warrning);
2372
+ Logger({
2373
+ level: "WARN",
2374
+ message: "Parameter Validation warrnings for validateVPA",
2375
+ });
2376
+ Logger({ level: "WARN", message: warrning });
1720
2377
  }
1721
2378
 
1722
2379
  const query_params = {};
1723
2380
 
1724
2381
  const xHeaders = {};
1725
2382
 
1726
- return APIClient.execute(
2383
+ const response = await APIClient.execute(
1727
2384
  this._conf,
1728
2385
  "post",
1729
2386
  constructUrl({
1730
- url: this._urls["initialisePaymentPaymentLink"],
2387
+ url: this._urls["validateVPA"],
1731
2388
  params: {},
1732
2389
  }),
1733
2390
  query_params,
1734
2391
  body,
1735
2392
  xHeaders
1736
2393
  );
2394
+
2395
+ const {
2396
+ error: res_error,
2397
+ } = PaymentModel.ValidateVPAResponse().validate(response, {
2398
+ abortEarly: false,
2399
+ allowUnknown: false,
2400
+ });
2401
+
2402
+ if (res_error) {
2403
+ Logger({
2404
+ level: "WARN",
2405
+ message: "Response Validation Warnnings for validateVPA",
2406
+ });
2407
+ Logger({ level: "WARN", message: res_error });
2408
+ }
2409
+
2410
+ return response;
1737
2411
  }
1738
2412
 
1739
2413
  /**
1740
2414
  * @param {Object} arg - Arg object.
1741
- * @param {PaymentStatusUpdateRequest} arg.body
1742
- * @returns {Promise<PaymentStatusUpdateResponse>} - Success response
1743
- * @summary: Performs continuous polling to check status of payment on the server
1744
- * @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
2415
+ * @param {ChargeCustomerRequest} arg.body
2416
+ * @returns {Promise<ChargeCustomerResponse>} - Success response
2417
+ * @summary: Verify and charge payment
2418
+ * @description: Use this API to verify and check the status of a payment transaction (server-to-server) made through aggregators like Simpl and Mswipe.
1745
2419
  */
1746
- checkAndUpdatePaymentStatusPaymentLink({ body } = {}) {
1747
- const {
1748
- error,
1749
- } = PaymentValidator.checkAndUpdatePaymentStatusPaymentLink().validate(
2420
+ async verifyAndChargePayment({ body } = {}) {
2421
+ const { error } = PaymentValidator.verifyAndChargePayment().validate(
1750
2422
  { body },
1751
2423
  { abortEarly: false, allowUnknown: true }
1752
2424
  );
@@ -1757,44 +2429,62 @@ class Payment {
1757
2429
  // Showing warrnings if extra unknown parameters are found
1758
2430
  const {
1759
2431
  error: warrning,
1760
- } = PaymentValidator.checkAndUpdatePaymentStatusPaymentLink().validate(
2432
+ } = PaymentValidator.verifyAndChargePayment().validate(
1761
2433
  { body },
1762
2434
  { abortEarly: false, allowUnknown: false }
1763
2435
  );
1764
2436
  if (warrning) {
1765
- console.log(
1766
- "Parameter Validation warrnings for checkAndUpdatePaymentStatusPaymentLink"
1767
- );
1768
- console.log(warrning);
2437
+ Logger({
2438
+ level: "WARN",
2439
+ message: "Parameter Validation warrnings for verifyAndChargePayment",
2440
+ });
2441
+ Logger({ level: "WARN", message: warrning });
1769
2442
  }
1770
2443
 
1771
2444
  const query_params = {};
1772
2445
 
1773
2446
  const xHeaders = {};
1774
2447
 
1775
- return APIClient.execute(
2448
+ const response = await APIClient.execute(
1776
2449
  this._conf,
1777
2450
  "post",
1778
2451
  constructUrl({
1779
- url: this._urls["checkAndUpdatePaymentStatusPaymentLink"],
2452
+ url: this._urls["verifyAndChargePayment"],
1780
2453
  params: {},
1781
2454
  }),
1782
2455
  query_params,
1783
2456
  body,
1784
2457
  xHeaders
1785
2458
  );
2459
+
2460
+ const {
2461
+ error: res_error,
2462
+ } = PaymentModel.ChargeCustomerResponse().validate(response, {
2463
+ abortEarly: false,
2464
+ allowUnknown: false,
2465
+ });
2466
+
2467
+ if (res_error) {
2468
+ Logger({
2469
+ level: "WARN",
2470
+ message: "Response Validation Warnnings for verifyAndChargePayment",
2471
+ });
2472
+ Logger({ level: "WARN", message: res_error });
2473
+ }
2474
+
2475
+ return response;
1786
2476
  }
1787
2477
 
1788
2478
  /**
1789
2479
  * @param {Object} arg - Arg object.
1790
- * @param {string} [arg.aggregator] -
1791
- * @returns {Promise<CustomerCreditSummaryResponse>} - Success response
1792
- * @summary: API to fetch the customer credit summary
1793
- * @description: Use this API to fetch the customer credit summary.
2480
+ * @param {ValidateCustomerRequest} arg.body
2481
+ * @returns {Promise<ValidateCustomerResponse>} - Success response
2482
+ * @summary: Validate customer for payment
2483
+ * @description: Use this API to check if the customer is eligible to use credit-line facilities such as Simpl Pay Later and Rupifi.
1794
2484
  */
1795
- customerCreditSummary({ aggregator } = {}) {
1796
- const { error } = PaymentValidator.customerCreditSummary().validate(
1797
- { aggregator },
2485
+ async verifyCustomerForPayment({ body } = {}) {
2486
+ const { error } = PaymentValidator.verifyCustomerForPayment().validate(
2487
+ { body },
1798
2488
  { abortEarly: false, allowUnknown: true }
1799
2489
  );
1800
2490
  if (error) {
@@ -1804,46 +2494,63 @@ class Payment {
1804
2494
  // Showing warrnings if extra unknown parameters are found
1805
2495
  const {
1806
2496
  error: warrning,
1807
- } = PaymentValidator.customerCreditSummary().validate(
1808
- { aggregator },
2497
+ } = PaymentValidator.verifyCustomerForPayment().validate(
2498
+ { body },
1809
2499
  { abortEarly: false, allowUnknown: false }
1810
2500
  );
1811
2501
  if (warrning) {
1812
- console.log("Parameter Validation warrnings for customerCreditSummary");
1813
- console.log(warrning);
2502
+ Logger({
2503
+ level: "WARN",
2504
+ message: "Parameter Validation warrnings for verifyCustomerForPayment",
2505
+ });
2506
+ Logger({ level: "WARN", message: warrning });
1814
2507
  }
1815
2508
 
1816
2509
  const query_params = {};
1817
- query_params["aggregator"] = aggregator;
1818
2510
 
1819
2511
  const xHeaders = {};
1820
2512
 
1821
- return APIClient.execute(
2513
+ const response = await APIClient.execute(
1822
2514
  this._conf,
1823
- "get",
2515
+ "post",
1824
2516
  constructUrl({
1825
- url: this._urls["customerCreditSummary"],
2517
+ url: this._urls["verifyCustomerForPayment"],
1826
2518
  params: {},
1827
2519
  }),
1828
2520
  query_params,
1829
- undefined,
2521
+ body,
1830
2522
  xHeaders
1831
2523
  );
2524
+
2525
+ const {
2526
+ error: res_error,
2527
+ } = PaymentModel.ValidateCustomerResponse().validate(response, {
2528
+ abortEarly: false,
2529
+ allowUnknown: false,
2530
+ });
2531
+
2532
+ if (res_error) {
2533
+ Logger({
2534
+ level: "WARN",
2535
+ message: "Response Validation Warnnings for verifyCustomerForPayment",
2536
+ });
2537
+ Logger({ level: "WARN", message: res_error });
2538
+ }
2539
+
2540
+ return response;
1832
2541
  }
1833
2542
 
1834
2543
  /**
1835
2544
  * @param {Object} arg - Arg object.
1836
- * @param {string} [arg.source] - This is a String value that contains
1837
- * callback URL as value.
1838
- * @param {string} [arg.aggregator] - This is a String value that contains
1839
- * aggregator name as value.
1840
- * @returns {Promise<RedirectToAggregatorResponse>} - Success response
1841
- * @summary: API to get the redirect url to redirect the user to aggregator's page
1842
- * @description: Use this API to get the redirect url to redirect the user to aggregator's page
2545
+ * @param {string} [arg.ifscCode] - A 11-digit alphanumeric code that
2546
+ * uniquely identifies a bank branch.
2547
+ * @returns {Promise<IfscCodeResponse>} - Success response
2548
+ * @summary: Verify IFSC Code
2549
+ * @description: Use this API to check whether the 11-digit IFSC code is valid and to fetch the bank details for refund.
1843
2550
  */
1844
- redirectToAggregator({ source, aggregator } = {}) {
1845
- const { error } = PaymentValidator.redirectToAggregator().validate(
1846
- { source, aggregator },
2551
+ async verifyIfscCode({ ifscCode } = {}) {
2552
+ const { error } = PaymentValidator.verifyIfscCode().validate(
2553
+ { ifscCode },
1847
2554
  { abortEarly: false, allowUnknown: true }
1848
2555
  );
1849
2556
  if (error) {
@@ -1851,46 +2558,65 @@ class Payment {
1851
2558
  }
1852
2559
 
1853
2560
  // Showing warrnings if extra unknown parameters are found
1854
- const {
1855
- error: warrning,
1856
- } = PaymentValidator.redirectToAggregator().validate(
1857
- { source, aggregator },
2561
+ const { error: warrning } = PaymentValidator.verifyIfscCode().validate(
2562
+ { ifscCode },
1858
2563
  { abortEarly: false, allowUnknown: false }
1859
2564
  );
1860
2565
  if (warrning) {
1861
- console.log("Parameter Validation warrnings for redirectToAggregator");
1862
- console.log(warrning);
2566
+ Logger({
2567
+ level: "WARN",
2568
+ message: "Parameter Validation warrnings for verifyIfscCode",
2569
+ });
2570
+ Logger({ level: "WARN", message: warrning });
1863
2571
  }
1864
2572
 
1865
2573
  const query_params = {};
1866
- query_params["source"] = source;
1867
- query_params["aggregator"] = aggregator;
2574
+ query_params["ifsc_code"] = ifscCode;
1868
2575
 
1869
2576
  const xHeaders = {};
1870
2577
 
1871
- return APIClient.execute(
2578
+ const response = await APIClient.execute(
1872
2579
  this._conf,
1873
2580
  "get",
1874
2581
  constructUrl({
1875
- url: this._urls["redirectToAggregator"],
2582
+ url: this._urls["verifyIfscCode"],
1876
2583
  params: {},
1877
2584
  }),
1878
2585
  query_params,
1879
2586
  undefined,
1880
2587
  xHeaders
1881
2588
  );
2589
+
2590
+ const {
2591
+ error: res_error,
2592
+ } = PaymentModel.IfscCodeResponse().validate(response, {
2593
+ abortEarly: false,
2594
+ allowUnknown: false,
2595
+ });
2596
+
2597
+ if (res_error) {
2598
+ Logger({
2599
+ level: "WARN",
2600
+ message: "Response Validation Warnnings for verifyIfscCode",
2601
+ });
2602
+ Logger({ level: "WARN", message: res_error });
2603
+ }
2604
+
2605
+ return response;
1882
2606
  }
1883
2607
 
1884
2608
  /**
1885
2609
  * @param {Object} arg - Arg object.
1886
- * @param {string} [arg.aggregator] -
1887
- * @returns {Promise<CheckCreditResponse>} - Success response
1888
- * @summary: API to fetch the customer credit summary
1889
- * @description: Use this API to fetch the customer credit summary.
2610
+ * @param {AddBeneficiaryViaOtpVerificationRequest} arg.body
2611
+ * @returns {Promise<AddBeneficiaryViaOtpVerificationResponse>} - Success response
2612
+ * @summary: Verify the beneficiary details using OTP
2613
+ * @description: Use this API to perform an OTP validation before saving the beneficiary details added for a refund.
1890
2614
  */
1891
- checkCredit({ aggregator } = {}) {
1892
- const { error } = PaymentValidator.checkCredit().validate(
1893
- { aggregator },
2615
+ async verifyOtpAndAddBeneficiaryForBank({ body } = {}) {
2616
+ const {
2617
+ error,
2618
+ } = PaymentValidator.verifyOtpAndAddBeneficiaryForBank().validate(
2619
+ { body },
1894
2620
  { abortEarly: false, allowUnknown: true }
1895
2621
  );
1896
2622
  if (error) {
@@ -1898,42 +2624,67 @@ class Payment {
1898
2624
  }
1899
2625
 
1900
2626
  // Showing warrnings if extra unknown parameters are found
1901
- const { error: warrning } = PaymentValidator.checkCredit().validate(
1902
- { aggregator },
2627
+ const {
2628
+ error: warrning,
2629
+ } = PaymentValidator.verifyOtpAndAddBeneficiaryForBank().validate(
2630
+ { body },
1903
2631
  { abortEarly: false, allowUnknown: false }
1904
2632
  );
1905
2633
  if (warrning) {
1906
- console.log("Parameter Validation warrnings for checkCredit");
1907
- console.log(warrning);
2634
+ Logger({
2635
+ level: "WARN",
2636
+ message:
2637
+ "Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForBank",
2638
+ });
2639
+ Logger({ level: "WARN", message: warrning });
1908
2640
  }
1909
2641
 
1910
2642
  const query_params = {};
1911
- query_params["aggregator"] = aggregator;
1912
2643
 
1913
2644
  const xHeaders = {};
1914
2645
 
1915
- return APIClient.execute(
2646
+ const response = await APIClient.execute(
1916
2647
  this._conf,
1917
- "get",
2648
+ "post",
1918
2649
  constructUrl({
1919
- url: this._urls["checkCredit"],
2650
+ url: this._urls["verifyOtpAndAddBeneficiaryForBank"],
1920
2651
  params: {},
1921
2652
  }),
1922
2653
  query_params,
1923
- undefined,
2654
+ body,
1924
2655
  xHeaders
1925
2656
  );
2657
+
2658
+ const {
2659
+ error: res_error,
2660
+ } = PaymentModel.AddBeneficiaryViaOtpVerificationResponse().validate(
2661
+ response,
2662
+ { abortEarly: false, allowUnknown: false }
2663
+ );
2664
+
2665
+ if (res_error) {
2666
+ Logger({
2667
+ level: "WARN",
2668
+ message:
2669
+ "Response Validation Warnnings for verifyOtpAndAddBeneficiaryForBank",
2670
+ });
2671
+ Logger({ level: "WARN", message: res_error });
2672
+ }
2673
+
2674
+ return response;
1926
2675
  }
1927
2676
 
1928
2677
  /**
1929
2678
  * @param {Object} arg - Arg object.
1930
- * @param {CustomerOnboardingRequest} arg.body
1931
- * @returns {Promise<CustomerOnboardingResponse>} - Success response
1932
- * @summary: API to fetch the customer credit summary
1933
- * @description: Use this API to fetch the customer credit summary.
2679
+ * @param {WalletOtpRequest} arg.body
2680
+ * @returns {Promise<WalletOtpResponse>} - Success response
2681
+ * @summary: Send OTP on adding a wallet beneficiary
2682
+ * @description: Use this API to send an OTP while adding a wallet beneficiary by mobile no. verification.
1934
2683
  */
1935
- customerOnboard({ body } = {}) {
1936
- const { error } = PaymentValidator.customerOnboard().validate(
2684
+ async verifyOtpAndAddBeneficiaryForWallet({ body } = {}) {
2685
+ const {
2686
+ error,
2687
+ } = PaymentValidator.verifyOtpAndAddBeneficiaryForWallet().validate(
1937
2688
  { body },
1938
2689
  { abortEarly: false, allowUnknown: true }
1939
2690
  );
@@ -1942,30 +2693,54 @@ class Payment {
1942
2693
  }
1943
2694
 
1944
2695
  // Showing warrnings if extra unknown parameters are found
1945
- const { error: warrning } = PaymentValidator.customerOnboard().validate(
2696
+ const {
2697
+ error: warrning,
2698
+ } = PaymentValidator.verifyOtpAndAddBeneficiaryForWallet().validate(
1946
2699
  { body },
1947
2700
  { abortEarly: false, allowUnknown: false }
1948
2701
  );
1949
2702
  if (warrning) {
1950
- console.log("Parameter Validation warrnings for customerOnboard");
1951
- console.log(warrning);
2703
+ Logger({
2704
+ level: "WARN",
2705
+ message:
2706
+ "Parameter Validation warrnings for verifyOtpAndAddBeneficiaryForWallet",
2707
+ });
2708
+ Logger({ level: "WARN", message: warrning });
1952
2709
  }
1953
2710
 
1954
2711
  const query_params = {};
1955
2712
 
1956
2713
  const xHeaders = {};
1957
2714
 
1958
- return APIClient.execute(
2715
+ const response = await APIClient.execute(
1959
2716
  this._conf,
1960
2717
  "post",
1961
2718
  constructUrl({
1962
- url: this._urls["customerOnboard"],
2719
+ url: this._urls["verifyOtpAndAddBeneficiaryForWallet"],
1963
2720
  params: {},
1964
2721
  }),
1965
2722
  query_params,
1966
2723
  body,
1967
2724
  xHeaders
1968
2725
  );
2726
+
2727
+ const {
2728
+ error: res_error,
2729
+ } = PaymentModel.WalletOtpResponse().validate(response, {
2730
+ abortEarly: false,
2731
+ allowUnknown: false,
2732
+ });
2733
+
2734
+ if (res_error) {
2735
+ Logger({
2736
+ level: "WARN",
2737
+ message:
2738
+ "Response Validation Warnnings for verifyOtpAndAddBeneficiaryForWallet",
2739
+ });
2740
+ Logger({ level: "WARN", message: res_error });
2741
+ }
2742
+
2743
+ return response;
1969
2744
  }
1970
2745
  }
1971
2746