/api/administrator/subscriptions/payment-intents-count (GET)
await global.api.administrator.subscriptions.PaymentIntentsCount.get(req) Located in Stripe Subscriptions module API
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) => {
return subscriptions.StorageList.count(`${req.appid}/paymentIntents`, req.stripeKey)
}
}
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')
const TestStripeAccounts = require('../../../../../test-stripe-accounts.js')
describe('/api/administrator/subscriptions/payment-intents-count', function () {
this.timeout(60 * 60 * 1000)
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.createUserWithPaymentMethod()
await TestHelper.createPaymentIntent(user, {
amount: '30000',
currency: 'usd',
paymentmethodid: user.paymentMethod.id
})
}
const req = TestHelper.createRequest('/api/administrator/subscriptions/payment-intents-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)
})
})
})