Selaa lähdekoodia

Merge pull request #27018 from overleaf/ii-flexible-licensing-manually-billed-billed-tear-down-revert

[web] Revert "FL manually billed subscription feature flag tear down"

GitOrigin-RevId: 7cc809570d310f56b8f9e1a4f43ca895db8a8073
ilkin-overleaf 1 vuosi sitten
vanhempi
sitoutus
97f1425326

+ 8 - 36
services/web/app/src/Features/Subscription/SubscriptionGroupController.mjs

@@ -8,7 +8,6 @@ import SessionManager from '../Authentication/SessionManager.js'
 import UserAuditLogHandler from '../User/UserAuditLogHandler.js'
 import { expressify } from '@overleaf/promise-utils'
 import Modules from '../../infrastructure/Modules.js'
-import SplitTestHandler from '../SplitTests/SplitTestHandler.js'
 import UserGetter from '../User/UserGetter.js'
 import { Subscription } from '../../models/Subscription.js'
 import { isProfessionalGroupPlan } from './PlansHelper.mjs'
@@ -152,29 +151,13 @@ async function addSeatsToGroupSubscription(req, res) {
     await SubscriptionGroupHandler.promises.ensureSubscriptionHasNoPastDueInvoice(
       subscription
     )
-
-    const { variant: flexibleLicensingForManuallyBilledSubscriptionsVariant } =
-      await SplitTestHandler.promises.getAssignment(
-        req,
-        res,
-        'flexible-group-licensing-for-manually-billed-subscriptions'
-      )
-
-    if (flexibleLicensingForManuallyBilledSubscriptionsVariant === 'enabled') {
-      await SubscriptionGroupHandler.promises.checkBillingInfoExistence(
-        paymentProviderSubscription,
-        userId
-      )
-      await SubscriptionGroupHandler.promises.ensureSubscriptionHasAdditionalLicenseAddOnWhenCollectionMethodIsManual(
-        paymentProviderSubscription
-      )
-    } else {
-      await SubscriptionGroupHandler.promises.ensureSubscriptionCollectionMethodIsNotManual(
-        paymentProviderSubscription
-      )
-      // Check if the user has missing billing details
-      await Modules.promises.hooks.fire('getPaymentMethod', userId)
-    }
+    await SubscriptionGroupHandler.promises.checkBillingInfoExistence(
+      paymentProviderSubscription,
+      userId
+    )
+    await SubscriptionGroupHandler.promises.ensureSubscriptionHasAdditionalLicenseAddOnWhenCollectionMethodIsManual(
+      paymentProviderSubscription
+    )
 
     res.render('subscriptions/add-seats', {
       subscriptionId: subscription._id,
@@ -191,10 +174,7 @@ async function addSeatsToGroupSubscription(req, res) {
       )
     }
 
-    if (
-      error instanceof ManuallyCollectedError ||
-      error instanceof HasNoAdditionalLicenseWhenManuallyCollectedError
-    ) {
+    if (error instanceof HasNoAdditionalLicenseWhenManuallyCollectedError) {
       return res.redirect(
         '/user/subscription/group/manually-collected-subscription'
       )
@@ -235,7 +215,6 @@ async function previewAddSeatsSubscriptionChange(req, res) {
   } catch (error) {
     if (
       error instanceof MissingBillingInfoError ||
-      error instanceof ManuallyCollectedError ||
       error instanceof PendingChangeError ||
       error instanceof InactiveError ||
       error instanceof HasPastDueInvoiceError ||
@@ -279,7 +258,6 @@ async function createAddSeatsSubscriptionChange(req, res) {
   } catch (error) {
     if (
       error instanceof MissingBillingInfoError ||
-      error instanceof ManuallyCollectedError ||
       error instanceof PendingChangeError ||
       error instanceof InactiveError ||
       error instanceof HasPastDueInvoiceError ||
@@ -420,12 +398,6 @@ async function manuallyCollectedSubscription(req, res) {
     const subscription =
       await SubscriptionLocator.promises.getUsersSubscription(userId)
 
-    await SplitTestHandler.promises.getAssignment(
-      req,
-      res,
-      'flexible-group-licensing-for-manually-billed-subscriptions'
-    )
-
     res.render('subscriptions/manually-collected-subscription', {
       groupName: subscription.teamName,
     })

+ 0 - 1
services/web/frontend/extracted-translations.json

@@ -873,7 +873,6 @@
   "is_email_affiliated": "",
   "issued_on": "",
   "it_looks_like_that_didnt_work_you_can_try_again_or_get_in_touch": "",
-  "it_looks_like_your_account_is_billed_manually": "",
   "it_looks_like_your_account_is_billed_manually_purchasing_additional_license_or_upgrading_subscription": "",
   "it_looks_like_your_payment_details_are_missing_please_update_your_billing_information": "",
   "italics": "",

+ 6 - 11
services/web/frontend/js/features/group-management/components/add-seats/add-seats.tsx

@@ -30,7 +30,6 @@ import {
 } from '../../../../../../types/subscription/subscription-change-preview'
 import { MergeAndOverride, Nullable } from '../../../../../../types/utils'
 import { sendMB } from '../../../../infrastructure/event-tracking'
-import { useFeatureFlag } from '@/shared/context/split-test-context'
 
 export const MAX_NUMBER_OF_USERS = 20
 export const MAX_NUMBER_OF_PO_NUMBER_CHARACTERS = 50
@@ -50,9 +49,6 @@ function AddSeats() {
   const [addSeatsInputError, setAddSeatsInputError] = useState<string>()
   const [poNumberInputError, setPoNumberInputError] = useState<string>()
   const [shouldContactSales, setShouldContactSales] = useState(false)
-  const isFlexibleGroupLicensingForManuallyBilledSubscriptions = useFeatureFlag(
-    'flexible-group-licensing-for-manually-billed-subscriptions'
-  )
   const controller = useAbortController()
   const { signal: addSeatsSignal } = useAbortController()
   const { signal: contactSalesSignal } = useAbortController()
@@ -373,13 +369,12 @@ function AddSeats() {
                       <FormText type="error">{addSeatsInputError}</FormText>
                     )}
                   </FormGroup>
-                  {isFlexibleGroupLicensingForManuallyBilledSubscriptions &&
-                    isCollectionMethodManual && (
-                      <PoNumber
-                        error={poNumberInputError}
-                        validate={validatePoNumber}
-                      />
-                    )}
+                  {isCollectionMethodManual && (
+                    <PoNumber
+                      error={poNumberInputError}
+                      validate={validatePoNumber}
+                    />
+                  )}
                 </div>
                 <CostSummarySection
                   isLoadingCostSummary={isLoadingCostSummary}

+ 7 - 22
services/web/frontend/js/features/group-management/components/manually-collected-subscription.tsx

@@ -2,14 +2,9 @@ import { Trans, useTranslation } from 'react-i18next'
 import OLNotification from '@/features/ui/components/ol/ol-notification'
 import Card from '@/features/group-management/components/card'
 import useWaitForI18n from '@/shared/hooks/use-wait-for-i18n'
-import { useFeatureFlag } from '@/shared/context/split-test-context'
 
 function ManuallyCollectedSubscription() {
   const { t } = useTranslation()
-  const isFlexibleGroupLicensingForManuallyBilledSubscriptions = useFeatureFlag(
-    'flexible-group-licensing-for-manually-billed-subscriptions'
-  )
-
   const { isReady } = useWaitForI18n()
 
   if (!isReady) {
@@ -22,23 +17,13 @@ function ManuallyCollectedSubscription() {
         type="error"
         title={t('account_billed_manually')}
         content={
-          isFlexibleGroupLicensingForManuallyBilledSubscriptions ? (
-            <Trans
-              i18nKey="it_looks_like_your_account_is_billed_manually_purchasing_additional_license_or_upgrading_subscription"
-              components={[
-                // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-                <a href="/contact" rel="noreferrer noopener" />,
-              ]}
-            />
-          ) : (
-            <Trans
-              i18nKey="it_looks_like_your_account_is_billed_manually"
-              components={[
-                // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-                <a href="/contact" rel="noreferrer noopener" />,
-              ]}
-            />
-          )
+          <Trans
+            i18nKey="it_looks_like_your_account_is_billed_manually_purchasing_additional_license_or_upgrading_subscription"
+            components={[
+              // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
+              <a href="/contact" rel="noreferrer noopener" />,
+            ]}
+          />
         }
         className="m-0"
       />

+ 0 - 1
services/web/locales/en.json

@@ -1132,7 +1132,6 @@
   "issued_on": "Issued: __date__",
   "it": "Italian",
   "it_looks_like_that_didnt_work_you_can_try_again_or_get_in_touch": "It looks like that didn’t work. You can try again or <0>get in touch</0> with our Support team for more help.",
-  "it_looks_like_your_account_is_billed_manually": "It looks like your account is being billed manually - adding seats or upgrading your subscription can only be done by the Support team. Please <0>get in touch</0> for help.",
   "it_looks_like_your_account_is_billed_manually_purchasing_additional_license_or_upgrading_subscription": "It looks like your account is being billed manually - purchasing additional licenses or upgrading your subscription can only be done by the Support team. Please <0>get in touch</0> for help.",
   "it_looks_like_your_payment_details_are_missing_please_update_your_billing_information": "It looks like your payment details are missing. Please <0>update your billing information</0>, or <1>get in touch</1> with our Support team for more help.",
   "italics": "Italics",

+ 0 - 3
services/web/test/frontend/features/group-management/components/add-seats.spec.tsx

@@ -14,9 +14,6 @@ describe('<AddSeats />', function () {
       win.metaAttributesCache.set('ol-totalLicenses', this.totalLicenses)
       win.metaAttributesCache.set('ol-isProfessional', false)
       win.metaAttributesCache.set('ol-isCollectionMethodManual', true)
-      win.metaAttributesCache.set('ol-splitTestVariants', {
-        'flexible-group-licensing-for-manually-billed-subscriptions': 'enabled',
-      })
     })
 
     cy.mount(

+ 3 - 13
services/web/test/unit/src/Subscription/SubscriptionGroupController.test.mjs

@@ -107,12 +107,6 @@ describe('SubscriptionGroupController', function () {
       },
     }
 
-    ctx.SplitTestHandler = {
-      promises: {
-        getAssignment: sinon.stub().resolves({ variant: 'enabled' }),
-      },
-    }
-
     ctx.UserGetter = {
       promises: {
         getUserEmail: sinon.stub().resolves(ctx.user.email),
@@ -174,13 +168,6 @@ describe('SubscriptionGroupController', function () {
       default: ctx.Modules,
     }))
 
-    vi.doMock(
-      '../../../../app/src/Features/SplitTests/SplitTestHandler',
-      () => ({
-        default: ctx.SplitTestHandler,
-      })
-    )
-
     vi.doMock('../../../../app/src/Features/User/UserGetter', () => ({
       default: ctx.UserGetter,
     }))
@@ -459,6 +446,9 @@ describe('SubscriptionGroupController', function () {
             ctx.SubscriptionGroupHandler.promises.checkBillingInfoExistence
               .calledWith(ctx.recurlySubscription, ctx.adminUserId)
               .should.equal(true)
+            ctx.SubscriptionGroupHandler.promises.ensureSubscriptionHasAdditionalLicenseAddOnWhenCollectionMethodIsManual
+              .calledWith(ctx.recurlySubscription)
+              .should.equal(true)
             page.should.equal('subscriptions/add-seats')
             props.subscriptionId.should.equal(ctx.subscriptionId)
             props.groupName.should.equal(ctx.subscription.teamName)