Stripe Subscriptions module API explorer

/api/administrator/subscriptions/tax-rates-count (GET)

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

await global.api.administrator.subscriptions.TaxRatesCount.get(req)

Returns integer

NodeJS source (view on github)

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

module.exports = {
  get: async (req) => {
    const where = {
      appid: req.appid || global.appid
    }
    req.query = req.query || {}
    if (req.query.customerid) {
      where.customerid = req.query.customerid
    } else if (req.query.subscriptionid) {
      where.subscriptionid = req.query.subscriptionid
    } else if (req.query.accountid) {
      where.accountid = req.query.accountid
    }
    return subscriptions.Storage.TaxRate.count({
      where
    })
  }
}

Test source (view on github)

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

describe('/api/administrator/subscriptions/tax-rates-count', function () {
  describe('returns', () => {
    it('integer', async () => {
      const administrator = await TestHelper.createOwner()
      for (let i = 0, len = global.pageSize + 2; i < len; i++) {
        await TestHelper.createTaxRate(administrator)
      }
      const req = TestHelper.createRequest('/api/administrator/subscriptions/tax-rates-count')
      req.account = administrator.account
      req.session = administrator.session
      const result = await req.get()
      assert.strictEqual(result, global.pageSize + 2)
    })
  })
})