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/CreateRecurringPaymentSetupHandler')
  9. 9 : , require('../handlers/DeletePaymentSetupHandler')
  10. 10 : , require('../handlers/GetPaymentSetupHandler')
  11. 11 : , require('../handlers/UpdatePaymentSetupHandler'), require('../OrbipayApiError'));
  12. 12 : }
  13. 13 : }(this, function(ApiClient, InvocationContext, CommonUtil, ResponseWrapper, Base, CreateRecurringPaymentSetupHandler, DeletePaymentSetupHandler, GetPaymentSetupHandler, UpdatePaymentSetupHandler, OrbipayApiError) {
  14. 14 : 'use strict';
  15. 15 :
  16. 16 : /**
  17. 17 : * The PaymentSetup wrapper module.
  18. 18 : * @module wrappers/PaymentSetup
  19. 19 : */
  20. 20 : var exports = function(id_payment_setup) {
  21. 21 : var _this = this;
  22. 22 : Base.call(_this);
  23. 23 : _this['ID_PAYMENT_SETUP'] = id_payment_setup;
  24. 24 : _this.id = id_payment_setup;
  25. 25 : };
  26. 26 :
  27. 27 : /**
  28. 28 : * Constructs a <code>PaymentSetup</code> from a plain JavaScript object, optionally creating a new instance.
  29. 29 : * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
  30. 30 : * @param {Object} data The plain JavaScript object bearing properties of interest.
  31. 31 : * @param {module:wrappers/PaymentSetup} obj Optional instance to populate.
  32. 32 : * @return {module:wrappers/PaymentSetup} The populated <code>PaymentSetup</code> instance.
  33. 33 : */
  34. 34 : exports.constructFromObject = function (data, obj) {
  35. 35 : if (data) {
  36. 36 : obj = obj || new exports();
  37. 37 : if (data.hasOwnProperty('id')) {
  38. 38 : obj['id'] = data['id'];
  39. 39 : }
  40. 40 : if (data.hasOwnProperty('url')) {
  41. 41 : obj['url'] = data['url'];
  42. 42 : }
  43. 43 : if (data.hasOwnProperty('fee')) {
  44. 44 : var Fee = require('./Fee');
  45. 45 : obj['fee'] = Fee.constructFromObject(data['fee']);
  46. 46 : }
  47. 47 : if (data.hasOwnProperty('status')) {
  48. 48 : obj['status'] = data['status'];
  49. 49 : }
  50. 50 : if (data.hasOwnProperty('payment_method')) {
  51. 51 : obj['payment_method'] = data['payment_method'];
  52. 52 : }
  53. 53 : if (data.hasOwnProperty('payment_setup_schedule_type')) {
  54. 54 : obj['payment_setup_schedule_type'] = data['payment_setup_schedule_type'];
  55. 55 : }
  56. 56 : if (data.hasOwnProperty('confirmation_number')) {
  57. 57 : obj['confirmation_number'] = data['confirmation_number'];
  58. 58 : }
  59. 59 : if (data.hasOwnProperty('custom_fields')) {
  60. 60 : obj['custom_fields'] = data['custom_fields'];
  61. 61 : }
  62. 62 : if (data.hasOwnProperty('currency_code3d')) {
  63. 63 : obj['currency_code3d'] = data['currency_code3d'];
  64. 64 : }
  65. 65 : if (data.hasOwnProperty('amount')) {
  66. 66 : obj['amount'] = data['amount'];
  67. 67 : }
  68. 68 : if (data.hasOwnProperty('card_cvv_number')) {
  69. 69 : obj['card_cvv_number'] = data['card_cvv_number'];
  70. 70 : }
  71. 71 : if (data.hasOwnProperty('next_payment_date')) {
  72. 72 : obj['next_payment_date'] = data['next_payment_date'];
  73. 73 : }
  74. 74 : if (data.hasOwnProperty('payment_setup_reference')) {
  75. 75 : obj['payment_setup_reference'] = data['payment_setup_reference'];
  76. 76 : }
  77. 77 : if (data.hasOwnProperty('payment_schedule')) {
  78. 78 : var PaymentSchedule = require('./PaymentSchedule');
  79. 79 : obj['payment_schedule'] = PaymentSchedule.constructFromObject(data['payment_schedule']);
  80. 80 : }
  81. 81 : if (data.hasOwnProperty('payment_setup_entry_date')) {
  82. 82 : obj['payment_setup_entry_date'] = data['payment_setup_entry_date'];
  83. 83 : }
  84. 84 : if (data.hasOwnProperty('comments')) {
  85. 85 : obj['comments'] = data['comments'];
  86. 86 : }
  87. 87 : if (data.hasOwnProperty('deleted')) {
  88. 88 : obj['deleted'] = data['deleted'];
  89. 89 : }
  90. 90 : if (data.hasOwnProperty('customer')) {
  91. 91 : var Customer = require('./Customer');
  92. 92 : obj['customer'] = Customer.constructFromObject(data['customer']);
  93. 93 : }
  94. 94 : if (data.hasOwnProperty('funding_account')) {
  95. 95 : var FundingAccount = require('./FundingAccount');
  96. 96 : obj['funding_account'] = FundingAccount.constructFromObject(data['funding_account']);
  97. 97 : }
  98. 98 : if (data.hasOwnProperty('customer_account')) {
  99. 99 : var CustomerAccount = require('./CustomerAccount');
  100. 100 : obj['customer_account'] = CustomerAccount.constructFromObject(data['customer_account']);
  101. 101 : }
  102. 102 : if (data.hasOwnProperty('payment_network_response')) {
  103. 103 : var PaymentNetworkResponse = require('./PaymentNetworkResponse');
  104. 104 : obj['payment_network_response'] = PaymentNetworkResponse.constructFromObject(data['payment_network_response']);
  105. 105 : }
  106. 106 : if (data.hasOwnProperty('audit_info')) {
  107. 107 : var AuditInfo = require('./AuditInfo');
  108. 108 : obj['audit_info'] = AuditInfo.constructFromObject(data['audit_info']);
  109. 109 : }
  110. 110 : if (data.hasOwnProperty('ID_CUSTOMER')) {
  111. 111 : obj['ID_CUSTOMER'] = data['ID_CUSTOMER'];
  112. 112 : }
  113. 113 : if (data.hasOwnProperty('ID_PAYMENT_SETUP')) {
  114. 114 : obj['ID_PAYMENT_SETUP'] = data['ID_PAYMENT_SETUP'];
  115. 115 : }
  116. 116 : }
  117. 117 : return obj;
  118. 118 : };
  119. 119 :
  120. 120 :
  121. 121 : exports.prototype = Object.create(Base.prototype);
  122. 122 : exports.prototype.constructor = exports;
  123. 123 :
  124. 124 : /**
  125. 125 : * The unique identifier assigned by Orbipay to the payment setup.
  126. 126 : * @member {String} id
  127. 127 : */
  128. 128 : exports.prototype['id'] = undefined;
  129. 129 : /**
  130. 130 : * This URL fetches the details of payment setup.
  131. 131 : * @member {String} url
  132. 132 : */
  133. 133 : exports.prototype['url'] = undefined;
  134. 134 : /**
  135. 135 : * @member {Fee} fee
  136. 136 : */
  137. 137 : exports.prototype['fee'] = undefined;
  138. 138 : /**
  139. 139 : * The status of the payment.
  140. 140 : * @member {String} status
  141. 141 : */
  142. 142 : exports.prototype['status'] = undefined;
  143. 143 : /**
  144. 144 : * The fulfillment method for the payment.
  145. 145 : * @member {String} payment_method
  146. 146 : */
  147. 147 : exports.prototype['payment_method'] = undefined;
  148. 148 : /**
  149. 149 : * The schedule type for the payment setup.
  150. 150 : * @member {String} payment_setup_schedule_type
  151. 151 : */
  152. 152 : exports.prototype['payment_setup_schedule_type'] = undefined;
  153. 153 : /**
  154. 154 : * The confirmation number or reference provided to the customer for the payment setup.
  155. 155 : * @member {String} confirmation_number
  156. 156 : */
  157. 157 : exports.prototype['confirmation_number'] = undefined;
  158. 158 : /**
  159. 159 : * 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.
  160. 160 : * @member {{String: String}} custom_fields
  161. 161 : */
  162. 162 : exports.prototype['custom_fields'] = undefined;
  163. 163 : /**
  164. 164 : * 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.
  165. 165 : * @member {String} currency_code3d
  166. 166 : */
  167. 167 : exports.prototype['currency_code3d'] = undefined;
  168. 168 : /**
  169. 169 : * The amount being paid. In case the payment_amount_type is 'discounted_amount', 'penalty_amount' or 'other', the amount needs to be specified. In other cases, this is derived from the payment_amount_type.
  170. 170 : * @member {String} amount
  171. 171 : */
  172. 172 : exports.prototype['amount'] = undefined;
  173. 173 : /**
  174. 174 : * This is never returned by Orbipay. This needs to be passed to Orbipay when making or editing a payment setup with a card funding account.
  175. 175 : * @member {String} card_cvv_number
  176. 176 : */
  177. 177 : exports.prototype['card_cvv_number'] = undefined;
  178. 178 : /**
  179. 179 : * The date on which the payment is scheduled to be made. It must be in ISO8601 full-date format, namely, YYYY-MM-DD.
  180. 180 : * @member {String} next_payment_date
  181. 181 : */
  182. 182 : exports.prototype['next_payment_date'] = undefined;
  183. 183 : /**
  184. 184 : * The unique identifier in the client system for the payment setup.
  185. 185 : * @member {String} payment_setup_reference
  186. 186 : */
  187. 187 : exports.prototype['payment_setup_reference'] = undefined;
  188. 188 : /**
  189. 189 : * @member {PaymentSchedule} payment_schedule
  190. 190 : */
  191. 191 : exports.prototype['payment_schedule'] = undefined;
  192. 192 : /**
  193. 193 : * The date on which the payment setup is captured in Orbipay. It must be in ISO8601 full-date format, namely, YYYY-MM-DD.
  194. 194 : * @member {String} payment_setup_entry_date
  195. 195 : */
  196. 196 : exports.prototype['payment_setup_entry_date'] = undefined;
  197. 197 : /**
  198. 198 : * 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.
  199. 199 : * @member {String} comments
  200. 200 : */
  201. 201 : exports.prototype['comments'] = undefined;
  202. 202 : /**
  203. 203 : * The status of payment which says whether the payment is deleted or not
  204. 204 : * @member {String} deleted
  205. 205 : */
  206. 206 : exports.prototype['deleted'] = undefined;
  207. 207 : /**
  208. 208 : * @member {Customer} customer
  209. 209 : */
  210. 210 : exports.prototype['customer'] = undefined;
  211. 211 : /**
  212. 212 : * @member {FundingAccount} funding_account
  213. 213 : */
  214. 214 : exports.prototype['funding_account'] = undefined;
  215. 215 : /**
  216. 216 : * @member {CustomerAccount} customer_account
  217. 217 : */
  218. 218 : exports.prototype['customer_account'] = undefined;
  219. 219 : /**
  220. 220 : * @member {PaymentNetworkResponse} payment_network_response
  221. 221 : */
  222. 222 : exports.prototype['payment_network_response'] = undefined;
  223. 223 : /**
  224. 224 : * @member {AuditInfo} audit_info
  225. 225 : */
  226. 226 : exports.prototype['audit_info'] = undefined;
  227. 227 : /**
  228. 228 : * The unique identifier assigned by EBPP to the customer.
  229. 229 : * @member {String} ID_CUSTOMER
  230. 230 : */
  231. 231 : exports.prototype['ID_CUSTOMER'] = undefined;
  232. 232 : /**
  233. 233 : * The unique identifier assigned by EBPP to the payment setup.
  234. 234 : * @member {String} ID_PAYMENT_SETUP
  235. 235 : */
  236. 236 : exports.prototype['ID_PAYMENT_SETUP'] = undefined;
  237. 237 :
  238. 238 : /**
  239. 239 : * @param {String} client_key - The client_key of PaymentSetup.
  240. 240 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  241. 241 : */
  242. 242 : exports.prototype.forClient = function (client_key) {
  243. 243 : var _this = this;
  244. 244 : Base.prototype.forClient.call(_this,client_key);
  245. 245 : return _this;
  246. 246 : };
  247. 247 : /**
  248. 248 : * @param {String} channel - The channel of PaymentSetup.
  249. 249 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  250. 250 : */
  251. 251 : exports.prototype.videChannel = function (channel) {
  252. 252 : var _this = this;
  253. 253 : Base.prototype.videChannel.call(_this,channel);
  254. 254 : return _this;
  255. 255 : };
  256. 256 : /**
  257. 257 : * @param {String} amount - The amount of PaymentSetup.
  258. 258 : * @param {String} card_cvv_number - The card_cvv_number of PaymentSetup.
  259. 259 : * @param {String} payment_setup_schedule_type - The payment_setup_schedule_type of PaymentSetup.
  260. 260 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  261. 261 : */
  262. 262 : exports.prototype.withDetails = function (amount, card_cvv_number, payment_setup_schedule_type) {
  263. 263 : var _this = this;
  264. 264 :
  265. 265 : _this['amount'] = amount;
  266. 266 :
  267. 267 : _this['card_cvv_number'] = card_cvv_number;
  268. 268 :
  269. 269 : _this['payment_setup_schedule_type'] = payment_setup_schedule_type;
  270. 270 :
  271. 271 :
  272. 272 : return _this;
  273. 273 : };
  274. 274 : /**
  275. 275 : * @param {FundingAccount} funding_account - The funding_account of PaymentSetup.
  276. 276 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  277. 277 : */
  278. 278 : exports.prototype.fromAccount = function (funding_account) {
  279. 279 : var _this = this;
  280. 280 :
  281. 281 : _this['funding_account'] = funding_account;
  282. 282 :
  283. 283 :
  284. 284 : return _this;
  285. 285 : };
  286. 286 : /**
  287. 287 : * @param {CustomerAccount} customer_account - The customer_account of PaymentSetup.
  288. 288 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  289. 289 : */
  290. 290 : exports.prototype.toAccount = function (customer_account) {
  291. 291 : var _this = this;
  292. 292 :
  293. 293 : _this['customer_account'] = customer_account;
  294. 294 :
  295. 295 :
  296. 296 : return _this;
  297. 297 : };
  298. 298 : /**
  299. 299 : * @param {String} payment_setup_reference - The payment_setup_reference of PaymentSetup.
  300. 300 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  301. 301 : */
  302. 302 : exports.prototype.withReference = function (payment_setup_reference) {
  303. 303 : var _this = this;
  304. 304 :
  305. 305 : _this['payment_setup_reference'] = payment_setup_reference;
  306. 306 :
  307. 307 :
  308. 308 : return _this;
  309. 309 : };
  310. 310 : /**
  311. 311 : * @param {PaymentSchedule} payment_schedule - The payment_schedule of PaymentSetup.
  312. 312 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  313. 313 : */
  314. 314 : exports.prototype.withPaymentSchedule = function (payment_schedule) {
  315. 315 : var _this = this;
  316. 316 :
  317. 317 : _this['payment_schedule'] = payment_schedule;
  318. 318 :
  319. 319 :
  320. 320 : return _this;
  321. 321 : };
  322. 322 : /**
  323. 323 : * @param {String} status - The status of PaymentSetup.
  324. 324 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  325. 325 : */
  326. 326 : exports.prototype.withStatus = function (status) {
  327. 327 : var _this = this;
  328. 328 :
  329. 329 : _this['status'] = status;
  330. 330 :
  331. 331 :
  332. 332 : return _this;
  333. 333 : };
  334. 334 : /**
  335. 335 : * @param {{String: String}} custom_fields - The custom_fields of PaymentSetup.
  336. 336 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  337. 337 : */
  338. 338 : exports.prototype.withCustomFields = function (custom_fields) {
  339. 339 : var _this = this;
  340. 340 :
  341. 341 : _this['custom_fields'] = custom_fields;
  342. 342 :
  343. 343 :
  344. 344 : return _this;
  345. 345 : };
  346. 346 : /**
  347. 347 : * @param {String} comments - The comments of PaymentSetup.
  348. 348 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  349. 349 : */
  350. 350 : exports.prototype.withMemo = function (comments) {
  351. 351 : var _this = this;
  352. 352 :
  353. 353 : _this['comments'] = comments;
  354. 354 :
  355. 355 :
  356. 356 : return _this;
  357. 357 : };
  358. 358 : /**
  359. 359 : * @param {Fee} fee - The fee of PaymentSetup.
  360. 360 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  361. 361 : */
  362. 362 : exports.prototype.withFee = function (fee) {
  363. 363 : var _this = this;
  364. 364 :
  365. 365 : _this['fee'] = fee;
  366. 366 :
  367. 367 :
  368. 368 : return _this;
  369. 369 : };
  370. 370 : /**
  371. 371 : * @param {String} ID_CUSTOMER - The ID_CUSTOMER of PaymentSetup.
  372. 372 : * @return {module:wrappers/PaymentSetup} The instance of <code>PaymentSetup</code>.
  373. 373 : */
  374. 374 : exports.prototype.forCustomer = function (id_customer) {
  375. 375 : var _this = this;
  376. 376 :
  377. 377 : _this['ID_CUSTOMER'] = id_customer;
  378. 378 : var Customer = require('./Customer');
  379. 379 : _this['customer'] = new Customer(id_customer);
  380. 380 :
  381. 381 :
  382. 382 : return _this;
  383. 383 : };
  384. 384 :
  385. 385 : exports.prototype.createdBy = function (requestor, requestor_type) {
  386. 386 : var _this = this;
  387. 387 : _this.requestedBy(requestor, requestor_type);
  388. 388 : return _this;
  389. 389 : };
  390. 390 : exports.prototype.deletedBy = function (requestor, requestor_type) {
  391. 391 : var _this = this;
  392. 392 : _this.requestedBy(requestor, requestor_type);
  393. 393 : return _this;
  394. 394 : };
  395. 395 : exports.prototype.retrievedBy = function (requestor, requestor_type) {
  396. 396 : var _this = this;
  397. 397 : _this.requestedBy(requestor, requestor_type);
  398. 398 : return _this;
  399. 399 : };
  400. 400 : exports.prototype.updatedBy = function (requestor, requestor_type) {
  401. 401 : var _this = this;
  402. 402 : _this.requestedBy(requestor, requestor_type);
  403. 403 : return _this;
  404. 404 : };
  405. 405 :
  406. 406 : exports.prototype.create = function (invocation_context, callback, live_mode, api_end_point) {
  407. 407 : var _this = this;
  408. 408 : var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
  409. 409 : try {
  410. 410 : var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
  411. 411 : if (callback) {
  412. 412 : callback(response['exception'], response['data'])
  413. 413 : }
  414. 414 : } catch (e) {
  415. 415 : exception = OrbipayApiError.getDefaultException(e);
  416. 416 : if (callback) {
  417. 417 : callback(exception)
  418. 418 : }
  419. 419 : }
  420. 420 : };
  421. 421 : try {
  422. 422 : _this.withContext(invocation_context, live_mode, api_end_point);
  423. 423 : var handler = new CreateRecurringPaymentSetupHandler();
  424. 424 : if (callback && CommonUtil.isFunction(callback)) {
  425. 425 : return handler.process(_this, internalCallback);
  426. 426 : } else {
  427. 427 : return handler.process(_this);
  428. 428 : }
  429. 429 : }
  430. 430 : catch (e){
  431. 431 : var error = OrbipayApiError.getDefaultException(e);
  432. 432 : if (callback) {
  433. 433 : callback(error)
  434. 434 : }
  435. 435 : }
  436. 436 : };
  437. 437 : exports.prototype.delete = function (invocation_context, callback, live_mode, api_end_point) {
  438. 438 : var _this = this;
  439. 439 : var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
  440. 440 : try {
  441. 441 : var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
  442. 442 : if (callback) {
  443. 443 : callback(response['exception'], response['data'])
  444. 444 : }
  445. 445 : } catch (e) {
  446. 446 : exception = OrbipayApiError.getDefaultException(e);
  447. 447 : if (callback) {
  448. 448 : callback(exception)
  449. 449 : }
  450. 450 : }
  451. 451 : };
  452. 452 : try {
  453. 453 : _this.withContext(invocation_context, live_mode, api_end_point);
  454. 454 : var handler = new DeletePaymentSetupHandler();
  455. 455 : if (callback && CommonUtil.isFunction(callback)) {
  456. 456 : return handler.process(_this, internalCallback);
  457. 457 : } else {
  458. 458 : return handler.process(_this);
  459. 459 : }
  460. 460 : }
  461. 461 : catch (e){
  462. 462 : var error = OrbipayApiError.getDefaultException(e);
  463. 463 : if (callback) {
  464. 464 : callback(error)
  465. 465 : }
  466. 466 : }
  467. 467 : };
  468. 468 : exports.prototype.get = function (invocation_context, callback, live_mode, api_end_point) {
  469. 469 : var _this = this;
  470. 470 : var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
  471. 471 : try {
  472. 472 : var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
  473. 473 : if (callback) {
  474. 474 : callback(response['exception'], response['data'])
  475. 475 : }
  476. 476 : } catch (e) {
  477. 477 : exception = OrbipayApiError.getDefaultException(e);
  478. 478 : if (callback) {
  479. 479 : callback(exception)
  480. 480 : }
  481. 481 : }
  482. 482 : };
  483. 483 : try {
  484. 484 : _this.withContext(invocation_context, live_mode, api_end_point);
  485. 485 : var handler = new GetPaymentSetupHandler();
  486. 486 : if (callback && CommonUtil.isFunction(callback)) {
  487. 487 : return handler.process(_this, internalCallback);
  488. 488 : } else {
  489. 489 : return handler.process(_this);
  490. 490 : }
  491. 491 : }
  492. 492 : catch (e){
  493. 493 : var error = OrbipayApiError.getDefaultException(e);
  494. 494 : if (callback) {
  495. 495 : callback(error)
  496. 496 : }
  497. 497 : }
  498. 498 : };
  499. 499 : exports.prototype.update = function (invocation_context, callback, live_mode, api_end_point) {
  500. 500 : var _this = this;
  501. 501 : var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
  502. 502 : try {
  503. 503 : var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
  504. 504 : if (callback) {
  505. 505 : callback(response['exception'], response['data'])
  506. 506 : }
  507. 507 : } catch (e) {
  508. 508 : exception = OrbipayApiError.getDefaultException(e);
  509. 509 : if (callback) {
  510. 510 : callback(exception)
  511. 511 : }
  512. 512 : }
  513. 513 : };
  514. 514 : try {
  515. 515 : _this.withContext(invocation_context, live_mode, api_end_point);
  516. 516 : var handler = new UpdatePaymentSetupHandler();
  517. 517 : if (callback && CommonUtil.isFunction(callback)) {
  518. 518 : return handler.process(_this, internalCallback);
  519. 519 : } else {
  520. 520 : return handler.process(_this);
  521. 521 : }
  522. 522 : }
  523. 523 : catch (e){
  524. 524 : var error = OrbipayApiError.getDefaultException(e);
  525. 525 : if (callback) {
  526. 526 : callback(error)
  527. 527 : }
  528. 528 : }
  529. 529 : };
  530. 530 :
  531. 531 : return exports;
  532. 532 :
  533. 533 : }));