Просмотр исходного кода

Merge pull request #23060 from overleaf/ls-support-new-group-plan-in-redesigned-checkout-page

Support new group plan in the redesigned checkout page

GitOrigin-RevId: 2564477b36ee93ca4b4b6dd8210f140a3104c6ed
Liangjun Song 1 год назад
Родитель
Сommit
eba4418672

+ 3 - 8
services/web/app/src/Features/Subscription/RecurlyWrapper.js

@@ -241,6 +241,9 @@ const promises = {
           account_code: user._id,
         },
       }
+      if (subscriptionDetails.subscription_add_ons) {
+        data.subscription_add_ons = subscriptionDetails.subscription_add_ons
+      }
       const customFields =
         getCustomFieldsFromSubscriptionDetails(subscriptionDetails)
       if (customFields) {
@@ -286,14 +289,6 @@ const promises = {
       { userId: user._id },
       'starting process of creating paypal subscription'
     )
-    if (subscriptionDetails.subscription_add_ons) {
-      // TODO: support flexible licensing in paypal flow
-      const err = new Error('Add-on purchase not supported')
-      OError.tag(err, 'error in paypal subscription creation process', {
-        user_id: user._id,
-      })
-      throw err
-    }
     // We use waterfall through each of these actions in sequence
     // passing a `cache` object along the way. The cache is initialized
     // with required data, and `async.apply` to pass the cache to the first function

+ 1 - 1
services/web/frontend/js/features/group-management/components/upgrade-subscription/upgrade-subscription-plan-details.tsx

@@ -5,7 +5,7 @@ import { Card, Row, Col } from 'react-bootstrap-5'
 import MaterialIcon from '@/shared/components/material-icon'
 import { formatCurrency } from '@/shared/utils/currency'
 
-const LICENSE_ADD_ON = 'additional-license'
+export const LICENSE_ADD_ON = 'additional-license'
 
 function UpgradeSubscriptionPlanDetails() {
   const { t } = useTranslation()

+ 0 - 25
services/web/test/unit/src/Subscription/RecurlyWrapperTests.js

@@ -893,31 +893,6 @@ describe('RecurlyWrapper', function () {
         this.createSubscription.callCount.should.equal(0)
       })
     })
-
-    it('throw error if purchase with addon', async function () {
-      this.subscriptionDetails = {
-        currencyCode: 'EUR',
-        plan_code: 'some_plan_code',
-        coupon_code: '',
-        isPaypal: true,
-        address: {
-          address1: 'addr_one',
-          address2: 'addr_two',
-          country: 'some_country',
-          state: 'some_state',
-          zip: 'some_zip',
-        },
-        subscription_add_ons: [
-          { subscription_add_on: { add_on_code: 'test_add_on', quantity: 2 } },
-        ],
-      }
-      await expect(this.call()).to.be.rejected
-      this.checkAccountExists.callCount.should.equal(0)
-      this.createAccount.callCount.should.equal(0)
-      this.createBillingInfo.callCount.should.equal(0)
-      this.setAddressAndCompanyBillingInfo.callCount.should.equal(0)
-      this.createSubscription.callCount.should.equal(0)
-    })
   })
 
   describe('paypal actions', function () {