From 62760a9bf5698134f3e1fa6d8835a3f19f7d5cdb Mon Sep 17 00:00:00 2001 From: Liangjun Song <146005915+adai26@users.noreply.github.com> Date: Tue, 29 Apr 2025 15:48:02 +0800 Subject: [PATCH] Merge pull request #25117 from overleaf/ls-map-stripe-product-to-recurly-plan-code Use metadata to map Stripe product to Recurly plan code GitOrigin-RevId: 775eb39cedff81985fc72cb14d411575231ade8f --- .../src/Features/Subscription/PlansLocator.js | 18 ------------------ .../unit/src/Subscription/PlansLocatorTests.js | 16 ---------------- 2 files changed, 34 deletions(-) diff --git a/services/web/app/src/Features/Subscription/PlansLocator.js b/services/web/app/src/Features/Subscription/PlansLocator.js index 905fa7e7da..937d2d3ccb 100644 --- a/services/web/app/src/Features/Subscription/PlansLocator.js +++ b/services/web/app/src/Features/Subscription/PlansLocator.js @@ -36,15 +36,6 @@ const recurlyPlanCodeToStripeLookupKey = { student_free_trial_7_days: 'student_monthly', } -const stripeLookupKeyToRecurlyPlanCode = { - professional_annual: 'professional-annual', - professional_monthly: 'professional', - standard_annual: 'collaborator-annual', - standard_monthly: 'collaborator', - student_annual: 'student-annual', - student_monthly: 'student', -} - /** * * @param {RecurlyPlanCode} recurlyPlanCode @@ -54,14 +45,6 @@ function mapRecurlyPlanCodeToStripeLookupKey(recurlyPlanCode) { return recurlyPlanCodeToStripeLookupKey[recurlyPlanCode] } -/** - * @param {StripeLookupKey} stripeLookupKey - * @returns {RecurlyPlanCode} - */ -function mapStripeLookupKeyToRecurlyPlanCode(stripeLookupKey) { - return stripeLookupKeyToRecurlyPlanCode[stripeLookupKey] -} - const recurlyPlanCodeToPlanTypeAndPeriod = { collaborator: { planType: 'standard', period: 'monthly' }, collaborator_free_trial_7_days: { planType: 'standard', period: 'monthly' }, @@ -99,6 +82,5 @@ module.exports = { ensurePlansAreSetupCorrectly, findLocalPlanInSettings, mapRecurlyPlanCodeToStripeLookupKey, - mapStripeLookupKeyToRecurlyPlanCode, getPlanTypeAndPeriodFromRecurlyPlanCode, } diff --git a/services/web/test/unit/src/Subscription/PlansLocatorTests.js b/services/web/test/unit/src/Subscription/PlansLocatorTests.js index 7d1972a1ad..9373c02b89 100644 --- a/services/web/test/unit/src/Subscription/PlansLocatorTests.js +++ b/services/web/test/unit/src/Subscription/PlansLocatorTests.js @@ -114,22 +114,6 @@ describe('PlansLocator', function () { }) }) - describe('mapStripeLookupKeyToRecurlyPlanCode', function () { - it('should return the recurly plan code for existing plans', function () { - const planCode = 'standard_monthly' - const lookupKey = - this.PlansLocator.mapStripeLookupKeyToRecurlyPlanCode(planCode) - expect(lookupKey).to.equal('collaborator') - }) - - it('should return undefined for unknown plans', function () { - const planCode = 'foobar' - const lookupKey = - this.PlansLocator.mapStripeLookupKeyToRecurlyPlanCode(planCode) - expect(lookupKey).to.equal(undefined) - }) - }) - describe('getPlanTypeAndPeriodFromRecurlyPlanCode', function () { it('should return the plan type and period for "collaborator"', function () { const { planType, period } =