Merge pull request #1839 from Safelite/feature/CSR-1742-ajc
CSR-1742: refactor to centralize all insurance constants/helpers
This commit is contained in:
commit
79456bab46
9 changed files with 69 additions and 42 deletions
|
|
@ -1,20 +0,0 @@
|
||||||
const coverageStatus = {
|
|
||||||
PENDING: "Pending",
|
|
||||||
NOCOMP: "NoComp",
|
|
||||||
VERIFIED: "Verified",
|
|
||||||
};
|
|
||||||
|
|
||||||
export function coverageStatusValue(intCoverageStatus) {
|
|
||||||
switch (intCoverageStatus) {
|
|
||||||
case 0:
|
|
||||||
return coverageStatus.PENDING;
|
|
||||||
case 1:
|
|
||||||
return coverageStatus.NOCOMP;
|
|
||||||
case 2:
|
|
||||||
return coverageStatus.VERIFIED;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { coverageStatus };
|
|
||||||
30
src/constants/insurance.js
Normal file
30
src/constants/insurance.js
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { cartItemTypes } from "@/constants/cart-item-types";
|
||||||
|
|
||||||
|
export const payWithInsuranceStates = ["AZ", "CT", "FL", "KY", "MA", "MN", "NY", "SC"];
|
||||||
|
|
||||||
|
export const cartItemTypesCoveredByInsurance = [
|
||||||
|
cartItemTypes.GLASS_PARTS,
|
||||||
|
cartItemTypes.SUPPORTING_ITEMS,
|
||||||
|
cartItemTypes.RECYCLE_FEE,
|
||||||
|
cartItemTypes.REPLACE_FEE,
|
||||||
|
cartItemTypes.SUPPLIES_REPAIR,
|
||||||
|
];
|
||||||
|
|
||||||
|
export const coverageStatus = {
|
||||||
|
PENDING: "Pending",
|
||||||
|
NOCOMP: "NoComp",
|
||||||
|
VERIFIED: "Verified",
|
||||||
|
};
|
||||||
|
|
||||||
|
export function coverageStatusValue(intCoverageStatus) {
|
||||||
|
switch (intCoverageStatus) {
|
||||||
|
case 0:
|
||||||
|
return coverageStatus.PENDING;
|
||||||
|
case 1:
|
||||||
|
return coverageStatus.NOCOMP;
|
||||||
|
case 2:
|
||||||
|
return coverageStatus.VERIFIED;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export const payWithInsuranceStates = ["AZ", "CT", "FL", "KY", "MA", "MN", "NY", "SC"];
|
|
||||||
|
|
@ -177,7 +177,7 @@ import { getPromoCodeWithoutBundleIdentifier } from "@/helpers/promotions-helper
|
||||||
import { partTypeStrings } from "@/constants/part-type-strings";
|
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||||
import { cartItemCategories } from "@/constants/cart-item-categories";
|
import { cartItemCategories } from "@/constants/cart-item-categories";
|
||||||
import { cartItemTypes } from "@/constants/cart-item-types";
|
import { cartItemTypes } from "@/constants/cart-item-types";
|
||||||
import { coverageStatus } from "@/constants/coverage-status";
|
import { coverageStatus, cartItemTypesCoveredByInsurance } from "@/constants/insurance";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "cart",
|
name: "cart",
|
||||||
|
|
@ -520,7 +520,9 @@ export default {
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: false,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.FRONT_WIPERS
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
frontWiperLineItems.forEach((lineItem) => {
|
frontWiperLineItems.forEach((lineItem) => {
|
||||||
|
|
@ -558,7 +560,9 @@ export default {
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: false,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.REAR_WIPERS
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
rearWiperLineItems.forEach((lineItem) => {
|
rearWiperLineItems.forEach((lineItem) => {
|
||||||
|
|
@ -596,7 +600,9 @@ export default {
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: false,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.RAIN_DEFENSE
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
rainDefenseLineItem.cartItemType = cartItem.cartItemType;
|
rainDefenseLineItem.cartItemType = cartItem.cartItemType;
|
||||||
|
|
@ -617,7 +623,7 @@ export default {
|
||||||
|
|
||||||
if (this.glassParts.length > 0) {
|
if (this.glassParts.length > 0) {
|
||||||
this.glassParts.forEach((lineItem) => {
|
this.glassParts.forEach((lineItem) => {
|
||||||
let glassPartCartItem = {
|
let cartItem = {
|
||||||
name: null,
|
name: null,
|
||||||
category: cartItemCategories.GLASS_PARTS,
|
category: cartItemCategories.GLASS_PARTS,
|
||||||
cartItemType: cartItemTypes.GLASS_PARTS,
|
cartItemType: cartItemTypes.GLASS_PARTS,
|
||||||
|
|
@ -627,24 +633,25 @@ export default {
|
||||||
(lineItem.kitPrice ?? 0) +
|
(lineItem.kitPrice ?? 0) +
|
||||||
(lineItem.laborAmount ?? 0) +
|
(lineItem.laborAmount ?? 0) +
|
||||||
(lineItem.sellingPrice ?? 0),
|
(lineItem.sellingPrice ?? 0),
|
||||||
|
|
||||||
salesTax: lineItem.salesTax ?? 0,
|
salesTax: lineItem.salesTax ?? 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: true,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.GLASS_PARTS
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (lineItem.childParts?.length > 0) {
|
if (lineItem.childParts?.length > 0) {
|
||||||
lineItem.childParts.forEach((childPartLineItem) => {
|
lineItem.childParts.forEach((childPartLineItem) => {
|
||||||
glassPartCartItem.subTotal +=
|
cartItem.subTotal +=
|
||||||
(childPartLineItem.kitPrice ?? 0) +
|
(childPartLineItem.kitPrice ?? 0) +
|
||||||
(childPartLineItem.laborAmount ?? 0) +
|
(childPartLineItem.laborAmount ?? 0) +
|
||||||
(childPartLineItem.sellingPrice ?? 0);
|
(childPartLineItem.sellingPrice ?? 0);
|
||||||
|
|
||||||
glassPartCartItem.salesTax += childPartLineItem.salesTax;
|
cartItem.salesTax += childPartLineItem.salesTax;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
glassPartCartItems.push(glassPartCartItem);
|
glassPartCartItems.push(cartItem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -670,7 +677,9 @@ export default {
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: true,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.REPLACE_FEE
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
recycleFeeLineItem.cartItemType = cartItem.cartItemType;
|
recycleFeeLineItem.cartItemType = cartItem.cartItemType;
|
||||||
|
|
@ -708,7 +717,9 @@ export default {
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: true,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.SUPPLIES_REPAIR
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
suppliesRepairLineItem.cartItemType = cartItem.cartItemType;
|
suppliesRepairLineItem.cartItemType = cartItem.cartItemType;
|
||||||
|
|
@ -744,7 +755,9 @@ export default {
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: false,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.MOBILE_FEE
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
mobileFeeLineItem.cartItemType = cartItem.cartItemType;
|
mobileFeeLineItem.cartItemType = cartItem.cartItemType;
|
||||||
|
|
@ -778,7 +791,9 @@ export default {
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: true,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.SUPPORTING_ITEMS
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
otherSupportingItemsLineItems.forEach((lineItem) => {
|
otherSupportingItemsLineItems.forEach((lineItem) => {
|
||||||
|
|
@ -816,7 +831,9 @@ export default {
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: false,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
||||||
|
cartItemTypes.EARLY_BIRD
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
premiumAppointmentDiscountLineItem.cartItemType = cartItem.cartItemType;
|
premiumAppointmentDiscountLineItem.cartItemType = cartItem.cartItemType;
|
||||||
|
|
@ -862,7 +879,7 @@ export default {
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
lineItems: [],
|
lineItems: [],
|
||||||
isCoveredByInsurance: false,
|
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(promoCode),
|
||||||
};
|
};
|
||||||
|
|
||||||
promoLineItems.forEach((promoLineItem) => {
|
promoLineItems.forEach((promoLineItem) => {
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ import { convertDateStringToDate } from "@/layouts/schedule/helpers/schedule-hel
|
||||||
import { deepClone } from "@/helpers/object-helper";
|
import { deepClone } from "@/helpers/object-helper";
|
||||||
import { Form } from "vee-validate";
|
import { Form } from "vee-validate";
|
||||||
import { get12HourTimeFormat, get12HourTimeMobileFormat } from "@/helpers/date-helper";
|
import { get12HourTimeFormat, get12HourTimeMobileFormat } from "@/helpers/date-helper";
|
||||||
import { coverageStatus } from "@/constants/coverage-status";
|
import { coverageStatus } from "@/constants/insurance";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "confirmation",
|
name: "confirmation",
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ import { errorMessages } from "@/constants/error-messages";
|
||||||
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
||||||
import { partTypeStrings } from "@/constants/part-type-strings";
|
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||||
import { mapTaxedLineItemsToStoreFormat } from "../../store";
|
import { mapTaxedLineItemsToStoreFormat } from "../../store";
|
||||||
import { coverageStatus } from "@/constants/coverage-status";
|
import { coverageStatus } from "@/constants/insurance";
|
||||||
|
|
||||||
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ import { deepClone } from "@/helpers/object-helper";
|
||||||
import { submitWorkOrder } from "@/helpers/heritage-integration/order-helper.js";
|
import { submitWorkOrder } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
import iframeResize from "../../../node_modules/iframe-resizer/js/iframeResizer.js";
|
import iframeResize from "../../../node_modules/iframe-resizer/js/iframeResizer.js";
|
||||||
import { routerParams } from "@/router/router-constants/router-params";
|
import { routerParams } from "@/router/router-constants/router-params";
|
||||||
import { coverageStatus } from "@/constants/coverage-status";
|
import { coverageStatus } from "@/constants/insurance";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "payment",
|
name: "payment",
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ import { required } from "@/helpers/validation-rules";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import { Form, defineRule } from "vee-validate";
|
import { Form, defineRule } from "vee-validate";
|
||||||
import { applicationConfig } from "@/constants/application-config";
|
import { applicationConfig } from "@/constants/application-config";
|
||||||
import { payWithInsuranceStates } from "@/constants/pay-with-insurance-states";
|
import { payWithInsuranceStates } from "@/constants/insurance";
|
||||||
import {
|
import {
|
||||||
revalidatePromosAndValidateQueryStringPromo,
|
revalidatePromosAndValidateQueryStringPromo,
|
||||||
buildToastMessagesFromRevalidateOrValidatePromoResponse,
|
buildToastMessagesFromRevalidateOrValidatePromoResponse,
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ import {
|
||||||
} from "@/helpers/promotions-helper";
|
} from "@/helpers/promotions-helper";
|
||||||
import { getDateDifferenceInDays } from "@/helpers/date-helper";
|
import { getDateDifferenceInDays } from "@/helpers/date-helper";
|
||||||
import sharedMutations from "./vuex-shared-mutations/vuexSharedMutations";
|
import sharedMutations from "./vuex-shared-mutations/vuexSharedMutations";
|
||||||
import { coverageStatus, coverageStatusValue } from "@/constants/coverage-status";
|
import { coverageStatus, coverageStatusValue } from "@/constants/insurance";
|
||||||
|
|
||||||
// Export State
|
// Export State
|
||||||
const getDefaultState = () => {
|
const getDefaultState = () => {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue