1. 1 :
  2. 2 : (function(root, factory) {
  3. 3 : if (typeof define === 'function' && define.amd) {
  4. 4 : // AMD. Register as an anonymous module.
  5. 5 : define(['ApiClient', 'models/CreatePaymentSetupRequest', 'models/DeletePaymentSetupRequest', 'models/DeleteResponse', 'models/ErrorResponseVo', 'models/PaymentSetupResponse', 'models/PaymentSetupsResponse', 'models/UpdatePaymentSetupRequest'], factory);
  6. 6 : } else if (typeof module === 'object' && module.exports) {
  7. 7 : // CommonJS-like environments that support module.exports, like Node.
  8. 8 : module.exports = factory(require('../ApiClient'), require('../models/CreatePaymentSetupRequest'), require('../models/DeletePaymentSetupRequest'), require('../models/DeleteResponse'), require('../models/ErrorResponseVo'), require('../models/PaymentSetupResponse'), require('../models/PaymentSetupsResponse'), require('../models/UpdatePaymentSetupRequest'));
  9. 9 : } else {
  10. 10 : // Browser globals (root is window)
  11. 11 : if (!root.OrbipayPaymentsapiClient) {
  12. 12 : root.OrbipayPaymentsapiClient = {};
  13. 13 : }
  14. 14 : root.OrbipayPaymentsapiClient.PaymentSetupApi = factory(root.OrbipayPaymentsapiClient.ApiClient, root.OrbipayPaymentsapiClient.CreatePaymentSetupRequest, root.OrbipayPaymentsapiClient.DeletePaymentSetupRequest, root.OrbipayPaymentsapiClient.DeleteResponse, root.OrbipayPaymentsapiClient.ErrorResponseVo, root.OrbipayPaymentsapiClient.PaymentSetupResponse, root.OrbipayPaymentsapiClient.PaymentSetupsResponse, root.OrbipayPaymentsapiClient.UpdatePaymentSetupRequest);
  15. 15 : }
  16. 16 : }(this, function(ApiClient, CreatePaymentSetupRequest, DeletePaymentSetupRequest, DeleteResponse, ErrorResponseVo, PaymentSetupResponse, PaymentSetupsResponse, UpdatePaymentSetupRequest) {
  17. 17 : 'use strict';
  18. 18 :
  19. 19 : /**
  20. 20 : * PaymentSetup service.
  21. 21 : * @module api/PaymentSetupApi
  22. 22 : */
  23. 23 :
  24. 24 : /**
  25. 25 : * <h3 style="color:red"> This class subject to change without prior notice, Please dont use this class directly. </h3>
  26. 26 :
  27. 27 : * Constructs a new PaymentSetupApi.
  28. 28 : * @alias module:api/PaymentSetupApi
  29. 29 : * @class
  30. 30 : * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
  31. 31 : * default to {@link module:ApiClient#instance} if unspecified.
  32. 32 : */
  33. 33 : var exports = function(apiClient) {
  34. 34 : this.apiClient = apiClient || ApiClient.instance;
  35. 35 :
  36. 36 :
  37. 37 : /**
  38. 38 : * Callback function to receive the result of the createRecurringPaymentSetup operation.
  39. 39 : * @callback module:api/PaymentSetupApi~createRecurringPaymentSetupCallback
  40. 40 : * @param {String} error Error message, if any.
  41. 41 : * @param {module:models/PaymentSetupResponse} data The data returned by the service call.
  42. 42 : * @param {String} response The complete HTTP response.
  43. 43 : */
  44. 44 :
  45. 45 : /**
  46. 46 : * Create Payment Setup
  47. 47 : * The API is used to set up recurring payments to service a customer account.
  48. 48 : * @param {String} channel The channel through which the API is invoked.
  49. 49 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  50. 50 : * @param {module:models/String} product The product identifier corresponding to the API.
  51. 51 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  52. 52 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  53. 53 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  54. 54 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  55. 55 : * @param {module:models/CreatePaymentSetupRequest} create_payment_setup_request JSON containing all the fields required to create a recurring payment setup.
  56. 56 : * @param {Object} opts Optional parameters
  57. 57 : * @param {String} opts.requestor The identifier for the requestor of the API.
  58. 58 : * @param {String} opts.x_opay_headers Intended for the future use.
  59. 59 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  60. 60 : * @param {module:api/PaymentSetupApi~createRecurringPaymentSetupCallback} callback The callback function, accepting three arguments: error, data, response
  61. 61 : * data is of type: {@link module:models/PaymentSetupResponse}
  62. 62 : */
  63. 63 : this.createRecurringPaymentSetup = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, create_payment_setup_request, opts, callback) {
  64. 64 : opts = opts || {};
  65. 65 : var postBody = create_payment_setup_request;
  66. 66 :
  67. 67 : var pathParams = {
  68. 68 : 'ID_CUSTOMER': id_customer
  69. 69 : };
  70. 70 : var queryParams = {
  71. 71 : };
  72. 72 : var headerParams = {
  73. 73 : 'channel': channel,
  74. 74 : 'client_key': client_key,
  75. 75 : 'product': product,
  76. 76 : 'timestamp': timestamp,
  77. 77 : 'idempotent_request_key': idempotent_request_key,
  78. 78 : 'requestor_type': requestor_type,
  79. 79 : 'requestor': opts['requestor'],
  80. 80 : 'X-OPAY-Headers': opts['x_opay_headers'],
  81. 81 : 'trace_id': opts['trace_id']
  82. 82 : };
  83. 83 : var formParams = {
  84. 84 : };
  85. 85 :
  86. 86 : var authNames = [];
  87. 87 : var contentTypes = ['application/json'];
  88. 88 : var accepts = ['application/json'];
  89. 89 : var returnType = PaymentSetupResponse;
  90. 90 :
  91. 91 : return this.apiClient.callApi(
  92. 92 : '/customers/{ID_CUSTOMER}/paymentsetups', 'POST',
  93. 93 : pathParams, queryParams, headerParams, formParams, postBody,
  94. 94 : authNames, contentTypes, accepts, returnType, callback
  95. 95 : );
  96. 96 : };
  97. 97 :
  98. 98 : /**
  99. 99 : * Callback function to receive the result of the deletePaymentSetup operation.
  100. 100 : * @callback module:api/PaymentSetupApi~deletePaymentSetupCallback
  101. 101 : * @param {String} error Error message, if any.
  102. 102 : * @param {module:models/DeleteResponse} data The data returned by the service call.
  103. 103 : * @param {String} response The complete HTTP response.
  104. 104 : */
  105. 105 :
  106. 106 : /**
  107. 107 : * Delete Payment Setup
  108. 108 : * The API is used to delete or cancel a recurring payment setup. Cancelling a payment setup will also cancel all the pending and future payments under the setup.
  109. 109 : * @param {String} channel The channel through which the API is invoked.
  110. 110 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  111. 111 : * @param {module:models/String} product The product identifier corresponding to the API.
  112. 112 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  113. 113 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  114. 114 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  115. 115 : * @param {String} id_payment_setup The unique identifier assigned by EBPP to the payment setup.
  116. 116 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  117. 117 : * @param {module:models/DeletePaymentSetupRequest} delete_payment_setup_request JSON containing all the fields required to delete a payment. Setup.
  118. 118 : * @param {Object} opts Optional parameters
  119. 119 : * @param {String} opts.requestor The identifier for the requestor of the API.
  120. 120 : * @param {String} opts.x_opay_headers Intended for the future use.
  121. 121 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  122. 122 : * @param {module:api/PaymentSetupApi~deletePaymentSetupCallback} callback The callback function, accepting three arguments: error, data, response
  123. 123 : * data is of type: {@link module:models/DeleteResponse}
  124. 124 : */
  125. 125 : this.deletePaymentSetup = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment_setup, id_customer, delete_payment_setup_request, opts, callback) {
  126. 126 : opts = opts || {};
  127. 127 : var postBody = delete_payment_setup_request;
  128. 128 :
  129. 129 : var pathParams = {
  130. 130 : 'ID_PAYMENT_SETUP': id_payment_setup,
  131. 131 : 'ID_CUSTOMER': id_customer
  132. 132 : };
  133. 133 : var queryParams = {
  134. 134 : };
  135. 135 : var headerParams = {
  136. 136 : 'channel': channel,
  137. 137 : 'client_key': client_key,
  138. 138 : 'product': product,
  139. 139 : 'timestamp': timestamp,
  140. 140 : 'idempotent_request_key': idempotent_request_key,
  141. 141 : 'requestor_type': requestor_type,
  142. 142 : 'requestor': opts['requestor'],
  143. 143 : 'X-OPAY-Headers': opts['x_opay_headers'],
  144. 144 : 'trace_id': opts['trace_id']
  145. 145 : };
  146. 146 : var formParams = {
  147. 147 : };
  148. 148 :
  149. 149 : var authNames = [];
  150. 150 : var contentTypes = ['application/json'];
  151. 151 : var accepts = ['application/json'];
  152. 152 : var returnType = DeleteResponse;
  153. 153 :
  154. 154 : return this.apiClient.callApi(
  155. 155 : '/customers/{ID_CUSTOMER}/paymentsetups/{ID_PAYMENT_SETUP}', 'DELETE',
  156. 156 : pathParams, queryParams, headerParams, formParams, postBody,
  157. 157 : authNames, contentTypes, accepts, returnType, callback
  158. 158 : );
  159. 159 : };
  160. 160 :
  161. 161 : /**
  162. 162 : * Callback function to receive the result of the getPaymentSetup operation.
  163. 163 : * @callback module:api/PaymentSetupApi~getPaymentSetupCallback
  164. 164 : * @param {String} error Error message, if any.
  165. 165 : * @param {module:models/PaymentSetupResponse} data The data returned by the service call.
  166. 166 : * @param {String} response The complete HTTP response.
  167. 167 : */
  168. 168 :
  169. 169 : /**
  170. 170 : * Get Payment Setup
  171. 171 : * The API is used to retrieve the details of a recurring payment setup by id.
  172. 172 : * @param {String} channel The channel through which the API is invoked.
  173. 173 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  174. 174 : * @param {module:models/String} product The product identifier corresponding to the API.
  175. 175 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  176. 176 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  177. 177 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  178. 178 : * @param {String} id_payment_setup The unique identifier assigned by EBPP to the payment setup.
  179. 179 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  180. 180 : * @param {Object} opts Optional parameters
  181. 181 : * @param {String} opts.requestor The identifier for the requestor of the API.
  182. 182 : * @param {String} opts.x_opay_headers Intended for the future use.
  183. 183 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  184. 184 : * @param {module:api/PaymentSetupApi~getPaymentSetupCallback} callback The callback function, accepting three arguments: error, data, response
  185. 185 : * data is of type: {@link module:models/PaymentSetupResponse}
  186. 186 : */
  187. 187 : this.getPaymentSetup = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment_setup, id_customer, opts, callback) {
  188. 188 : opts = opts || {};
  189. 189 : var postBody = null;
  190. 190 :
  191. 191 : var pathParams = {
  192. 192 : 'ID_PAYMENT_SETUP': id_payment_setup,
  193. 193 : 'ID_CUSTOMER': id_customer
  194. 194 : };
  195. 195 : var queryParams = {
  196. 196 : };
  197. 197 : var headerParams = {
  198. 198 : 'channel': channel,
  199. 199 : 'client_key': client_key,
  200. 200 : 'product': product,
  201. 201 : 'timestamp': timestamp,
  202. 202 : 'idempotent_request_key': idempotent_request_key,
  203. 203 : 'requestor_type': requestor_type,
  204. 204 : 'requestor': opts['requestor'],
  205. 205 : 'X-OPAY-Headers': opts['x_opay_headers'],
  206. 206 : 'trace_id': opts['trace_id']
  207. 207 : };
  208. 208 : var formParams = {
  209. 209 : };
  210. 210 :
  211. 211 : var authNames = [];
  212. 212 : var contentTypes = [];
  213. 213 : var accepts = ['application/json'];
  214. 214 : var returnType = PaymentSetupResponse;
  215. 215 :
  216. 216 : return this.apiClient.callApi(
  217. 217 : '/customers/{ID_CUSTOMER}/paymentsetups/{ID_PAYMENT_SETUP}', 'GET',
  218. 218 : pathParams, queryParams, headerParams, formParams, postBody,
  219. 219 : authNames, contentTypes, accepts, returnType, callback
  220. 220 : );
  221. 221 : };
  222. 222 :
  223. 223 : /**
  224. 224 : * Callback function to receive the result of the retrievePaymentSetups operation.
  225. 225 : * @callback module:api/PaymentSetupApi~retrievePaymentSetupsCallback
  226. 226 : * @param {String} error Error message, if any.
  227. 227 : * @param {module:models/PaymentSetupsResponse} data The data returned by the service call.
  228. 228 : * @param {String} response The complete HTTP response.
  229. 229 : */
  230. 230 :
  231. 231 : /**
  232. 232 : * Retrieve Payment Setups
  233. 233 : * The API is used to retrieve the recurring and autopay payments setup made against a customer account. The setup can be filtered using the confirmation number, customer account, funding account, status and payment setup schedule type, by date range and others mentioned below. If no dates are provided for retrieval, recurring payments set up in the last six months and all the ones in future are returned. The results are sorted in descending order of the payment_start_date followed by the last_modified_time.
  234. 234 : * @param {String} channel The channel through which the API is invoked.
  235. 235 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  236. 236 : * @param {module:models/String} product The product identifier corresponding to the API.
  237. 237 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  238. 238 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  239. 239 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  240. 240 : * @param {Object} opts Optional parameters
  241. 241 : * @param {String} opts.requestor The identifier for the requestor of the API.
  242. 242 : * @param {String} opts.x_opay_headers Intended for the future use.
  243. 243 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  244. 244 : * @param {String} opts.id_customer The unique identifier assigned by EBPP to the customer.
  245. 245 : * @param {String} opts.id_funding_account The unique identifier assigned by EBPP to the funding account
  246. 246 : * @param {String} opts.id_customer_account The unique identifier assigned by EBPP to the customer account
  247. 247 : * @param {String} opts.confirmation_number The confirmation number or reference provided to the customer for the successful payment.
  248. 248 : * @param {Array.<module:models/String>} opts.status The status of the payment. This can take multiple values in the format key&#x3D;value1&amp;key&#x3D;value2....
  249. 249 : * @param {Array.<module:models/String>} opts.payment_setup_schedule_type The schedule type for the payment setup. This can take multiple values in the format key&#x3D;value1&amp;key&#x3D;value2....
  250. 250 : * @param {String} opts.from_date The date from which recurring payments setup, matching the criteria specified, need to be retrieved.
  251. 251 : * @param {String} opts.to_date The date upto which recurring payments setup, matching the criteria specified, need to be retrieved.
  252. 252 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  253. 253 : * @param {String} opts.query_id query id of the Retrieve/Search Customers lookup.
  254. 254 : * @param {String} opts.from_index To fetch the next set of objects that start after this object
  255. 255 : * @param {String} opts.to_index To fetch the previous set of objects that end at this object
  256. 256 : * @param {module:api/PaymentSetupApi~retrievePaymentSetupsCallback} callback The callback function, accepting three arguments: error, data, response
  257. 257 : * data is of type: {@link module:models/PaymentSetupsResponse}
  258. 258 : */
  259. 259 : this.retrievePaymentSetups = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, opts, callback) {
  260. 260 : opts = opts || {};
  261. 261 : var postBody = null;
  262. 262 :
  263. 263 : var pathParams = {
  264. 264 : };
  265. 265 : var queryParams = {
  266. 266 : 'id_customer': opts['id_customer'],
  267. 267 : 'id_funding_account': opts['id_funding_account'],
  268. 268 : 'id_customer_account': opts['id_customer_account'],
  269. 269 : 'confirmation_number': opts['confirmation_number'],
  270. 270 : 'status': opts['status'],
  271. 271 : 'payment_setup_schedule_type': opts['payment_setup_schedule_type'],
  272. 272 : 'from_date': opts['from_date'],
  273. 273 : 'to_date': opts['to_date'],
  274. 274 : 'page_size': opts['page_size'],
  275. 275 : 'query_id': opts['query_id'],
  276. 276 : 'from_index': opts['from_index'],
  277. 277 : 'to_index': opts['to_index']
  278. 278 : };
  279. 279 : var headerParams = {
  280. 280 : 'channel': channel,
  281. 281 : 'client_key': client_key,
  282. 282 : 'product': product,
  283. 283 : 'timestamp': timestamp,
  284. 284 : 'idempotent_request_key': idempotent_request_key,
  285. 285 : 'requestor_type': requestor_type,
  286. 286 : 'requestor': opts['requestor'],
  287. 287 : 'X-OPAY-Headers': opts['x_opay_headers'],
  288. 288 : 'trace_id': opts['trace_id']
  289. 289 : };
  290. 290 : var formParams = {
  291. 291 : };
  292. 292 :
  293. 293 : var authNames = [];
  294. 294 : var contentTypes = [];
  295. 295 : var accepts = ['application/json'];
  296. 296 : var returnType = PaymentSetupsResponse;
  297. 297 :
  298. 298 : return this.apiClient.callApi(
  299. 299 : '/paymentsetups', 'GET',
  300. 300 : pathParams, queryParams, headerParams, formParams, postBody,
  301. 301 : authNames, contentTypes, accepts, returnType, callback
  302. 302 : );
  303. 303 : };
  304. 304 :
  305. 305 : /**
  306. 306 : * Callback function to receive the result of the updatePaymentSetup operation.
  307. 307 : * @callback module:api/PaymentSetupApi~updatePaymentSetupCallback
  308. 308 : * @param {String} error Error message, if any.
  309. 309 : * @param {module:models/PaymentSetupResponse} data The data returned by the service call.
  310. 310 : * @param {String} response The complete HTTP response.
  311. 311 : */
  312. 312 :
  313. 313 : /**
  314. 314 : * Update Payment Setup
  315. 315 : * The API is used to edit a payment Setup. Only autopay payment setup is allowed to edit.
  316. 316 : * @param {String} channel The channel through which the API is invoked.
  317. 317 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  318. 318 : * @param {module:models/String} product The product identifier corresponding to the API.
  319. 319 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  320. 320 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  321. 321 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  322. 322 : * @param {String} id_payment_setup The unique identifier assigned by EBPP to the payment setup.
  323. 323 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  324. 324 : * @param {module:models/UpdatePaymentSetupRequest} update_payment_setup_request Details of the Payment Setup to be updated.
  325. 325 : * @param {Object} opts Optional parameters
  326. 326 : * @param {String} opts.requestor The identifier for the requestor of the API.
  327. 327 : * @param {String} opts.x_opay_headers Intended for the future use.
  328. 328 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  329. 329 : * @param {module:api/PaymentSetupApi~updatePaymentSetupCallback} callback The callback function, accepting three arguments: error, data, response
  330. 330 : * data is of type: {@link module:models/PaymentSetupResponse}
  331. 331 : */
  332. 332 : this.updatePaymentSetup = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment_setup, id_customer, update_payment_setup_request, opts, callback) {
  333. 333 : opts = opts || {};
  334. 334 : var postBody = update_payment_setup_request;
  335. 335 :
  336. 336 : var pathParams = {
  337. 337 : 'ID_PAYMENT_SETUP': id_payment_setup,
  338. 338 : 'ID_CUSTOMER': id_customer
  339. 339 : };
  340. 340 : var queryParams = {
  341. 341 : };
  342. 342 : var headerParams = {
  343. 343 : 'channel': channel,
  344. 344 : 'client_key': client_key,
  345. 345 : 'product': product,
  346. 346 : 'timestamp': timestamp,
  347. 347 : 'idempotent_request_key': idempotent_request_key,
  348. 348 : 'requestor_type': requestor_type,
  349. 349 : 'requestor': opts['requestor'],
  350. 350 : 'X-OPAY-Headers': opts['x_opay_headers'],
  351. 351 : 'trace_id': opts['trace_id']
  352. 352 : };
  353. 353 : var formParams = {
  354. 354 : };
  355. 355 :
  356. 356 : var authNames = [];
  357. 357 : var contentTypes = ['application/json'];
  358. 358 : var accepts = ['application/json'];
  359. 359 : var returnType = PaymentSetupResponse;
  360. 360 :
  361. 361 : return this.apiClient.callApi(
  362. 362 : '/customers/{ID_CUSTOMER}/paymentsetups/{ID_PAYMENT_SETUP}', 'PUT',
  363. 363 : pathParams, queryParams, headerParams, formParams, postBody,
  364. 364 : authNames, contentTypes, accepts, returnType, callback
  365. 365 : );
  366. 366 : };
  367. 367 : };
  368. 368 :
  369. 369 : return exports;
  370. 370 : }));