Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api-service): add new 'pro' tier #7719

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .source
22 changes: 20 additions & 2 deletions apps/api/src/app/billing/e2e/create-checkout-session.e2e-ee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,29 @@ describe('Create checkout session #novu-v2', async () => {
},
};
let checkoutCreateStub: sinon.SinonStub;
let getFeatureFlagStub: { execute: sinon.SinonStub };
const IS_2025_Q1_TIERING_ENABLED = true;

beforeEach(() => {
checkoutCreateStub = sinon.stub(stripeStub.checkout.sessions, 'create').resolves({ url: 'url' });
getFeatureFlagStub = {
execute: sinon.stub().resolves(IS_2025_Q1_TIERING_ENABLED),
};
});

afterEach(() => {
checkoutCreateStub.reset();
getFeatureFlagStub.execute.reset();
});

it('Create checkout session with 1 subscription containing 1 licensed item and 1 metered item for monthly billing interval', async () => {
const usecase = new CreateCheckoutSession(stripeStub, getOrCreateCustomer, userRepository, getPrices);
const usecase = new CreateCheckoutSession(
stripeStub,
getOrCreateCustomer,
userRepository,
getPrices,
getFeatureFlagStub
);

const result = await usecase.execute({
organizationId: 'organization_id',
Expand All @@ -89,7 +101,13 @@ describe('Create checkout session #novu-v2', async () => {
});

it('Create checkout session with 1 subscription containing 1 licensed item for annual billing interval', async () => {
const usecase = new CreateCheckoutSession(stripeStub, getOrCreateCustomer, userRepository, getPrices);
const usecase = new CreateCheckoutSession(
stripeStub,
getOrCreateCustomer,
userRepository,
getPrices,
getFeatureFlagStub
);

const result = await usecase.execute({
organizationId: 'organization_id',
Expand Down
20 changes: 20 additions & 0 deletions apps/api/src/app/billing/e2e/get-prices.e2e-ee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ describe('GetPrices #novu-v2', () => {
? ['free_usage_notifications_10k']
: ['free_usage_notifications'];

const proPrices = [
{
apiServiceLevel: ApiServiceLevelEnum.PRO,
billingInterval: StripeBillingIntervalEnum.MONTH,
prices: {
licensed: ['pro_flat_monthly'],
metered: ['pro_usage_notifications'],
},
},
{
apiServiceLevel: ApiServiceLevelEnum.PRO,
billingInterval: StripeBillingIntervalEnum.YEAR,
prices: {
licensed: ['pro_flat_annually'],
metered: ['pro_usage_notifications'],
},
},
];

const expectedPrices = [
{
apiServiceLevel: ApiServiceLevelEnum.FREE,
Expand All @@ -56,6 +75,7 @@ describe('GetPrices #novu-v2', () => {
metered: freeMeteredPriceLookupKey,
},
},
...(IS_2025_Q1_TIERING_ENABLED ? proPrices : []),
{
apiServiceLevel: ApiServiceLevelEnum.BUSINESS,
billingInterval: StripeBillingIntervalEnum.MONTH,
Expand Down
Loading