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. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
  58. 58 : * @param {String} opts.x_opay_headers Intended for the future use.
  59. 59 : * @param {module:api/PaymentSetupApi~createRecurringPaymentSetupCallback} callback The callback function, accepting three arguments: error, data, response
  60. 60 : * data is of type: {@link module:models/PaymentSetupResponse}
  61. 61 : */
  62. 62 : this.createRecurringPaymentSetup = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, create_payment_setup_request, opts, callback) {
  63. 63 : opts = opts || {};
  64. 64 : var postBody = create_payment_setup_request;
  65. 65 :
  66. 66 : var pathParams = {
  67. 67 : 'ID_CUSTOMER': id_customer
  68. 68 : };
  69. 69 : var queryParams = {
  70. 70 : };
  71. 71 : var headerParams = {
  72. 72 : 'channel': channel,
  73. 73 : 'client_key': client_key,
  74. 74 : 'product': product,
  75. 75 : 'timestamp': timestamp,
  76. 76 : 'idempotent_request_key': idempotent_request_key,
  77. 77 : 'requestor_type': requestor_type,
  78. 78 : 'requestor': opts['requestor'],
  79. 79 : 'X-OPAY-Headers': opts['x_opay_headers']
  80. 80 : };
  81. 81 : var formParams = {
  82. 82 : };
  83. 83 :
  84. 84 : var authNames = [];
  85. 85 : var contentTypes = ['application/json'];
  86. 86 : var accepts = ['application/json'];
  87. 87 : var returnType = PaymentSetupResponse;
  88. 88 :
  89. 89 : return this.apiClient.callApi(
  90. 90 : '/customers/{ID_CUSTOMER}/paymentsetups', 'POST',
  91. 91 : pathParams, queryParams, headerParams, formParams, postBody,
  92. 92 : authNames, contentTypes, accepts, returnType, callback
  93. 93 : );
  94. 94 : };
  95. 95 :
  96. 96 : /**
  97. 97 : * Callback function to receive the result of the deletePaymentSetup operation.
  98. 98 : * @callback module:api/PaymentSetupApi~deletePaymentSetupCallback
  99. 99 : * @param {String} error Error message, if any.
  100. 100 : * @param {module:models/DeleteResponse} data The data returned by the service call.
  101. 101 : * @param {String} response The complete HTTP response.
  102. 102 : */
  103. 103 :
  104. 104 : /**
  105. 105 : * Delete Payment Setup
  106. 106 : * 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.
  107. 107 : * @param {String} channel The channel through which the API is invoked.
  108. 108 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  109. 109 : * @param {module:models/String} product The product identifier corresponding to the API.
  110. 110 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  111. 111 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  112. 112 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  113. 113 : * @param {String} id_payment_setup The unique identifier assigned by EBPP to the payment setup.
  114. 114 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  115. 115 : * @param {module:models/DeletePaymentSetupRequest} delete_payment_setup_request JSON containing all the fields required to delete a payment. Setup.
  116. 116 : * @param {Object} opts Optional parameters
  117. 117 : * @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
  118. 118 : * @param {String} opts.x_opay_headers Intended for the future use.
  119. 119 : * @param {module:api/PaymentSetupApi~deletePaymentSetupCallback} callback The callback function, accepting three arguments: error, data, response
  120. 120 : * data is of type: {@link module:models/DeleteResponse}
  121. 121 : */
  122. 122 : this.deletePaymentSetup = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment_setup, id_customer, delete_payment_setup_request, opts, callback) {
  123. 123 : opts = opts || {};
  124. 124 : var postBody = delete_payment_setup_request;
  125. 125 :
  126. 126 : var pathParams = {
  127. 127 : 'ID_PAYMENT_SETUP': id_payment_setup,
  128. 128 : 'ID_CUSTOMER': id_customer
  129. 129 : };
  130. 130 : var queryParams = {
  131. 131 : };
  132. 132 : var headerParams = {
  133. 133 : 'channel': channel,
  134. 134 : 'client_key': client_key,
  135. 135 : 'product': product,
  136. 136 : 'timestamp': timestamp,
  137. 137 : 'idempotent_request_key': idempotent_request_key,
  138. 138 : 'requestor_type': requestor_type,
  139. 139 : 'requestor': opts['requestor'],
  140. 140 : 'X-OPAY-Headers': opts['x_opay_headers']
  141. 141 : };
  142. 142 : var formParams = {
  143. 143 : };
  144. 144 :
  145. 145 : var authNames = [];
  146. 146 : var contentTypes = ['application/json'];
  147. 147 : var accepts = ['application/json'];
  148. 148 : var returnType = DeleteResponse;
  149. 149 :
  150. 150 : return this.apiClient.callApi(
  151. 151 : '/customers/{ID_CUSTOMER}/paymentsetups/{ID_PAYMENT_SETUP}', 'DELETE',
  152. 152 : pathParams, queryParams, headerParams, formParams, postBody,
  153. 153 : authNames, contentTypes, accepts, returnType, callback
  154. 154 : );
  155. 155 : };
  156. 156 :
  157. 157 : /**
  158. 158 : * Callback function to receive the result of the getPaymentSetup operation.
  159. 159 : * @callback module:api/PaymentSetupApi~getPaymentSetupCallback
  160. 160 : * @param {String} error Error message, if any.
  161. 161 : * @param {module:models/PaymentSetupResponse} data The data returned by the service call.
  162. 162 : * @param {String} response The complete HTTP response.
  163. 163 : */
  164. 164 :
  165. 165 : /**
  166. 166 : * Get Payment Setup
  167. 167 : * The API is used to retrieve the details of a recurring payment setup by id.
  168. 168 : * @param {String} channel The channel through which the API is invoked.
  169. 169 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  170. 170 : * @param {module:models/String} product The product identifier corresponding to the API.
  171. 171 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  172. 172 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  173. 173 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  174. 174 : * @param {String} id_payment_setup The unique identifier assigned by EBPP to the payment setup.
  175. 175 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  176. 176 : * @param {Object} opts Optional parameters
  177. 177 : * @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
  178. 178 : * @param {String} opts.x_opay_headers Intended for the future use.
  179. 179 : * @param {module:api/PaymentSetupApi~getPaymentSetupCallback} callback The callback function, accepting three arguments: error, data, response
  180. 180 : * data is of type: {@link module:models/PaymentSetupResponse}
  181. 181 : */
  182. 182 : this.getPaymentSetup = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment_setup, id_customer, opts, callback) {
  183. 183 : opts = opts || {};
  184. 184 : var postBody = null;
  185. 185 :
  186. 186 : var pathParams = {
  187. 187 : 'ID_PAYMENT_SETUP': id_payment_setup,
  188. 188 : 'ID_CUSTOMER': id_customer
  189. 189 : };
  190. 190 : var queryParams = {
  191. 191 : };
  192. 192 : var headerParams = {
  193. 193 : 'channel': channel,
  194. 194 : 'client_key': client_key,
  195. 195 : 'product': product,
  196. 196 : 'timestamp': timestamp,
  197. 197 : 'idempotent_request_key': idempotent_request_key,
  198. 198 : 'requestor_type': requestor_type,
  199. 199 : 'requestor': opts['requestor'],
  200. 200 : 'X-OPAY-Headers': opts['x_opay_headers']
  201. 201 : };
  202. 202 : var formParams = {
  203. 203 : };
  204. 204 :
  205. 205 : var authNames = [];
  206. 206 : var contentTypes = [];
  207. 207 : var accepts = ['application/json'];
  208. 208 : var returnType = PaymentSetupResponse;
  209. 209 :
  210. 210 : return this.apiClient.callApi(
  211. 211 : '/customers/{ID_CUSTOMER}/paymentsetups/{ID_PAYMENT_SETUP}', 'GET',
  212. 212 : pathParams, queryParams, headerParams, formParams, postBody,
  213. 213 : authNames, contentTypes, accepts, returnType, callback
  214. 214 : );
  215. 215 : };
  216. 216 :
  217. 217 : /**
  218. 218 : * Callback function to receive the result of the retrievePaymentSetups operation.
  219. 219 : * @callback module:api/PaymentSetupApi~retrievePaymentSetupsCallback
  220. 220 : * @param {String} error Error message, if any.
  221. 221 : * @param {module:models/PaymentSetupsResponse} data The data returned by the service call.
  222. 222 : * @param {String} response The complete HTTP response.
  223. 223 : */
  224. 224 :
  225. 225 : /**
  226. 226 : * Retrieve Payment Setups
  227. 227 : * 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. If the requestor type is customer then the id_customer request parameter is mandatory.
  228. 228 : * @param {String} channel The channel through which the API is invoked.
  229. 229 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  230. 230 : * @param {module:models/String} product The product identifier corresponding to the API.
  231. 231 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  232. 232 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  233. 233 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  234. 234 : * @param {Object} opts Optional parameters
  235. 235 : * @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
  236. 236 : * @param {String} opts.x_opay_headers Intended for the future use.
  237. 237 : * @param {String} opts.id_customer The unique identifier assigned by EBPP to the customer.
  238. 238 : * @param {String} opts.id_funding_account The unique identifier assigned by EBPP to the funding account
  239. 239 : * @param {String} opts.id_customer_account The unique identifier assigned by EBPP to the customer account
  240. 240 : * @param {String} opts.confirmation_number The confirmation number or reference provided to the customer for the successful payment.
  241. 241 : * @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....
  242. 242 : * @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....
  243. 243 : * @param {String} opts.from_date The date from which recurring payments setup, matching the criteria specified, need to be retrieved.
  244. 244 : * @param {String} opts.to_date The date upto which recurring payments setup, matching the criteria specified, need to be retrieved.
  245. 245 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  246. 246 : * @param {String} opts.query_id query id of the Retrieve/Search Customers lookup.
  247. 247 : * @param {String} opts.from_index To fetch the next set of objects that start after this object
  248. 248 : * @param {String} opts.to_index To fetch the previous set of objects that end at this object
  249. 249 : * @param {module:api/PaymentSetupApi~retrievePaymentSetupsCallback} callback The callback function, accepting three arguments: error, data, response
  250. 250 : * data is of type: {@link module:models/PaymentSetupsResponse}
  251. 251 : */
  252. 252 : this.retrievePaymentSetups = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, opts, callback) {
  253. 253 : opts = opts || {};
  254. 254 : var postBody = null;
  255. 255 :
  256. 256 : var pathParams = {
  257. 257 : };
  258. 258 : var queryParams = {
  259. 259 : 'id_customer': opts['id_customer'],
  260. 260 : 'id_funding_account': opts['id_funding_account'],
  261. 261 : 'id_customer_account': opts['id_customer_account'],
  262. 262 : 'confirmation_number': opts['confirmation_number'],
  263. 263 : 'status': opts['status'],
  264. 264 : 'payment_setup_schedule_type': opts['payment_setup_schedule_type'],
  265. 265 : 'from_date': opts['from_date'],
  266. 266 : 'to_date': opts['to_date'],
  267. 267 : 'page_size': opts['page_size'],
  268. 268 : 'query_id': opts['query_id'],
  269. 269 : 'from_index': opts['from_index'],
  270. 270 : 'to_index': opts['to_index']
  271. 271 : };
  272. 272 : var headerParams = {
  273. 273 : 'channel': channel,
  274. 274 : 'client_key': client_key,
  275. 275 : 'product': product,
  276. 276 : 'timestamp': timestamp,
  277. 277 : 'idempotent_request_key': idempotent_request_key,
  278. 278 : 'requestor_type': requestor_type,
  279. 279 : 'requestor': opts['requestor'],
  280. 280 : 'X-OPAY-Headers': opts['x_opay_headers']
  281. 281 : };
  282. 282 : var formParams = {
  283. 283 : };
  284. 284 :
  285. 285 : var authNames = [];
  286. 286 : var contentTypes = [];
  287. 287 : var accepts = ['application/json'];
  288. 288 : var returnType = PaymentSetupsResponse;
  289. 289 :
  290. 290 : return this.apiClient.callApi(
  291. 291 : '/paymentsetups', 'GET',
  292. 292 : pathParams, queryParams, headerParams, formParams, postBody,
  293. 293 : authNames, contentTypes, accepts, returnType, callback
  294. 294 : );
  295. 295 : };
  296. 296 :
  297. 297 : /**
  298. 298 : * Callback function to receive the result of the updatePaymentSetup operation.
  299. 299 : * @callback module:api/PaymentSetupApi~updatePaymentSetupCallback
  300. 300 : * @param {String} error Error message, if any.
  301. 301 : * @param {module:models/PaymentSetupResponse} data The data returned by the service call.
  302. 302 : * @param {String} response The complete HTTP response.
  303. 303 : */
  304. 304 :
  305. 305 : /**
  306. 306 : * Update Payment Setup
  307. 307 : * The API is used to edit a payment Setup. Only autopay payment setup is allowed to edit.
  308. 308 : * @param {String} channel The channel through which the API is invoked.
  309. 309 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  310. 310 : * @param {module:models/String} product The product identifier corresponding to the API.
  311. 311 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  312. 312 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  313. 313 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  314. 314 : * @param {String} id_payment_setup The unique identifier assigned by EBPP to the payment setup.
  315. 315 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  316. 316 : * @param {module:models/UpdatePaymentSetupRequest} update_payment_setup_request Details of the Payment Setup to be updated.
  317. 317 : * @param {Object} opts Optional parameters
  318. 318 : * @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
  319. 319 : * @param {String} opts.x_opay_headers Intended for the future use.
  320. 320 : * @param {module:api/PaymentSetupApi~updatePaymentSetupCallback} callback The callback function, accepting three arguments: error, data, response
  321. 321 : * data is of type: {@link module:models/PaymentSetupResponse}
  322. 322 : */
  323. 323 : this.updatePaymentSetup = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment_setup, id_customer, update_payment_setup_request, opts, callback) {
  324. 324 : opts = opts || {};
  325. 325 : var postBody = update_payment_setup_request;
  326. 326 :
  327. 327 : var pathParams = {
  328. 328 : 'ID_PAYMENT_SETUP': id_payment_setup,
  329. 329 : 'ID_CUSTOMER': id_customer
  330. 330 : };
  331. 331 : var queryParams = {
  332. 332 : };
  333. 333 : var headerParams = {
  334. 334 : 'channel': channel,
  335. 335 : 'client_key': client_key,
  336. 336 : 'product': product,
  337. 337 : 'timestamp': timestamp,
  338. 338 : 'idempotent_request_key': idempotent_request_key,
  339. 339 : 'requestor_type': requestor_type,
  340. 340 : 'requestor': opts['requestor'],
  341. 341 : 'X-OPAY-Headers': opts['x_opay_headers']
  342. 342 : };
  343. 343 : var formParams = {
  344. 344 : };
  345. 345 :
  346. 346 : var authNames = [];
  347. 347 : var contentTypes = ['application/json'];
  348. 348 : var accepts = ['application/json'];
  349. 349 : var returnType = PaymentSetupResponse;
  350. 350 :
  351. 351 : return this.apiClient.callApi(
  352. 352 : '/customers/{ID_CUSTOMER}/paymentsetups/{ID_PAYMENT_SETUP}', 'PUT',
  353. 353 : pathParams, queryParams, headerParams, formParams, postBody,
  354. 354 : authNames, contentTypes, accepts, returnType, callback
  355. 355 : );
  356. 356 : };
  357. 357 : };
  358. 358 :
  359. 359 : return exports;
  360. 360 : }));