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. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
  58. 58 : * @param {String} opts.x_opay_headers Intended for the future use.
  59. 59 : * @param {module:api/CustomerAccountApi~getCustomerAccountCallback} callback The callback function, accepting three arguments: error, data, response
  60. 60 : * data is of type: {@link module:models/CustomerAccountResponse}
  61. 61 : */
  62. 62 : this.getCustomerAccount = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer_account, id_customer, opts, callback) {
  63. 63 : opts = opts || {};
  64. 64 : var postBody = null;
  65. 65 :
  66. 66 : var pathParams = {
  67. 67 : 'ID_CUSTOMER_ACCOUNT': id_customer_account,
  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 : };
  82. 82 : var formParams = {
  83. 83 : };
  84. 84 :
  85. 85 : var authNames = [];
  86. 86 : var contentTypes = [];
  87. 87 : var accepts = ['application/json'];
  88. 88 : var returnType = CustomerAccountResponse;
  89. 89 :
  90. 90 : return this.apiClient.callApi(
  91. 91 : '/customers/{ID_CUSTOMER}/customeraccounts/{ID_CUSTOMER_ACCOUNT}', 'GET',
  92. 92 : pathParams, queryParams, headerParams, formParams, postBody,
  93. 93 : authNames, contentTypes, accepts, returnType, callback
  94. 94 : );
  95. 95 : };
  96. 96 :
  97. 97 : /**
  98. 98 : * Callback function to receive the result of the renewCustomerAccount operation.
  99. 99 : * @callback module:api/CustomerAccountApi~renewCustomerAccountCallback
  100. 100 : * @param {String} error Error message, if any.
  101. 101 : * @param {module:models/CustomerAccountResponse} data The data returned by the service call.
  102. 102 : * @param {String} response The complete HTTP response.
  103. 103 : */
  104. 104 :
  105. 105 : /**
  106. 106 : * Renew Customer Account
  107. 107 : * 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.
  108. 108 : * @param {String} channel The channel through which the API is invoked.
  109. 109 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  110. 110 : * @param {module:models/String} product The product identifier corresponding to the API.
  111. 111 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  112. 112 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  113. 113 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  114. 114 : * @param {String} id_customer_account The unique identifier assigned by EBPP to the Customer Account.
  115. 115 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  116. 116 : * @param {module:models/RenewCustomerAccountRequest} renew_customer_account_request JSON containing all the attributes of the Customer account to be renewed.
  117. 117 : * @param {Object} opts Optional parameters
  118. 118 : * @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.
  119. 119 : * @param {String} opts.x_opay_headers Intended for the future use.
  120. 120 : * @param {module:api/CustomerAccountApi~renewCustomerAccountCallback} callback The callback function, accepting three arguments: error, data, response
  121. 121 : * data is of type: {@link module:models/CustomerAccountResponse}
  122. 122 : */
  123. 123 : this.renewCustomerAccount = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer_account, id_customer, renew_customer_account_request, opts, callback) {
  124. 124 : opts = opts || {};
  125. 125 : var postBody = renew_customer_account_request;
  126. 126 :
  127. 127 : var pathParams = {
  128. 128 : 'ID_CUSTOMER_ACCOUNT': id_customer_account,
  129. 129 : 'ID_CUSTOMER': id_customer
  130. 130 : };
  131. 131 : var queryParams = {
  132. 132 : };
  133. 133 : var headerParams = {
  134. 134 : 'channel': channel,
  135. 135 : 'client_key': client_key,
  136. 136 : 'product': product,
  137. 137 : 'timestamp': timestamp,
  138. 138 : 'idempotent_request_key': idempotent_request_key,
  139. 139 : 'requestor_type': requestor_type,
  140. 140 : 'requestor': opts['requestor'],
  141. 141 : 'X-OPAY-Headers': opts['x_opay_headers']
  142. 142 : };
  143. 143 : var formParams = {
  144. 144 : };
  145. 145 :
  146. 146 : var authNames = [];
  147. 147 : var contentTypes = ['application/json'];
  148. 148 : var accepts = ['application/json'];
  149. 149 : var returnType = CustomerAccountResponse;
  150. 150 :
  151. 151 : return this.apiClient.callApi(
  152. 152 : '/customers/{ID_CUSTOMER}/customeraccounts/{ID_CUSTOMER_ACCOUNT}/renew', 'POST',
  153. 153 : pathParams, queryParams, headerParams, formParams, postBody,
  154. 154 : authNames, contentTypes, accepts, returnType, callback
  155. 155 : );
  156. 156 : };
  157. 157 :
  158. 158 : /**
  159. 159 : * Callback function to receive the result of the retrieveCustomerAccounts operation.
  160. 160 : * @callback module:api/CustomerAccountApi~retrieveCustomerAccountsCallback
  161. 161 : * @param {String} error Error message, if any.
  162. 162 : * @param {module:models/CustomerAccountsResponse} data The data returned by the service call.
  163. 163 : * @param {String} response The complete HTTP response.
  164. 164 : */
  165. 165 :
  166. 166 : /**
  167. 167 : * Retrieve Customer Accounts
  168. 168 : * 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.
  169. 169 : * @param {String} channel The channel through which the API is invoked.
  170. 170 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  171. 171 : * @param {module:models/String} product The product identifier corresponding to the API.
  172. 172 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  173. 173 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  174. 174 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  175. 175 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  176. 176 : * @param {Object} opts Optional parameters
  177. 177 : * @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
  178. 178 : * @param {String} opts.x_opay_headers Intended for the future use.
  179. 179 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  180. 180 : * @param {String} opts.account_number The Account Number to get details of.
  181. 181 : * @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....
  182. 182 : * @param {module:api/CustomerAccountApi~retrieveCustomerAccountsCallback} callback The callback function, accepting three arguments: error, data, response
  183. 183 : * data is of type: {@link module:models/CustomerAccountsResponse}
  184. 184 : */
  185. 185 : this.retrieveCustomerAccounts = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, opts, callback) {
  186. 186 : opts = opts || {};
  187. 187 : var postBody = null;
  188. 188 :
  189. 189 : var pathParams = {
  190. 190 : 'ID_CUSTOMER': id_customer
  191. 191 : };
  192. 192 : var queryParams = {
  193. 193 : 'page_size': opts['page_size']
  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 : };
  205. 205 : var formParams = {
  206. 206 : 'account_number': opts['account_number'],
  207. 207 : 'status': this.apiClient.buildCollectionParam(opts['status'], 'multi')
  208. 208 : };
  209. 209 :
  210. 210 : var authNames = [];
  211. 211 : var contentTypes = ['application/x-www-form-urlencoded'];
  212. 212 : var accepts = ['application/json'];
  213. 213 : var returnType = CustomerAccountsResponse;
  214. 214 :
  215. 215 : return this.apiClient.callApi(
  216. 216 : '/customers/{ID_CUSTOMER}/customeraccounts/lists', 'POST',
  217. 217 : pathParams, queryParams, headerParams, formParams, postBody,
  218. 218 : authNames, contentTypes, accepts, returnType, callback
  219. 219 : );
  220. 220 : };
  221. 221 :
  222. 222 : /**
  223. 223 : * Callback function to receive the result of the retrieveCustomerAccountsPage operation.
  224. 224 : * @callback module:api/CustomerAccountApi~retrieveCustomerAccountsPageCallback
  225. 225 : * @param {String} error Error message, if any.
  226. 226 : * @param {module:models/CustomerAccountsResponse} data The data returned by the service call.
  227. 227 : * @param {String} response The complete HTTP response.
  228. 228 : */
  229. 229 :
  230. 230 : /**
  231. 231 : * Retrieve Customer Accounts Pagination
  232. 232 : * This API is used to paginate through the list of customer Accounts returned in the Retrieve Customer Accounts API.
  233. 233 : * @param {String} channel The channel through which the API is invoked.
  234. 234 : * @param {String} client_key The unique identifier assigned by EBPP to the client.
  235. 235 : * @param {module:models/String} product The product identifier corresponding to the API.
  236. 236 : * @param {String} timestamp The timestamp for the moment when the API request is created.
  237. 237 : * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
  238. 238 : * @param {module:models/String} requestor_type Type of the requestor of the API.
  239. 239 : * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
  240. 240 : * @param {String} query_id query id of the Retrieve/Search Accounts lookup.
  241. 241 : * @param {Object} opts Optional parameters
  242. 242 : * @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.
  243. 243 : * @param {String} opts.x_opay_headers Intended for the future use.
  244. 244 : * @param {String} opts.page_size The maximum number of objects returned in the query.
  245. 245 : * @param {String} opts.from_index To fetch the next set of objects that start after this object
  246. 246 : * @param {String} opts.to_index To fetch the previous set of objects that end at this object
  247. 247 : * @param {module:api/CustomerAccountApi~retrieveCustomerAccountsPageCallback} callback The callback function, accepting three arguments: error, data, response
  248. 248 : * data is of type: {@link module:models/CustomerAccountsResponse}
  249. 249 : */
  250. 250 : this.retrieveCustomerAccountsPage = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, query_id, opts, callback) {
  251. 251 : opts = opts || {};
  252. 252 : var postBody = null;
  253. 253 :
  254. 254 : var pathParams = {
  255. 255 : 'ID_CUSTOMER': id_customer
  256. 256 : };
  257. 257 : var queryParams = {
  258. 258 : 'page_size': opts['page_size'],
  259. 259 : 'query_id': query_id,
  260. 260 : 'from_index': opts['from_index'],
  261. 261 : 'to_index': opts['to_index']
  262. 262 : };
  263. 263 : var headerParams = {
  264. 264 : 'channel': channel,
  265. 265 : 'client_key': client_key,
  266. 266 : 'product': product,
  267. 267 : 'timestamp': timestamp,
  268. 268 : 'idempotent_request_key': idempotent_request_key,
  269. 269 : 'requestor_type': requestor_type,
  270. 270 : 'requestor': opts['requestor'],
  271. 271 : 'X-OPAY-Headers': opts['x_opay_headers']
  272. 272 : };
  273. 273 : var formParams = {
  274. 274 : };
  275. 275 :
  276. 276 : var authNames = [];
  277. 277 : var contentTypes = [];
  278. 278 : var accepts = ['application/json'];
  279. 279 : var returnType = CustomerAccountsResponse;
  280. 280 :
  281. 281 : return this.apiClient.callApi(
  282. 282 : '/customers/{ID_CUSTOMER}/customeraccounts/lists', 'GET',
  283. 283 : pathParams, queryParams, headerParams, formParams, postBody,
  284. 284 : authNames, contentTypes, accepts, returnType, callback
  285. 285 : );
  286. 286 : };
  287. 287 : };
  288. 288 :
  289. 289 : return exports;
  290. 290 : }));