From 0d03f5e36e62e404a4ae9dd8b437ebf039c38301 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Tue, 16 Jul 2024 15:57:55 -0400 Subject: [PATCH 1/2] dont add fee if hidden. prevents price override on backend. --- src/store/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 8552b9bf..47d8bb38 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -6,7 +6,7 @@ import { endpoints } from '@/constants/endpoints'; import { getDateForSavedSessionTimeout } from '@/helpers/session-helper'; // eslint-disable-next-line import/no-cycle import globalMethods from '@/global-methods'; -import { experimentTriggers, experimentUniverses } from '@/constants/experiments'; +import { experimentSettings, experimentTriggers, experimentUniverses } from '@/constants/experiments'; import applicationConfig from '@/constants/application-config'; import issPageValues from '@/router/router-constants/issPage-values'; import damageLocationsSelected from '@/constants/damage-locations-selected'; @@ -28,7 +28,7 @@ import partNumberStrings from '@/constants/part-number-strings'; import { findLineItemIndex, getLineItemsFlattened } from '@/helpers/line-items-helper'; import { buildQueryStringParameterFromArrayOfComplexObjects, getLineItemQueryString, getTaxLineItemQueryString } from '@/helpers/querystring-helper'; import coverageType from '@/constants/coverage-type'; -import { getFeatureTogglesQueryString } from '@/helpers/experiment-helper'; +import { getExperimentSettingValue, getFeatureTogglesQueryString } from '@/helpers/experiment-helper'; import { getSessionKeyValue, getUserIdValue } from '@/helpers/cookie-helper'; const storeId = 'main'; @@ -1692,8 +1692,9 @@ export const useMainStore = defineStore({ }, updateMobileFee(fee) { - // Mobile Fee is only added for NO COMP or ITAC - if (fee && this.isVerified && (this.isNoComp || this.isITAC)) { + const isMobileFeeHidden = getExperimentSettingValue(experimentSettings.ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_HIDDEN) === 'true'; + // Mobile Fee is only added for NO COMP or ITAC and is NOT hidden + if (fee && this.isVerified && (this.isNoComp || this.isITAC) && !isMobileFeeHidden) { this.addPartTypeFeeItem(fee, partTypeStrings.MOBILE_FEE); } else { this.addPartTypeFeeItem(null, partTypeStrings.MOBILE_FEE); @@ -1701,8 +1702,9 @@ export const useMainStore = defineStore({ }, updateRecycleFee(fee) { - // Recycle Fee is only added for NO COMP or ITAC and has Windshield Replacement - if (fee && this.isVerified && (this.isNoComp || this.isITAC) && this.hasWindshieldReplacement) { + const isRecycleFeeHidden = this.getSettingValue(experimentSettings.ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_HIDDEN) === 'true'; + // Recycle Fee is only added for NO COMP or ITAC and has Windshield Replacement and is NOT hidden + if (fee && this.isVerified && (this.isNoComp || this.isITAC) && this.hasWindshieldReplacement && !isRecycleFeeHidden) { this.addPartNumberFeeItem(fee, partNumberStrings.RECYCLE_FEE); } else { this.addPartNumberFeeItem(null, partNumberStrings.RECYCLE_FEE); From 8cabb807e889f7392b1f68af462c8e136f0a7ac7 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 18 Jul 2024 09:07:31 -0400 Subject: [PATCH 2/2] dont add fee to local array if hidden --- src/store/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 47d8bb38..57918dbe 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1692,7 +1692,7 @@ export const useMainStore = defineStore({ }, updateMobileFee(fee) { - const isMobileFeeHidden = getExperimentSettingValue(experimentSettings.ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_HIDDEN) === 'true'; + const isMobileFeeHidden = getExperimentSettingValue(this.experimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_HIDDEN) === 'true'; // Mobile Fee is only added for NO COMP or ITAC and is NOT hidden if (fee && this.isVerified && (this.isNoComp || this.isITAC) && !isMobileFeeHidden) { this.addPartTypeFeeItem(fee, partTypeStrings.MOBILE_FEE); @@ -1702,7 +1702,7 @@ export const useMainStore = defineStore({ }, updateRecycleFee(fee) { - const isRecycleFeeHidden = this.getSettingValue(experimentSettings.ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_HIDDEN) === 'true'; + const isRecycleFeeHidden = getExperimentSettingValue(this.experimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_HIDDEN) === 'true'; // Recycle Fee is only added for NO COMP or ITAC and has Windshield Replacement and is NOT hidden if (fee && this.isVerified && (this.isNoComp || this.isITAC) && this.hasWindshieldReplacement && !isRecycleFeeHidden) { this.addPartNumberFeeItem(fee, partNumberStrings.RECYCLE_FEE);