Stripe Subscriptions module API explorer

/api/user/subscriptions/published-products-count (GET)

await global.api.user.subscriptions.PublishedProductsCount.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 subscriptions = require('../../../../../index.js')

module.exports = {
  get: async (req) => {
    const result = await subscriptions.StorageList.count(`${req.appid}/published/products`)
    return result
  }
}

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/subscriptions/published-products-count', () => {
  describe('returns', () => {
    it('integer', async () => {
      const administrator = await TestHelper.createOwner()
      await TestHelper.createProduct(administrator, {
        published: 'true'
      })
      await TestHelper.createProduct(administrator, {
        published: 'true'
      })
      const user = await TestHelper.createUser()
      const req = TestHelper.createRequest('/api/user/subscriptions/published-products-count')
      req.account = user.account
      req.session = user.session
      req.filename = __filename
      req.saveResponse = true
      const result = await req.get()
      assert.strictEqual(result, global.pageSize)
    })
  })
})