- {formatCurrencyLocalized(
+ {formatCurrency(
subscriptionChange.immediateCharge.total,
subscriptionChange.currency
)}
@@ -73,7 +73,7 @@ function UpgradeSummary({ subscriptionChange }: UpgradeSummaryProps) {
{t('after_that_well_bill_you_x_annually_on_date_unless_you_cancel', {
- subtotal: formatCurrencyLocalized(
+ subtotal: formatCurrency(
subscriptionChange.nextInvoice.subtotal,
subscriptionChange.currency
),
diff --git a/services/web/frontend/js/features/plans/group-plan-modal/index.js b/services/web/frontend/js/features/plans/group-plan-modal/index.js
index abf318601a..32858d295b 100644
--- a/services/web/frontend/js/features/plans/group-plan-modal/index.js
+++ b/services/web/frontend/js/features/plans/group-plan-modal/index.js
@@ -1,12 +1,7 @@
import getMeta from '../../../utils/meta'
import { swapModal } from '../../utils/swapModal'
import * as eventTracking from '../../../infrastructure/event-tracking'
-import {
- createLocalizedGroupPlanPrice,
- formatCurrencyDefault,
-} from '../utils/group-plan-pricing'
-import { getSplitTestVariant } from '@/utils/splitTestUtils'
-import { formatCurrencyLocalized } from '@/shared/utils/currency'
+import { createLocalizedGroupPlanPrice } from '../utils/group-plan-pricing'
export const GROUP_PLAN_MODAL_HASH = '#groups'
@@ -27,18 +22,12 @@ export function updateGroupModalPlanPricing() {
const modalEl = document.querySelector('[data-ol-group-plan-modal]')
const { planCode, size, currency, usage } = getFormValues()
- const localCcyVariant = getSplitTestVariant('local-ccy-format-v2')
-
const { localizedPrice, localizedPerUserPrice } =
createLocalizedGroupPlanPrice({
plan: planCode,
licenseSize: size,
currency,
usage,
- formatCurrency:
- localCcyVariant === 'enabled'
- ? formatCurrencyLocalized
- : formatCurrencyDefault,
})
modalEl.querySelectorAll('[data-ol-group-plan-plan-code]').forEach(el => {
diff --git a/services/web/frontend/js/features/plans/utils/group-plan-pricing.js b/services/web/frontend/js/features/plans/utils/group-plan-pricing.js
index 53959d7ecf..060a8ea2a7 100644
--- a/services/web/frontend/js/features/plans/utils/group-plan-pricing.js
+++ b/services/web/frontend/js/features/plans/utils/group-plan-pricing.js
@@ -1,7 +1,8 @@
+import { formatCurrency } from '@/shared/utils/currency'
import getMeta from '../../../utils/meta'
/**
- * @import { CurrencyCode } from '../../../../../types/currency-code'
+ * @import { CurrencyCode } from '../../../../../types/subscription/currency'
*/
// plan: 'collaborator' or 'professional'
@@ -13,7 +14,6 @@ import getMeta from '../../../utils/meta'
* @param {CurrencyCode} opts.currency
* @param {'enterprise' | 'educational'} opts.usage
* @param {string} [opts.locale]
- * @param {(amount: number, currency: CurrencyCode, locale: string, includeSymbol: boolean) => string} opts.formatCurrency
* @returns {{localizedPrice: string, localizedPerUserPrice: string}}
*/
export function createLocalizedGroupPlanPrice({
@@ -22,7 +22,6 @@ export function createLocalizedGroupPlanPrice({
currency,
usage,
locale = getMeta('ol-i18n').currentLangCode || 'en',
- formatCurrency,
}) {
const groupPlans = getMeta('ol-groupPlans')
const priceInCents =
@@ -42,44 +41,3 @@ export function createLocalizedGroupPlanPrice({
localizedPerUserPrice: formatPrice(perUserPrice),
}
}
-
-const LOCALES = {
- BRL: 'pt-BR',
- MXN: 'es-MX',
- COP: 'es-CO',
- CLP: 'es-CL',
- PEN: 'es-PE',
-}
-
-/**
- * @param {number} amount
- * @param {string} currency
- */
-export function formatCurrencyDefault(amount, currency) {
- const currencySymbols = getMeta('ol-currencySymbols')
-
- const currencySymbol = currencySymbols[currency]
-
- switch (currency) {
- case 'BRL':
- case 'MXN':
- case 'COP':
- case 'CLP':
- case 'PEN':
- // Test using toLocaleString to format currencies for new LATAM regions
- return amount.toLocaleString(LOCALES[currency], {
- style: 'currency',
- currency,
- minimumFractionDigits: Number.isInteger(amount) ? 0 : null,
- })
- case 'CHF':
- return `${currencySymbol} ${amount}`
- case 'DKK':
- case 'SEK':
- case 'NOK':
- return `${amount} ${currencySymbol}`
- default: {
- return `${currencySymbol}${amount}`
- }
- }
-}
diff --git a/services/web/frontend/js/features/subscription/components/preview-subscription-change/root.tsx b/services/web/frontend/js/features/subscription/components/preview-subscription-change/root.tsx
index 04d8de4d74..404a733adf 100644
--- a/services/web/frontend/js/features/subscription/components/preview-subscription-change/root.tsx
+++ b/services/web/frontend/js/features/subscription/components/preview-subscription-change/root.tsx
@@ -8,7 +8,7 @@ import {
PremiumSubscriptionChange,
} from '../../../../../../types/subscription/subscription-change-preview'
import getMeta from '@/utils/meta'
-import { formatCurrencyLocalized } from '@/shared/utils/currency'
+import { formatCurrency } from '@/shared/utils/currency'
import useAsync from '@/shared/hooks/use-async'
import { useLocation } from '@/shared/hooks/use-location'
import { debugConsole } from '@/utils/debugging'
@@ -101,7 +101,7 @@ function PreviewSubscriptionChange() {
{changeName}
- {formatCurrencyLocalized(
+ {formatCurrency(
preview.immediateCharge.subtotal,
preview.currency
)}
@@ -115,7 +115,7 @@ function PreviewSubscriptionChange() {
{t('vat')} {preview.nextInvoice.tax.rate * 100}%
- {formatCurrencyLocalized(
+ {formatCurrency(
preview.immediateCharge.tax,
preview.currency
)}
@@ -127,7 +127,7 @@ function PreviewSubscriptionChange() {
{t('total_today')}
- {formatCurrencyLocalized(
+ {formatCurrency(
preview.immediateCharge.total,
preview.currency
)}
@@ -169,7 +169,7 @@ function PreviewSubscriptionChange() {
{preview.nextInvoice.plan.name}
- {formatCurrencyLocalized(
+ {formatCurrency(
preview.nextInvoice.plan.amount,
preview.currency
)}
@@ -183,7 +183,7 @@ function PreviewSubscriptionChange() {
{addOn.quantity > 1 ? ` ×${addOn.quantity}` : ''}
- {formatCurrencyLocalized(addOn.amount, preview.currency)}
+ {formatCurrency(addOn.amount, preview.currency)}
))}
@@ -194,7 +194,7 @@ function PreviewSubscriptionChange() {
{t('vat')} {preview.nextInvoice.tax.rate * 100}%
- {formatCurrencyLocalized(
+ {formatCurrency(
preview.nextInvoice.tax.amount,
preview.currency
)}
@@ -209,10 +209,7 @@ function PreviewSubscriptionChange() {
: t('total_per_month')}
- {formatCurrencyLocalized(
- preview.nextInvoice.total,
- preview.currency
- )}
+ {formatCurrency(preview.nextInvoice.total, preview.currency)}
diff --git a/services/web/frontend/js/features/subscription/context/subscription-dashboard-context.tsx b/services/web/frontend/js/features/subscription/context/subscription-dashboard-context.tsx
index 766054f2c5..6c17f9ae8c 100644
--- a/services/web/frontend/js/features/subscription/context/subscription-dashboard-context.tsx
+++ b/services/web/frontend/js/features/subscription/context/subscription-dashboard-context.tsx
@@ -21,15 +21,13 @@ import {
import { Institution } from '../../../../../types/institution'
import getMeta from '../../../utils/meta'
import {
- formatCurrencyDefault,
loadDisplayPriceWithTaxPromise,
loadGroupDisplayPriceWithTaxPromise,
} from '../util/recurly-pricing'
import { isRecurlyLoaded } from '../util/is-recurly-loaded'
import { SubscriptionDashModalIds } from '../../../../../types/subscription/dashboard/modal-ids'
import { debugConsole } from '@/utils/debugging'
-import { useFeatureFlag } from '@/shared/context/split-test-context'
-import { formatCurrencyLocalized } from '@/shared/utils/currency'
+import { formatCurrency } from '@/shared/utils/currency'
import { ManagedInstitution } from '../../../../../types/subscription/dashboard/managed-institution'
import { Publisher } from '../../../../../types/subscription/dashboard/publisher'
@@ -141,10 +139,6 @@ export function SubscriptionDashboardProvider({
memberGroupSubscriptions?.length > 0
)
- const formatCurrency = useFeatureFlag('local-ccy-format-v2')
- ? formatCurrencyLocalized
- : formatCurrencyDefault
-
useEffect(() => {
if (!isRecurlyLoaded()) {
setRecurlyLoadError(true)
@@ -167,8 +161,7 @@ export function SubscriptionDashboardProvider({
plan.planCode,
currency,
taxRate,
- i18n.language,
- formatCurrency
+ i18n.language
)
if (priceData?.totalAsNumber !== undefined) {
plan.displayPrice = formatCurrency(
@@ -186,12 +179,7 @@ export function SubscriptionDashboardProvider({
}
fetchPlansDisplayPrices().catch(debugConsole.error)
}
- }, [
- personalSubscription,
- plansWithoutDisplayPrice,
- i18n.language,
- formatCurrency,
- ])
+ }, [personalSubscription, plansWithoutDisplayPrice, i18n.language])
useEffect(() => {
if (
@@ -214,8 +202,7 @@ export function SubscriptionDashboardProvider({
taxRate,
groupPlanToChangeToSize,
groupPlanToChangeToUsage,
- i18n.language,
- formatCurrency
+ i18n.language
)
} catch (e) {
debugConsole.error(e)
@@ -231,7 +218,6 @@ export function SubscriptionDashboardProvider({
groupPlanToChangeToSize,
personalSubscription,
groupPlanToChangeToCode,
- formatCurrency,
i18n.language,
])
diff --git a/services/web/frontend/js/features/subscription/util/recurly-pricing.ts b/services/web/frontend/js/features/subscription/util/recurly-pricing.ts
index e3e8c7b616..584174da1a 100644
--- a/services/web/frontend/js/features/subscription/util/recurly-pricing.ts
+++ b/services/web/frontend/js/features/subscription/util/recurly-pricing.ts
@@ -1,11 +1,9 @@
import { SubscriptionPricingState } from '@recurly/recurly-js'
import { PriceForDisplayData } from '../../../../../types/subscription/plan'
-import {
- currencies,
- CurrencyCode,
-} from '../../../../../types/subscription/currency'
+import { CurrencyCode } from '../../../../../types/subscription/currency'
import { getRecurlyGroupPlanCode } from './recurly-group-plan-code'
import { debugConsole } from '@/utils/debugging'
+import { formatCurrency } from '@/shared/utils/currency'
function queryRecurlyPlanPrice(planCode: string, currency: CurrencyCode) {
return new Promise(resolve => {
@@ -23,31 +21,11 @@ function queryRecurlyPlanPrice(planCode: string, currency: CurrencyCode) {
})
}
-type FormatCurrency = (
- price: number,
- currency: CurrencyCode,
- locale: string,
- stripIfInteger?: boolean
-) => string
-
-export const formatCurrencyDefault: FormatCurrency = (
- price: number,
- currency: CurrencyCode,
- _locale: string,
- stripIfInteger = false
-) => {
- const currencySymbol = currencies[currency]
- const number =
- stripIfInteger && price % 1 === 0 ? Number(price) : price.toFixed(2)
- return `${currencySymbol}${number}`
-}
-
export function formatPriceForDisplayData(
price: string,
taxRate: number,
currencyCode: CurrencyCode,
- locale: string,
- formatCurrency: FormatCurrency
+ locale: string
): PriceForDisplayData {
const totalPriceExTax = parseFloat(price)
let taxAmount = totalPriceExTax * taxRate
@@ -69,8 +47,7 @@ function getPerUserDisplayPrice(
totalPrice: number,
currency: CurrencyCode,
size: string,
- locale: string,
- formatCurrency: FormatCurrency
+ locale: string
): string {
return formatCurrency(totalPrice / parseInt(size), currency, locale, true)
}
@@ -79,8 +56,7 @@ export async function loadDisplayPriceWithTaxPromise(
planCode: string,
currencyCode: CurrencyCode,
taxRate: number,
- locale: string,
- formatCurrency: FormatCurrency
+ locale: string
) {
if (!recurly) return
@@ -93,8 +69,7 @@ export async function loadDisplayPriceWithTaxPromise(
price.next.total,
taxRate,
currencyCode,
- locale,
- formatCurrency
+ locale
)
}
@@ -104,8 +79,7 @@ export async function loadGroupDisplayPriceWithTaxPromise(
taxRate: number,
size: string,
usage: string,
- locale: string,
- formatCurrency: FormatCurrency
+ locale: string
) {
if (!recurly) return
@@ -114,8 +88,7 @@ export async function loadGroupDisplayPriceWithTaxPromise(
planCode,
currencyCode,
taxRate,
- locale,
- formatCurrency
+ locale
)
if (price) {
@@ -123,8 +96,7 @@ export async function loadGroupDisplayPriceWithTaxPromise(
price.totalAsNumber,
currencyCode,
size,
- locale,
- formatCurrency
+ locale
)
}
diff --git a/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-group-plan.js b/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-group-plan.js
index 8204f66eb1..5616d40fa8 100644
--- a/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-group-plan.js
+++ b/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-group-plan.js
@@ -1,12 +1,8 @@
-import { updateGroupModalPlanPricing } from '../../../../features/plans/group-plan-modal'
import '../../../../features/plans/plans-v2-group-plan-modal'
-import {
- createLocalizedGroupPlanPrice,
- formatCurrencyDefault,
-} from '../../../../features/plans/utils/group-plan-pricing'
+
import getMeta from '../../../../utils/meta'
-import { getSplitTestVariant } from '@/utils/splitTestUtils'
-import { formatCurrencyLocalized } from '@/shared/utils/currency'
+import { updateGroupModalPlanPricing } from '../../../../features/plans/group-plan-modal'
+import { createLocalizedGroupPlanPrice } from '../../../../features/plans/utils/group-plan-pricing'
const MINIMUM_LICENSE_SIZE_EDUCATIONAL_DISCOUNT = 10
@@ -26,11 +22,6 @@ export function updateMainGroupPlanPricing() {
? 'educational'
: 'enterprise'
- const localCcyVariant = getSplitTestVariant('local-ccy-format-v2')
- const formatCurrency =
- localCcyVariant === 'enabled'
- ? formatCurrencyLocalized
- : formatCurrencyDefault
const {
localizedPrice: localizedPriceProfessional,
localizedPerUserPrice: localizedPerUserPriceProfessional,
@@ -39,7 +30,6 @@ export function updateMainGroupPlanPricing() {
licenseSize,
currency,
usage,
- formatCurrency,
})
const {
@@ -50,7 +40,6 @@ export function updateMainGroupPlanPricing() {
licenseSize,
currency,
usage,
- formatCurrency,
})
document.querySelector(
diff --git a/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-tracking.ts b/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-tracking.ts
index 0377be631d..3f10f033ca 100644
--- a/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-tracking.ts
+++ b/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-tracking.ts
@@ -13,10 +13,6 @@ export function sendPlansViewEvent() {
'group-tab-improvements'
)
- const websiteRedesignPlansTestVariant = getMeta(
- 'ol-websiteRedesignPlansVariant'
- )
-
const periodToggleTestVariant = getSplitTestVariant(
'period-toggle-improvements'
)
@@ -32,7 +28,6 @@ export function sendPlansViewEvent() {
currency,
countryCode,
device,
- 'website-redesign-plans': websiteRedesignPlansTestVariant,
'group-tab-improvements': groupTabImprovementsVariant,
plan: planTabParam,
'period-toggle-improvements': periodToggleTestVariant,
diff --git a/services/web/frontend/js/shared/utils/currency.ts b/services/web/frontend/js/shared/utils/currency.ts
index 4fe3fef8b6..5a51150d56 100644
--- a/services/web/frontend/js/shared/utils/currency.ts
+++ b/services/web/frontend/js/shared/utils/currency.ts
@@ -2,7 +2,7 @@ import getMeta from '@/utils/meta'
const DEFAULT_LOCALE = getMeta('ol-i18n')?.currentLangCode ?? 'en'
-export function formatCurrencyLocalized(
+export function formatCurrency(
amount: number,
currency: string,
locale: string = DEFAULT_LOCALE,
diff --git a/services/web/test/frontend/features/subscription/components/dashboard/states/active/change-plan/change-plan.test.tsx b/services/web/test/frontend/features/subscription/components/dashboard/states/active/change-plan/change-plan.test.tsx
index 1a9eccd210..4d7afd5742 100644
--- a/services/web/test/frontend/features/subscription/components/dashboard/states/active/change-plan/change-plan.test.tsx
+++ b/services/web/test/frontend/features/subscription/components/dashboard/states/active/change-plan/change-plan.test.tsx
@@ -344,7 +344,7 @@ describe('', function () {
within(modal).getByText('Customize your group subscription')
within(modal).getByText('Save 30% or more')
- within(modal).getByText('$1290 per year')
+ within(modal).getByText('$1,290 per year')
expect(within(modal).getAllByText('$129 per user').length).to.equal(2)
within(modal).getByText('Each user will have access to:')
@@ -432,9 +432,9 @@ describe('', function () {
within(modal).getByText('Total:', { exact: false })
expect(
- within(modal).getAllByText('€1438.40', { exact: false }).length
+ within(modal).getAllByText('€1,438.40', { exact: false }).length
).to.equal(3)
- within(modal).getByText('(€1160.00 + €278.40 tax) per year', {
+ within(modal).getByText('(€1,160.00 + €278.40 tax) per year', {
exact: false,
})
})
@@ -444,7 +444,7 @@ describe('', function () {
await openModal()
- within(modal).getByText('$1290 per year')
+ within(modal).getByText('$1,290 per year')
within(modal).getAllByText('$129 per user')
// plan type (pro collab)
@@ -468,7 +468,7 @@ describe('', function () {
) as HTMLInputElement
expect(professionalPlanRadioInput.checked).to.be.true
- await within(modal).findByText('$2590 per year')
+ await within(modal).findByText('$2,590 per year')
await within(modal).findAllByText('$259 per user')
// user count
@@ -478,7 +478,7 @@ describe('', function () {
sizeSelect = within(modal).getByRole('combobox') as HTMLInputElement
expect(sizeSelect.value).to.equal('5')
- await within(modal).findByText('$1395 per year')
+ await within(modal).findByText('$1,395 per year')
await within(modal).findAllByText('$279 per user')
// usage (enterprise or educational)
@@ -493,12 +493,12 @@ describe('', function () {
expect(educationInput.checked).to.be.true
// make sure doesn't change price until back at min user to qualify
- await within(modal).findByText('$1395 per year')
+ await within(modal).findByText('$1,395 per year')
await within(modal).findAllByText('$279 per user')
await userEvent.selectOptions(sizeSelect, [screen.getByText('10')])
- await within(modal).findByText('$1550 per year')
+ await within(modal).findByText('$1,550 per year')
await within(modal).findAllByText('$155 per user')
})
diff --git a/services/web/test/frontend/features/subscription/util/recurly-pricing.test.ts b/services/web/test/frontend/features/subscription/util/recurly-pricing.test.ts
index d9590087e2..6804df63db 100644
--- a/services/web/test/frontend/features/subscription/util/recurly-pricing.test.ts
+++ b/services/web/test/frontend/features/subscription/util/recurly-pricing.test.ts
@@ -1,16 +1,9 @@
import { expect } from 'chai'
import { formatPriceForDisplayData } from '../../../../../frontend/js/features/subscription/util/recurly-pricing'
-import { formatCurrencyLocalized } from '@/shared/utils/currency'
describe('formatPriceForDisplayData', function () {
it('should handle no tax rate', function () {
- const data = formatPriceForDisplayData(
- '1000',
- 0,
- 'USD',
- 'en',
- formatCurrencyLocalized
- )
+ const data = formatPriceForDisplayData('1000', 0, 'USD', 'en')
expect(data).to.deep.equal({
totalForDisplay: '$1,000',
totalAsNumber: 1000,
@@ -21,13 +14,7 @@ describe('formatPriceForDisplayData', function () {
})
it('should handle a tax rate', function () {
- const data = formatPriceForDisplayData(
- '380',
- 0.2,
- 'EUR',
- 'en',
- formatCurrencyLocalized
- )
+ const data = formatPriceForDisplayData('380', 0.2, 'EUR', 'en')
expect(data).to.deep.equal({
totalForDisplay: '€456',
totalAsNumber: 456,
@@ -38,13 +25,7 @@ describe('formatPriceForDisplayData', function () {
})
it('should handle total with cents', function () {
- const data = formatPriceForDisplayData(
- '8',
- 0.2,
- 'EUR',
- 'en',
- formatCurrencyLocalized
- )
+ const data = formatPriceForDisplayData('8', 0.2, 'EUR', 'en')
expect(data).to.deep.equal({
totalForDisplay: '€9.60',
totalAsNumber: 9.6,
diff --git a/services/web/test/frontend/shared/utils/group-plan-pricing.test.js b/services/web/test/frontend/shared/utils/group-plan-pricing.test.js
index 949c3a7da6..d5d5f19de5 100644
--- a/services/web/test/frontend/shared/utils/group-plan-pricing.test.js
+++ b/services/web/test/frontend/shared/utils/group-plan-pricing.test.js
@@ -1,6 +1,5 @@
import { expect } from 'chai'
import { createLocalizedGroupPlanPrice } from '../../../../frontend/js/features/plans/utils/group-plan-pricing'
-import { formatCurrencyLocalized } from '@/shared/utils/currency'
describe('group-plan-pricing', function () {
beforeEach(function () {
@@ -25,11 +24,6 @@ describe('group-plan-pricing', function () {
},
},
})
- window.metaAttributesCache.set('ol-currencySymbols', {
- CHF: 'Fr',
- DKK: 'kr',
- USD: '$',
- })
window.metaAttributesCache.set('ol-i18n', { currentLangCode: 'en' })
})
@@ -41,7 +35,6 @@ describe('group-plan-pricing', function () {
currency: 'CHF',
licenseSize: '2',
usage: 'enterprise',
- formatCurrency: formatCurrencyLocalized,
})
expect(localizedGroupPlanPrice).to.deep.equal({
@@ -57,7 +50,6 @@ describe('group-plan-pricing', function () {
currency: 'DKK',
licenseSize: '2',
usage: 'enterprise',
- formatCurrency: formatCurrencyLocalized,
})
expect(localizedGroupPlanPrice).to.deep.equal({
@@ -73,7 +65,6 @@ describe('group-plan-pricing', function () {
currency: 'USD',
licenseSize: '2',
usage: 'enterprise',
- formatCurrency: formatCurrencyLocalized,
})
expect(localizedGroupPlanPrice).to.deep.equal({
diff --git a/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js b/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js
index 79dcc3234b..806113920d 100644
--- a/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js
+++ b/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js
@@ -176,7 +176,7 @@ describe('SubscriptionController', function () {
},
'../../infrastructure/Features': this.Features,
'../../util/currency': (this.currency = {
- formatCurrencyLocalized: sinon.stub(),
+ formatCurrency: sinon.stub(),
}),
},
})
@@ -380,26 +380,10 @@ describe('SubscriptionController', function () {
})
})
- describe('localCcyAssignment', function () {
- it('uses formatCurrencyLocalized when variant is enabled', function (done) {
- this.SplitTestV2Hander.promises.getAssignment
- .withArgs(this.req, this.res, 'local-ccy-format-v2')
- .resolves({
- variant: 'enabled',
- })
+ describe('formatCurrency data', function () {
+ it('return correct formatCurrency function', function (done) {
this.res.render = (page, opts) => {
- expect(opts.formatCurrency).to.equal(
- this.currency.formatCurrencyLocalized
- )
- done()
- }
- this.SubscriptionController.plansPage(this.req, this.res)
- })
- it('uses formatCurrencyDefault when variant is default', function (done) {
- this.res.render = (page, opts) => {
- expect(opts.formatCurrency).to.equal(
- this.SubscriptionHelper.formatCurrencyDefault
- )
+ expect(opts.formatCurrency).to.equal(this.currency.formatCurrency)
done()
}
this.SubscriptionController.plansPage(this.req, this.res)
@@ -698,26 +682,10 @@ describe('SubscriptionController', function () {
})
})
- describe('localCcyAssignment', function () {
- it('uses formatCurrencyLocalized when variant is enabled', function (done) {
- this.SplitTestV2Hander.promises.getAssignment
- .withArgs(this.req, this.res, 'local-ccy-format-v2')
- .resolves({
- variant: 'enabled',
- })
+ describe('formatCurrency data', function () {
+ it('return correct formatCurrency function', function (done) {
this.res.render = (page, opts) => {
- expect(opts.formatCurrency).to.equal(
- this.currency.formatCurrencyLocalized
- )
- done()
- }
- this.SubscriptionController.plansPageLightDesign(this.req, this.res)
- })
- it('uses formatCurrencyDefault when variant is default', function (done) {
- this.res.render = (page, opts) => {
- expect(opts.formatCurrency).to.equal(
- this.SubscriptionHelper.formatCurrencyDefault
- )
+ expect(opts.formatCurrency).to.equal(this.currency.formatCurrency)
done()
}
this.SubscriptionController.plansPageLightDesign(this.req, this.res)
diff --git a/services/web/test/unit/src/Subscription/SubscriptionHelperTests.js b/services/web/test/unit/src/Subscription/SubscriptionHelperTests.js
index 7ec420543c..69dcb20ea1 100644
--- a/services/web/test/unit/src/Subscription/SubscriptionHelperTests.js
+++ b/services/web/test/unit/src/Subscription/SubscriptionHelperTests.js
@@ -1,6 +1,5 @@
const SandboxedModule = require('sandboxed-module')
const { expect } = require('chai')
-const { formatCurrencyLocalized } = require('../../../../app/src/util/currency')
const modulePath =
'../../../../app/src/Features/Subscription/SubscriptionHelper'
@@ -34,15 +33,7 @@ describe('SubscriptionHelper', function () {
beforeEach(function () {
this.INITIAL_LICENSE_SIZE = 2
this.settings = {
- groupPlanModalOptions: {
- currencySymbols: {
- USD: '$',
- CHF: 'Fr',
- DKK: 'kr',
- NOK: 'kr',
- SEK: 'kr',
- },
- },
+ groupPlanModalOptions: {},
}
this.GroupPlansData = {
enterprise: {
@@ -154,8 +145,7 @@ describe('SubscriptionHelper', function () {
const localizedPrice =
this.SubscriptionHelper.generateInitialLocalizedGroupPrice(
'CHF',
- 'fr',
- formatCurrencyLocalized
+ 'fr'
)
expect(localizedPrice).to.deep.equal({
@@ -176,8 +166,7 @@ describe('SubscriptionHelper', function () {
const localizedPrice =
this.SubscriptionHelper.generateInitialLocalizedGroupPrice(
'DKK',
- 'da',
- formatCurrencyLocalized
+ 'da'
)
expect(localizedPrice).to.deep.equal({
@@ -198,8 +187,7 @@ describe('SubscriptionHelper', function () {
const localizedPrice =
this.SubscriptionHelper.generateInitialLocalizedGroupPrice(
'SEK',
- 'sv',
- formatCurrencyLocalized
+ 'sv'
)
expect(localizedPrice).to.deep.equal({
@@ -222,8 +210,7 @@ describe('SubscriptionHelper', function () {
'NOK',
// there seem to be possible inconsistencies with the CI
// maybe it depends on what languages are installed on the server?
- 'en',
- formatCurrencyLocalized
+ 'en'
)
expect(localizedPrice).to.deep.equal({
@@ -244,8 +231,7 @@ describe('SubscriptionHelper', function () {
const localizedPrice =
this.SubscriptionHelper.generateInitialLocalizedGroupPrice(
'USD',
- 'en',
- formatCurrencyLocalized
+ 'en'
)
expect(localizedPrice).to.deep.equal({
diff --git a/services/web/types/currency-code.ts b/services/web/types/currency-code.ts
deleted file mode 100644
index a9963f5fe5..0000000000
--- a/services/web/types/currency-code.ts
+++ /dev/null
@@ -1 +0,0 @@
-export type { CurrencyCode } from './subscription/currency'
diff --git a/services/web/types/subscription/currency.ts b/services/web/types/subscription/currency.ts
index 4a844e3869..8d6b88dc0b 100644
--- a/services/web/types/subscription/currency.ts
+++ b/services/web/types/subscription/currency.ts
@@ -20,4 +20,3 @@ export const currencies = {
type Currency = typeof currencies
export type CurrencyCode = keyof Currency
-export type CurrencySymbol = Currency[CurrencyCode]
diff --git a/services/web/types/subscription/payment-context-value.tsx b/services/web/types/subscription/payment-context-value.tsx
index a305095dbb..07472efb28 100644
--- a/services/web/types/subscription/payment-context-value.tsx
+++ b/services/web/types/subscription/payment-context-value.tsx
@@ -2,7 +2,7 @@ import countries from '@/features/subscription/data/countries'
import { Plan } from './plan'
import { SubscriptionPricingStateTax } from 'recurly__recurly-js'
import { SubscriptionPricingInstanceCustom } from '../recurly/pricing/subscription'
-import { currencies, CurrencyCode, CurrencySymbol } from './currency'
+import { currencies, CurrencyCode } from './currency'
export type PricingFormState = {
first_name: string
@@ -23,7 +23,6 @@ export type PaymentContextValue = {
setCurrencyCode: React.Dispatch<
React.SetStateAction
>
- currencySymbol: CurrencySymbol
limitedCurrencies: Partial
pricingFormState: PricingFormState
setPricingFormState: React.Dispatch<