Source: Affiliates.js

  1. const WHMCS = require('../whmcs')
  2. /**
  3. * Allows you to manage your Project Management module in WHMCS.
  4. * @extends WHMCS
  5. */
  6. class Affiliates extends WHMCS {
  7. /**
  8. * @param {Object} config Object containing your API credentials.
  9. * @param {string} config.serverUrl URL to your installation. Remember to point to /includes/api.php
  10. * @param {string} [config.username]
  11. * @param {string} [config.password]
  12. * @param {string} [config.identifier]
  13. * @param {string} [config.secret]
  14. */
  15. constructor (config) {
  16. super(config)
  17. }
  18. /**
  19. * Activate affiliate referrals for a client. - https://developers.whmcs.com/api-reference/affiliateactivate/
  20. * @param {Object} opts
  21. * @param {Number} opts.userid The client ID to activate affiliate status for
  22. */
  23. affiliateActivate (opts) {
  24. const options = {
  25. action: 'AffiliateActivate',
  26. ...opts
  27. }
  28. return this.callApi(options)
  29. }
  30. /**
  31. * Obtain an array of affiliates - https://developers.whmcs.com/api-reference/getaffiliates/
  32. * @param {Object} opts
  33. * @param {Number} [opts.limitstart] The offset for the returned affiliate data (default: 0)
  34. * @param {Number} [opts.limitnum] The number of records to return (default: 25)
  35. * @param {Number} [opts.userid] Obtain affiliate data for a specific client account
  36. * @param {Number} [opts.visitors] Provide affiliates that match a specific visitor count
  37. * @param {String} [opts.paytype] Provide affiliates matching the paytype provided. One of “, ‘percentage’, ‘fixedamount’
  38. * @param {Number} [opts.payamount] Provide affiliates matching a specific overridden payout amount
  39. * @param {Number} [opts.onetime] Provide affiliates configured to receive one time affiliates
  40. * @param {Number} [opts.balance] Provide affiliates that have this balance
  41. * @param {Number} [opts.withdrawn] Provide affiliates that have withdrawn this amount
  42. */
  43. getAffiliates (opts) {
  44. const options = {
  45. action: 'GetAffiliates',
  46. ...opts
  47. }
  48. return this.callApi(options)
  49. }
  50. }
  51. module.exports = Affiliates