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