@gofynd/fdk-client-javascript 0.1.35

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 (277) hide show
  1. package/.github/workflows/on_create_release.yml +23 -0
  2. package/.github/workflows/on_merge_main.yml +38 -0
  3. package/.github/workflows/on_pull_request.yml +35 -0
  4. package/.prettierrc +5 -0
  5. package/LICENSE +21 -0
  6. package/README.md +118 -0
  7. package/application.d.ts +3 -0
  8. package/application.js +6 -0
  9. package/common.d.ts +4 -0
  10. package/common.js +9 -0
  11. package/documentation/application/CART.md +7290 -0
  12. package/documentation/application/CATALOG.md +9570 -0
  13. package/documentation/application/COMMON.md +448 -0
  14. package/documentation/application/COMMUNICATION.md +463 -0
  15. package/documentation/application/CONFIGURATION.md +2902 -0
  16. package/documentation/application/CONTENT.md +3350 -0
  17. package/documentation/application/FILESTORAGE.md +491 -0
  18. package/documentation/application/LEAD.md +1891 -0
  19. package/documentation/application/LOGISTIC.md +439 -0
  20. package/documentation/application/ORDER.md +3428 -0
  21. package/documentation/application/PAYMENT.md +5035 -0
  22. package/documentation/application/POSCART.md +7889 -0
  23. package/documentation/application/README.md +21 -0
  24. package/documentation/application/REWARDS.md +714 -0
  25. package/documentation/application/SHARE.md +729 -0
  26. package/documentation/application/THEME.md +5796 -0
  27. package/documentation/application/USER.md +4326 -0
  28. package/documentation/platform/ANALYTICS.md +1150 -0
  29. package/documentation/platform/AUDITTRAIL.md +572 -0
  30. package/documentation/platform/BILLING.md +2396 -0
  31. package/documentation/platform/CART.md +5539 -0
  32. package/documentation/platform/CATALOG.md +21624 -0
  33. package/documentation/platform/COMMON.md +448 -0
  34. package/documentation/platform/COMMUNICATION.md +5714 -0
  35. package/documentation/platform/COMPANYPROFILE.md +2141 -0
  36. package/documentation/platform/CONFIGURATION.md +7335 -0
  37. package/documentation/platform/CONTENT.md +8989 -0
  38. package/documentation/platform/DISCOUNT.md +773 -0
  39. package/documentation/platform/FILESTORAGE.md +994 -0
  40. package/documentation/platform/INVENTORY.md +1775 -0
  41. package/documentation/platform/LEAD.md +4736 -0
  42. package/documentation/platform/ORDER.md +3764 -0
  43. package/documentation/platform/PARTNER.md +216 -0
  44. package/documentation/platform/PAYMENT.md +3444 -0
  45. package/documentation/platform/README.md +27 -0
  46. package/documentation/platform/REWARDS.md +871 -0
  47. package/documentation/platform/SHARE.md +602 -0
  48. package/documentation/platform/THEME.md +35725 -0
  49. package/documentation/platform/USER.md +2305 -0
  50. package/documentation/platform/WEBHOOK.md +587 -0
  51. package/documentation/public/CONFIGURATION.md +448 -0
  52. package/documentation/public/INVENTORY.md +686 -0
  53. package/documentation/public/WEBHOOK.md +348 -0
  54. package/index.d.ts +10 -0
  55. package/index.js +18 -0
  56. package/jest.config.d.ts +4 -0
  57. package/jest.config.js +6 -0
  58. package/package.json +35 -0
  59. package/platform.d.ts +3 -0
  60. package/platform.js +6 -0
  61. package/public.d.ts +3 -0
  62. package/public.js +6 -0
  63. package/sdk/application/ApplicationAPIClient.d.ts +11 -0
  64. package/sdk/application/ApplicationAPIClient.js +44 -0
  65. package/sdk/application/ApplicationClient.d.ts +40 -0
  66. package/sdk/application/ApplicationClient.js +84 -0
  67. package/sdk/application/ApplicationConfig.d.ts +19 -0
  68. package/sdk/application/ApplicationConfig.js +55 -0
  69. package/sdk/application/ApplicationModels.d.ts +826 -0
  70. package/sdk/application/ApplicationModels.js +10474 -0
  71. package/sdk/application/client/CartApplicationClient.d.ts +432 -0
  72. package/sdk/application/client/CartApplicationClient.js +1066 -0
  73. package/sdk/application/client/CatalogApplicationClient.d.ts +694 -0
  74. package/sdk/application/client/CatalogApplicationClient.js +1629 -0
  75. package/sdk/application/client/CommonApplicationClient.d.ts +38 -0
  76. package/sdk/application/client/CommonApplicationClient.js +105 -0
  77. package/sdk/application/client/CommunicationApplicationClient.d.ts +39 -0
  78. package/sdk/application/client/CommunicationApplicationClient.js +131 -0
  79. package/sdk/application/client/ConfigurationApplicationClient.d.ts +210 -0
  80. package/sdk/application/client/ConfigurationApplicationClient.js +649 -0
  81. package/sdk/application/client/ContentApplicationClient.d.ts +256 -0
  82. package/sdk/application/client/ContentApplicationClient.js +785 -0
  83. package/sdk/application/client/FileStorageApplicationClient.d.ts +88 -0
  84. package/sdk/application/client/FileStorageApplicationClient.js +214 -0
  85. package/sdk/application/client/LeadApplicationClient.d.ts +90 -0
  86. package/sdk/application/client/LeadApplicationClient.js +264 -0
  87. package/sdk/application/client/LogisticApplicationClient.d.ts +42 -0
  88. package/sdk/application/client/LogisticApplicationClient.js +128 -0
  89. package/sdk/application/client/OrderApplicationClient.d.ts +190 -0
  90. package/sdk/application/client/OrderApplicationClient.js +479 -0
  91. package/sdk/application/client/PaymentApplicationClient.d.ts +454 -0
  92. package/sdk/application/client/PaymentApplicationClient.js +1378 -0
  93. package/sdk/application/client/PosCartApplicationClient.d.ts +449 -0
  94. package/sdk/application/client/PosCartApplicationClient.js +1123 -0
  95. package/sdk/application/client/RewardsApplicationClient.d.ts +93 -0
  96. package/sdk/application/client/RewardsApplicationClient.js +293 -0
  97. package/sdk/application/client/ShareApplicationClient.d.ts +87 -0
  98. package/sdk/application/client/ShareApplicationClient.js +268 -0
  99. package/sdk/application/client/ThemeApplicationClient.d.ts +52 -0
  100. package/sdk/application/client/ThemeApplicationClient.js +161 -0
  101. package/sdk/application/client/UserApplicationClient.d.ts +446 -0
  102. package/sdk/application/client/UserApplicationClient.js +1275 -0
  103. package/sdk/application/constructUrl.d.ts +5 -0
  104. package/sdk/application/constructUrl.js +13 -0
  105. package/sdk/application/index.d.ts +2 -0
  106. package/sdk/application/index.js +4 -0
  107. package/sdk/application/models/CartValidator.d.ts +29 -0
  108. package/sdk/application/models/CartValidator.js +223 -0
  109. package/sdk/application/models/CatalogValidator.d.ts +33 -0
  110. package/sdk/application/models/CatalogValidator.js +233 -0
  111. package/sdk/application/models/CommonValidator.d.ts +5 -0
  112. package/sdk/application/models/CommonValidator.js +18 -0
  113. package/sdk/application/models/CommunicationValidator.d.ts +6 -0
  114. package/sdk/application/models/CommunicationValidator.js +20 -0
  115. package/sdk/application/models/ConfigurationValidator.d.ts +19 -0
  116. package/sdk/application/models/ConfigurationValidator.js +88 -0
  117. package/sdk/application/models/ContentValidator.d.ts +22 -0
  118. package/sdk/application/models/ContentValidator.js +106 -0
  119. package/sdk/application/models/FileStorageValidator.d.ts +6 -0
  120. package/sdk/application/models/FileStorageValidator.js +24 -0
  121. package/sdk/application/models/LeadValidator.d.ts +10 -0
  122. package/sdk/application/models/LeadValidator.js +48 -0
  123. package/sdk/application/models/LogisticValidator.d.ts +6 -0
  124. package/sdk/application/models/LogisticValidator.js +22 -0
  125. package/sdk/application/models/OrderValidator.d.ts +15 -0
  126. package/sdk/application/models/OrderValidator.js +87 -0
  127. package/sdk/application/models/PaymentValidator.d.ts +40 -0
  128. package/sdk/application/models/PaymentValidator.js +235 -0
  129. package/sdk/application/models/PosCartValidator.d.ts +30 -0
  130. package/sdk/application/models/PosCartValidator.js +232 -0
  131. package/sdk/application/models/RewardsValidator.d.ts +10 -0
  132. package/sdk/application/models/RewardsValidator.js +43 -0
  133. package/sdk/application/models/ShareValidator.d.ts +10 -0
  134. package/sdk/application/models/ShareValidator.js +44 -0
  135. package/sdk/application/models/ThemeValidator.d.ts +7 -0
  136. package/sdk/application/models/ThemeValidator.js +27 -0
  137. package/sdk/application/models/UserValidator.d.ts +38 -0
  138. package/sdk/application/models/UserValidator.js +233 -0
  139. package/sdk/common/AxiosHelper.d.ts +1 -0
  140. package/sdk/common/AxiosHelper.js +141 -0
  141. package/sdk/common/Constant.d.ts +294 -0
  142. package/sdk/common/Constant.js +332 -0
  143. package/sdk/common/FDKError.d.ts +26 -0
  144. package/sdk/common/FDKError.js +51 -0
  145. package/sdk/common/Logger.d.ts +2 -0
  146. package/sdk/common/Logger.js +85 -0
  147. package/sdk/common/Paginator.d.ts +16 -0
  148. package/sdk/common/Paginator.js +26 -0
  149. package/sdk/common/RequestSigner.d.ts +1 -0
  150. package/sdk/common/RequestSigner.js +306 -0
  151. package/sdk/common/Utility.d.ts +9 -0
  152. package/sdk/common/Utility.js +86 -0
  153. package/sdk/common/utils.d.ts +14 -0
  154. package/sdk/common/utils.js +165 -0
  155. package/sdk/platform/OAuthClient.d.ts +26 -0
  156. package/sdk/platform/OAuthClient.js +221 -0
  157. package/sdk/platform/PlatformAPIClient.d.ts +12 -0
  158. package/sdk/platform/PlatformAPIClient.js +43 -0
  159. package/sdk/platform/PlatformApplicationClient.d.ts +24398 -0
  160. package/sdk/platform/PlatformApplicationClient.js +23185 -0
  161. package/sdk/platform/PlatformApplicationModels.d.ts +333 -0
  162. package/sdk/platform/PlatformApplicationModels.js +21262 -0
  163. package/sdk/platform/PlatformClient.d.ts +9535 -0
  164. package/sdk/platform/PlatformClient.js +12336 -0
  165. package/sdk/platform/PlatformConfig.d.ts +29 -0
  166. package/sdk/platform/PlatformConfig.js +36 -0
  167. package/sdk/platform/PlatformModels.d.ts +1396 -0
  168. package/sdk/platform/PlatformModels.js +19222 -0
  169. package/sdk/platform/client/AnalyticsPlatformClient.d.ts +84 -0
  170. package/sdk/platform/client/AnalyticsPlatformClient.js +215 -0
  171. package/sdk/platform/client/AuditTrailPlatformClient.d.ts +38 -0
  172. package/sdk/platform/client/AuditTrailPlatformClient.js +133 -0
  173. package/sdk/platform/client/BillingPlatformClient.d.ts +109 -0
  174. package/sdk/platform/client/BillingPlatformClient.js +381 -0
  175. package/sdk/platform/client/CatalogPlatformClient.d.ts +806 -0
  176. package/sdk/platform/client/CatalogPlatformClient.js +2462 -0
  177. package/sdk/platform/client/CommonPlatformClient.d.ts +30 -0
  178. package/sdk/platform/client/CommonPlatformClient.js +84 -0
  179. package/sdk/platform/client/CommunicationPlatformClient.d.ts +26 -0
  180. package/sdk/platform/client/CommunicationPlatformClient.js +72 -0
  181. package/sdk/platform/client/CompanyProfilePlatformClient.d.ts +182 -0
  182. package/sdk/platform/client/CompanyProfilePlatformClient.js +540 -0
  183. package/sdk/platform/client/ConfigurationPlatformClient.d.ts +277 -0
  184. package/sdk/platform/client/ConfigurationPlatformClient.js +806 -0
  185. package/sdk/platform/client/DiscountPlatformClient.d.ts +118 -0
  186. package/sdk/platform/client/DiscountPlatformClient.js +364 -0
  187. package/sdk/platform/client/FileStoragePlatformClient.d.ts +111 -0
  188. package/sdk/platform/client/FileStoragePlatformClient.js +268 -0
  189. package/sdk/platform/client/InventoryPlatformClient.d.ts +125 -0
  190. package/sdk/platform/client/InventoryPlatformClient.js +409 -0
  191. package/sdk/platform/client/LeadPlatformClient.d.ts +150 -0
  192. package/sdk/platform/client/LeadPlatformClient.js +439 -0
  193. package/sdk/platform/client/OrderPlatformClient.d.ts +190 -0
  194. package/sdk/platform/client/OrderPlatformClient.js +521 -0
  195. package/sdk/platform/client/PaymentPlatformClient.d.ts +98 -0
  196. package/sdk/platform/client/PaymentPlatformClient.js +331 -0
  197. package/sdk/platform/client/WebhookPlatformClient.d.ts +64 -0
  198. package/sdk/platform/client/WebhookPlatformClient.js +207 -0
  199. package/sdk/platform/index.d.ts +2 -0
  200. package/sdk/platform/index.js +4 -0
  201. package/sdk/platform/models/AnalyticsValidator.d.ts +7 -0
  202. package/sdk/platform/models/AnalyticsValidator.js +36 -0
  203. package/sdk/platform/models/AuditTrailValidator.d.ts +7 -0
  204. package/sdk/platform/models/AuditTrailValidator.js +26 -0
  205. package/sdk/platform/models/BillingValidator.d.ts +15 -0
  206. package/sdk/platform/models/BillingValidator.js +72 -0
  207. package/sdk/platform/models/CartValidator.d.ts +0 -0
  208. package/sdk/platform/models/CartValidator.js +0 -0
  209. package/sdk/platform/models/CatalogValidator.d.ts +74 -0
  210. package/sdk/platform/models/CatalogValidator.js +484 -0
  211. package/sdk/platform/models/CommonValidator.d.ts +5 -0
  212. package/sdk/platform/models/CommonValidator.js +18 -0
  213. package/sdk/platform/models/CommunicationValidator.d.ts +4 -0
  214. package/sdk/platform/models/CommunicationValidator.js +11 -0
  215. package/sdk/platform/models/CompanyProfileValidator.d.ts +17 -0
  216. package/sdk/platform/models/CompanyProfileValidator.js +93 -0
  217. package/sdk/platform/models/ConfigurationValidator.d.ts +21 -0
  218. package/sdk/platform/models/ConfigurationValidator.js +134 -0
  219. package/sdk/platform/models/ContentValidator.d.ts +0 -0
  220. package/sdk/platform/models/ContentValidator.js +0 -0
  221. package/sdk/platform/models/DiscountValidator.d.ts +13 -0
  222. package/sdk/platform/models/DiscountValidator.js +75 -0
  223. package/sdk/platform/models/FileStorageValidator.d.ts +9 -0
  224. package/sdk/platform/models/FileStorageValidator.js +44 -0
  225. package/sdk/platform/models/InventoryValidator.d.ts +15 -0
  226. package/sdk/platform/models/InventoryValidator.js +81 -0
  227. package/sdk/platform/models/LeadValidator.d.ts +14 -0
  228. package/sdk/platform/models/LeadValidator.js +78 -0
  229. package/sdk/platform/models/OrderValidator.d.ts +14 -0
  230. package/sdk/platform/models/OrderValidator.js +110 -0
  231. package/sdk/platform/models/PartnerValidator.d.ts +0 -0
  232. package/sdk/platform/models/PartnerValidator.js +0 -0
  233. package/sdk/platform/models/PaymentValidator.d.ts +13 -0
  234. package/sdk/platform/models/PaymentValidator.js +65 -0
  235. package/sdk/platform/models/RewardsValidator.d.ts +0 -0
  236. package/sdk/platform/models/RewardsValidator.js +0 -0
  237. package/sdk/platform/models/ShareValidator.d.ts +0 -0
  238. package/sdk/platform/models/ShareValidator.js +0 -0
  239. package/sdk/platform/models/ThemeValidator.d.ts +0 -0
  240. package/sdk/platform/models/ThemeValidator.js +0 -0
  241. package/sdk/platform/models/UserValidator.d.ts +0 -0
  242. package/sdk/platform/models/UserValidator.js +0 -0
  243. package/sdk/platform/models/WebhookValidator.d.ts +9 -0
  244. package/sdk/platform/models/WebhookValidator.js +42 -0
  245. package/sdk/public/PublicAPIClient.d.ts +11 -0
  246. package/sdk/public/PublicAPIClient.js +38 -0
  247. package/sdk/public/PublicClient.d.ts +12 -0
  248. package/sdk/public/PublicClient.js +24 -0
  249. package/sdk/public/PublicConfig.d.ts +10 -0
  250. package/sdk/public/PublicConfig.js +12 -0
  251. package/sdk/public/PublicModels.d.ts +50 -0
  252. package/sdk/public/PublicModels.js +712 -0
  253. package/sdk/public/client/ConfigurationPublicClient.d.ts +38 -0
  254. package/sdk/public/client/ConfigurationPublicClient.js +102 -0
  255. package/sdk/public/client/InventoryPublicClient.d.ts +81 -0
  256. package/sdk/public/client/InventoryPublicClient.js +239 -0
  257. package/sdk/public/client/WebhookPublicClient.d.ts +28 -0
  258. package/sdk/public/client/WebhookPublicClient.js +92 -0
  259. package/sdk/public/constructUrl.d.ts +5 -0
  260. package/sdk/public/constructUrl.js +13 -0
  261. package/sdk/public/index.d.ts +2 -0
  262. package/sdk/public/index.js +4 -0
  263. package/sdk/public/models/ConfigurationValidator.d.ts +5 -0
  264. package/sdk/public/models/ConfigurationValidator.js +18 -0
  265. package/sdk/public/models/InventoryValidator.d.ts +9 -0
  266. package/sdk/public/models/InventoryValidator.js +43 -0
  267. package/sdk/public/models/WebhookValidator.d.ts +5 -0
  268. package/sdk/public/models/WebhookValidator.js +14 -0
  269. package/tests/application/catalog.spec.js +47 -0
  270. package/tests/common/action-url.spec.js +35 -0
  271. package/tests/common/schema/action-url.json +163 -0
  272. package/tests/common/schema/url-action.json +667 -0
  273. package/tests/common/url-action.spec.js +48 -0
  274. package/tests/helpers/cookie.helper.js +31 -0
  275. package/tests/helpers/oauth.helper.js +43 -0
  276. package/tests/platform/catalog.spec.js +49 -0
  277. package/tests/public/location.spec.js +39 -0
