Skip to content

Commit

Permalink
feat(api-service): add FFs for the new tiering (#7717)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChmaraX authored Feb 13, 2025
1 parent 5d17730 commit c6ae39e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .source
15 changes: 13 additions & 2 deletions apps/api/src/app/billing/e2e/get-prices.e2e-ee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ describe('GetPrices #novu-v2', () => {
},
};
let listPricesStub: sinon.SinonStub;
let getFeatureFlagStub: { execute: sinon.SinonStub };
const IS_2025_Q1_TIERING_ENABLED = true;

beforeEach(() => {
getFeatureFlagStub = {
execute: sinon.stub().resolves(IS_2025_Q1_TIERING_ENABLED),
};

listPricesStub = stripeStub.prices.list;
listPricesStub.onFirstCall().resolves({
data: [{ id: 'licensed_price_id_1' }],
Expand All @@ -32,17 +38,22 @@ describe('GetPrices #novu-v2', () => {

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

const createUseCase = () => new GetPrices(stripeStub as any);
const createUseCase = () => new GetPrices(stripeStub, getFeatureFlagStub);

const freeMeteredPriceLookupKey = IS_2025_Q1_TIERING_ENABLED
? ['free_usage_notifications_10k']
: ['free_usage_notifications'];

const expectedPrices = [
{
apiServiceLevel: ApiServiceLevelEnum.FREE,
billingInterval: StripeBillingIntervalEnum.MONTH,
prices: {
licensed: ['free_flat_monthly'],
metered: ['free_usage_notifications'],
metered: freeMeteredPriceLookupKey,
},
},
{
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/types/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ export enum FeatureFlagsKeysEnum {
IS_SUBSCRIBERS_PAGE_ENABLED = 'IS_SUBSCRIBERS_PAGE_ENABLED',
IS_WORKFLOW_CHECK_LIST_ENABLED = 'IS_WORKFLOW_CHECK_LIST_ENABLED',
IS_TIER_DURATION_RESTRICTION_EXCLUDED_ENABLED = 'IS_TIER_DURATION_RESTRICTION_EXCLUDED_ENABLED',
IS_2025_Q1_TIERING_ENABLED = 'IS_2025_Q1_TIERING_ENABLED',
IS_LEGACY_TO_2025_Q1_TIER_MIGRATION_ENABLED = 'IS_LEGACY_TO_2025_Q1_TIER_MIGRATION_ENABLED',
}

0 comments on commit c6ae39e

Please sign in to comment.