lint
This commit is contained in:
parent
e05821d6d7
commit
84079450f9
|
@ -99,13 +99,9 @@ export default class LicenseAPI extends BaseAPI {
|
|||
}, opts)
|
||||
}
|
||||
|
||||
async updatePlan(
|
||||
priceId: string,
|
||||
opts: APIRequestOpts = { status: 200 }
|
||||
) {
|
||||
async updatePlan(priceId: string, opts: APIRequestOpts = { status: 200 }) {
|
||||
return this.doRequest(() => {
|
||||
return this.client.put(`/api/license/plan`,
|
||||
{
|
||||
return this.client.put(`/api/license/plan`, {
|
||||
body: { priceId },
|
||||
})
|
||||
}, opts)
|
||||
|
|
|
@ -41,12 +41,13 @@ export default class StripeAPI extends BaseAPI {
|
|||
async linkStripeCustomer(
|
||||
accountId: string,
|
||||
stripeCustomerId: string,
|
||||
opts: APIRequestOpts = { status: 200 }) {
|
||||
opts: APIRequestOpts = { status: 200 }
|
||||
) {
|
||||
return this.doRequest(() => {
|
||||
return this.client.post(`/api/stripe/link`, {
|
||||
body: {
|
||||
accountId,
|
||||
stripeCustomerId
|
||||
stripeCustomerId,
|
||||
},
|
||||
internal: true,
|
||||
})
|
||||
|
|
|
@ -35,7 +35,7 @@ describe("license management", () => {
|
|||
|
||||
// Select priceId from premium plan
|
||||
let premiumPriceId = null
|
||||
let businessPriceId = ''
|
||||
let businessPriceId = ""
|
||||
for (const plan of planBody) {
|
||||
if (plan.type === PlanType.PREMIUM) {
|
||||
premiumPriceId = plan.prices[0].priceId
|
||||
|
@ -53,16 +53,16 @@ describe("license management", () => {
|
|||
expect(checkoutSessionUrl).toContain("checkout.stripe.com")
|
||||
|
||||
// Create stripe customer
|
||||
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY)
|
||||
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY)
|
||||
const customer = await stripe.customers.create({
|
||||
email: createAccountRequest.email
|
||||
email: createAccountRequest.email,
|
||||
})
|
||||
|
||||
// Create payment method
|
||||
const paymentMethod = await stripe.paymentMethods.create({
|
||||
type: 'card',
|
||||
type: "card",
|
||||
card: {
|
||||
token: 'tok_visa' // Test Visa Card
|
||||
token: "tok_visa", // Test Visa Card
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -88,7 +88,7 @@ describe("license management", () => {
|
|||
},
|
||||
],
|
||||
default_payment_method: paymentMethod.id,
|
||||
collection_method: 'charge_automatically',
|
||||
collection_method: "charge_automatically",
|
||||
})
|
||||
|
||||
await config.doInNewState(async () => {
|
||||
|
@ -99,7 +99,8 @@ describe("license management", () => {
|
|||
expect(selfBodyPremium.license.plan.type).toBe(PlanType.PREMIUM)
|
||||
|
||||
// Create portal session - Check URL
|
||||
const [portalRes, portalSessionBody] = await config.api.stripe.createPortalSession(customer.id)
|
||||
const [portalRes, portalSessionBody] =
|
||||
await config.api.stripe.createPortalSession(customer.id)
|
||||
expect(portalSessionBody.url).toContain("billing.stripe.com")
|
||||
|
||||
// Update subscription from premium to business license
|
||||
|
|
Loading…
Reference in New Issue