@@ -0,0 +1,1378 @@
1
+ const APIClient = require("../ApplicationAPIClient");
2
+ const Paginator = require("../../common/Paginator");
3
+ const constructUrl = require("../constructUrl");
4
+ const { FDKClientValidationError } = require("../../common/FDKError");
5
+ const PaymentValidator = require("../models/PaymentValidator");
6
+
7
+ class Payment {
8
+ constructor(_conf) {
9
+ this._conf = _conf;
10
+ this._relativeUrls = {
11
+ getAggregatorsConfig:
12
+ "/service/application/payment/v1.0/config/aggregators/key",
13
+ attachCardToCustomer: "/service/application/payment/v1.0/card/attach",
14
+ getActiveCardAggregator:
15
+ "/service/application/payment/v1.0/card/aggregator",
16
+ 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",
25
+ getPaymentModeRoutes: "/service/application/payment/v1.0/payment/options",
26
+ getPosPaymentModeRoutes:
27
+ "/service/application/payment/v1.0/payment/options/pos",
28
+ getRupifiBannerDetails: "/service/application/payment/v1.0/rupifi/banner",
29
+ getEpaylaterBannerDetails:
30
+ "/service/application/payment/v1.0/epaylater/banner",
31
+ resendOrCancelPayment:
32
+ "/service/application/payment/v1.0/payment/resend_or_cancel",
33
+ getActiveRefundTransferModes:
34
+ "/service/application/payment/v1.0/refund/transfer-mode",
35
+ enableOrDisableRefundTransferMode:
36
+ "/service/application/payment/v1.0/refund/transfer-mode",
37
+ getUserBeneficiariesDetail:
38
+ "/service/application/payment/v1.0/refund/user/beneficiary",
39
+ verifyIfscCode: "/service/application/payment/v1.0/ifsc-code/verify",
40
+ getOrderBeneficiariesDetail:
41
+ "/service/application/payment/v1.0/refund/order/beneficiaries",
42
+ verifyOtpAndAddBeneficiaryForBank:
43
+ "/service/application/payment/v1.0/refund/verification/bank",
44
+ addBeneficiaryDetails: "/service/application/payment/v1.0/refund/account",
45
+ addRefundBankAccountUsingOTP:
46
+ "/service/application/payment/v1.0/refund/account/otp",
47
+ verifyOtpAndAddBeneficiaryForWallet:
48
+ "/service/application/payment/v1.0/refund/verification/wallet",
49
+ updateDefaultBeneficiary:
50
+ "/service/application/payment/v1.0/refund/beneficiary/default",
51
+ getPaymentLink: "/service/application/payment/v1.0/create-payment-link/",
52
+ createPaymentLink:
53
+ "/service/application/payment/v1.0/create-payment-link/",
54
+ resendPaymentLink:
55
+ "/service/application/payment/v1.0/resend-payment-link/",
56
+ cancelPaymentLink:
57
+ "/service/application/payment/v1.0/cancel-payment-link/",
58
+ getPaymentModeRoutesPaymentLink:
59
+ "/service/application/payment/v1.0/payment/options/link/",
60
+ pollingPaymentLink:
61
+ "/service/application/payment/v1.0/polling-payment-link/",
62
+ createOrderHandlerPaymentLink:
63
+ "/service/application/payment/v1.0/create-order/link/",
64
+ initialisePaymentPaymentLink:
65
+ "/service/application/payment/v1.0/payment/request/link/",
66
+ checkAndUpdatePaymentStatusPaymentLink:
67
+ "/service/application/payment/v1.0/payment/confirm/polling/link/",
68
+ customerCreditSummary:
69
+ "/service/application/payment/v1.0/payment/credit-summary/",
70
+ redirectToAggregator:
71
+ "/service/application/payment/v1.0/payment/redirect-to-aggregator/",
72
+ checkCredit: "/service/application/payment/v1.0/check-credits/",
73
+ customerOnboard: "/service/application/payment/v1.0/credit-onboard/",
74
+ };
75
+ this._urls = Object.entries(this._relativeUrls).reduce(
76
+ (urls, [method, relativeUrl]) => {
77
+ urls[method] = `${_conf.domain}${relativeUrl}`;
78
+ return urls;
79
+ },
80
+ {}
81
+ );
82
+ }
83
+
84
+ updateUrls(urls) {
85
+ this._urls = {
86
+ ...this._urls,
87
+ ...urls,
88
+ };
89
+ }
90
+
91
+ /**
92
+ * @param {Object} arg - Arg object.
93
+ * @param {string} [arg.xApiToken] - Used for basic authentication.
94
+ * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
95
+ * to remove temporary cache files on payment gateway and replace with the
96
+ * latest one.
97
+ * @returns {Promise<AggregatorsConfigDetailResponse>} - Success response
98
+ * @summary: Get payment gateway keys
99
+ * @description: Use this API to retrieve the payment gateway key, secrets, merchant, SDK/API details to complete a payment at front-end.
100
+ */
101
+ getAggregatorsConfig({ xApiToken, refresh } = {}) {
102
+ const { error } = PaymentValidator.getAggregatorsConfig().validate(
103
+ { xApiToken, refresh },
104
+ { abortEarly: false, allowUnknown: true }
105
+ );
106
+ if (error) {
107
+ return Promise.reject(new FDKClientValidationError(error));
108
+ }
109
+ const query_params = {};
110
+ query_params["refresh"] = refresh;
111
+
112
+ const xHeaders = {};
113
+ xHeaders["x-api-token"] = xApiToken;
114
+
115
+ return APIClient.execute(
116
+ this._conf,
117
+ "get",
118
+ constructUrl({
119
+ url: this._urls["getAggregatorsConfig"],
120
+ params: {},
121
+ }),
122
+ query_params,
123
+ undefined,
124
+ xHeaders
125
+ );
126
+ }
127
+
128
+ /**
129
+ * @param {Object} arg - Arg object.
130
+ * @param {AttachCardRequest} arg.body
131
+ * @returns {Promise<AttachCardsResponse>} - Success response
132
+ * @summary: Attach a saved card to customer.
133
+ * @description: Use this API to attach a customer's saved card at the payment gateway, such as Stripe, Juspay.
134
+ */
135
+ attachCardToCustomer({ body } = {}) {
136
+ const { error } = PaymentValidator.attachCardToCustomer().validate(
137
+ { body },
138
+ { abortEarly: false, allowUnknown: true }
139
+ );
140
+ if (error) {
141
+ return Promise.reject(new FDKClientValidationError(error));
142
+ }
143
+ const query_params = {};
144
+
145
+ const xHeaders = {};
146
+
147
+ return APIClient.execute(
148
+ this._conf,
149
+ "post",
150
+ constructUrl({
151
+ url: this._urls["attachCardToCustomer"],
152
+ params: {},
153
+ }),
154
+ query_params,
155
+ body,
156
+ xHeaders
157
+ );
158
+ }
159
+
160
+ /**
161
+ * @param {Object} arg - Arg object.
162
+ * @param {boolean} [arg.refresh] -
163
+ * @returns {Promise<ActiveCardPaymentGatewayResponse>} - Success response
164
+ * @summary: Fetch active payment gateway for card payments
165
+ * @description: Use this API to retrieve an active payment aggregator along with the Customer ID. This is applicable for cards payments only.
166
+ */
167
+ getActiveCardAggregator({ refresh } = {}) {
168
+ const { error } = PaymentValidator.getActiveCardAggregator().validate(
169
+ { refresh },
170
+ { abortEarly: false, allowUnknown: true }
171
+ );
172
+ if (error) {
173
+ return Promise.reject(new FDKClientValidationError(error));
174
+ }
175
+ const query_params = {};
176
+ query_params["refresh"] = refresh;
177
+
178
+ const xHeaders = {};
179
+
180
+ return APIClient.execute(
181
+ this._conf,
182
+ "get",
183
+ constructUrl({
184
+ url: this._urls["getActiveCardAggregator"],
185
+ params: {},
186
+ }),
187
+ query_params,
188
+ undefined,
189
+ xHeaders
190
+ );
191
+ }
192
+
193
+ /**
194
+ * @param {Object} arg - Arg object.
195
+ * @param {boolean} [arg.forceRefresh] -
196
+ * @returns {Promise<ListCardsResponse>} - Success response
197
+ * @summary: Fetch the list of cards saved by the user
198
+ * @description: Use this API to retrieve a list of cards stored by user from an active payment gateway.
199
+ */
200
+ getActiveUserCards({ forceRefresh } = {}) {
201
+ const { error } = PaymentValidator.getActiveUserCards().validate(
202
+ { forceRefresh },
203
+ { abortEarly: false, allowUnknown: true }
204
+ );
205
+ if (error) {
206
+ return Promise.reject(new FDKClientValidationError(error));
207
+ }
208
+ const query_params = {};
209
+ query_params["force_refresh"] = forceRefresh;
210
+
211
+ const xHeaders = {};
212
+
213
+ return APIClient.execute(
214
+ this._conf,
215
+ "get",
216
+ constructUrl({
217
+ url: this._urls["getActiveUserCards"],
218
+ params: {},
219
+ }),
220
+ query_params,
221
+ undefined,
222
+ xHeaders
223
+ );
224
+ }
225
+
226
+ /**
227
+ * @param {Object} arg - Arg object.
228
+ * @param {DeletehCardRequest} arg.body
229
+ * @returns {Promise<DeleteCardsResponse>} - Success response
230
+ * @summary: Delete a card
231
+ * @description: Use this API to delete a card added by a user on the payment gateway and clear the cache.
232
+ */
233
+ deleteUserCard({ body } = {}) {
234
+ const { error } = PaymentValidator.deleteUserCard().validate(
235
+ { body },
236
+ { abortEarly: false, allowUnknown: true }
237
+ );
238
+ if (error) {
239
+ return Promise.reject(new FDKClientValidationError(error));
240
+ }
241
+ const query_params = {};
242
+
243
+ const xHeaders = {};
244
+
245
+ return APIClient.execute(
246
+ this._conf,
247
+ "post",
248
+ constructUrl({
249
+ url: this._urls["deleteUserCard"],
250
+ params: {},
251
+ }),
252
+ query_params,
253
+ body,
254
+ xHeaders
255
+ );
256
+ }
257
+
258
+ /**
259
+ * @param {Object} arg - Arg object.
260
+ * @param {ValidateCustomerRequest} arg.body
261
+ * @returns {Promise<ValidateCustomerResponse>} - Success response
262
+ * @summary: Validate customer for payment
263
+ * @description: Use this API to check if the customer is eligible to use credit-line facilities such as Simpl Pay Later and Rupifi.
264
+ */
265
+ verifyCustomerForPayment({ body } = {}) {
266
+ const { error } = PaymentValidator.verifyCustomerForPayment().validate(
267
+ { body },
268
+ { abortEarly: false, allowUnknown: true }
269
+ );
270
+ if (error) {
271
+ return Promise.reject(new FDKClientValidationError(error));
272
+ }
273
+ const query_params = {};
274
+
275
+ const xHeaders = {};
276
+
277
+ return APIClient.execute(
278
+ this._conf,
279
+ "post",
280
+ constructUrl({
281
+ url: this._urls["verifyCustomerForPayment"],
282
+ params: {},
283
+ }),
284
+ query_params,
285
+ body,
286
+ xHeaders
287
+ );
288
+ }
289
+
290
+ /**
291
+ * @param {Object} arg - Arg object.
292
+ * @param {ChargeCustomerRequest} arg.body
293
+ * @returns {Promise<ChargeCustomerResponse>} - Success response
294
+ * @summary: Verify and charge payment
295
+ * @description: Use this API to verify and check the status of a payment transaction (server-to-server) made through aggregators like Simpl and Mswipe.
296
+ */
297
+ verifyAndChargePayment({ body } = {}) {
298
+ const { error } = PaymentValidator.verifyAndChargePayment().validate(
299
+ { body },
300
+ { abortEarly: false, allowUnknown: true }
301
+ );
302
+ if (error) {
303
+ return Promise.reject(new FDKClientValidationError(error));
304
+ }
305
+ const query_params = {};
306
+
307
+ const xHeaders = {};
308
+
309
+ return APIClient.execute(
310
+ this._conf,
311
+ "post",
312
+ constructUrl({
313
+ url: this._urls["verifyAndChargePayment"],
314
+ params: {},
315
+ }),
316
+ query_params,
317
+ body,
318
+ xHeaders
319
+ );
320
+ }
321
+
322
+ /**
323
+ * @param {Object} arg - Arg object.
324
+ * @param {PaymentInitializationRequest} arg.body
325
+ * @returns {Promise<PaymentInitializationResponse>} - Success response
326
+ * @summary: Initialize a payment (server-to-server) for UPI and BharatQR
327
+ * @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.
328
+ */
329
+ initialisePayment({ body } = {}) {
330
+ const { error } = PaymentValidator.initialisePayment().validate(
331
+ { body },
332
+ { abortEarly: false, allowUnknown: true }
333
+ );
334
+ if (error) {
335
+ return Promise.reject(new FDKClientValidationError(error));
336
+ }
337
+ const query_params = {};
338
+
339
+ const xHeaders = {};
340
+
341
+ return APIClient.execute(
342
+ this._conf,
343
+ "post",
344
+ constructUrl({
345
+ url: this._urls["initialisePayment"],
346
+ params: {},
347
+ }),
348
+ query_params,
349
+ body,
350
+ xHeaders
351
+ );
352
+ }
353
+
354
+ /**
355
+ * @param {Object} arg - Arg object.
356
+ * @param {PaymentStatusUpdateRequest} arg.body
357
+ * @returns {Promise<PaymentStatusUpdateResponse>} - Success response
358
+ * @summary: Performs continuous polling to check status of payment on the server
359
+ * @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
360
+ */
361
+ checkAndUpdatePaymentStatus({ body } = {}) {
362
+ const { error } = PaymentValidator.checkAndUpdatePaymentStatus().validate(
363
+ { body },
364
+ { abortEarly: false, allowUnknown: true }
365
+ );
366
+ if (error) {
367
+ return Promise.reject(new FDKClientValidationError(error));
368
+ }
369
+ const query_params = {};
370
+
371
+ const xHeaders = {};
372
+
373
+ return APIClient.execute(
374
+ this._conf,
375
+ "post",
376
+ constructUrl({
377
+ url: this._urls["checkAndUpdatePaymentStatus"],
378
+ params: {},
379
+ }),
380
+ query_params,
381
+ body,
382
+ xHeaders
383
+ );
384
+ }
385
+
386
+ /**
387
+ * @param {Object} arg - Arg object.
388
+ * @param {number} arg.amount - Payable amount.
389
+ * @param {string} arg.cartId - Identifier of the cart.
390
+ * @param {string} arg.pincode - The PIN Code of the destination address, e.g. 400059
391
+ * @param {string} arg.checkoutMode - Option to checkout for self or for others.
392
+ * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
393
+ * to remove temporary cache files on payment gateway and replace with the
394
+ * latest one.
395
+ * @param {string} [arg.cardReference] - Card reference id of user's debit
396
+ * or credit card.
397
+ * @param {string} [arg.userDetails] - URIencoded JSON containing details of
398
+ * an anonymous user.
399
+ * @returns {Promise<PaymentModeRouteResponse>} - Success response
400
+ * @summary: Get applicable payment options
401
+ * @description: Use this API to get all valid payment options for doing a payment.
402
+ */
403
+ getPaymentModeRoutes({
404
+ amount,
405
+ cartId,
406
+ pincode,
407
+ checkoutMode,
408
+ refresh,
409
+ cardReference,
410
+ userDetails,
411
+ } = {}) {
412
+ const { error } = PaymentValidator.getPaymentModeRoutes().validate(
413
+ {
414
+ amount,
415
+ cartId,
416
+ pincode,
417
+ checkoutMode,
418
+ refresh,
419
+ cardReference,
420
+ userDetails,
421
+ },
422
+ { abortEarly: false, allowUnknown: true }
423
+ );
424
+ if (error) {
425
+ return Promise.reject(new FDKClientValidationError(error));
426
+ }
427
+ const query_params = {};
428
+ query_params["amount"] = amount;
429
+ query_params["cart_id"] = cartId;
430
+ query_params["pincode"] = pincode;
431
+ query_params["checkout_mode"] = checkoutMode;
432
+ query_params["refresh"] = refresh;
433
+ query_params["card_reference"] = cardReference;
434
+ query_params["user_details"] = userDetails;
435
+
436
+ const xHeaders = {};
437
+
438
+ return APIClient.execute(
439
+ this._conf,
440
+ "get",
441
+ constructUrl({
442
+ url: this._urls["getPaymentModeRoutes"],
443
+ params: {},
444
+ }),
445
+ query_params,
446
+ undefined,
447
+ xHeaders
448
+ );
449
+ }
450
+
451
+ /**
452
+ * @param {Object} arg - Arg object.
453
+ * @param {number} arg.amount - Payable amount.
454
+ * @param {string} arg.cartId - Identifier of the cart.
455
+ * @param {string} arg.pincode - The PIN Code of the destination address, e.g. 400059
456
+ * @param {string} arg.checkoutMode - Option to checkout for self or for others.
457
+ * @param {boolean} [arg.refresh] - This is a boolean value. Select `true`
458
+ * to remove temporary cache files on payment gateway and replace with the
459
+ * latest one.
460
+ * @param {string} [arg.cardReference] - Card reference id of user's debit
461
+ * or credit card.
462
+ * @param {string} arg.orderType - The order type of shipment * HomeDelivery
463
+ * - If the customer wants the order home-delivered * PickAtStore - If the
464
+ * customer wants the handover of an order at the store itself.
465
+ * @param {string} [arg.userDetails] - URIencoded JSON containing details of
466
+ * an anonymous user.
467
+ * @returns {Promise<PaymentModeRouteResponse>} - Success response
468
+ * @summary: Get applicable payment options for Point-of-Sale (POS)
469
+ * @description: Use this API to get all valid payment options for doing a payment in POS.
470
+ */
471
+ getPosPaymentModeRoutes({
472
+ amount,
473
+ cartId,
474
+ pincode,
475
+ checkoutMode,
476
+ orderType,
477
+ refresh,
478
+ cardReference,
479
+ userDetails,
480
+ } = {}) {
481
+ const { error } = PaymentValidator.getPosPaymentModeRoutes().validate(
482
+ {
483
+ amount,
484
+ cartId,
485
+ pincode,
486
+ checkoutMode,
487
+ orderType,
488
+ refresh,
489
+ cardReference,
490
+ userDetails,
491
+ },
492
+ { abortEarly: false, allowUnknown: true }
493
+ );
494
+ if (error) {
495
+ return Promise.reject(new FDKClientValidationError(error));
496
+ }
497
+ const query_params = {};
498
+ query_params["amount"] = amount;
499
+ query_params["cart_id"] = cartId;
500
+ query_params["pincode"] = pincode;
501
+ query_params["checkout_mode"] = checkoutMode;
502
+ query_params["refresh"] = refresh;
503
+ query_params["card_reference"] = cardReference;
504
+ query_params["order_type"] = orderType;
505
+ query_params["user_details"] = userDetails;
506
+
507
+ const xHeaders = {};
508
+
509
+ return APIClient.execute(
510
+ this._conf,
511
+ "get",
512
+ constructUrl({
513
+ url: this._urls["getPosPaymentModeRoutes"],
514
+ params: {},
515
+ }),
516
+ query_params,
517
+ undefined,
518
+ xHeaders
519
+ );
520
+ }
521
+
522
+ /**
523
+ * @param {Object} arg - Arg object.
524
+ * @returns {Promise<RupifiBannerResponse>} - Success response
525
+ * @summary: Get CreditLine Offer
526
+ * @description: Get CreditLine Offer if user is tentatively approved by rupifi
527
+ */
528
+ getRupifiBannerDetails({} = {}) {
529
+ const { error } = PaymentValidator.getRupifiBannerDetails().validate(
530
+ {},
531
+ { abortEarly: false, allowUnknown: true }
532
+ );
533
+ if (error) {
534
+ return Promise.reject(new FDKClientValidationError(error));
535
+ }
536
+ const query_params = {};
537
+
538
+ const xHeaders = {};
539
+
540
+ return APIClient.execute(
541
+ this._conf,
542
+ "get",
543
+ constructUrl({
544
+ url: this._urls["getRupifiBannerDetails"],
545
+ params: {},
546
+ }),
547
+ query_params,
548
+ undefined,
549
+ xHeaders
550
+ );
551
+ }
552
+
553
+ /**
554
+ * @param {Object} arg - Arg object.
555
+ * @returns {Promise<EpaylaterBannerResponse>} - Success response
556
+ * @summary: Get Epaylater Enabled
557
+ * @description: Get Epaylater Enabled if user is tentatively approved by epaylater
558
+ */
559
+ getEpaylaterBannerDetails({} = {}) {
560
+ const { error } = PaymentValidator.getEpaylaterBannerDetails().validate(
561
+ {},
562
+ { abortEarly: false, allowUnknown: true }
563
+ );
564
+ if (error) {
565
+ return Promise.reject(new FDKClientValidationError(error));
566
+ }
567
+ const query_params = {};
568
+
569
+ const xHeaders = {};
570
+
571
+ return APIClient.execute(
572
+ this._conf,
573
+ "get",
574
+ constructUrl({
575
+ url: this._urls["getEpaylaterBannerDetails"],
576
+ params: {},
577
+ }),
578
+ query_params,
579
+ undefined,
580
+ xHeaders
581
+ );
582
+ }
583
+
584
+ /**
585
+ * @param {Object} arg - Arg object.
586
+ * @param {ResendOrCancelPaymentRequest} arg.body
587
+ * @returns {Promise<ResendOrCancelPaymentResponse>} - Success response
588
+ * @summary: API to resend and cancel a payment link which was already generated.
589
+ * @description: Use this API to perform resend or cancel a payment link based on request payload.
590
+ */
591
+ resendOrCancelPayment({ body } = {}) {
592
+ const { error } = PaymentValidator.resendOrCancelPayment().validate(
593
+ { body },
594
+ { abortEarly: false, allowUnknown: true }
595
+ );
596
+ if (error) {
597
+ return Promise.reject(new FDKClientValidationError(error));
598
+ }
599
+ const query_params = {};
600
+
601
+ const xHeaders = {};
602
+
603
+ return APIClient.execute(
604
+ this._conf,
605
+ "post",
606
+ constructUrl({
607
+ url: this._urls["resendOrCancelPayment"],
608
+ params: {},
609
+ }),
610
+ query_params,
611
+ body,
612
+ xHeaders
613
+ );
614
+ }
615
+
616
+ /**
617
+ * @param {Object} arg - Arg object.
618
+ * @returns {Promise<TransferModeResponse>} - Success response
619
+ * @summary: Lists the mode of refund
620
+ * @description: Use this API to retrieve eligible refund modes (such as Netbanking) and add the beneficiary details.
621
+ */
622
+ getActiveRefundTransferModes({} = {}) {
623
+ const { error } = PaymentValidator.getActiveRefundTransferModes().validate(
624
+ {},
625
+ { abortEarly: false, allowUnknown: true }
626
+ );
627
+ if (error) {
628
+ return Promise.reject(new FDKClientValidationError(error));
629
+ }
630
+ const query_params = {};
631
+
632
+ const xHeaders = {};
633
+
634
+ return APIClient.execute(
635
+ this._conf,
636
+ "get",
637
+ constructUrl({
638
+ url: this._urls["getActiveRefundTransferModes"],
639
+ params: {},
640
+ }),
641
+ query_params,
642
+ undefined,
643
+ xHeaders
644
+ );
645
+ }
646
+
647
+ /**
648
+ * @param {Object} arg - Arg object.
649
+ * @param {UpdateRefundTransferModeRequest} arg.body
650
+ * @returns {Promise<UpdateRefundTransferModeResponse>} - Success response
651
+ * @summary: Enable/Disable a mode for transferring a refund
652
+ * @description: Activate or Deactivate Transfer Mode to collect Beneficiary Details for Refund
653
+ */
654
+ enableOrDisableRefundTransferMode({ body } = {}) {
655
+ const {
656
+ error,
657
+ } = PaymentValidator.enableOrDisableRefundTransferMode().validate(
658
+ { body },
659
+ { abortEarly: false, allowUnknown: true }
660
+ );
661
+ if (error) {
662
+ return Promise.reject(new FDKClientValidationError(error));
663
+ }
664
+ const query_params = {};
665
+
666
+ const xHeaders = {};
667
+
668
+ return APIClient.execute(
669
+ this._conf,
670
+ "put",
671
+ constructUrl({
672
+ url: this._urls["enableOrDisableRefundTransferMode"],
673
+ params: {},
674
+ }),
675
+ query_params,
676
+ body,
677
+ xHeaders
678
+ );
679
+ }
680
+
681
+ /**
682
+ * @param {Object} arg - Arg object.
683
+ * @param {string} arg.orderId - A unique number used for identifying and
684
+ * tracking your orders.
685
+ * @returns {Promise<OrderBeneficiaryResponse>} - Success response
686
+ * @summary: Lists the beneficiary of a refund
687
+ * @description: Use this API to get the details of all active beneficiary added by a user for refund.
688
+ */
689
+ getUserBeneficiariesDetail({ orderId } = {}) {
690
+ const { error } = PaymentValidator.getUserBeneficiariesDetail().validate(
691
+ { orderId },
692
+ { abortEarly: false, allowUnknown: true }
693
+ );
694
+ if (error) {
695
+ return Promise.reject(new FDKClientValidationError(error));
696
+ }
697
+ const query_params = {};
698
+ query_params["order_id"] = orderId;
699
+
700
+ const xHeaders = {};
701
+
702
+ return APIClient.execute(
703
+ this._conf,
704
+ "get",
705
+ constructUrl({
706
+ url: this._urls["getUserBeneficiariesDetail"],
707
+ params: {},
708
+ }),
709
+ query_params,
710
+ undefined,
711
+ xHeaders
712
+ );
713
+ }
714
+
715
+ /**
716
+ * @param {Object} arg - Arg object.
717
+ * @param {string} [arg.ifscCode] - A 11-digit alphanumeric code that
718
+ * uniquely identifies a bank branch.
719
+ * @returns {Promise<IfscCodeResponse>} - Success response
720
+ * @summary: Verify IFSC Code
721
+ * @description: Use this API to check whether the 11-digit IFSC code is valid and to fetch the bank details for refund.
722
+ */
723
+ verifyIfscCode({ ifscCode } = {}) {
724
+ const { error } = PaymentValidator.verifyIfscCode().validate(
725
+ { ifscCode },
726
+ { abortEarly: false, allowUnknown: true }
727
+ );
728
+ if (error) {
729
+ return Promise.reject(new FDKClientValidationError(error));
730
+ }
731
+ const query_params = {};
732
+ query_params["ifsc_code"] = ifscCode;
733
+
734
+ const xHeaders = {};
735
+
736
+ return APIClient.execute(
737
+ this._conf,
738
+ "get",
739
+ constructUrl({
740
+ url: this._urls["verifyIfscCode"],
741
+ params: {},
742
+ }),
743
+ query_params,
744
+ undefined,
745
+ xHeaders
746
+ );
747
+ }
748
+
749
+ /**
750
+ * @param {Object} arg - Arg object.
751
+ * @param {string} arg.orderId - A unique number used for identifying and
752
+ * tracking your orders.
753
+ * @returns {Promise<OrderBeneficiaryResponse>} - Success response
754
+ * @summary: Lists the beneficiary of a refund
755
+ * @description: Use this API to get the details of all active beneficiary added by a user for refund.
756
+ */
757
+ getOrderBeneficiariesDetail({ orderId } = {}) {
758
+ const { error } = PaymentValidator.getOrderBeneficiariesDetail().validate(
759
+ { orderId },
760
+ { abortEarly: false, allowUnknown: true }
761
+ );
762
+ if (error) {
763
+ return Promise.reject(new FDKClientValidationError(error));
764
+ }
765
+ const query_params = {};
766
+ query_params["order_id"] = orderId;
767
+
768
+ const xHeaders = {};
769
+
770
+ return APIClient.execute(
771
+ this._conf,
772
+ "get",
773
+ constructUrl({
774
+ url: this._urls["getOrderBeneficiariesDetail"],
775
+ params: {},
776
+ }),
777
+ query_params,
778
+ undefined,
779
+ xHeaders
780
+ );
781
+ }
782
+
783
+ /**
784
+ * @param {Object} arg - Arg object.
785
+ * @param {AddBeneficiaryViaOtpVerificationRequest} arg.body
786
+ * @returns {Promise<AddBeneficiaryViaOtpVerificationResponse>} - Success response
787
+ * @summary: Verify the beneficiary details using OTP
788
+ * @description: Use this API to perform an OTP validation before saving the beneficiary details added for a refund.
789
+ */
790
+ verifyOtpAndAddBeneficiaryForBank({ body } = {}) {
791
+ const {
792
+ error,
793
+ } = PaymentValidator.verifyOtpAndAddBeneficiaryForBank().validate(
794
+ { body },
795
+ { abortEarly: false, allowUnknown: true }
796
+ );
797
+ if (error) {
798
+ return Promise.reject(new FDKClientValidationError(error));
799
+ }
800
+ const query_params = {};
801
+
802
+ const xHeaders = {};
803
+
804
+ return APIClient.execute(
805
+ this._conf,
806
+ "post",
807
+ constructUrl({
808
+ url: this._urls["verifyOtpAndAddBeneficiaryForBank"],
809
+ params: {},
810
+ }),
811
+ query_params,
812
+ body,
813
+ xHeaders
814
+ );
815
+ }
816
+
817
+ /**
818
+ * @param {Object} arg - Arg object.
819
+ * @param {AddBeneficiaryDetailsRequest} arg.body
820
+ * @returns {Promise<RefundAccountResponse>} - Success response
821
+ * @summary: Save bank details for cancelled/returned order
822
+ * @description: Use this API to save the bank details for a returned or cancelled order to refund the amount.
823
+ */
824
+ addBeneficiaryDetails({ body } = {}) {
825
+ const { error } = PaymentValidator.addBeneficiaryDetails().validate(
826
+ { body },
827
+ { abortEarly: false, allowUnknown: true }
828
+ );
829
+ if (error) {
830
+ return Promise.reject(new FDKClientValidationError(error));
831
+ }
832
+ const query_params = {};
833
+
834
+ const xHeaders = {};
835
+
836
+ return APIClient.execute(
837
+ this._conf,
838
+ "post",
839
+ constructUrl({
840
+ url: this._urls["addBeneficiaryDetails"],
841
+ params: {},
842
+ }),
843
+ query_params,
844
+ body,
845
+ xHeaders
846
+ );
847
+ }
848
+
849
+ /**
850
+ * @param {Object} arg - Arg object.
851
+ * @param {AddBeneficiaryDetailsOTPRequest} arg.body
852
+ * @returns {Promise<RefundAccountResponse>} - Success response
853
+ * @summary: Save bank details for cancelled/returned order
854
+ * @description: Use this API to save bank details for returned/cancelled order to refund amount in his account.
855
+ */
856
+ addRefundBankAccountUsingOTP({ body } = {}) {
857
+ const { error } = PaymentValidator.addRefundBankAccountUsingOTP().validate(
858
+ { body },
859
+ { abortEarly: false, allowUnknown: true }
860
+ );
861
+ if (error) {
862
+ return Promise.reject(new FDKClientValidationError(error));
863
+ }
864
+ const query_params = {};
865
+
866
+ const xHeaders = {};
867
+
868
+ return APIClient.execute(
869
+ this._conf,
870
+ "post",
871
+ constructUrl({
872
+ url: this._urls["addRefundBankAccountUsingOTP"],
873
+ params: {},
874
+ }),
875
+ query_params,
876
+ body,
877
+ xHeaders
878
+ );
879
+ }
880
+
881
+ /**
882
+ * @param {Object} arg - Arg object.
883
+ * @param {WalletOtpRequest} arg.body
884
+ * @returns {Promise<WalletOtpResponse>} - Success response
885
+ * @summary: Send OTP on adding a wallet beneficiary
886
+ * @description: Use this API to send an OTP while adding a wallet beneficiary by mobile no. verification.
887
+ */
888
+ verifyOtpAndAddBeneficiaryForWallet({ body } = {}) {
889
+ const {
890
+ error,
891
+ } = PaymentValidator.verifyOtpAndAddBeneficiaryForWallet().validate(
892
+ { body },
893
+ { abortEarly: false, allowUnknown: true }
894
+ );
895
+ if (error) {
896
+ return Promise.reject(new FDKClientValidationError(error));
897
+ }
898
+ const query_params = {};
899
+
900
+ const xHeaders = {};
901
+
902
+ return APIClient.execute(
903
+ this._conf,
904
+ "post",
905
+ constructUrl({
906
+ url: this._urls["verifyOtpAndAddBeneficiaryForWallet"],
907
+ params: {},
908
+ }),
909
+ query_params,
910
+ body,
911
+ xHeaders
912
+ );
913
+ }
914
+
915
+ /**
916
+ * @param {Object} arg - Arg object.
917
+ * @param {SetDefaultBeneficiaryRequest} arg.body
918
+ * @returns {Promise<SetDefaultBeneficiaryResponse>} - Success response
919
+ * @summary: Set a default beneficiary for a refund
920
+ * @description: Use this API to set a default beneficiary for getting a refund.
921
+ */
922
+ updateDefaultBeneficiary({ body } = {}) {
923
+ const { error } = PaymentValidator.updateDefaultBeneficiary().validate(
924
+ { body },
925
+ { abortEarly: false, allowUnknown: true }
926
+ );
927
+ if (error) {
928
+ return Promise.reject(new FDKClientValidationError(error));
929
+ }
930
+ const query_params = {};
931
+
932
+ const xHeaders = {};
933
+
934
+ return APIClient.execute(
935
+ this._conf,
936
+ "post",
937
+ constructUrl({
938
+ url: this._urls["updateDefaultBeneficiary"],
939
+ params: {},
940
+ }),
941
+ query_params,
942
+ body,
943
+ xHeaders
944
+ );
945
+ }
946
+
947
+ /**
948
+ * @param {Object} arg - Arg object.
949
+ * @param {string} [arg.paymentLinkId] -
950
+ * @returns {Promise<GetPaymentLinkResponse>} - Success response
951
+ * @summary: Get payment link
952
+ * @description: Use this API to get a payment link
953
+ */
954
+ getPaymentLink({ paymentLinkId } = {}) {
955
+ const { error } = PaymentValidator.getPaymentLink().validate(
956
+ { paymentLinkId },
957
+ { abortEarly: false, allowUnknown: true }
958
+ );
959
+ if (error) {
960
+ return Promise.reject(new FDKClientValidationError(error));
961
+ }
962
+ const query_params = {};
963
+ query_params["payment_link_id"] = paymentLinkId;
964
+
965
+ const xHeaders = {};
966
+
967
+ return APIClient.execute(
968
+ this._conf,
969
+ "get",
970
+ constructUrl({
971
+ url: this._urls["getPaymentLink"],
972
+ params: {},
973
+ }),
974
+ query_params,
975
+ undefined,
976
+ xHeaders
977
+ );
978
+ }
979
+
980
+ /**
981
+ * @param {Object} arg - Arg object.
982
+ * @param {CreatePaymentLinkRequest} arg.body
983
+ * @returns {Promise<CreatePaymentLinkResponse>} - Success response
984
+ * @summary: Create payment link
985
+ * @description: Use this API to create a payment link for the customer
986
+ */
987
+ createPaymentLink({ body } = {}) {
988
+ const { error } = PaymentValidator.createPaymentLink().validate(
989
+ { body },
990
+ { abortEarly: false, allowUnknown: true }
991
+ );
992
+ if (error) {
993
+ return Promise.reject(new FDKClientValidationError(error));
994
+ }
995
+ const query_params = {};
996
+
997
+ const xHeaders = {};
998
+
999
+ return APIClient.execute(
1000
+ this._conf,
1001
+ "post",
1002
+ constructUrl({
1003
+ url: this._urls["createPaymentLink"],
1004
+ params: {},
1005
+ }),
1006
+ query_params,
1007
+ body,
1008
+ xHeaders
1009
+ );
1010
+ }
1011
+
1012
+ /**
1013
+ * @param {Object} arg - Arg object.
1014
+ * @param {CancelOrResendPaymentLinkRequest} arg.body
1015
+ * @returns {Promise<ResendPaymentLinkResponse>} - Success response
1016
+ * @summary: Resend payment link
1017
+ * @description: Use this API to resend a payment link for the customer
1018
+ */
1019
+ resendPaymentLink({ body } = {}) {
1020
+ const { error } = PaymentValidator.resendPaymentLink().validate(
1021
+ { body },
1022
+ { abortEarly: false, allowUnknown: true }
1023
+ );
1024
+ if (error) {
1025
+ return Promise.reject(new FDKClientValidationError(error));
1026
+ }
1027
+ const query_params = {};
1028
+
1029
+ const xHeaders = {};
1030
+
1031
+ return APIClient.execute(
1032
+ this._conf,
1033
+ "post",
1034
+ constructUrl({
1035
+ url: this._urls["resendPaymentLink"],
1036
+ params: {},
1037
+ }),
1038
+ query_params,
1039
+ body,
1040
+ xHeaders
1041
+ );
1042
+ }
1043
+
1044
+ /**
1045
+ * @param {Object} arg - Arg object.
1046
+ * @param {CancelOrResendPaymentLinkRequest} arg.body
1047
+ * @returns {Promise<CancelPaymentLinkResponse>} - Success response
1048
+ * @summary: Cancel payment link
1049
+ * @description: Use this API to cancel a payment link for the customer
1050
+ */
1051
+ cancelPaymentLink({ body } = {}) {
1052
+ const { error } = PaymentValidator.cancelPaymentLink().validate(
1053
+ { body },
1054
+ { abortEarly: false, allowUnknown: true }
1055
+ );
1056
+ if (error) {
1057
+ return Promise.reject(new FDKClientValidationError(error));
1058
+ }
1059
+ const query_params = {};
1060
+
1061
+ const xHeaders = {};
1062
+
1063
+ return APIClient.execute(
1064
+ this._conf,
1065
+ "post",
1066
+ constructUrl({
1067
+ url: this._urls["cancelPaymentLink"],
1068
+ params: {},
1069
+ }),
1070
+ query_params,
1071
+ body,
1072
+ xHeaders
1073
+ );
1074
+ }
1075
+
1076
+ /**
1077
+ * @param {Object} arg - Arg object.
1078
+ * @param {string} arg.paymentLinkId - Payment link id
1079
+ * @returns {Promise<PaymentModeRouteResponse>} - Success response
1080
+ * @summary: Get applicable payment options for payment link
1081
+ * @description: Use this API to get all valid payment options for doing a payment through payment link
1082
+ */
1083
+ getPaymentModeRoutesPaymentLink({ paymentLinkId } = {}) {
1084
+ const {
1085
+ error,
1086
+ } = PaymentValidator.getPaymentModeRoutesPaymentLink().validate(
1087
+ { paymentLinkId },
1088
+ { abortEarly: false, allowUnknown: true }
1089
+ );
1090
+ if (error) {
1091
+ return Promise.reject(new FDKClientValidationError(error));
1092
+ }
1093
+ const query_params = {};
1094
+ query_params["payment_link_id"] = paymentLinkId;
1095
+
1096
+ const xHeaders = {};
1097
+
1098
+ return APIClient.execute(
1099
+ this._conf,
1100
+ "get",
1101
+ constructUrl({
1102
+ url: this._urls["getPaymentModeRoutesPaymentLink"],
1103
+ params: {},
1104
+ }),
1105
+ query_params,
1106
+ undefined,
1107
+ xHeaders
1108
+ );
1109
+ }
1110
+
1111
+ /**
1112
+ * @param {Object} arg - Arg object.
1113
+ * @param {string} [arg.paymentLinkId] -
1114
+ * @returns {Promise<PollingPaymentLinkResponse>} - Success response
1115
+ * @summary: Used for polling if payment successful or not
1116
+ * @description: Use this API to poll if payment through payment was successful or not
1117
+ */
1118
+ pollingPaymentLink({ paymentLinkId } = {}) {
1119
+ const { error } = PaymentValidator.pollingPaymentLink().validate(
1120
+ { paymentLinkId },
1121
+ { abortEarly: false, allowUnknown: true }
1122
+ );
1123
+ if (error) {
1124
+ return Promise.reject(new FDKClientValidationError(error));
1125
+ }
1126
+ const query_params = {};
1127
+ query_params["payment_link_id"] = paymentLinkId;
1128
+
1129
+ const xHeaders = {};
1130
+
1131
+ return APIClient.execute(
1132
+ this._conf,
1133
+ "get",
1134
+ constructUrl({
1135
+ url: this._urls["pollingPaymentLink"],
1136
+ params: {},
1137
+ }),
1138
+ query_params,
1139
+ undefined,
1140
+ xHeaders
1141
+ );
1142
+ }
1143
+
1144
+ /**
1145
+ * @param {Object} arg - Arg object.
1146
+ * @param {CreateOrderUserRequest} arg.body
1147
+ * @returns {Promise<CreateOrderUserResponse>} - Success response
1148
+ * @summary: Create Order user
1149
+ * @description: Use this API to create a order and payment on aggregator side
1150
+ */
1151
+ createOrderHandlerPaymentLink({ body } = {}) {
1152
+ const { error } = PaymentValidator.createOrderHandlerPaymentLink().validate(
1153
+ { body },
1154
+ { abortEarly: false, allowUnknown: true }
1155
+ );
1156
+ if (error) {
1157
+ return Promise.reject(new FDKClientValidationError(error));
1158
+ }
1159
+ const query_params = {};
1160
+
1161
+ const xHeaders = {};
1162
+
1163
+ return APIClient.execute(
1164
+ this._conf,
1165
+ "post",
1166
+ constructUrl({
1167
+ url: this._urls["createOrderHandlerPaymentLink"],
1168
+ params: {},
1169
+ }),
1170
+ query_params,
1171
+ body,
1172
+ xHeaders
1173
+ );
1174
+ }
1175
+
1176
+ /**
1177
+ * @param {Object} arg - Arg object.
1178
+ * @param {PaymentInitializationRequest} arg.body
1179
+ * @returns {Promise<PaymentInitializationResponse>} - Success response
1180
+ * @summary: Initialize a payment (server-to-server) for UPI and BharatQR
1181
+ * @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.
1182
+ */
1183
+ initialisePaymentPaymentLink({ body } = {}) {
1184
+ const { error } = PaymentValidator.initialisePaymentPaymentLink().validate(
1185
+ { body },
1186
+ { abortEarly: false, allowUnknown: true }
1187
+ );
1188
+ if (error) {
1189
+ return Promise.reject(new FDKClientValidationError(error));
1190
+ }
1191
+ const query_params = {};
1192
+
1193
+ const xHeaders = {};
1194
+
1195
+ return APIClient.execute(
1196
+ this._conf,
1197
+ "post",
1198
+ constructUrl({
1199
+ url: this._urls["initialisePaymentPaymentLink"],
1200
+ params: {},
1201
+ }),
1202
+ query_params,
1203
+ body,
1204
+ xHeaders
1205
+ );
1206
+ }
1207
+
1208
+ /**
1209
+ * @param {Object} arg - Arg object.
1210
+ * @param {PaymentStatusUpdateRequest} arg.body
1211
+ * @returns {Promise<PaymentStatusUpdateResponse>} - Success response
1212
+ * @summary: Performs continuous polling to check status of payment on the server
1213
+ * @description: Use this API to perform continuous polling at intervals to check the status of payment until timeout.
1214
+ */
1215
+ checkAndUpdatePaymentStatusPaymentLink({ body } = {}) {
1216
+ const {
1217
+ error,
1218
+ } = PaymentValidator.checkAndUpdatePaymentStatusPaymentLink().validate(
1219
+ { body },
1220
+ { abortEarly: false, allowUnknown: true }
1221
+ );
1222
+ if (error) {
1223
+ return Promise.reject(new FDKClientValidationError(error));
1224
+ }
1225
+ const query_params = {};
1226
+
1227
+ const xHeaders = {};
1228
+
1229
+ return APIClient.execute(
1230
+ this._conf,
1231
+ "post",
1232
+ constructUrl({
1233
+ url: this._urls["checkAndUpdatePaymentStatusPaymentLink"],
1234
+ params: {},
1235
+ }),
1236
+ query_params,
1237
+ body,
1238
+ xHeaders
1239
+ );
1240
+ }
1241
+
1242
+ /**
1243
+ * @param {Object} arg - Arg object.
1244
+ * @param {string} [arg.aggregator] -
1245
+ * @returns {Promise<CustomerCreditSummaryResponse>} - Success response
1246
+ * @summary: API to fetch the customer credit summary
1247
+ * @description: Use this API to fetch the customer credit summary.
1248
+ */
1249
+ customerCreditSummary({ aggregator } = {}) {
1250
+ const { error } = PaymentValidator.customerCreditSummary().validate(
1251
+ { aggregator },
1252
+ { abortEarly: false, allowUnknown: true }
1253
+ );
1254
+ if (error) {
1255
+ return Promise.reject(new FDKClientValidationError(error));
1256
+ }
1257
+ const query_params = {};
1258
+ query_params["aggregator"] = aggregator;
1259
+
1260
+ const xHeaders = {};
1261
+
1262
+ return APIClient.execute(
1263
+ this._conf,
1264
+ "get",
1265
+ constructUrl({
1266
+ url: this._urls["customerCreditSummary"],
1267
+ params: {},
1268
+ }),
1269
+ query_params,
1270
+ undefined,
1271
+ xHeaders
1272
+ );
1273
+ }
1274
+
1275
+ /**
1276
+ * @param {Object} arg - Arg object.
1277
+ * @param {string} [arg.source] - This is a String value that contains
1278
+ * callback URL as value.
1279
+ * @param {string} [arg.aggregator] - This is a String value that contains
1280
+ * aggregator name as value.
1281
+ * @returns {Promise<RedirectToAggregatorResponse>} - Success response
1282
+ * @summary: API to get the redirect url to redirect the user to aggregator's page
1283
+ * @description: Use this API to get the redirect url to redirect the user to aggregator's page
1284
+ */
1285
+ redirectToAggregator({ source, aggregator } = {}) {
1286
+ const { error } = PaymentValidator.redirectToAggregator().validate(
1287
+ { source, aggregator },
1288
+ { abortEarly: false, allowUnknown: true }
1289
+ );
1290
+ if (error) {
1291
+ return Promise.reject(new FDKClientValidationError(error));
1292
+ }
1293
+ const query_params = {};
1294
+ query_params["source"] = source;
1295
+ query_params["aggregator"] = aggregator;
1296
+
1297
+ const xHeaders = {};
1298
+
1299
+ return APIClient.execute(
1300
+ this._conf,
1301
+ "get",
1302
+ constructUrl({
1303
+ url: this._urls["redirectToAggregator"],
1304
+ params: {},
1305
+ }),
1306
+ query_params,
1307
+ undefined,
1308
+ xHeaders
1309
+ );
1310
+ }
1311
+
1312
+ /**
1313
+ * @param {Object} arg - Arg object.
1314
+ * @param {string} [arg.aggregator] -
1315
+ * @returns {Promise<CheckCreditResponse>} - Success response
1316
+ * @summary: API to fetch the customer credit summary
1317
+ * @description: Use this API to fetch the customer credit summary.
1318
+ */
1319
+ checkCredit({ aggregator } = {}) {
1320
+ const { error } = PaymentValidator.checkCredit().validate(
1321
+ { aggregator },
1322
+ { abortEarly: false, allowUnknown: true }
1323
+ );
1324
+ if (error) {
1325
+ return Promise.reject(new FDKClientValidationError(error));
1326
+ }
1327
+ const query_params = {};
1328
+ query_params["aggregator"] = aggregator;
1329
+
1330
+ const xHeaders = {};
1331
+
1332
+ return APIClient.execute(
1333
+ this._conf,
1334
+ "get",
1335
+ constructUrl({
1336
+ url: this._urls["checkCredit"],
1337
+ params: {},
1338
+ }),
1339
+ query_params,
1340
+ undefined,
1341
+ xHeaders
1342
+ );
1343
+ }
1344
+
1345
+ /**
1346
+ * @param {Object} arg - Arg object.
1347
+ * @param {CustomerOnboardingRequest} arg.body
1348
+ * @returns {Promise<CustomerOnboardingResponse>} - Success response
1349
+ * @summary: API to fetch the customer credit summary
1350
+ * @description: Use this API to fetch the customer credit summary.
1351
+ */
1352
+ customerOnboard({ body } = {}) {
1353
+ const { error } = PaymentValidator.customerOnboard().validate(
1354
+ { body },
1355
+ { abortEarly: false, allowUnknown: true }
1356
+ );
1357
+ if (error) {
1358
+ return Promise.reject(new FDKClientValidationError(error));
1359
+ }
1360
+ const query_params = {};
1361
+
1362
+ const xHeaders = {};
1363
+
1364
+ return APIClient.execute(
1365
+ this._conf,
1366
+ "post",
1367
+ constructUrl({
1368
+ url: this._urls["customerOnboard"],
1369
+ params: {},
1370
+ }),
1371
+ query_params,
1372
+ body,
1373
+ xHeaders
1374
+ );
1375
+ }
1376
+ }
1377
+
1378
+ module.exports = Payment;