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/CreateCustomerRequest', 'models/CustomerResponse', 'models/CustomersResponse', 'models/ErrorResponseVo', 'models/UpdateCustomerRequest'], 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/CreateCustomerRequest'), require('../models/CustomerResponse'), require('../models/CustomersResponse'), require('../models/ErrorResponseVo'), require('../models/UpdateCustomerRequest'));
  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.CustomerApi = factory(root.OrbipayPaymentsapiClient.ApiClient, root.OrbipayPaymentsapiClient.CreateCustomerRequest, root.OrbipayPaymentsapiClient.CustomerResponse, root.OrbipayPaymentsapiClient.CustomersResponse, root.OrbipayPaymentsapiClient.ErrorResponseVo, root.OrbipayPaymentsapiClient.UpdateCustomerRequest);
  15. 15 : }
  16. 16 : }(this, function(ApiClient, CreateCustomerRequest, CustomerResponse, CustomersResponse, ErrorResponseVo, UpdateCustomerRequest) {
  17. 17 : 'use strict';
  18. 18 :
  19. 19 : /**
  20. 20 : * Customer service.
  21. 21 : * @module api/CustomerApi
  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 CustomerApi.
  28. 28 : * @alias module:api/CustomerApi
  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 createCustomer operation.
  39. 39 : * @callback module:api/CustomerApi~createCustomerCallback
  40. 40 : * @param {String} error Error message, if any.
  41. 41 : * @param {module:models/CustomerResponse} 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 Customer
  47. 47 : * The Create Customer API is used to register a customer with a biller in EBPP. It is also mandatory to create a customer account for the customer. So, at least one customer account should be provided in order to register a customer. There is no limit on the number of accounts that can be associated with the customer. Either first_name or last_name is required to create a customer.
  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 {module:models/CreateCustomerRequest} create_customer_request The JSON that contains all the attributes of customer to be created.
  55. 55 : * @param {Object} opts Optional parameters
  56. 56 : * @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.
  57. 57 : * @param {String} opts.x_opay_headers Intended for the future use.
  58. 58 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  59. 59 : * @param {module:api/CustomerApi~createCustomerCallback} callback The callback function, accepting three arguments: error, data, response
  60. 60 : * data is of type: {@link module:models/CustomerResponse}
  61. 61 : */
  62. 62 : this.createCustomer = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, create_customer_request, opts, callback) {
  63. 63 : opts = opts || {};
  64. 64 : var postBody = create_customer_request;
  65. 65 :
  66. 66 : var pathParams = {
  67. 67 : };
  68. 68 : var queryParams = {
  69. 69 : };
  70. 70 : var headerParams = {
  71. 71 : 'channel': channel,
  72. 72 : 'client_key': client_key,
  73. 73 : 'product': product,
  74. 74 : 'timestamp': timestamp,
  75. 75 : 'idempotent_request_key': idempotent_request_key,
  76. 76 : 'requestor_type': requestor_type,
  77. 77 : 'requestor': opts['requestor'],
  78. 78 : 'X-OPAY-Headers': opts['x_opay_headers'],
  79. 79 : 'trace_id': opts['trace_id']
  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 = CustomerResponse;
  88. 88 :
  89. 89 : return this.apiClient.callApi(
  90. 90 : '/customers', '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 getCustomer operation.
  98. 98 : * @callback module:api/CustomerApi~getCustomerCallback
  99. 99 : * @param {String} error Error message, if any.
  100. 100 : * @param {module:models/CustomerResponse} 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 : * Get Customer
  106. 106 : * The Get Customer API is used to retrieve the details of the customer based on the id.
  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_customer The unique identifier assigned by EBPP to the customer.
  114. 114 : * @param {Object} opts Optional parameters
  115. 115 : * @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.
  116. 116 : * @param {String} opts.x_opay_headers Intended for the future use.
  117. 117 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  118. 118 : * @param {module:api/CustomerApi~getCustomerCallback} callback The callback function, accepting three arguments: error, data, response
  119. 119 : * data is of type: {@link module:models/CustomerResponse}
  120. 120 : */
  121. 121 : this.getCustomer = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, opts, callback) {
  122. 122 : opts = opts || {};
  123. 123 : var postBody = null;
  124. 124 :
  125. 125 : var pathParams = {
  126. 126 : 'ID_CUSTOMER': id_customer
  127. 127 : };
  128. 128 : var queryParams = {
  129. 129 : };
  130. 130 : var headerParams = {
  131. 131 : 'channel': channel,
  132. 132 : 'client_key': client_key,
  133. 133 : 'product': product,
  134. 134 : 'timestamp': timestamp,
  135. 135 : 'idempotent_request_key': idempotent_request_key,
  136. 136 : 'requestor_type': requestor_type,
  137. 137 : 'requestor': opts['requestor'],
  138. 138 : 'X-OPAY-Headers': opts['x_opay_headers'],
  139. 139 : 'trace_id': opts['trace_id']
  140. 140 : };
  141. 141 : var formParams = {
  142. 142 : };
  143. 143 :
  144. 144 : var authNames = [];
  145. 145 : var contentTypes = [];
  146. 146 : var accepts = ['application/json'];
  147. 147 : var returnType = CustomerResponse;
  148. 148 :
  149. 149 : return this.apiClient.callApi(
  150. 150 : '/customers/{ID_CUSTOMER}', 'GET',
  151. 151 : pathParams, queryParams, headerParams, formParams, postBody,
  152. 152 : authNames, contentTypes, accepts, returnType, callback
  153. 153 : );
  154. 154 : };
  155. 155 :
  156. 156 : /**
  157. 157 : * Callback function to receive the result of the retrieveCustomers operation.
  158. 158 : * @callback module:api/CustomerApi~retrieveCustomersCallback
  159. 159 : * @param {String} error Error message, if any.
  160. 160 : * @param {module:models/CustomersResponse} data The data returned by the service call.
  161. 161 : * @param {String} response The complete HTTP response.
  162. 162 : */
  163. 163 :
  164. 164 : /**
  165. 165 : * Retrieve Customers
  166. 166 : * This API is used to retrieve/lookup customers from EBPP. Customers can be retrieved matching criteria that includes the customer_reference, the ssn, the email or the customer account number. A unique customer can be retrieved by using search criteria as per the customer uniqueness parameters opted by the client/biller. If the requestor_type is customer, the Retrieve Customers API will return an error if it cannot retrieve a unique customer.
  167. 167 : * @param {String} channel The channel through which the API is invoked.
  168. 168 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  169. 169 : * @param {module:models/String} product The product identifier corresponding to the API.
  170. 170 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  171. 171 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  172. 172 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  173. 173 : * @param {Object} opts Optional parameters
  174. 174 : * @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.
  175. 175 : * @param {String} opts.x_opay_headers Intended for the future use.
  176. 176 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  177. 177 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  178. 178 : * @param {String} opts.customer_reference Unique ID assigned by the biller/client system for a given customer.
  179. 179 : * @param {String} opts.ssn The SSN of the customer if the account holder is an individual or the tax ID, if the customer is a business.
  180. 180 : * @param {String} opts.email This field contains the customer’s email address within EBPP.
  181. 181 : * @param {String} opts.account_number Customer Account Number of the customer to get details of.
  182. 182 : * @param {module:api/CustomerApi~retrieveCustomersCallback} callback The callback function, accepting three arguments: error, data, response
  183. 183 : * data is of type: {@link module:models/CustomersResponse}
  184. 184 : */
  185. 185 : this.retrieveCustomers = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, opts, callback) {
  186. 186 : opts = opts || {};
  187. 187 : var postBody = null;
  188. 188 :
  189. 189 : var pathParams = {
  190. 190 : };
  191. 191 : var queryParams = {
  192. 192 : 'page_size': opts['page_size']
  193. 193 : };
  194. 194 : var headerParams = {
  195. 195 : 'channel': channel,
  196. 196 : 'client_key': client_key,
  197. 197 : 'product': product,
  198. 198 : 'timestamp': timestamp,
  199. 199 : 'idempotent_request_key': idempotent_request_key,
  200. 200 : 'requestor_type': requestor_type,
  201. 201 : 'requestor': opts['requestor'],
  202. 202 : 'X-OPAY-Headers': opts['x_opay_headers'],
  203. 203 : 'trace_id': opts['trace_id']
  204. 204 : };
  205. 205 : var formParams = {
  206. 206 : 'customer_reference': opts['customer_reference'],
  207. 207 : 'ssn': opts['ssn'],
  208. 208 : 'email': opts['email'],
  209. 209 : 'account_number': opts['account_number']
  210. 210 : };
  211. 211 :
  212. 212 : var authNames = [];
  213. 213 : var contentTypes = ['application/x-www-form-urlencoded'];
  214. 214 : var accepts = ['application/json'];
  215. 215 : var returnType = CustomersResponse;
  216. 216 :
  217. 217 : return this.apiClient.callApi(
  218. 218 : '/customers/lists', 'POST',
  219. 219 : pathParams, queryParams, headerParams, formParams, postBody,
  220. 220 : authNames, contentTypes, accepts, returnType, callback
  221. 221 : );
  222. 222 : };
  223. 223 :
  224. 224 : /**
  225. 225 : * Callback function to receive the result of the retrieveCustomersPage operation.
  226. 226 : * @callback module:api/CustomerApi~retrieveCustomersPageCallback
  227. 227 : * @param {String} error Error message, if any.
  228. 228 : * @param {module:models/CustomersResponse} data The data returned by the service call.
  229. 229 : * @param {String} response The complete HTTP response.
  230. 230 : */
  231. 231 :
  232. 232 : /**
  233. 233 : * Retrieve Customers Pagination
  234. 234 : * This API is used to paginate through the list of customers returned in the Retrieve Customers API.
  235. 235 : * @param {String} channel The channel through which the API is invoked.
  236. 236 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  237. 237 : * @param {module:models/String} product The product identifier corresponding to the API.
  238. 238 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  239. 239 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  240. 240 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  241. 241 : * @param {String} query_id query id of the Retrieve/Search Customers lookup.
  242. 242 : * @param {Object} opts Optional parameters
  243. 243 : * @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.
  244. 244 : * @param {String} opts.x_opay_headers Intended for the future use.
  245. 245 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  246. 246 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  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/CustomerApi~retrieveCustomersPageCallback} callback The callback function, accepting three arguments: error, data, response
  250. 250 : * data is of type: {@link module:models/CustomersResponse}
  251. 251 : */
  252. 252 : this.retrieveCustomersPage = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, query_id, 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 : 'page_size': opts['page_size'],
  260. 260 : 'query_id': query_id,
  261. 261 : 'from_index': opts['from_index'],
  262. 262 : 'to_index': opts['to_index']
  263. 263 : };
  264. 264 : var headerParams = {
  265. 265 : 'channel': channel,
  266. 266 : 'client_key': client_key,
  267. 267 : 'product': product,
  268. 268 : 'timestamp': timestamp,
  269. 269 : 'idempotent_request_key': idempotent_request_key,
  270. 270 : 'requestor_type': requestor_type,
  271. 271 : 'requestor': opts['requestor'],
  272. 272 : 'X-OPAY-Headers': opts['x_opay_headers'],
  273. 273 : 'trace_id': opts['trace_id']
  274. 274 : };
  275. 275 : var formParams = {
  276. 276 : };
  277. 277 :
  278. 278 : var authNames = [];
  279. 279 : var contentTypes = [];
  280. 280 : var accepts = ['application/json'];
  281. 281 : var returnType = CustomersResponse;
  282. 282 :
  283. 283 : return this.apiClient.callApi(
  284. 284 : '/customers/lists', 'GET',
  285. 285 : pathParams, queryParams, headerParams, formParams, postBody,
  286. 286 : authNames, contentTypes, accepts, returnType, callback
  287. 287 : );
  288. 288 : };
  289. 289 :
  290. 290 : /**
  291. 291 : * Callback function to receive the result of the updateCustomer operation.
  292. 292 : * @callback module:api/CustomerApi~updateCustomerCallback
  293. 293 : * @param {String} error Error message, if any.
  294. 294 : * @param {module:models/CustomerResponse} data The data returned by the service call.
  295. 295 : * @param {String} response The complete HTTP response.
  296. 296 : */
  297. 297 :
  298. 298 : /**
  299. 299 : * Update Customer
  300. 300 : * The Update Customer API is used to edit the customer&#39;&#39;s personal details, accounts or the customer&#39;&#39;s status. Only the information being updated needs to be sent in the request, along with the id of the customer being updated. A customer can also be associated with new customer accounts using the API. &lt;br&gt;&lt;br&gt; Along with Customer details , Customer and Customer Account statuses also can be updated using the Update Customer API. Below are the possible customer state transformations. | from_status | to_status | allowed requestor_type | | ------------ | ------------ | ------------ | | active | suspended| &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; | | active | revoked | &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; | | suspended | active | &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; | | suspended | revoked | &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; | | revoked | active | &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; | Below are the possible customer account state transformation. | from_status | to_status | allowed requestor_type | | ------------ | ------------ | ------------ | | active | inactive| &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; | | inactive | active | &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; | | active | incollections | &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; | | incollections | active | &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; | | inactive | incollections | &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; | | incollections | inactive | &lt;ul&gt; &lt;li&gt;external_user&lt;/li&gt; &lt;li&gt; client_agent&lt;/li&gt; &lt;li&gt; system&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; |
  301. 301 : * @param {String} channel The channel through which the API is invoked.
  302. 302 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  303. 303 : * @param {module:models/String} product The product identifier corresponding to the API.
  304. 304 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  305. 305 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  306. 306 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  307. 307 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  308. 308 : * @param {module:models/UpdateCustomerRequest} update_customer_request JSON containing all the attributes of the customer to be updated.
  309. 309 : * @param {Object} opts Optional parameters
  310. 310 : * @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.
  311. 311 : * @param {String} opts.x_opay_headers Intended for the future use.
  312. 312 : * @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
  313. 313 : * @param {module:api/CustomerApi~updateCustomerCallback} callback The callback function, accepting three arguments: error, data, response
  314. 314 : * data is of type: {@link module:models/CustomerResponse}
  315. 315 : */
  316. 316 : this.updateCustomer = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, update_customer_request, opts, callback) {
  317. 317 : opts = opts || {};
  318. 318 : var postBody = update_customer_request;
  319. 319 :
  320. 320 : var pathParams = {
  321. 321 : 'ID_CUSTOMER': id_customer
  322. 322 : };
  323. 323 : var queryParams = {
  324. 324 : };
  325. 325 : var headerParams = {
  326. 326 : 'channel': channel,
  327. 327 : 'client_key': client_key,
  328. 328 : 'product': product,
  329. 329 : 'timestamp': timestamp,
  330. 330 : 'idempotent_request_key': idempotent_request_key,
  331. 331 : 'requestor_type': requestor_type,
  332. 332 : 'requestor': opts['requestor'],
  333. 333 : 'X-OPAY-Headers': opts['x_opay_headers'],
  334. 334 : 'trace_id': opts['trace_id']
  335. 335 : };
  336. 336 : var formParams = {
  337. 337 : };
  338. 338 :
  339. 339 : var authNames = [];
  340. 340 : var contentTypes = ['application/json'];
  341. 341 : var accepts = ['application/json'];
  342. 342 : var returnType = CustomerResponse;
  343. 343 :
  344. 344 : return this.apiClient.callApi(
  345. 345 : '/customers/{ID_CUSTOMER}', 'PUT',
  346. 346 : pathParams, queryParams, headerParams, formParams, postBody,
  347. 347 : authNames, contentTypes, accepts, returnType, callback
  348. 348 : );
  349. 349 : };
  350. 350 : };
  351. 351 :
  352. 352 : return exports;
  353. 353 : }));