Stripe Connect module API explorer

/api/user/connect/country-specs-count (GET)

await global.api.user.connect.CountrySpecsCount.get(req)

Returns integer

Exceptions

These exceptions are thrown (NodeJS) or returned as JSON (HTTP) if you provide incorrect data or do not meet the requirements:

Exception Circumstances

NodeJS source (edit on github)

If you see a problem with the source submit a pull request on Github.

const stripeCache = require('../../../../stripe-cache.js')
let cache

module.exports = {
  get: async (req) => {
    if (!cache) {
      const items = await stripeCache.execute('countrySpecs', 'list', { limit: 100 }, req.stripeKey)
      if (items && items.data.length) {
        cache = items.data.length
      }
    }
    return cache
  }
}

Test source (edit on github)

Tests perform real HTTP requests against a running Dashboard server.

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

describe('/api/user/connect/country-specs-count', () => {
  describe('returns', () => {
    it('integer', async () => {
      const user = await TestHelper.createUser()
      const req = TestHelper.createRequest('/api/user/connect/country-specs-count')
      req.account = user.account
      req.session = user.session
      req.filename = __filename
      req.saveResponse = true
      const total = await req.get()
      assert.strictEqual(total > 0, true)
    })
  })
})