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/CustomerAccountResponse', 'models/CustomerAccountsResponse', 'models/ErrorResponseVo', 'models/RenewCustomerAccountRequest'], 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/CustomerAccountResponse'), require('../models/CustomerAccountsResponse'), require('../models/ErrorResponseVo'), require('../models/RenewCustomerAccountRequest'));
  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.CustomerAccountApi = factory(root.OrbipayPaymentsapiClient.ApiClient, root.OrbipayPaymentsapiClient.CustomerAccountResponse, root.OrbipayPaymentsapiClient.CustomerAccountsResponse, root.OrbipayPaymentsapiClient.ErrorResponseVo, root.OrbipayPaymentsapiClient.RenewCustomerAccountRequest);
  15. 15 : }
  16. 16 : }(this, function(ApiClient, CustomerAccountResponse, CustomerAccountsResponse, ErrorResponseVo, RenewCustomerAccountRequest) {
  17. 17 : 'use strict';
  18. 18 :
  19. 19 : /**
  20. 20 : * CustomerAccount service.
  21. 21 : * @module api/CustomerAccountApi
  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 CustomerAccountApi.
  28. 28 : * @alias module:api/CustomerAccountApi
  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 getCustomerAccount operation.
  39. 39 : * @callback module:api/CustomerAccountApi~getCustomerAccountCallback
  40. 40 : * @param {String} error Error message, if any.
  41. 41 : * @param {module:models/CustomerAccountResponse} 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 : * Get Customer Account
  47. 47 : * The Get Customer Account API is used to retrieve the details of a customer account based on the id.
  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_account The unique identifier assigned by EBPP to the Customer Account.
  55. 55 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  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/CustomerAccountApi~getCustomerAccountCallback} callback The callback function, accepting three arguments: error, data, response
  61. 61 : * data is of type: {@link module:models/CustomerAccountResponse}
  62. 62 : */
  63. 63 : this.getCustomerAccount = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer_account, id_customer, opts, callback) {
  64. 64 : opts = opts || {};
  65. 65 : var postBody = null;
  66. 66 :
  67. 67 : var pathParams = {
  68. 68 : 'ID_CUSTOMER_ACCOUNT': id_customer_account,
  69. 69 : 'ID_CUSTOMER': id_customer
  70. 70 : };
  71. 71 : var queryParams = {
  72. 72 : };
  73. 73 : var headerParams = {
  74. 74 : 'channel': channel,
  75. 75 : 'client_key': client_key,
  76. 76 : 'product': product,
  77. 77 : 'timestamp': timestamp,
  78. 78 : 'idempotent_request_key': idempotent_request_key,
  79. 79 : 'requestor_type': requestor_type,
  80. 80 : 'requestor': opts['requestor'],
  81. 81 : 'X-OPAY-Headers': opts['x_opay_headers'],
  82. 82 : 'trace_id': opts['trace_id']
  83. 83 : };
  84. 84 : var formParams = {
  85. 85 : };
  86. 86 :
  87. 87 : var authNames = [];
  88. 88 : var contentTypes = [];
  89. 89 : var accepts = ['application/json'];
  90. 90 : var returnType = CustomerAccountResponse;
  91. 91 :
  92. 92 : return this.apiClient.callApi(
  93. 93 : '/customers/{ID_CUSTOMER}/customeraccounts/{ID_CUSTOMER_ACCOUNT}', 'GET',
  94. 94 : pathParams, queryParams, headerParams, formParams, postBody,
  95. 95 : authNames, contentTypes, accepts, returnType, callback
  96. 96 : );
  97. 97 : };
  98. 98 :
  99. 99 : /**
  100. 100 : * Callback function to receive the result of the renewCustomerAccount operation.
  101. 101 : * @callback module:api/CustomerAccountApi~renewCustomerAccountCallback
  102. 102 : * @param {String} error Error message, if any.
  103. 103 : * @param {module:models/CustomerAccountResponse} data The data returned by the service call.
  104. 104 : * @param {String} response The complete HTTP response.
  105. 105 : */
  106. 106 :
  107. 107 : /**
  108. 108 : * Renew Customer Account
  109. 109 : * This API is used to renew a customer account. The API migrates all the pending payments and active payment setups from the original customer account to the new one.
  110. 110 : * @param {String} channel The channel through which the API is invoked.
  111. 111 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  112. 112 : * @param {module:models/String} product The product identifier corresponding to the API.
  113. 113 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  114. 114 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  115. 115 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  116. 116 : * @param {String} id_customer_account The unique identifier assigned by EBPP to the Customer Account.
  117. 117 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  118. 118 : * @param {module:models/RenewCustomerAccountRequest} renew_customer_account_request JSON containing all the attributes of the Customer account to be renewed.
  119. 119 : * @param {Object} opts Optional parameters
  120. 120 : * @param {String} opts.requestor The identifier for the requestor of the API.
  121. 121 : * @param {String} opts.x_opay_headers Intended for the future use.
  122. 122 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  123. 123 : * @param {module:api/CustomerAccountApi~renewCustomerAccountCallback} callback The callback function, accepting three arguments: error, data, response
  124. 124 : * data is of type: {@link module:models/CustomerAccountResponse}
  125. 125 : */
  126. 126 : this.renewCustomerAccount = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer_account, id_customer, renew_customer_account_request, opts, callback) {
  127. 127 : opts = opts || {};
  128. 128 : var postBody = renew_customer_account_request;
  129. 129 :
  130. 130 : var pathParams = {
  131. 131 : 'ID_CUSTOMER_ACCOUNT': id_customer_account,
  132. 132 : 'ID_CUSTOMER': id_customer
  133. 133 : };
  134. 134 : var queryParams = {
  135. 135 : };
  136. 136 : var headerParams = {
  137. 137 : 'channel': channel,
  138. 138 : 'client_key': client_key,
  139. 139 : 'product': product,
  140. 140 : 'timestamp': timestamp,
  141. 141 : 'idempotent_request_key': idempotent_request_key,
  142. 142 : 'requestor_type': requestor_type,
  143. 143 : 'requestor': opts['requestor'],
  144. 144 : 'X-OPAY-Headers': opts['x_opay_headers'],
  145. 145 : 'trace_id': opts['trace_id']
  146. 146 : };
  147. 147 : var formParams = {
  148. 148 : };
  149. 149 :
  150. 150 : var authNames = [];
  151. 151 : var contentTypes = ['application/json'];
  152. 152 : var accepts = ['application/json'];
  153. 153 : var returnType = CustomerAccountResponse;
  154. 154 :
  155. 155 : return this.apiClient.callApi(
  156. 156 : '/customers/{ID_CUSTOMER}/customeraccounts/{ID_CUSTOMER_ACCOUNT}/renew', 'POST',
  157. 157 : pathParams, queryParams, headerParams, formParams, postBody,
  158. 158 : authNames, contentTypes, accepts, returnType, callback
  159. 159 : );
  160. 160 : };
  161. 161 :
  162. 162 : /**
  163. 163 : * Callback function to receive the result of the retrieveCustomerAccounts operation.
  164. 164 : * @callback module:api/CustomerAccountApi~retrieveCustomerAccountsCallback
  165. 165 : * @param {String} error Error message, if any.
  166. 166 : * @param {module:models/CustomerAccountsResponse} data The data returned by the service call.
  167. 167 : * @param {String} response The complete HTTP response.
  168. 168 : */
  169. 169 :
  170. 170 : /**
  171. 171 : * Retrieve Customer Accounts
  172. 172 : * The API is used to retrieve all the customer accounts associated with a customer. The accounts can be filtered using the account number, status. The API responds with the first page of the list of customerAccounts matching the criteria. The results are sorted in descending order of the last_modified_time.
  173. 173 : * @param {String} channel The channel through which the API is invoked.
  174. 174 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  175. 175 : * @param {module:models/String} product The product identifier corresponding to the API.
  176. 176 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  177. 177 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  178. 178 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  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 {String} opts.page_size The maximum number of objects returned in the query.
  185. 185 : * @param {String} opts.account_number The Account Number to get details of.
  186. 186 : * @param {Array.<module:models/String>} opts.status The status of the customer&#39;s account in EBPP. This can take multiple values in the format key&#x3D;value1&amp;key&#x3D;value2....
  187. 187 : * @param {module:api/CustomerAccountApi~retrieveCustomerAccountsCallback} callback The callback function, accepting three arguments: error, data, response
  188. 188 : * data is of type: {@link module:models/CustomerAccountsResponse}
  189. 189 : */
  190. 190 : this.retrieveCustomerAccounts = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, opts, callback) {
  191. 191 : opts = opts || {};
  192. 192 : var postBody = null;
  193. 193 :
  194. 194 : var pathParams = {
  195. 195 : 'ID_CUSTOMER': id_customer
  196. 196 : };
  197. 197 : var queryParams = {
  198. 198 : 'page_size': opts['page_size']
  199. 199 : };
  200. 200 : var headerParams = {
  201. 201 : 'channel': channel,
  202. 202 : 'client_key': client_key,
  203. 203 : 'product': product,
  204. 204 : 'timestamp': timestamp,
  205. 205 : 'idempotent_request_key': idempotent_request_key,
  206. 206 : 'requestor_type': requestor_type,
  207. 207 : 'requestor': opts['requestor'],
  208. 208 : 'X-OPAY-Headers': opts['x_opay_headers'],
  209. 209 : 'trace_id': opts['trace_id']
  210. 210 : };
  211. 211 : var formParams = {
  212. 212 : 'account_number': opts['account_number'],
  213. 213 : 'status': this.apiClient.buildCollectionParam(opts['status'], 'multi')
  214. 214 : };
  215. 215 :
  216. 216 : var authNames = [];
  217. 217 : var contentTypes = ['application/x-www-form-urlencoded'];
  218. 218 : var accepts = ['application/json'];
  219. 219 : var returnType = CustomerAccountsResponse;
  220. 220 :
  221. 221 : return this.apiClient.callApi(
  222. 222 : '/customers/{ID_CUSTOMER}/customeraccounts/lists', 'POST',
  223. 223 : pathParams, queryParams, headerParams, formParams, postBody,
  224. 224 : authNames, contentTypes, accepts, returnType, callback
  225. 225 : );
  226. 226 : };
  227. 227 :
  228. 228 : /**
  229. 229 : * Callback function to receive the result of the retrieveCustomerAccountsPage operation.
  230. 230 : * @callback module:api/CustomerAccountApi~retrieveCustomerAccountsPageCallback
  231. 231 : * @param {String} error Error message, if any.
  232. 232 : * @param {module:models/CustomerAccountsResponse} data The data returned by the service call.
  233. 233 : * @param {String} response The complete HTTP response.
  234. 234 : */
  235. 235 :
  236. 236 : /**
  237. 237 : * Retrieve Customer Accounts Pagination
  238. 238 : * This API is used to paginate through the list of customer Accounts returned in the Retrieve Customer Accounts API.
  239. 239 : * @param {String} channel The channel through which the API is invoked.
  240. 240 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  241. 241 : * @param {module:models/String} product The product identifier corresponding to the API.
  242. 242 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  243. 243 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  244. 244 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  245. 245 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  246. 246 : * @param {String} query_id query id of the Retrieve/Search Accounts lookup.
  247. 247 : * @param {Object} opts Optional parameters
  248. 248 : * @param {String} opts.requestor The identifier for the requestor of the API.
  249. 249 : * @param {String} opts.x_opay_headers Intended for the future use.
  250. 250 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  251. 251 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  252. 252 : * @param {String} opts.from_index To fetch the next set of objects that start after this object
  253. 253 : * @param {String} opts.to_index To fetch the previous set of objects that end at this object
  254. 254 : * @param {module:api/CustomerAccountApi~retrieveCustomerAccountsPageCallback} callback The callback function, accepting three arguments: error, data, response
  255. 255 : * data is of type: {@link module:models/CustomerAccountsResponse}
  256. 256 : */
  257. 257 : this.retrieveCustomerAccountsPage = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, query_id, opts, callback) {
  258. 258 : opts = opts || {};
  259. 259 : var postBody = null;
  260. 260 :
  261. 261 : var pathParams = {
  262. 262 : 'ID_CUSTOMER': id_customer
  263. 263 : };
  264. 264 : var queryParams = {
  265. 265 : 'page_size': opts['page_size'],
  266. 266 : 'query_id': query_id,
  267. 267 : 'from_index': opts['from_index'],
  268. 268 : 'to_index': opts['to_index']
  269. 269 : };
  270. 270 : var headerParams = {
  271. 271 : 'channel': channel,
  272. 272 : 'client_key': client_key,
  273. 273 : 'product': product,
  274. 274 : 'timestamp': timestamp,
  275. 275 : 'idempotent_request_key': idempotent_request_key,
  276. 276 : 'requestor_type': requestor_type,
  277. 277 : 'requestor': opts['requestor'],
  278. 278 : 'X-OPAY-Headers': opts['x_opay_headers'],
  279. 279 : 'trace_id': opts['trace_id']
  280. 280 : };
  281. 281 : var formParams = {
  282. 282 : };
  283. 283 :
  284. 284 : var authNames = [];
  285. 285 : var contentTypes = [];
  286. 286 : var accepts = ['application/json'];
  287. 287 : var returnType = CustomerAccountsResponse;
  288. 288 :
  289. 289 : return this.apiClient.callApi(
  290. 290 : '/customers/{ID_CUSTOMER}/customeraccounts/lists', 'GET',
  291. 291 : pathParams, queryParams, headerParams, formParams, postBody,
  292. 292 : authNames, contentTypes, accepts, returnType, callback
  293. 293 : );
  294. 294 : };
  295. 295 : };
  296. 296 :
  297. 297 : return exports;
  298. 298 : }));