Merge pull request #1313 from Safelite/feature/Digital/CSR-1416
CSR-1416
This commit is contained in:
commit
515dfd2cd3
3 changed files with 55 additions and 2 deletions
1
src/constants/pay-with-insurance-states.js
Normal file
1
src/constants/pay-with-insurance-states.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export const payWithInsuranceStates = ["AZ", "CT", "FL", "KY", "MA", "MN", "NY", "SC"];
|
||||||
|
|
@ -263,6 +263,9 @@ describe("quote.vue", () => {
|
||||||
payment: {
|
payment: {
|
||||||
isInsurance: null,
|
isInsurance: null,
|
||||||
},
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
state: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
wrapper.vm.$route = { query: { isInsurance: "true" } };
|
wrapper.vm.$route = { query: { isInsurance: "true" } };
|
||||||
|
|
@ -290,6 +293,9 @@ describe("quote.vue", () => {
|
||||||
payment: {
|
payment: {
|
||||||
isInsurance: null,
|
isInsurance: null,
|
||||||
},
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
state: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
wrapper.vm.$route = { query: { isInsurance: "false" } };
|
wrapper.vm.$route = { query: { isInsurance: "false" } };
|
||||||
|
|
@ -317,6 +323,9 @@ describe("quote.vue", () => {
|
||||||
payment: {
|
payment: {
|
||||||
isInsurance: true,
|
isInsurance: true,
|
||||||
},
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
state: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// Ensure that query param isn't overriding selection
|
// Ensure that query param isn't overriding selection
|
||||||
|
|
@ -345,6 +354,9 @@ describe("quote.vue", () => {
|
||||||
payment: {
|
payment: {
|
||||||
isInsurance: false,
|
isInsurance: false,
|
||||||
},
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
state: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// Ensure that query param isn't overriding selection
|
// Ensure that query param isn't overriding selection
|
||||||
|
|
@ -374,6 +386,9 @@ describe("quote.vue", () => {
|
||||||
payment: {
|
payment: {
|
||||||
isInsurance: null, // Ensure that previous selection isn't overriding selection
|
isInsurance: null, // Ensure that previous selection isn't overriding selection
|
||||||
},
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
state: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
mockTierOnePrice = 200;
|
mockTierOnePrice = 200;
|
||||||
|
|
@ -404,6 +419,9 @@ describe("quote.vue", () => {
|
||||||
payment: {
|
payment: {
|
||||||
isInsurance: null, // Ensure that previous selection isn't overriding selection
|
isInsurance: null, // Ensure that previous selection isn't overriding selection
|
||||||
},
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
state: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
mockTierOnePrice = 505;
|
mockTierOnePrice = 505;
|
||||||
|
|
@ -421,6 +439,33 @@ describe("quote.vue", () => {
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.isInsuranceSelected).toBe(true);
|
expect(wrapper.vm.isInsuranceSelected).toBe(true);
|
||||||
});
|
});
|
||||||
|
test("Should default to insurence if user Service zip is from certain States", async () => {
|
||||||
|
//Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
store.getters = {
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
glassParts: ["item", "item2"],
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
isInsurance: null,
|
||||||
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
state: "AZ",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
wrapper.vm.$route = { query: null };
|
||||||
|
//Act
|
||||||
|
await quote.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "quote" } },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
//Assert
|
||||||
|
expect(wrapper.vm.isInsuranceSelected).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ customMountOptions }) {
|
function setupMocks({ customMountOptions }) {
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ import { errorMessages } from "@/constants/error-messages";
|
||||||
import { Form, defineRule } from "vee-validate";
|
import { Form, defineRule } from "vee-validate";
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
import { applicationConfig } from "@/constants/application-config";
|
import { applicationConfig } from "@/constants/application-config";
|
||||||
|
import { payWithInsuranceStates } from "@/constants/pay-with-insurance-states";
|
||||||
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -154,11 +154,18 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getDefaultIsInsuranceSelectedValue(availableLineItems) {
|
getDefaultIsInsuranceSelectedValue(availableLineItems) {
|
||||||
|
const serviceLocationState = store.getters.order.serviceLocation.state;
|
||||||
// Override if coming back from QuoteDetails. Remove override after Quote release
|
// Override if coming back from QuoteDetails. Remove override after Quote release
|
||||||
const isInsuranceOverrideValue = this.$route.query?.isInsurance;
|
const isInsuranceOverrideValue = this.$route.query?.isInsurance;
|
||||||
|
|
||||||
const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance;
|
const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance;
|
||||||
if (isInsuranceOverrideValue != null) {
|
//Default to Insurance Tab if user Service zip is from certain States
|
||||||
|
if (
|
||||||
|
serviceLocationState != null &&
|
||||||
|
payWithInsuranceStates.find((item) => item === serviceLocationState)
|
||||||
|
)
|
||||||
|
return true;
|
||||||
|
else if (isInsuranceOverrideValue != null) {
|
||||||
return isInsuranceOverrideValue == "true";
|
return isInsuranceOverrideValue == "true";
|
||||||
} else if (defaultIsInsuranceSelectedValue != null) {
|
} else if (defaultIsInsuranceSelectedValue != null) {
|
||||||
return defaultIsInsuranceSelectedValue;
|
return defaultIsInsuranceSelectedValue;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue