Skip to content

Commit

Permalink
Merge pull request #17247 from mozilla/fxa-9797-cleanup-contentful-ba…
Browse files Browse the repository at this point in the history
…nd-aids

feat(cms): cleanup contentful cms band aids
  • Loading branch information
StaberindeZA authored Jul 26, 2024
2 parents 8e9e4d0 + c428a61 commit b0d2557
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 97 deletions.
3 changes: 0 additions & 3 deletions apps/payments/next/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ STRAPI_CLIENT_CONFIG__MEM_CACHE_T_T_L=
STRAPI_CLIENT_CONFIG__FIRESTORE_CACHE_COLLECTION_NAME=strapiClientQueryCacheCollection
STRAPI_CLIENT_CONFIG__FIRESTORE_CACHE_T_T_L=

# CMS Config
CMS_CONFIG__SUPPORTED_PRICE_IDS=plan_GqM9N6qyhvxaVk,price_1KbomlBVqmGyQTMaa0Tq7UaW,price_1Ivq4gBVqmGyQTMaplHcFEGO

# Firestore Config
FIRESTORE_CONFIG__CREDENTIALS__CLIENT_EMAIL=
FIRESTORE_CONFIG__CREDENTIALS__PRIVATE_KEY=
Expand Down
3 changes: 0 additions & 3 deletions apps/payments/next/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ STRAPI_CLIENT_CONFIG__MEM_CACHE_T_T_L=
STRAPI_CLIENT_CONFIG__FIRESTORE_CACHE_COLLECTION_NAME=strapiClientQueryCacheCollection
STRAPI_CLIENT_CONFIG__FIRESTORE_CACHE_T_T_L=

# CMS Config
CMS_CONFIG__SUPPORTED_PRICE_IDS=

# Firestore Config
FIRESTORE_CONFIG__CREDENTIALS__CLIENT_EMAIL=
FIRESTORE_CONFIG__CREDENTIALS__PRIVATE_KEY=
Expand Down
2 changes: 0 additions & 2 deletions libs/payments/capability/src/lib/capability.manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
ServicesWithCapabilitiesQueryFactory,
ServicesWithCapabilitiesResult,
StrapiClient,
MockCMSConfigProvider,
MockStrapiClientConfigProvider,
StrapiEntityFactory,
} from '@fxa/shared/cms';
Expand All @@ -35,7 +34,6 @@ describe('CapabilityManager', () => {
const module = await Test.createTestingModule({
providers: [
CapabilityManager,
MockCMSConfigProvider,
MockStrapiClientConfigProvider,
MockFirestoreProvider,
MockStatsDProvider,
Expand Down
2 changes: 0 additions & 2 deletions libs/payments/cart/src/lib/cart.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
TaxAddressFactory,
} from '@fxa/payments/stripe';
import {
MockCMSConfigProvider,
MockStrapiClientConfigProvider,
ProductConfigurationManager,
StrapiClient,
Expand Down Expand Up @@ -84,7 +83,6 @@ describe('CartService', () => {
CartManager,
CartService,
CheckoutService,
MockCMSConfigProvider,
ConfigService,
MockStrapiClientConfigProvider,
CustomerManager,
Expand Down
2 changes: 0 additions & 2 deletions libs/payments/cart/src/lib/checkout.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import {
} from '@fxa/payments/stripe';
import { AccountManager } from '@fxa/shared/account/account';
import {
MockCMSConfigProvider,
MockStrapiClientConfigProvider,
ProductConfigurationManager,
StrapiClient,
Expand Down Expand Up @@ -88,7 +87,6 @@ describe('CheckoutService', () => {
AccountManager,
CartManager,
CheckoutService,
MockCMSConfigProvider,
MockStrapiClientConfigProvider,
CustomerManager,
EligibilityManager,
Expand Down
2 changes: 0 additions & 2 deletions libs/payments/eligibility/src/lib/eligibility.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
import {
EligibilityContentByOfferingResultUtil,
EligibilityContentOfferingResultFactory,
MockCMSConfigProvider,
MockStrapiClientConfigProvider,
ProductConfigurationManager,
StrapiClient,
Expand Down Expand Up @@ -49,7 +48,6 @@ describe('EligibilityService', () => {

const module: TestingModule = await Test.createTestingModule({
providers: [
MockCMSConfigProvider,
MockStrapiClientConfigProvider,
EligibilityManager,
EligibilityService,
Expand Down
2 changes: 0 additions & 2 deletions libs/payments/legacy/src/lib/stripe-mapper.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
StripeProductFactory,
} from '@fxa/payments/stripe';
import {
MockCMSConfigProvider,
ProductConfigurationManager,
PurchaseWithDetailsOfferingContentTransformedFactory,
PurchaseWithDetailsOfferingContentUtil,
Expand All @@ -40,7 +39,6 @@ describe('StripeMapperService', () => {
const module = await Test.createTestingModule({
providers: [
MockStrapiClientConfigProvider,
MockCMSConfigProvider,
MockFirestoreProvider,
MockStatsDProvider,
PriceManager,
Expand Down
7 changes: 1 addition & 6 deletions libs/payments/ui/src/lib/nestapp/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { MySQLConfig } from '@fxa/shared/db/mysql/core';
import { GeoDBConfig, GeoDBManagerConfig } from '@fxa/shared/geodb';
import { PaypalClientConfig } from 'libs/payments/paypal/src/lib/paypal.client.config';
import { StripeConfig } from '@fxa/payments/stripe';
import { CMSConfig, StrapiClientConfig } from '@fxa/shared/cms';
import { StrapiClientConfig } from '@fxa/shared/cms';
import { FirestoreConfig } from 'libs/shared/db/firestore/src/lib/firestore.config';
import { StatsDConfig } from 'libs/shared/metrics/statsd/src/lib/statsd.config';

Expand Down Expand Up @@ -43,11 +43,6 @@ export class RootConfig {
@IsDefined()
public readonly strapiClientConfig!: Partial<StrapiClientConfig>;

@Type(() => CMSConfig)
@ValidateNested()
@IsDefined()
public readonly cmsConfig!: Partial<CMSConfig>;

@Type(() => FirestoreConfig)
@ValidateNested()
@IsDefined()
Expand Down
1 change: 0 additions & 1 deletion libs/shared/cms/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

export * from './lib/cms.config';
export * from './lib/cms.error';
export * from './lib/constants';
export * from './lib/factories';
Expand Down
21 changes: 0 additions & 21 deletions libs/shared/cms/src/lib/cms.config.ts

This file was deleted.

4 changes: 0 additions & 4 deletions libs/shared/cms/src/lib/product-configuration.manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ import {
CapabilityPurchaseResultFactory,
CapabilityServiceByPlanIdsQueryFactory,
CapabilityServiceByPlanIdsResultUtil,
CMSConfig,
EligibilityContentByOfferingResultUtil,
EligibilityContentByPlanIdsQueryFactory,
EligibilityContentByPlanIdsResultUtil,
EligibilityPurchaseResult,
EligibilityPurchaseResultFactory,
MockCMSConfigProvider,
ProductConfigError,
ServicesWithCapabilitiesQueryFactory,
ServicesWithCapabilitiesResultUtil,
Expand Down Expand Up @@ -75,9 +73,7 @@ describe('productConfigurationManager', () => {
const module = await Test.createTestingModule({
providers: [
{ provide: StatsDService, useValue: mockStatsd },
CMSConfig,
MockStrapiClientConfigProvider,
MockCMSConfigProvider,
MockFirestoreProvider,
PriceManager,
ProductConfigurationManager,
Expand Down
12 changes: 1 addition & 11 deletions libs/shared/cms/src/lib/product-configuration.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
EligibilityContentByOfferingQuery,
PageContentForOfferingQuery,
} from '../__generated__/graphql';
import { CMSConfig } from './cms.config';
import { ProductConfigError } from './cms.error';
import { DEFAULT_LOCALE } from './constants';
import {
Expand Down Expand Up @@ -50,7 +49,6 @@ import { DeepNonNullable } from './types';
export class ProductConfigurationManager {
constructor(
private strapiClient: StrapiClient,
private cmsConfig: CMSConfig,
private priceManager: PriceManager,
@Inject(StatsDService) private statsd: StatsD
) {
Expand Down Expand Up @@ -229,16 +227,8 @@ export class ProductConfigurationManager {
interval: SubplatInterval
) {
const priceIds = await this.getOfferingPlanIds(offeringConfigId);
// Temporary supported list of plans
// CMS purchase.stripePlanChoices is currently not configured correctly
// Unfortunately, currently the CMS is read-only and can't be updated
// As a temporary work around provide a list of supported plans
const supportedListOfPriceIds = this.cmsConfig.supportedPriceIds.split(',');
const filteredPriceIds = priceIds.filter((stripePlanChoice) =>
supportedListOfPriceIds.includes(stripePlanChoice)
);
const price = await this.priceManager.retrieveByInterval(
filteredPriceIds,
priceIds,
interval
);
if (!price) throw new ProductConfigError('Plan not found');
Expand Down
38 changes: 0 additions & 38 deletions packages/fxa-graphql-api/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,44 +42,6 @@ const conf = convict({
default: 'http://localhost:9000/v1',
},
},
contentful: {
cdnUrl: {
doc: 'Base URL for Content Delivery API (https://www.contentful.com/developers/docs/references/content-delivery-api//)',
format: String,
env: 'CONTENTFUL_CDN_API_URL',
default: '',
},
graphqlUrl: {
doc: 'Base URL for GraphQL Content API (https://www.contentful.com/developers/docs/references/graphql/)',
format: String,
env: 'CONTENTFUL_GRAPHQL_API_URL',
default: '',
},
apiKey: {
doc: 'GraphQL Content API key for Contentful hCMS to fetch RP-provided content (https://www.contentful.com/developers/docs/references/authentication/)',
format: String,
env: 'CONTENTFUL_GRAPHQL_API_KEY',
default: '',
},
spaceId: {
doc: 'Alphanumeric id used for instantiating the ContentfulClient (https://www.contentful.com/developers/docs/references/content-management-api/#/reference/spaces)',
format: String,
env: 'CONTENTFUL_GRAPHQL_SPACE_ID',
default: '',
},
environment: {
doc: 'Environment alias used for instantiating the ContentfulClient (https://www.contentful.com/developers/docs/concepts/multiple-environments/)',
format: String,
env: 'CONTENTFUL_GRAPHQL_ENVIRONMENT',
default: '',
},
firestoreCacheCollectionName: {
doc: 'Firestore collection name to store Contentful query cache',
format: String,
env: 'CONTENTFUL_FIRESTORE_CACHE_COLLECTION_NAME',
default: 'fxa-graphql-api-contentful-query-cache',
},
},
corsOrigin: {
doc: 'Value for the Access-Control-Allow-Origin response header',
format: Array,
Expand Down

0 comments on commit b0d2557

Please sign in to comment.