PayoutItem.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* Copyright 2015-2016 PayPal, Inc. */
  2. "use strict";
  3. var generate = require('../generate');
  4. var api = require('../api');
  5. /**
  6. * An individual Payout item
  7. * @return {Object} payout object functions
  8. */
  9. function payoutItem() {
  10. var baseURL = '/v1/payments/payouts-item/';
  11. var operations = ['get'];
  12. var ret = {
  13. baseURL: baseURL,
  14. /**
  15. * Cancel an existing payout/transaction in UNCLAIMED state
  16. * Explicitly define `cancel` method here to avoid having to pass in an empty `data` parameter
  17. * as required by the generated generic `cancel` operation.
  18. *
  19. * @param {String} id Payout item id
  20. * @param {Object|Function} config Configuration parameters e.g. client_id, client_secret override or callback
  21. * @param {Function} cb
  22. * @return {Object} Payout item details object with transaction status of RETURNED
  23. */
  24. cancel: function cancel(id, config, cb) {
  25. api.executeHttp('POST', this.baseURL + id + '/cancel', {}, config, cb);
  26. }
  27. };
  28. ret = generate.mixin(ret, operations);
  29. return ret;
  30. }
  31. module.exports = payoutItem;