commit
f9da6154a5
2 changed files with 32 additions and 23 deletions
|
|
@ -376,7 +376,7 @@ describe("quote.vue", () => {
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.isInsuranceSelected).toBe(true);
|
expect(wrapper.vm.isInsuranceSelected).toBe(true);
|
||||||
});
|
});
|
||||||
test("should default to cash if query param 'isInsurance' is false", async () => {
|
test("should use amount threshold if query param 'isInsurance' is false", async () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
store.getters = {
|
store.getters = {
|
||||||
lineItems: {
|
lineItems: {
|
||||||
|
|
@ -403,6 +403,7 @@ describe("quote.vue", () => {
|
||||||
settingName: "SERVICE_PACKAGE_DISCOUNT",
|
settingName: "SERVICE_PACKAGE_DISCOUNT",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
mockTierOnePrice = 200;
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
|
|
|
||||||
|
|
@ -299,8 +299,9 @@ export default {
|
||||||
|
|
||||||
const getIsInsuranceSelectedValue = (availableLineItems, insuranceThreshold) => {
|
const getIsInsuranceSelectedValue = (availableLineItems, insuranceThreshold) => {
|
||||||
const serviceLocationState = store.getters.order.serviceLocation.state;
|
const serviceLocationState = store.getters.order.serviceLocation.state;
|
||||||
// Override if coming back from QuoteDetails. Remove override after Quote release
|
|
||||||
const isInsuranceOverrideValue = to.query?.isInsurance;
|
// usually true when returning from heritage but can be false when returning from heritage on a save quote
|
||||||
|
const isInsuranceFromQueryString = to.query?.isInsurance;
|
||||||
const defaultIsInsuranceSelectedValue = store.getters.order.payment.isInsurance;
|
const defaultIsInsuranceSelectedValue = store.getters.order.payment.isInsurance;
|
||||||
const hideRecalCost =
|
const hideRecalCost =
|
||||||
experimentMixin.methods
|
experimentMixin.methods
|
||||||
|
|
@ -311,29 +312,36 @@ export default {
|
||||||
if (
|
if (
|
||||||
serviceLocationState != null &&
|
serviceLocationState != null &&
|
||||||
payWithInsuranceStates.find((item) => item === serviceLocationState)
|
payWithInsuranceStates.find((item) => item === serviceLocationState)
|
||||||
)
|
) {
|
||||||
return true;
|
return true;
|
||||||
else if (isInsuranceOverrideValue != null) {
|
|
||||||
return isInsuranceOverrideValue == "true";
|
|
||||||
} else if (defaultIsInsuranceSelectedValue != null) {
|
|
||||||
return defaultIsInsuranceSelectedValue;
|
|
||||||
} else {
|
|
||||||
if (availableLineItems) {
|
|
||||||
const lineItemsForCalculatingPrice = hideRecalCost
|
|
||||||
? baseMixin.methods.filterOutFees(
|
|
||||||
baseMixin.methods.filterOutRecalibration(availableLineItems) // Strip out recal before filtering out fees
|
|
||||||
)
|
|
||||||
: baseMixin.methods.filterOutFees(availableLineItems);
|
|
||||||
|
|
||||||
return (
|
|
||||||
baseMixin.methods.getTierOnePackagePrice(lineItemsForCalculatingPrice) >
|
|
||||||
insuranceThreshold
|
|
||||||
); // compare base price vs arbitrary threshold (representing insurance price)
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defaultIsInsuranceSelectedValue != null) {
|
||||||
|
return defaultIsInsuranceSelectedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (availableLineItems) {
|
||||||
|
const lineItemsForCalculatingPrice = hideRecalCost
|
||||||
|
? baseMixin.methods.filterOutFees(
|
||||||
|
baseMixin.methods.filterOutRecalibration(availableLineItems) // Strip out recal before filtering out fees
|
||||||
|
)
|
||||||
|
: baseMixin.methods.filterOutFees(availableLineItems);
|
||||||
|
|
||||||
|
if (isInsuranceFromQueryString != null) {
|
||||||
|
if (isInsuranceFromQueryString == "true") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
baseMixin.methods.getTierOnePackagePrice(lineItemsForCalculatingPrice) >
|
||||||
|
insuranceThreshold
|
||||||
|
); // compare base price vs arbitrary threshold (representing insurance price)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
let thresholdToUse = INSURANCE_TAB_TO_DISPLAY_THRESHOLD_DEFAULT;
|
let thresholdToUse = INSURANCE_TAB_TO_DISPLAY_THRESHOLD_DEFAULT;
|
||||||
let internalThreshold = experimentMixin.methods.getSettingValue(
|
let internalThreshold = experimentMixin.methods.getSettingValue(
|
||||||
experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL
|
experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue