1. 1 :
  2. 2 :
  3. 3 : (function(root, factory) {
  4. 4 :
  5. 5 : if (typeof module === 'object' && module.exports) {
  6. 6 : // CommonJS-like environments that support module.exports, like Node.
  7. 7 : module.exports = factory(require('../ApiClient'), require('./InvocationContext'), require('../CommonUtil'), require('../ResponseWrapper'), require('./Base')
  8. 8 : , require('../handlers/AddFundingAccountHandler')
  9. 9 : , require('../handlers/DeleteFundingAccountHandler')
  10. 10 : , require('../handlers/GetFundingAccountHandler')
  11. 11 : , require('../handlers/ReplaceFundingAccountHandler')
  12. 12 : , require('../handlers/UpdateFundingAccountHandler'), require('../OrbipayApiError'));
  13. 13 : }
  14. 14 : }(this, function(ApiClient, InvocationContext, CommonUtil, ResponseWrapper, Base, AddFundingAccountHandler, DeleteFundingAccountHandler, GetFundingAccountHandler, ReplaceFundingAccountHandler, UpdateFundingAccountHandler, OrbipayApiError) {
  15. 15 : 'use strict';
  16. 16 :
  17. 17 : /**
  18. 18 : * The FundingAccount wrapper module.
  19. 19 : * @module wrappers/FundingAccount
  20. 20 : */
  21. 21 : var exports = function(id_funding_account) {
  22. 22 : var _this = this;
  23. 23 : Base.call(_this);
  24. 24 : _this['ID_FUNDING_ACCOUNT'] = id_funding_account;
  25. 25 : _this.id = id_funding_account;
  26. 26 : };
  27. 27 :
  28. 28 : /**
  29. 29 : * Constructs a <code>FundingAccount</code> from a plain JavaScript object, optionally creating a new instance.
  30. 30 : * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
  31. 31 : * @param {Object} data The plain JavaScript object bearing properties of interest.
  32. 32 : * @param {module:wrappers/FundingAccount} obj Optional instance to populate.
  33. 33 : * @return {module:wrappers/FundingAccount} The populated <code>FundingAccount</code> instance.
  34. 34 : */
  35. 35 : exports.constructFromObject = function (data, obj) {
  36. 36 : if (data) {
  37. 37 : obj = obj || new exports();
  38. 38 : if (data.hasOwnProperty('account_holder_name')) {
  39. 39 : obj['account_holder_name'] = data['account_holder_name'];
  40. 40 : }
  41. 41 : if (data.hasOwnProperty('nickname')) {
  42. 42 : obj['nickname'] = data['nickname'];
  43. 43 : }
  44. 44 : if (data.hasOwnProperty('address')) {
  45. 45 : var Address = require('./Address');
  46. 46 : obj['address'] = Address.constructFromObject(data['address']);
  47. 47 : }
  48. 48 : if (data.hasOwnProperty('account_number')) {
  49. 49 : obj['account_number'] = data['account_number'];
  50. 50 : }
  51. 51 : if (data.hasOwnProperty('aba_routing_number')) {
  52. 52 : obj['aba_routing_number'] = data['aba_routing_number'];
  53. 53 : }
  54. 54 : if (data.hasOwnProperty('issuer_name')) {
  55. 55 : obj['issuer_name'] = data['issuer_name'];
  56. 56 : }
  57. 57 : if (data.hasOwnProperty('currency_code3d')) {
  58. 58 : obj['currency_code3d'] = data['currency_code3d'];
  59. 59 : }
  60. 60 : if (data.hasOwnProperty('expiry_date')) {
  61. 61 : obj['expiry_date'] = data['expiry_date'];
  62. 62 : }
  63. 63 : if (data.hasOwnProperty('account_holder_type')) {
  64. 64 : obj['account_holder_type'] = data['account_holder_type'];
  65. 65 : }
  66. 66 : if (data.hasOwnProperty('custom_fields')) {
  67. 67 : obj['custom_fields'] = data['custom_fields'];
  68. 68 : }
  69. 69 : if (data.hasOwnProperty('account_subtype')) {
  70. 70 : obj['account_subtype'] = data['account_subtype'];
  71. 71 : }
  72. 72 : if (data.hasOwnProperty('id')) {
  73. 73 : obj['id'] = data['id'];
  74. 74 : }
  75. 75 : if (data.hasOwnProperty('url')) {
  76. 76 : obj['url'] = data['url'];
  77. 77 : }
  78. 78 : if (data.hasOwnProperty('ach_eligible_flag')) {
  79. 79 : obj['ach_eligible_flag'] = data['ach_eligible_flag'];
  80. 80 : }
  81. 81 : if (data.hasOwnProperty('atm_eligible_flag')) {
  82. 82 : obj['atm_eligible_flag'] = data['atm_eligible_flag'];
  83. 83 : }
  84. 84 : if (data.hasOwnProperty('card_cvv_number')) {
  85. 85 : obj['card_cvv_number'] = data['card_cvv_number'];
  86. 86 : }
  87. 87 : if (data.hasOwnProperty('account_type')) {
  88. 88 : obj['account_type'] = data['account_type'];
  89. 89 : }
  90. 90 : if (data.hasOwnProperty('status')) {
  91. 91 : obj['status'] = data['status'];
  92. 92 : }
  93. 93 : if (data.hasOwnProperty('device_manufacturer_id')) {
  94. 94 : obj['device_manufacturer_id'] = data['device_manufacturer_id'];
  95. 95 : }
  96. 96 : if (data.hasOwnProperty('display_text')) {
  97. 97 : obj['display_text'] = data['display_text'];
  98. 98 : }
  99. 99 : if (data.hasOwnProperty('comments')) {
  100. 100 : obj['comments'] = data['comments'];
  101. 101 : }
  102. 102 : if (data.hasOwnProperty('deleted')) {
  103. 103 : obj['deleted'] = data['deleted'];
  104. 104 : }
  105. 105 : if (data.hasOwnProperty('audit_info')) {
  106. 106 : var AuditInfo = require('./AuditInfo');
  107. 107 : obj['audit_info'] = AuditInfo.constructFromObject(data['audit_info']);
  108. 108 : }
  109. 109 : if (data.hasOwnProperty('ID_CUSTOMER')) {
  110. 110 : obj['ID_CUSTOMER'] = data['ID_CUSTOMER'];
  111. 111 : }
  112. 112 : if (data.hasOwnProperty('ID_FUNDING_ACCOUNT')) {
  113. 113 : obj['ID_FUNDING_ACCOUNT'] = data['ID_FUNDING_ACCOUNT'];
  114. 114 : }
  115. 115 : }
  116. 116 : return obj;
  117. 117 : };
  118. 118 :
  119. 119 :
  120. 120 : exports.prototype = Object.create(Base.prototype);
  121. 121 : exports.prototype.constructor = exports;
  122. 122 :
  123. 123 : /**
  124. 124 : * The name as specified on the account.
  125. 125 : * @member {String} account_holder_name
  126. 126 : */
  127. 127 : exports.prototype['account_holder_name'] = undefined;
  128. 128 : /**
  129. 129 : * The nickname by which a customer might want to identify the account.
  130. 130 : * @member {String} nickname
  131. 131 : */
  132. 132 : exports.prototype['nickname'] = undefined;
  133. 133 : /**
  134. 134 : * @member {Address} address
  135. 135 : */
  136. 136 : exports.prototype['address'] = undefined;
  137. 137 : /**
  138. 138 : * The number or reference that a customer uses to identify the funding account. In case of Apple Pay, this is the device-specific account number of the card.
  139. 139 : * @member {String} account_number
  140. 140 : */
  141. 141 : exports.prototype['account_number'] = undefined;
  142. 142 : /**
  143. 143 : * The ABA/Routing number for the bank account.
  144. 144 : * @member {String} aba_routing_number
  145. 145 : */
  146. 146 : exports.prototype['aba_routing_number'] = undefined;
  147. 147 : /**
  148. 148 : * The name of the authority that has issued the account. This is relevant only in the case of bank accounts.
  149. 149 : * @member {String} issuer_name
  150. 150 : */
  151. 151 : exports.prototype['issuer_name'] = undefined;
  152. 152 : /**
  153. 153 : * The three-letter currency code in the ISO4217 format, in uppercase, for the card account. It must be a currency supported by Orbipay. This defaults to USD.
  154. 154 : * @member {String} currency_code3d
  155. 155 : */
  156. 156 : exports.prototype['currency_code3d'] = undefined;
  157. 157 : /**
  158. 158 : * The expiry date for the card. This is to be in the format MM/YY.
  159. 159 : * @member {String} expiry_date
  160. 160 : */
  161. 161 : exports.prototype['expiry_date'] = undefined;
  162. 162 : /**
  163. 163 : * The type of ownership for the funding account. This is applicable only in the case of bank accounts and it is defaults to personal.
  164. 164 : * @member {String} account_holder_type
  165. 165 : */
  166. 166 : exports.prototype['account_holder_type'] = undefined;
  167. 167 : /**
  168. 168 : * The additional information or meta-information that Orbipay can accept, maintain and transmit back to the client. The custom fields need to be configured with Orbipay before they can be accepted. Orbipay would reject custom fields that are not pre-configured. Please contact <a href = \"mailto: support@billerpayments.com\">support@billerpayments.com</a> for more information on configuring and using custom fields. Only the custom fields enabled for the client, in Orbipay, would be accepted in the requests.
  169. 169 : * @member {{String: String}} custom_fields
  170. 170 : */
  171. 171 : exports.prototype['custom_fields'] = undefined;
  172. 172 : /**
  173. 173 : * The sub type of the funding account. This is derived by Orbipay in the case of card funding accounts. It needs to be passed when adding or editing a DDA/Bank/ApplePay account. For e.g., a savings account, a checking account.
  174. 174 : * @member {String} account_subtype
  175. 175 : */
  176. 176 : exports.prototype['account_subtype'] = undefined;
  177. 177 : /**
  178. 178 : * Id is a unique identifier assigned to the funding account in Orbipay. A new Id is generated for the funding account when the account number is updated.
  179. 179 : * @member {String} id
  180. 180 : */
  181. 181 : exports.prototype['id'] = undefined;
  182. 182 : /**
  183. 183 : * This URL fetches the funding account details.
  184. 184 : * @member {String} url
  185. 185 : */
  186. 186 : exports.prototype['url'] = undefined;
  187. 187 : /**
  188. 188 : * Indicates if the funding account can be debited vide ACH, in case the funding account is a Demand Deposit Account (DDA).
  189. 189 : * @member {String} ach_eligible_flag
  190. 190 : */
  191. 191 : exports.prototype['ach_eligible_flag'] = undefined;
  192. 192 : /**
  193. 193 : * Indicates if the funding account can be debited vide the ATM Rail network, in case the funding account is a Debit Card.
  194. 194 : * @member {String} atm_eligible_flag
  195. 195 : */
  196. 196 : exports.prototype['atm_eligible_flag'] = undefined;
  197. 197 : /**
  198. 198 : * This is never returned by Orbipay. This needs to be passed to Orbipay when adding or editing a card funding account.
  199. 199 : * @member {String} card_cvv_number
  200. 200 : */
  201. 201 : exports.prototype['card_cvv_number'] = undefined;
  202. 202 : /**
  203. 203 : * The type of the funding account.
  204. 204 : * @member {String} account_type
  205. 205 : */
  206. 206 : exports.prototype['account_type'] = undefined;
  207. 207 : /**
  208. 208 : * The status of the funding account in Orbipay.
  209. 209 : * @member {String} status
  210. 210 : */
  211. 211 : exports.prototype['status'] = undefined;
  212. 212 : /**
  213. 213 : * This is applicable only for Apple Pay transactions. Hex-encoded device manufacturer identifier.
  214. 214 : * @member {String} device_manufacturer_id
  215. 215 : */
  216. 216 : exports.prototype['device_manufacturer_id'] = undefined;
  217. 217 : /**
  218. 218 : * UI representation of the account.
  219. 219 : * @member {String} display_text
  220. 220 : */
  221. 221 : exports.prototype['display_text'] = undefined;
  222. 222 : /**
  223. 223 : * Comments that can be used to recollect the operation performed on the resource object. API clients need to ensure that no sensitive information is passed in the memo. Alacriti (Orbipay) is not responsible for the security of any sensitive information that may be passed as part of the memo.
  224. 224 : * @member {String} comments
  225. 225 : */
  226. 226 : exports.prototype['comments'] = undefined;
  227. 227 : /**
  228. 228 : * The status of funding account which says whether the funding account is deleted or not
  229. 229 : * @member {String} deleted
  230. 230 : */
  231. 231 : exports.prototype['deleted'] = undefined;
  232. 232 : /**
  233. 233 : * @member {AuditInfo} audit_info
  234. 234 : */
  235. 235 : exports.prototype['audit_info'] = undefined;
  236. 236 : /**
  237. 237 : * The unique identifier assigned by EBPP to the customer.
  238. 238 : * @member {String} ID_CUSTOMER
  239. 239 : */
  240. 240 : exports.prototype['ID_CUSTOMER'] = undefined;
  241. 241 : /**
  242. 242 : * The unique identifier assigned by EBPP to the Funding Account.
  243. 243 : * @member {String} ID_FUNDING_ACCOUNT
  244. 244 : */
  245. 245 : exports.prototype['ID_FUNDING_ACCOUNT'] = undefined;
  246. 246 :
  247. 247 : /**
  248. 248 : * @param {String} client_key - The client_key of FundingAccount.
  249. 249 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  250. 250 : */
  251. 251 : exports.prototype.forClient = function (client_key) {
  252. 252 : var _this = this;
  253. 253 : Base.prototype.forClient.call(_this,client_key);
  254. 254 : return _this;
  255. 255 : };
  256. 256 : /**
  257. 257 : * @param {String} channel - The channel of FundingAccount.
  258. 258 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  259. 259 : */
  260. 260 : exports.prototype.videChannel = function (channel) {
  261. 261 : var _this = this;
  262. 262 : Base.prototype.videChannel.call(_this,channel);
  263. 263 : return _this;
  264. 264 : };
  265. 265 : /**
  266. 266 : * @param {String} account_holder_name - The account_holder_name of FundingAccount.
  267. 267 : * @param {String} nickname - The nickname of FundingAccount.
  268. 268 : * @param {String} account_number - The account_number of FundingAccount.
  269. 269 : * @param {String} account_subtype - The account_subtype of FundingAccount.
  270. 270 : * @param {String} aba_routing_number - The aba_routing_number of FundingAccount.
  271. 271 : * @param {String} card_cvv_number - The card_cvv_number of FundingAccount.
  272. 272 : * @param {String} expiry_date - The expiry_date of FundingAccount.
  273. 273 : * @param {String} account_holder_type - The account_holder_type of FundingAccount.
  274. 274 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  275. 275 : */
  276. 276 : exports.prototype.withDetails = function (account_holder_name, nickname, account_number, account_subtype, aba_routing_number, card_cvv_number, expiry_date, account_holder_type) {
  277. 277 : var _this = this;
  278. 278 :
  279. 279 : _this['account_holder_name'] = account_holder_name;
  280. 280 :
  281. 281 : _this['nickname'] = nickname;
  282. 282 :
  283. 283 : _this['account_number'] = account_number;
  284. 284 :
  285. 285 : _this['account_subtype'] = account_subtype;
  286. 286 :
  287. 287 : _this['aba_routing_number'] = aba_routing_number;
  288. 288 :
  289. 289 : _this['card_cvv_number'] = card_cvv_number;
  290. 290 :
  291. 291 : _this['expiry_date'] = expiry_date;
  292. 292 :
  293. 293 : _this['account_holder_type'] = account_holder_type;
  294. 294 :
  295. 295 :
  296. 296 : return _this;
  297. 297 : };
  298. 298 : /**
  299. 299 : * @param {String} account_number - The account_number of FundingAccount.
  300. 300 : * @param {String} issuer_name - The issuer_name of FundingAccount.
  301. 301 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  302. 302 : */
  303. 303 : exports.prototype.withRecordedDetails = function (account_number, issuer_name) {
  304. 304 : var _this = this;
  305. 305 :
  306. 306 : _this['account_number'] = account_number;
  307. 307 :
  308. 308 : _this['issuer_name'] = issuer_name;
  309. 309 :
  310. 310 :
  311. 311 : return _this;
  312. 312 : };
  313. 313 : /**
  314. 314 : * @param {String} status - The status of FundingAccount.
  315. 315 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  316. 316 : */
  317. 317 : exports.prototype.withStatus = function (status) {
  318. 318 : var _this = this;
  319. 319 :
  320. 320 : _this['status'] = status;
  321. 321 :
  322. 322 :
  323. 323 : return _this;
  324. 324 : };
  325. 325 : /**
  326. 326 : * @param {Address} address - The address of FundingAccount.
  327. 327 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  328. 328 : */
  329. 329 : exports.prototype.withAddress = function (address) {
  330. 330 : var _this = this;
  331. 331 :
  332. 332 : _this['address'] = address;
  333. 333 :
  334. 334 :
  335. 335 : return _this;
  336. 336 : };
  337. 337 : /**
  338. 338 : * @param {{String: String}} custom_fields - The custom_fields of FundingAccount.
  339. 339 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  340. 340 : */
  341. 341 : exports.prototype.withCustomFields = function (custom_fields) {
  342. 342 : var _this = this;
  343. 343 :
  344. 344 : _this['custom_fields'] = custom_fields;
  345. 345 :
  346. 346 :
  347. 347 : return _this;
  348. 348 : };
  349. 349 : /**
  350. 350 : * @param {String} comments - The comments of FundingAccount.
  351. 351 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  352. 352 : */
  353. 353 : exports.prototype.withMemo = function (comments) {
  354. 354 : var _this = this;
  355. 355 :
  356. 356 : _this['comments'] = comments;
  357. 357 :
  358. 358 :
  359. 359 : return _this;
  360. 360 : };
  361. 361 : /**
  362. 362 : * @param {String} ID_CUSTOMER - The ID_CUSTOMER of FundingAccount.
  363. 363 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  364. 364 : */
  365. 365 : exports.prototype.forCustomer = function (id_customer) {
  366. 366 : var _this = this;
  367. 367 :
  368. 368 : _this['ID_CUSTOMER'] = id_customer;
  369. 369 :
  370. 370 :
  371. 371 : return _this;
  372. 372 : };
  373. 373 : /**
  374. 374 : * @param {String} device_manufacturer_id - The device_manufacturer_id of FundingAccount.
  375. 375 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  376. 376 : */
  377. 377 : exports.prototype.withDeviceManufacturerId = function (device_manufacturer_id) {
  378. 378 : var _this = this;
  379. 379 :
  380. 380 : _this['device_manufacturer_id'] = device_manufacturer_id;
  381. 381 :
  382. 382 :
  383. 383 : return _this;
  384. 384 : };
  385. 385 : /**
  386. 386 : * @param {String} display_text - The display_text of FundingAccount.
  387. 387 : * @return {module:wrappers/FundingAccount} The instance of <code>FundingAccount</code>.
  388. 388 : */
  389. 389 : exports.prototype.withDisplayText = function (display_text) {
  390. 390 : var _this = this;
  391. 391 :
  392. 392 : _this['display_text'] = display_text;
  393. 393 :
  394. 394 :
  395. 395 : return _this;
  396. 396 : };
  397. 397 :
  398. 398 : exports.prototype.createdBy = function (requestor, requestor_type) {
  399. 399 : var _this = this;
  400. 400 : _this.requestedBy(requestor, requestor_type);
  401. 401 : return _this;
  402. 402 : };
  403. 403 : exports.prototype.deletedBy = function (requestor, requestor_type) {
  404. 404 : var _this = this;
  405. 405 : _this.requestedBy(requestor, requestor_type);
  406. 406 : return _this;
  407. 407 : };
  408. 408 : exports.prototype.retrievedBy = function (requestor, requestor_type) {
  409. 409 : var _this = this;
  410. 410 : _this.requestedBy(requestor, requestor_type);
  411. 411 : return _this;
  412. 412 : };
  413. 413 : exports.prototype.replacedBy = function (requestor, requestor_type) {
  414. 414 : var _this = this;
  415. 415 : _this.requestedBy(requestor, requestor_type);
  416. 416 : return _this;
  417. 417 : };
  418. 418 : exports.prototype.updatedBy = function (requestor, requestor_type) {
  419. 419 : var _this = this;
  420. 420 : _this.requestedBy(requestor, requestor_type);
  421. 421 : return _this;
  422. 422 : };
  423. 423 :
  424. 424 : exports.prototype.create = function (invocation_context, callback, live_mode, api_end_point) {
  425. 425 : var _this = this;
  426. 426 : var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
  427. 427 : try {
  428. 428 : var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
  429. 429 : if (callback) {
  430. 430 : callback(response['exception'], response['data'])
  431. 431 : }
  432. 432 : } catch (e) {
  433. 433 : exception = OrbipayApiError.getDefaultException(e);
  434. 434 : if (callback) {
  435. 435 : callback(exception)
  436. 436 : }
  437. 437 : }
  438. 438 : };
  439. 439 : try {
  440. 440 : _this.withContext(invocation_context, live_mode, api_end_point);
  441. 441 : var handler = new AddFundingAccountHandler();
  442. 442 : if (callback && CommonUtil.isFunction(callback)) {
  443. 443 : return handler.process(_this, internalCallback);
  444. 444 : } else {
  445. 445 : return handler.process(_this);
  446. 446 : }
  447. 447 : }
  448. 448 : catch (e){
  449. 449 : var error = OrbipayApiError.getDefaultException(e);
  450. 450 : if (callback) {
  451. 451 : callback(error)
  452. 452 : }
  453. 453 : }
  454. 454 : };
  455. 455 : exports.prototype.delete = function (invocation_context, callback, live_mode, api_end_point) {
  456. 456 : var _this = this;
  457. 457 : var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
  458. 458 : try {
  459. 459 : var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
  460. 460 : if (callback) {
  461. 461 : callback(response['exception'], response['data'])
  462. 462 : }
  463. 463 : } catch (e) {
  464. 464 : exception = OrbipayApiError.getDefaultException(e);
  465. 465 : if (callback) {
  466. 466 : callback(exception)
  467. 467 : }
  468. 468 : }
  469. 469 : };
  470. 470 : try {
  471. 471 : _this.withContext(invocation_context, live_mode, api_end_point);
  472. 472 : var handler = new DeleteFundingAccountHandler();
  473. 473 : if (callback && CommonUtil.isFunction(callback)) {
  474. 474 : return handler.process(_this, internalCallback);
  475. 475 : } else {
  476. 476 : return handler.process(_this);
  477. 477 : }
  478. 478 : }
  479. 479 : catch (e){
  480. 480 : var error = OrbipayApiError.getDefaultException(e);
  481. 481 : if (callback) {
  482. 482 : callback(error)
  483. 483 : }
  484. 484 : }
  485. 485 : };
  486. 486 : exports.prototype.get = function (invocation_context, callback, live_mode, api_end_point) {
  487. 487 : var _this = this;
  488. 488 : var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
  489. 489 : try {
  490. 490 : var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
  491. 491 : if (callback) {
  492. 492 : callback(response['exception'], response['data'])
  493. 493 : }
  494. 494 : } catch (e) {
  495. 495 : exception = OrbipayApiError.getDefaultException(e);
  496. 496 : if (callback) {
  497. 497 : callback(exception)
  498. 498 : }
  499. 499 : }
  500. 500 : };
  501. 501 : try {
  502. 502 : _this.withContext(invocation_context, live_mode, api_end_point);
  503. 503 : var handler = new GetFundingAccountHandler();
  504. 504 : if (callback && CommonUtil.isFunction(callback)) {
  505. 505 : return handler.process(_this, internalCallback);
  506. 506 : } else {
  507. 507 : return handler.process(_this);
  508. 508 : }
  509. 509 : }
  510. 510 : catch (e){
  511. 511 : var error = OrbipayApiError.getDefaultException(e);
  512. 512 : if (callback) {
  513. 513 : callback(error)
  514. 514 : }
  515. 515 : }
  516. 516 : };
  517. 517 : exports.prototype.replace = function (invocation_context, callback, live_mode, api_end_point) {
  518. 518 : var _this = this;
  519. 519 : var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
  520. 520 : try {
  521. 521 : var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
  522. 522 : if (callback) {
  523. 523 : callback(response['exception'], response['data'])
  524. 524 : }
  525. 525 : } catch (e) {
  526. 526 : exception = OrbipayApiError.getDefaultException(e);
  527. 527 : if (callback) {
  528. 528 : callback(exception)
  529. 529 : }
  530. 530 : }
  531. 531 : };
  532. 532 : try {
  533. 533 : _this.withContext(invocation_context, live_mode, api_end_point);
  534. 534 : var handler = new ReplaceFundingAccountHandler();
  535. 535 : if (callback && CommonUtil.isFunction(callback)) {
  536. 536 : return handler.process(_this, internalCallback);
  537. 537 : } else {
  538. 538 : return handler.process(_this);
  539. 539 : }
  540. 540 : }
  541. 541 : catch (e){
  542. 542 : var error = OrbipayApiError.getDefaultException(e);
  543. 543 : if (callback) {
  544. 544 : callback(error)
  545. 545 : }
  546. 546 : }
  547. 547 : };
  548. 548 : exports.prototype.update = function (invocation_context, callback, live_mode, api_end_point) {
  549. 549 : var _this = this;
  550. 550 : var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
  551. 551 : try {
  552. 552 : var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
  553. 553 : if (callback) {
  554. 554 : callback(response['exception'], response['data'])
  555. 555 : }
  556. 556 : } catch (e) {
  557. 557 : exception = OrbipayApiError.getDefaultException(e);
  558. 558 : if (callback) {
  559. 559 : callback(exception)
  560. 560 : }
  561. 561 : }
  562. 562 : };
  563. 563 : try {
  564. 564 : _this.withContext(invocation_context, live_mode, api_end_point);
  565. 565 : var handler = new UpdateFundingAccountHandler();
  566. 566 : if (callback && CommonUtil.isFunction(callback)) {
  567. 567 : return handler.process(_this, internalCallback);
  568. 568 : } else {
  569. 569 : return handler.process(_this);
  570. 570 : }
  571. 571 : }
  572. 572 : catch (e){
  573. 573 : var error = OrbipayApiError.getDefaultException(e);
  574. 574 : if (callback) {
  575. 575 : callback(error)
  576. 576 : }
  577. 577 : }
  578. 578 : };
  579. 579 :
  580. 580 : return exports;
  581. 581 :
  582. 582 : }));