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/CreatePaymentRequest', 'models/DeletePaymentRequest', 'models/DeleteRecordedPaymentRequest', 'models/DeleteResponse', 'models/ErrorResponseVo', 'models/PaymentResponse', 'models/PaymentsResponse', 'models/RecordPaymentRequest', 'models/RecordedPaymentResponse', 'models/SimplePaymentRequest', 'models/SimplePaymentResponse', 'models/UpdatePaymentRequest'], 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/CreatePaymentRequest'), require('../models/DeletePaymentRequest'), require('../models/DeleteRecordedPaymentRequest'), require('../models/DeleteResponse'), require('../models/ErrorResponseVo'), require('../models/PaymentResponse'), require('../models/PaymentsResponse'), require('../models/RecordPaymentRequest'), require('../models/RecordedPaymentResponse'), require('../models/SimplePaymentRequest'), require('../models/SimplePaymentResponse'), require('../models/UpdatePaymentRequest'));
  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.PaymentApi = factory(root.OrbipayPaymentsapiClient.ApiClient, root.OrbipayPaymentsapiClient.CreatePaymentRequest, root.OrbipayPaymentsapiClient.DeletePaymentRequest, root.OrbipayPaymentsapiClient.DeleteRecordedPaymentRequest, root.OrbipayPaymentsapiClient.DeleteResponse, root.OrbipayPaymentsapiClient.ErrorResponseVo, root.OrbipayPaymentsapiClient.PaymentResponse, root.OrbipayPaymentsapiClient.PaymentsResponse, root.OrbipayPaymentsapiClient.RecordPaymentRequest, root.OrbipayPaymentsapiClient.RecordedPaymentResponse, root.OrbipayPaymentsapiClient.SimplePaymentRequest, root.OrbipayPaymentsapiClient.SimplePaymentResponse, root.OrbipayPaymentsapiClient.UpdatePaymentRequest);
  15. 15 : }
  16. 16 : }(this, function(ApiClient, CreatePaymentRequest, DeletePaymentRequest, DeleteRecordedPaymentRequest, DeleteResponse, ErrorResponseVo, PaymentResponse, PaymentsResponse, RecordPaymentRequest, RecordedPaymentResponse, SimplePaymentRequest, SimplePaymentResponse, UpdatePaymentRequest) {
  17. 17 : 'use strict';
  18. 18 :
  19. 19 : /**
  20. 20 : * Payment service.
  21. 21 : * @module api/PaymentApi
  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 PaymentApi.
  28. 28 : * @alias module:api/PaymentApi
  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 createPayment operation.
  39. 39 : * @callback module:api/PaymentApi~createPaymentCallback
  40. 40 : * @param {String} error Error message, if any.
  41. 41 : * @param {module:models/PaymentResponse} 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
  47. 47 : * The API is used to make payments to service a customer account. Client systems can provide the unique identifier for the payment in their system as payment_reference.&lt;p&gt;Fee amount and fee type are conditional and should be provided if the details of the fee to be charged are maintained in the client system. The fee types that are supported in EBPP are add_to_principal and bill_separately. Alternatively, the fee information can be setup in EBPP, in which case, these fields are ignored. If fee information is setup in the system, the details of the fee are returned in the response.&lt;/p&gt; &lt;p&gt; if payment_authorization.id is passed then the payment is charged from the amount that is hold as part of the create payment authorization API &lt;/p&gt;
  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/CreatePaymentRequest} create_payment_request JSON containing all the fields required to make a payment.
  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/PaymentApi~createPaymentCallback} callback The callback function, accepting three arguments: error, data, response
  61. 61 : * data is of type: {@link module:models/PaymentResponse}
  62. 62 : */
  63. 63 : this.createPayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, create_payment_request, opts, callback) {
  64. 64 : opts = opts || {};
  65. 65 : var postBody = create_payment_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 = PaymentResponse;
  90. 90 :
  91. 91 : return this.apiClient.callApi(
  92. 92 : '/customers/{ID_CUSTOMER}/payments', '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 deletePayment operation.
  100. 100 : * @callback module:api/PaymentApi~deletePaymentCallback
  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
  108. 108 : * The API is used to delete or cancel a payment. Payments that are under processing or have already been processed cannot be deleted.
  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 The unique identifier assigned by EBPP to the payment.
  116. 116 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  117. 117 : * @param {module:models/DeletePaymentRequest} delete_payment_request Details of payment to be deleted/cancelled
  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/PaymentApi~deletePaymentCallback} 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.deletePayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, id_customer, delete_payment_request, opts, callback) {
  126. 126 : opts = opts || {};
  127. 127 : var postBody = delete_payment_request;
  128. 128 :
  129. 129 : var pathParams = {
  130. 130 : 'ID_PAYMENT': id_payment,
  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}/payments/{ID_PAYMENT}', '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 deleteRecordPayment operation.
  163. 163 : * @callback module:api/PaymentApi~deleteRecordPaymentCallback
  164. 164 : * @param {String} error Error message, if any.
  165. 165 : * @param data This operation does not return a value.
  166. 166 : * @param {String} response The complete HTTP response.
  167. 167 : */
  168. 168 :
  169. 169 : /**
  170. 170 : * Delete Recorded Payment
  171. 171 : * The API is used to delete the recorded payment. It returns 204 http status code with empty body in successful case
  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 The unique identifier assigned by EBPP to the payment.
  179. 179 : * @param {module:models/DeleteRecordedPaymentRequest} delete_recorded_payment_request Details of payment to be deleted/cancelled
  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/PaymentApi~deleteRecordPaymentCallback} callback The callback function, accepting three arguments: error, data, response
  185. 185 : */
  186. 186 : this.deleteRecordPayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, delete_recorded_payment_request, opts, callback) {
  187. 187 : opts = opts || {};
  188. 188 : var postBody = delete_recorded_payment_request;
  189. 189 :
  190. 190 : var pathParams = {
  191. 191 : 'ID_PAYMENT': id_payment
  192. 192 : };
  193. 193 : var queryParams = {
  194. 194 : };
  195. 195 : var headerParams = {
  196. 196 : 'channel': channel,
  197. 197 : 'client_key': client_key,
  198. 198 : 'product': product,
  199. 199 : 'timestamp': timestamp,
  200. 200 : 'idempotent_request_key': idempotent_request_key,
  201. 201 : 'requestor_type': requestor_type,
  202. 202 : 'requestor': opts['requestor'],
  203. 203 : 'X-OPAY-Headers': opts['x_opay_headers'],
  204. 204 : 'trace_id': opts['trace_id']
  205. 205 : };
  206. 206 : var formParams = {
  207. 207 : };
  208. 208 :
  209. 209 : var authNames = [];
  210. 210 : var contentTypes = ['application/json'];
  211. 211 : var accepts = ['application/json'];
  212. 212 : var returnType = null;
  213. 213 :
  214. 214 : return this.apiClient.callApi(
  215. 215 : '/recordedpayments/{ID_PAYMENT}', 'DELETE',
  216. 216 : pathParams, queryParams, headerParams, formParams, postBody,
  217. 217 : authNames, contentTypes, accepts, returnType, callback
  218. 218 : );
  219. 219 : };
  220. 220 :
  221. 221 : /**
  222. 222 : * Callback function to receive the result of the getPayment operation.
  223. 223 : * @callback module:api/PaymentApi~getPaymentCallback
  224. 224 : * @param {String} error Error message, if any.
  225. 225 : * @param {module:models/PaymentResponse} data The data returned by the service call.
  226. 226 : * @param {String} response The complete HTTP response.
  227. 227 : */
  228. 228 :
  229. 229 : /**
  230. 230 : * Get Payment
  231. 231 : * The API is used to retrieve the details of a payment or a recorded payment by id.
  232. 232 : * @param {String} channel The channel through which the API is invoked.
  233. 233 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  234. 234 : * @param {module:models/String} product The product identifier corresponding to the API.
  235. 235 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  236. 236 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  237. 237 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  238. 238 : * @param {String} id_payment The unique identifier assigned by EBPP to the payment.
  239. 239 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  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 {module:api/PaymentApi~getPaymentCallback} callback The callback function, accepting three arguments: error, data, response
  245. 245 : * data is of type: {@link module:models/PaymentResponse}
  246. 246 : */
  247. 247 : this.getPayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, id_customer, opts, callback) {
  248. 248 : opts = opts || {};
  249. 249 : var postBody = null;
  250. 250 :
  251. 251 : var pathParams = {
  252. 252 : 'ID_PAYMENT': id_payment,
  253. 253 : 'ID_CUSTOMER': id_customer
  254. 254 : };
  255. 255 : var queryParams = {
  256. 256 : };
  257. 257 : var headerParams = {
  258. 258 : 'channel': channel,
  259. 259 : 'client_key': client_key,
  260. 260 : 'product': product,
  261. 261 : 'timestamp': timestamp,
  262. 262 : 'idempotent_request_key': idempotent_request_key,
  263. 263 : 'requestor_type': requestor_type,
  264. 264 : 'requestor': opts['requestor'],
  265. 265 : 'X-OPAY-Headers': opts['x_opay_headers'],
  266. 266 : 'trace_id': opts['trace_id']
  267. 267 : };
  268. 268 : var formParams = {
  269. 269 : };
  270. 270 :
  271. 271 : var authNames = [];
  272. 272 : var contentTypes = [];
  273. 273 : var accepts = ['application/json'];
  274. 274 : var returnType = PaymentResponse;
  275. 275 :
  276. 276 : return this.apiClient.callApi(
  277. 277 : '/customers/{ID_CUSTOMER}/payments/{ID_PAYMENT}', 'GET',
  278. 278 : pathParams, queryParams, headerParams, formParams, postBody,
  279. 279 : authNames, contentTypes, accepts, returnType, callback
  280. 280 : );
  281. 281 : };
  282. 282 :
  283. 283 : /**
  284. 284 : * Callback function to receive the result of the recordPayment operation.
  285. 285 : * @callback module:api/PaymentApi~recordPaymentCallback
  286. 286 : * @param {String} error Error message, if any.
  287. 287 : * @param {module:models/RecordedPaymentResponse} data The data returned by the service call.
  288. 288 : * @param {String} response The complete HTTP response.
  289. 289 : */
  290. 290 :
  291. 291 : /**
  292. 292 : * Record Payment
  293. 293 : * The API is used to record payments in EBPP those are made and fulfilled outside EBPP.
  294. 294 : * @param {String} channel The channel through which the API is invoked.
  295. 295 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  296. 296 : * @param {module:models/String} product The product identifier corresponding to the API.
  297. 297 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  298. 298 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  299. 299 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  300. 300 : * @param {module:models/RecordPaymentRequest} record_payment_request JSON containing all the fields required to record a payment.
  301. 301 : * @param {Object} opts Optional parameters
  302. 302 : * @param {String} opts.requestor The identifier for the requestor of the API.
  303. 303 : * @param {String} opts.x_opay_headers Intended for the future use.
  304. 304 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  305. 305 : * @param {module:api/PaymentApi~recordPaymentCallback} callback The callback function, accepting three arguments: error, data, response
  306. 306 : * data is of type: {@link module:models/RecordedPaymentResponse}
  307. 307 : */
  308. 308 : this.recordPayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, record_payment_request, opts, callback) {
  309. 309 : opts = opts || {};
  310. 310 : var postBody = record_payment_request;
  311. 311 :
  312. 312 : var pathParams = {
  313. 313 : };
  314. 314 : var queryParams = {
  315. 315 : };
  316. 316 : var headerParams = {
  317. 317 : 'channel': channel,
  318. 318 : 'client_key': client_key,
  319. 319 : 'product': product,
  320. 320 : 'timestamp': timestamp,
  321. 321 : 'idempotent_request_key': idempotent_request_key,
  322. 322 : 'requestor_type': requestor_type,
  323. 323 : 'requestor': opts['requestor'],
  324. 324 : 'X-OPAY-Headers': opts['x_opay_headers'],
  325. 325 : 'trace_id': opts['trace_id']
  326. 326 : };
  327. 327 : var formParams = {
  328. 328 : };
  329. 329 :
  330. 330 : var authNames = [];
  331. 331 : var contentTypes = ['application/json'];
  332. 332 : var accepts = ['application/json'];
  333. 333 : var returnType = RecordedPaymentResponse;
  334. 334 :
  335. 335 : return this.apiClient.callApi(
  336. 336 : '/recordedpayments', 'POST',
  337. 337 : pathParams, queryParams, headerParams, formParams, postBody,
  338. 338 : authNames, contentTypes, accepts, returnType, callback
  339. 339 : );
  340. 340 : };
  341. 341 :
  342. 342 : /**
  343. 343 : * Callback function to receive the result of the retrieveFeePayment operation.
  344. 344 : * @callback module:api/PaymentApi~retrieveFeePaymentCallback
  345. 345 : * @param {String} error Error message, if any.
  346. 346 : * @param {module:models/PaymentResponse} data The data returned by the service call.
  347. 347 : * @param {String} response The complete HTTP response.
  348. 348 : */
  349. 349 :
  350. 350 : /**
  351. 351 : * Get Fee Payment
  352. 352 : * The API is used to retrieve the details of a fee payment by id.
  353. 353 : * @param {String} channel The channel through which the API is invoked.
  354. 354 : * @param {String} client_key The unique identifier assigned by OrbiPay to the client.
  355. 355 : * @param {module:models/String} product The product identifier corresponding to the API.
  356. 356 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  357. 357 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  358. 358 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  359. 359 : * @param {String} id_fee The unique identifier assigned by OrbiPay to the FeePayment.
  360. 360 : * @param {String} id_customer The unique identifier assigned by OrbiPay to the customer.
  361. 361 : * @param {Object} opts Optional parameters
  362. 362 : * @param {String} opts.requestor The identifier for the requestor of the API.
  363. 363 : * @param {String} opts.x_opay_headers Intended for the future use.
  364. 364 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  365. 365 : * @param {module:api/PaymentApi~retrieveFeePaymentCallback} callback The callback function, accepting three arguments: error, data, response
  366. 366 : * data is of type: {@link module:models/PaymentResponse}
  367. 367 : */
  368. 368 : this.retrieveFeePayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_fee, id_customer, opts, callback) {
  369. 369 : opts = opts || {};
  370. 370 : var postBody = null;
  371. 371 :
  372. 372 : var pathParams = {
  373. 373 : 'ID_FEE': id_fee,
  374. 374 : 'ID_CUSTOMER': id_customer
  375. 375 : };
  376. 376 : var queryParams = {
  377. 377 : };
  378. 378 : var headerParams = {
  379. 379 : 'channel': channel,
  380. 380 : 'client_key': client_key,
  381. 381 : 'product': product,
  382. 382 : 'timestamp': timestamp,
  383. 383 : 'idempotent_request_key': idempotent_request_key,
  384. 384 : 'requestor_type': requestor_type,
  385. 385 : 'requestor': opts['requestor'],
  386. 386 : 'X-OPAY-Headers': opts['x_opay_headers'],
  387. 387 : 'trace_id': opts['trace_id']
  388. 388 : };
  389. 389 : var formParams = {
  390. 390 : };
  391. 391 :
  392. 392 : var authNames = [];
  393. 393 : var contentTypes = [];
  394. 394 : var accepts = ['application/json'];
  395. 395 : var returnType = PaymentResponse;
  396. 396 :
  397. 397 : return this.apiClient.callApi(
  398. 398 : '/customers/{ID_CUSTOMER}/fees/{ID_FEE}', 'GET',
  399. 399 : pathParams, queryParams, headerParams, formParams, postBody,
  400. 400 : authNames, contentTypes, accepts, returnType, callback
  401. 401 : );
  402. 402 : };
  403. 403 :
  404. 404 : /**
  405. 405 : * Callback function to receive the result of the retrievePayments operation.
  406. 406 : * @callback module:api/PaymentApi~retrievePaymentsCallback
  407. 407 : * @param {String} error Error message, if any.
  408. 408 : * @param {module:models/PaymentsResponse} data The data returned by the service call.
  409. 409 : * @param {String} response The complete HTTP response.
  410. 410 : */
  411. 411 :
  412. 412 : /**
  413. 413 : * Retrieve Payments
  414. 414 : * The API is used to retrieve the payments and recorded payments made by a customer. Payments can be filtered using the confirmation number, customer account, funding account, status and payment schedule type, payment method, by date range and others mentioned below. If no dates are provided for retrieval, payments in the last six months and all the payments scheduled for a future date are returned. In case a payment has failed due to ACH returns, then the payment return date and the return code will be available in the response. The results are sorted in descending order of the payment_date followed by the last_modified_time.
  415. 415 : * @param {String} channel The channel through which the API is invoked.
  416. 416 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  417. 417 : * @param {module:models/String} product The product identifier corresponding to the API.
  418. 418 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  419. 419 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  420. 420 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  421. 421 : * @param {Object} opts Optional parameters
  422. 422 : * @param {String} opts.requestor The identifier for the requestor of the API.
  423. 423 : * @param {String} opts.x_opay_headers Intended for the future use.
  424. 424 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  425. 425 : * @param {String} opts.id_customer The unique identifier assigned by EBPP to the customer.
  426. 426 : * @param {String} opts.id_funding_account The unique identifier assigned by EBPP to the funding account
  427. 427 : * @param {String} opts.id_customer_account The unique identifier assigned by EBPP to the customer account
  428. 428 : * @param {String} opts.confirmation_number The confirmation number or reference provided to the customer for the successful payment.
  429. 429 : * @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....
  430. 430 : * @param {Array.<module:models/String>} opts.payment_schedule_type The schedule type for the payment setup. This can take multiple values in the format key&#x3D;value1&amp;key&#x3D;value2....
  431. 431 : * @param {Array.<module:models/String>} opts.payment_method The fulfillment method for the payment.
  432. 432 : * @param {String} opts.from_date The date from which payments, matching the criteria specified, need to be retrieved.
  433. 433 : * @param {String} opts.to_date The date upto which payments, matching the criteria specified, need to be retrieved.
  434. 434 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  435. 435 : * @param {String} opts.query_id query id of the Retrieve/Search Customers lookup.
  436. 436 : * @param {String} opts.from_index To fetch the next set of objects that start after this object
  437. 437 : * @param {String} opts.to_index To fetch the previous set of objects that end at this object
  438. 438 : * @param {module:api/PaymentApi~retrievePaymentsCallback} callback The callback function, accepting three arguments: error, data, response
  439. 439 : * data is of type: {@link module:models/PaymentsResponse}
  440. 440 : */
  441. 441 : this.retrievePayments = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, opts, callback) {
  442. 442 : opts = opts || {};
  443. 443 : var postBody = null;
  444. 444 :
  445. 445 : var pathParams = {
  446. 446 : };
  447. 447 : var queryParams = {
  448. 448 : 'id_customer': opts['id_customer'],
  449. 449 : 'id_funding_account': opts['id_funding_account'],
  450. 450 : 'id_customer_account': opts['id_customer_account'],
  451. 451 : 'confirmation_number': opts['confirmation_number'],
  452. 452 : 'status': opts['status'],
  453. 453 : 'payment_schedule_type': opts['payment_schedule_type'],
  454. 454 : 'payment_method': opts['payment_method'],
  455. 455 : 'from_date': opts['from_date'],
  456. 456 : 'to_date': opts['to_date'],
  457. 457 : 'page_size': opts['page_size'],
  458. 458 : 'query_id': opts['query_id'],
  459. 459 : 'from_index': opts['from_index'],
  460. 460 : 'to_index': opts['to_index']
  461. 461 : };
  462. 462 : var headerParams = {
  463. 463 : 'channel': channel,
  464. 464 : 'client_key': client_key,
  465. 465 : 'product': product,
  466. 466 : 'timestamp': timestamp,
  467. 467 : 'idempotent_request_key': idempotent_request_key,
  468. 468 : 'requestor_type': requestor_type,
  469. 469 : 'requestor': opts['requestor'],
  470. 470 : 'X-OPAY-Headers': opts['x_opay_headers'],
  471. 471 : 'trace_id': opts['trace_id']
  472. 472 : };
  473. 473 : var formParams = {
  474. 474 : };
  475. 475 :
  476. 476 : var authNames = [];
  477. 477 : var contentTypes = [];
  478. 478 : var accepts = ['application/json'];
  479. 479 : var returnType = PaymentsResponse;
  480. 480 :
  481. 481 : return this.apiClient.callApi(
  482. 482 : '/payments', 'GET',
  483. 483 : pathParams, queryParams, headerParams, formParams, postBody,
  484. 484 : authNames, contentTypes, accepts, returnType, callback
  485. 485 : );
  486. 486 : };
  487. 487 :
  488. 488 : /**
  489. 489 : * Callback function to receive the result of the simplePayment operation.
  490. 490 : * @callback module:api/PaymentApi~simplePaymentCallback
  491. 491 : * @param {String} error Error message, if any.
  492. 492 : * @param {module:models/SimplePaymentResponse} data The data returned by the service call.
  493. 493 : * @param {String} response The complete HTTP response.
  494. 494 : */
  495. 495 :
  496. 496 : /**
  497. 497 : * Simple Payment
  498. 498 : * The API is used to make payments to service a customer account. Client systems can provide the unique identifier for the payment in their system as payment_reference. Fee amount and fee type are conditional and should be provided if the details of the fee to be charged are maintained in the client system. The fee types that are supported in EBPP are add_to_principal and bill_separately. Alternatively, the fee information can be setup in EBPP, in which case, these fields are ignored. If fee information is setup in the system, the details of the fee are returned in the response. This API updates the details of the customer, customer account and the funding account if those exist in EBPP or creates them otherwise.
  499. 499 : * @param {String} channel The channel through which the API is invoked.
  500. 500 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  501. 501 : * @param {module:models/String} product The product identifier corresponding to the API.
  502. 502 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  503. 503 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  504. 504 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  505. 505 : * @param {module:models/SimplePaymentRequest} simple_payment_request JSON containing all the fields required to make a payment.
  506. 506 : * @param {Object} opts Optional parameters
  507. 507 : * @param {String} opts.requestor The identifier for the requestor of the API.
  508. 508 : * @param {String} opts.x_opay_headers Intended for the future use.
  509. 509 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  510. 510 : * @param {module:models/String} opts.save_funding_account query param
  511. 511 : * @param {module:api/PaymentApi~simplePaymentCallback} callback The callback function, accepting three arguments: error, data, response
  512. 512 : * data is of type: {@link module:models/SimplePaymentResponse}
  513. 513 : */
  514. 514 : this.simplePayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, simple_payment_request, opts, callback) {
  515. 515 : opts = opts || {};
  516. 516 : var postBody = simple_payment_request;
  517. 517 :
  518. 518 : var pathParams = {
  519. 519 : };
  520. 520 : var queryParams = {
  521. 521 : 'save_funding_account': opts['save_funding_account']
  522. 522 : };
  523. 523 : var headerParams = {
  524. 524 : 'channel': channel,
  525. 525 : 'client_key': client_key,
  526. 526 : 'product': product,
  527. 527 : 'timestamp': timestamp,
  528. 528 : 'idempotent_request_key': idempotent_request_key,
  529. 529 : 'requestor_type': requestor_type,
  530. 530 : 'requestor': opts['requestor'],
  531. 531 : 'X-OPAY-Headers': opts['x_opay_headers'],
  532. 532 : 'trace_id': opts['trace_id']
  533. 533 : };
  534. 534 : var formParams = {
  535. 535 : };
  536. 536 :
  537. 537 : var authNames = [];
  538. 538 : var contentTypes = ['application/json'];
  539. 539 : var accepts = ['application/json'];
  540. 540 : var returnType = SimplePaymentResponse;
  541. 541 :
  542. 542 : return this.apiClient.callApi(
  543. 543 : '/payments', 'POST',
  544. 544 : pathParams, queryParams, headerParams, formParams, postBody,
  545. 545 : authNames, contentTypes, accepts, returnType, callback
  546. 546 : );
  547. 547 : };
  548. 548 :
  549. 549 : /**
  550. 550 : * Callback function to receive the result of the updatePayment operation.
  551. 551 : * @callback module:api/PaymentApi~updatePaymentCallback
  552. 552 : * @param {String} error Error message, if any.
  553. 553 : * @param {module:models/PaymentResponse} data The data returned by the service call.
  554. 554 : * @param {String} response The complete HTTP response.
  555. 555 : */
  556. 556 :
  557. 557 : /**
  558. 558 : * Update Payment
  559. 559 : * The API is used to edit a payment. Only payments in scheduled status can be edited.
  560. 560 : * @param {String} channel The channel through which the API is invoked.
  561. 561 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  562. 562 : * @param {module:models/String} product The product identifier corresponding to the API.
  563. 563 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  564. 564 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  565. 565 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  566. 566 : * @param {String} id_payment The unique identifier assigned by EBPP to the payment.
  567. 567 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  568. 568 : * @param {module:models/UpdatePaymentRequest} update_payment_request Details of the Payment to be updated.
  569. 569 : * @param {Object} opts Optional parameters
  570. 570 : * @param {String} opts.requestor The identifier for the requestor of the API.
  571. 571 : * @param {String} opts.x_opay_headers Intended for the future use.
  572. 572 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  573. 573 : * @param {module:api/PaymentApi~updatePaymentCallback} callback The callback function, accepting three arguments: error, data, response
  574. 574 : * data is of type: {@link module:models/PaymentResponse}
  575. 575 : */
  576. 576 : this.updatePayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, id_customer, update_payment_request, opts, callback) {
  577. 577 : opts = opts || {};
  578. 578 : var postBody = update_payment_request;
  579. 579 :
  580. 580 : var pathParams = {
  581. 581 : 'ID_PAYMENT': id_payment,
  582. 582 : 'ID_CUSTOMER': id_customer
  583. 583 : };
  584. 584 : var queryParams = {
  585. 585 : };
  586. 586 : var headerParams = {
  587. 587 : 'channel': channel,
  588. 588 : 'client_key': client_key,
  589. 589 : 'product': product,
  590. 590 : 'timestamp': timestamp,
  591. 591 : 'idempotent_request_key': idempotent_request_key,
  592. 592 : 'requestor_type': requestor_type,
  593. 593 : 'requestor': opts['requestor'],
  594. 594 : 'X-OPAY-Headers': opts['x_opay_headers'],
  595. 595 : 'trace_id': opts['trace_id']
  596. 596 : };
  597. 597 : var formParams = {
  598. 598 : };
  599. 599 :
  600. 600 : var authNames = [];
  601. 601 : var contentTypes = ['application/json'];
  602. 602 : var accepts = ['application/json'];
  603. 603 : var returnType = PaymentResponse;
  604. 604 :
  605. 605 : return this.apiClient.callApi(
  606. 606 : '/customers/{ID_CUSTOMER}/payments/{ID_PAYMENT}', 'PUT',
  607. 607 : pathParams, queryParams, headerParams, formParams, postBody,
  608. 608 : authNames, contentTypes, accepts, returnType, callback
  609. 609 : );
  610. 610 : };
  611. 611 : };
  612. 612 :
  613. 613 : return exports;
  614. 614 : }));