Stripe Connect module API explorer

/api/administrator/connect/payouts-count (GET)

Account information like email addresses is generated with faker-js it is not real user information.

await global.api.administrator.connect.PayoutsCount.get(req)

NodeJS source (view on github)

const connect = require('../../../../../index.js')

module.exports = {
  get: async (req) => {
    req.query = req.query || {}
    const where = {
      appid: req.appid || global.appid
    }
    if (req.query.stripeid) {
      where.stripeid = req.query.stripeid
    } else if (req.query.accountid) {
      where.accountid = req.query.accountid
    }
    return connect.Storage.Payout.count({
      where
    })
  }
}

Test source (view on github)

/* eslint-env mocha */
const assert = require('assert')
const TestHelper = require('../../../../../test-helper.js')
const TestStripeAccounts = require('../../../../../test-stripe-accounts.js')

describe('/api/administrator/connect/payouts-count', function () {
  before(TestHelper.disableMetrics)
  after(TestHelper.enableMetrics)
  describe('returns', () => {
    it('integer', async () => {
      const administrator = await TestHelper.createOwner()
      for (let i = 0, len = global.pageSize + 1; i < len; i++) {
        const user = await TestStripeAccounts.createSubmittedIndividual('NZ')
        await TestHelper.createPayout(user)
      }
      const req = TestHelper.createRequest('/api/administrator/connect/payouts-count')
      req.account = administrator.account
      req.session = administrator.session
      req.filename = __filename
      req.saveResponse = true
      const result = await req.get()
      assert.strictEqual(result, global.pageSize + 1)
    })
  })
})