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 {module:api/CustomerApi~createCustomerCallback} callback The callback function, accepting three arguments: error, data, response
  59. 59 : * data is of type: {@link module:models/CustomerResponse}
  60. 60 : */
  61. 61 : this.createCustomer = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, create_customer_request, opts, callback) {
  62. 62 : opts = opts || {};
  63. 63 : var postBody = create_customer_request;
  64. 64 :
  65. 65 : var pathParams = {
  66. 66 : };
  67. 67 : var queryParams = {
  68. 68 : };
  69. 69 : var headerParams = {
  70. 70 : 'channel': channel,
  71. 71 : 'client_key': client_key,
  72. 72 : 'product': product,
  73. 73 : 'timestamp': timestamp,
  74. 74 : 'idempotent_request_key': idempotent_request_key,
  75. 75 : 'requestor_type': requestor_type,
  76. 76 : 'requestor': opts['requestor'],
  77. 77 : 'X-OPAY-Headers': opts['x_opay_headers']
  78. 78 : };
  79. 79 : var formParams = {
  80. 80 : };
  81. 81 :
  82. 82 : var authNames = [];
  83. 83 : var contentTypes = ['application/json'];
  84. 84 : var accepts = ['application/json'];
  85. 85 : var returnType = CustomerResponse;
  86. 86 :
  87. 87 : return this.apiClient.callApi(
  88. 88 : '/customers', 'POST',
  89. 89 : pathParams, queryParams, headerParams, formParams, postBody,
  90. 90 : authNames, contentTypes, accepts, returnType, callback
  91. 91 : );
  92. 92 : };
  93. 93 :
  94. 94 : /**
  95. 95 : * Callback function to receive the result of the getCustomer operation.
  96. 96 : * @callback module:api/CustomerApi~getCustomerCallback
  97. 97 : * @param {String} error Error message, if any.
  98. 98 : * @param {module:models/CustomerResponse} data The data returned by the service call.
  99. 99 : * @param {String} response The complete HTTP response.
  100. 100 : */
  101. 101 :
  102. 102 : /**
  103. 103 : * Get Customer
  104. 104 : * The Get Customer API is used to retrieve the details of the customer based on the id.
  105. 105 : * @param {String} channel The channel through which the API is invoked.
  106. 106 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  107. 107 : * @param {module:models/String} product The product identifier corresponding to the API.
  108. 108 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  109. 109 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  110. 110 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  111. 111 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  112. 112 : * @param {Object} opts Optional parameters
  113. 113 : * @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.
  114. 114 : * @param {String} opts.x_opay_headers Intended for the future use.
  115. 115 : * @param {module:api/CustomerApi~getCustomerCallback} callback The callback function, accepting three arguments: error, data, response
  116. 116 : * data is of type: {@link module:models/CustomerResponse}
  117. 117 : */
  118. 118 : this.getCustomer = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, opts, callback) {
  119. 119 : opts = opts || {};
  120. 120 : var postBody = null;
  121. 121 :
  122. 122 : var pathParams = {
  123. 123 : 'ID_CUSTOMER': id_customer
  124. 124 : };
  125. 125 : var queryParams = {
  126. 126 : };
  127. 127 : var headerParams = {
  128. 128 : 'channel': channel,
  129. 129 : 'client_key': client_key,
  130. 130 : 'product': product,
  131. 131 : 'timestamp': timestamp,
  132. 132 : 'idempotent_request_key': idempotent_request_key,
  133. 133 : 'requestor_type': requestor_type,
  134. 134 : 'requestor': opts['requestor'],
  135. 135 : 'X-OPAY-Headers': opts['x_opay_headers']
  136. 136 : };
  137. 137 : var formParams = {
  138. 138 : };
  139. 139 :
  140. 140 : var authNames = [];
  141. 141 : var contentTypes = [];
  142. 142 : var accepts = ['application/json'];
  143. 143 : var returnType = CustomerResponse;
  144. 144 :
  145. 145 : return this.apiClient.callApi(
  146. 146 : '/customers/{ID_CUSTOMER}', 'GET',
  147. 147 : pathParams, queryParams, headerParams, formParams, postBody,
  148. 148 : authNames, contentTypes, accepts, returnType, callback
  149. 149 : );
  150. 150 : };
  151. 151 :
  152. 152 : /**
  153. 153 : * Callback function to receive the result of the retrieveCustomers operation.
  154. 154 : * @callback module:api/CustomerApi~retrieveCustomersCallback
  155. 155 : * @param {String} error Error message, if any.
  156. 156 : * @param {module:models/CustomersResponse} data The data returned by the service call.
  157. 157 : * @param {String} response The complete HTTP response.
  158. 158 : */
  159. 159 :
  160. 160 : /**
  161. 161 : * Retrieve Customers
  162. 162 : * 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.
  163. 163 : * @param {String} channel The channel through which the API is invoked.
  164. 164 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  165. 165 : * @param {module:models/String} product The product identifier corresponding to the API.
  166. 166 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  167. 167 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  168. 168 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  169. 169 : * @param {Object} opts Optional parameters
  170. 170 : * @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.
  171. 171 : * @param {String} opts.x_opay_headers Intended for the future use.
  172. 172 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  173. 173 : * @param {String} opts.customer_reference Unique ID assigned by the biller/client system for a given customer.
  174. 174 : * @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.
  175. 175 : * @param {String} opts.email This field contains the customer’s email address within EBPP.
  176. 176 : * @param {String} opts.account_number Customer Account Number of the customer to get details of.
  177. 177 : * @param {module:api/CustomerApi~retrieveCustomersCallback} callback The callback function, accepting three arguments: error, data, response
  178. 178 : * data is of type: {@link module:models/CustomersResponse}
  179. 179 : */
  180. 180 : this.retrieveCustomers = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, opts, callback) {
  181. 181 : opts = opts || {};
  182. 182 : var postBody = null;
  183. 183 :
  184. 184 : var pathParams = {
  185. 185 : };
  186. 186 : var queryParams = {
  187. 187 : 'page_size': opts['page_size']
  188. 188 : };
  189. 189 : var headerParams = {
  190. 190 : 'channel': channel,
  191. 191 : 'client_key': client_key,
  192. 192 : 'product': product,
  193. 193 : 'timestamp': timestamp,
  194. 194 : 'idempotent_request_key': idempotent_request_key,
  195. 195 : 'requestor_type': requestor_type,
  196. 196 : 'requestor': opts['requestor'],
  197. 197 : 'X-OPAY-Headers': opts['x_opay_headers']
  198. 198 : };
  199. 199 : var formParams = {
  200. 200 : 'customer_reference': opts['customer_reference'],
  201. 201 : 'ssn': opts['ssn'],
  202. 202 : 'email': opts['email'],
  203. 203 : 'account_number': opts['account_number']
  204. 204 : };
  205. 205 :
  206. 206 : var authNames = [];
  207. 207 : var contentTypes = ['application/x-www-form-urlencoded'];
  208. 208 : var accepts = ['application/json'];
  209. 209 : var returnType = CustomersResponse;
  210. 210 :
  211. 211 : return this.apiClient.callApi(
  212. 212 : '/customers/lists', 'POST',
  213. 213 : pathParams, queryParams, headerParams, formParams, postBody,
  214. 214 : authNames, contentTypes, accepts, returnType, callback
  215. 215 : );
  216. 216 : };
  217. 217 :
  218. 218 : /**
  219. 219 : * Callback function to receive the result of the retrieveCustomersPage operation.
  220. 220 : * @callback module:api/CustomerApi~retrieveCustomersPageCallback
  221. 221 : * @param {String} error Error message, if any.
  222. 222 : * @param {module:models/CustomersResponse} data The data returned by the service call.
  223. 223 : * @param {String} response The complete HTTP response.
  224. 224 : */
  225. 225 :
  226. 226 : /**
  227. 227 : * Retrieve Customers Pagination
  228. 228 : * This API is used to paginate through the list of customers returned in the Retrieve Customers API.
  229. 229 : * @param {String} channel The channel through which the API is invoked.
  230. 230 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  231. 231 : * @param {module:models/String} product The product identifier corresponding to the API.
  232. 232 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  233. 233 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  234. 234 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  235. 235 : * @param {String} query_id query id of the Retrieve/Search Customers lookup.
  236. 236 : * @param {Object} opts Optional parameters
  237. 237 : * @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.
  238. 238 : * @param {String} opts.x_opay_headers Intended for the future use.
  239. 239 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  240. 240 : * @param {String} opts.from_index To fetch the next set of objects that start after this object
  241. 241 : * @param {String} opts.to_index To fetch the previous set of objects that end at this object
  242. 242 : * @param {module:api/CustomerApi~retrieveCustomersPageCallback} callback The callback function, accepting three arguments: error, data, response
  243. 243 : * data is of type: {@link module:models/CustomersResponse}
  244. 244 : */
  245. 245 : this.retrieveCustomersPage = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, query_id, opts, callback) {
  246. 246 : opts = opts || {};
  247. 247 : var postBody = null;
  248. 248 :
  249. 249 : var pathParams = {
  250. 250 : };
  251. 251 : var queryParams = {
  252. 252 : 'page_size': opts['page_size'],
  253. 253 : 'query_id': query_id,
  254. 254 : 'from_index': opts['from_index'],
  255. 255 : 'to_index': opts['to_index']
  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 : };
  267. 267 : var formParams = {
  268. 268 : };
  269. 269 :
  270. 270 : var authNames = [];
  271. 271 : var contentTypes = [];
  272. 272 : var accepts = ['application/json'];
  273. 273 : var returnType = CustomersResponse;
  274. 274 :
  275. 275 : return this.apiClient.callApi(
  276. 276 : '/customers/lists', 'GET',
  277. 277 : pathParams, queryParams, headerParams, formParams, postBody,
  278. 278 : authNames, contentTypes, accepts, returnType, callback
  279. 279 : );
  280. 280 : };
  281. 281 :
  282. 282 : /**
  283. 283 : * Callback function to receive the result of the updateCustomer operation.
  284. 284 : * @callback module:api/CustomerApi~updateCustomerCallback
  285. 285 : * @param {String} error Error message, if any.
  286. 286 : * @param {module:models/CustomerResponse} data The data returned by the service call.
  287. 287 : * @param {String} response The complete HTTP response.
  288. 288 : */
  289. 289 :
  290. 290 : /**
  291. 291 : * Update Customer
  292. 292 : * 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; |
  293. 293 : * @param {String} channel The channel through which the API is invoked.
  294. 294 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  295. 295 : * @param {module:models/String} product The product identifier corresponding to the API.
  296. 296 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  297. 297 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  298. 298 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  299. 299 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  300. 300 : * @param {module:models/UpdateCustomerRequest} update_customer_request JSON containing all the attributes of the customer to be updated.
  301. 301 : * @param {Object} opts Optional parameters
  302. 302 : * @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.
  303. 303 : * @param {String} opts.x_opay_headers Intended for the future use.
  304. 304 : * @param {module:api/CustomerApi~updateCustomerCallback} callback The callback function, accepting three arguments: error, data, response
  305. 305 : * data is of type: {@link module:models/CustomerResponse}
  306. 306 : */
  307. 307 : this.updateCustomer = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, update_customer_request, opts, callback) {
  308. 308 : opts = opts || {};
  309. 309 : var postBody = update_customer_request;
  310. 310 :
  311. 311 : var pathParams = {
  312. 312 : 'ID_CUSTOMER': id_customer
  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 : };
  326. 326 : var formParams = {
  327. 327 : };
  328. 328 :
  329. 329 : var authNames = [];
  330. 330 : var contentTypes = ['application/json'];
  331. 331 : var accepts = ['application/json'];
  332. 332 : var returnType = CustomerResponse;
  333. 333 :
  334. 334 : return this.apiClient.callApi(
  335. 335 : '/customers/{ID_CUSTOMER}', 'PUT',
  336. 336 : pathParams, queryParams, headerParams, formParams, postBody,
  337. 337 : authNames, contentTypes, accepts, returnType, callback
  338. 338 : );
  339. 339 : };
  340. 340 : };
  341. 341 :
  342. 342 : return exports;
  343. 343 : }));