CASH-1947: QPD Insurance
This commit is contained in:
parent
590c28d220
commit
69bae67175
8 changed files with 152 additions and 28 deletions
|
|
@ -78,3 +78,7 @@ export function coverageTypeEnum(strCoverageType) {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export const insuranceCompanyNameStrings = {
|
||||
ERIE: "erie insurance",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { partTypeStrings } from "./part-type-strings";
|
|||
|
||||
export const quotePageDiscountTable = [
|
||||
// Repair
|
||||
//--Cash
|
||||
{
|
||||
name: "Repair Glass Only",
|
||||
experimentCode: "Show_GlassOnly_Repair_Discount",
|
||||
|
|
@ -10,6 +11,7 @@ export const quotePageDiscountTable = [
|
|||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "GLASS RPR GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_ONE,
|
||||
isInsurance: false,
|
||||
},
|
||||
{
|
||||
name: "Repair Standard",
|
||||
|
|
@ -18,6 +20,7 @@ export const quotePageDiscountTable = [
|
|||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "STD RPR GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_TWO,
|
||||
isInsurance: false,
|
||||
},
|
||||
{
|
||||
name: "Repair Premium",
|
||||
|
|
@ -26,8 +29,38 @@ export const quotePageDiscountTable = [
|
|||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "PREM RPR GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_THREE,
|
||||
isInsurance: false,
|
||||
},
|
||||
//--Insurance
|
||||
{
|
||||
name: "Insurance Repair Glass Only",
|
||||
experimentCode: "Show_Ins_GlassOnly_Repair_Discount",
|
||||
partNumber: "GL RPR INS PKG",
|
||||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "GLASS RPR GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_ONE,
|
||||
isInsurance: true,
|
||||
},
|
||||
{
|
||||
name: "Insurance Repair Standard",
|
||||
experimentCode: "Show_Ins_Standard_Repair_Discount",
|
||||
partNumber: "STD RPR INS PKG",
|
||||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "STD RPR GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_TWO,
|
||||
isInsurance: true,
|
||||
},
|
||||
{
|
||||
name: "Insurance Repair Premium",
|
||||
experimentCode: "Show_Ins_Premium_Repair_Discount",
|
||||
partNumber: "PRM RPR INS PKG",
|
||||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "PREM RPR GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_THREE,
|
||||
isInsurance: true,
|
||||
},
|
||||
// Replace - No recal
|
||||
//--Cash
|
||||
{
|
||||
name: "Replace Glass Only",
|
||||
experimentCode: "Show_GlassOnly_Replace_Discount",
|
||||
|
|
@ -35,6 +68,7 @@ export const quotePageDiscountTable = [
|
|||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "GLASS RPL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_ONE,
|
||||
isInsurance: false,
|
||||
},
|
||||
{
|
||||
name: "Replace Standard",
|
||||
|
|
@ -43,6 +77,7 @@ export const quotePageDiscountTable = [
|
|||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "STD RPL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_TWO,
|
||||
isInsurance: false,
|
||||
},
|
||||
{
|
||||
name: "Replace Premium",
|
||||
|
|
@ -51,8 +86,38 @@ export const quotePageDiscountTable = [
|
|||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "PREM RPL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_THREE,
|
||||
isInsurance: false,
|
||||
},
|
||||
//--Insurance
|
||||
{
|
||||
name: "Insurance Replace Glass Only",
|
||||
experimentCode: "Show_Ins_GlassOnly_Replace_Discount",
|
||||
partNumber: "GL RPL INS PKG",
|
||||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "GLASS RPL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_ONE,
|
||||
isInsurance: true,
|
||||
},
|
||||
{
|
||||
name: "Insurance Replace Standard",
|
||||
experimentCode: "Show_Ins_Standard_Replace_Discount",
|
||||
partNumber: "STD RPL INS PKG",
|
||||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "STD RPL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_TWO,
|
||||
isInsurance: true,
|
||||
},
|
||||
{
|
||||
name: "Insurance Replace Premium",
|
||||
experimentCode: "Show_Ins_Premium_Replace_Discount",
|
||||
partNumber: "PRM RPL INS PKG",
|
||||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "PREM RPL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_THREE,
|
||||
isInsurance: true,
|
||||
},
|
||||
// Replace - with recal
|
||||
//--Cash
|
||||
{
|
||||
name: "Recal Glass Only",
|
||||
experimentCode: "Show_GlassOnly_Recal_Discount",
|
||||
|
|
@ -60,6 +125,7 @@ export const quotePageDiscountTable = [
|
|||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "GLASS RCL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_ONE,
|
||||
isInsurance: false,
|
||||
},
|
||||
{
|
||||
name: "Recal Standard",
|
||||
|
|
@ -68,6 +134,7 @@ export const quotePageDiscountTable = [
|
|||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "STD RCL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_TWO,
|
||||
isInsurance: false,
|
||||
},
|
||||
{
|
||||
name: "Recal Premium",
|
||||
|
|
@ -76,5 +143,34 @@ export const quotePageDiscountTable = [
|
|||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "PREM RCL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_THREE,
|
||||
isInsurance: false,
|
||||
},
|
||||
//--Insurance
|
||||
{
|
||||
name: "Insurance Recal Glass Only",
|
||||
experimentCode: "Show_Ins_GlassOnly_Recal_Discount",
|
||||
partNumber: "GL RCL INS PKG",
|
||||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "GLASS RCL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_ONE,
|
||||
isInsurance: true,
|
||||
},
|
||||
{
|
||||
name: "Insurance Recal Standard",
|
||||
experimentCode: "Show_Ins_Standard_Recal_Discount",
|
||||
partNumber: "STD RCL INS PKG",
|
||||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "STD RCL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_TWO,
|
||||
isInsurance: true,
|
||||
},
|
||||
{
|
||||
name: "Insurance Recal Premium",
|
||||
experimentCode: "Show_Ins_Premium_Recal_Discount",
|
||||
partNumber: "PRM RCL INS PKG",
|
||||
partType: partTypeStrings.QUOTE_PAGE_DISCOUNT,
|
||||
description: "PREM RCL GEOTARGET DISC",
|
||||
packageLevel: packageNames.TIER_THREE,
|
||||
isInsurance: true,
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ export default {
|
|||
},
|
||||
async removeQPDLineItemIfExists() {
|
||||
const lineItems = deepClone(store.getters.order.lineItems);
|
||||
lineItems.supportingItems = baseMixin.methods.filterOutQuotePageDiscountPart(
|
||||
lineItems.supportingItems = baseMixin.methods.filterOutCashQuotePageDiscountPart(
|
||||
lineItems.supportingItems
|
||||
);
|
||||
await baseMixin.methods.dispatchStoreAction(
|
||||
|
|
|
|||
|
|
@ -99,6 +99,12 @@
|
|||
v-if="showSaveProgressModal"
|
||||
pageName="quote" />
|
||||
|
||||
<textBlock
|
||||
v-if="isInsuranceSelected && isQuotePageDiscountOnOrder"
|
||||
cmsWidgetName="qpdInsuranceDisclaimer"
|
||||
typeStyle="caption"
|
||||
class="text-left text-md-center" />
|
||||
|
||||
<textBlock
|
||||
cmsWidgetName="quoteDisclaimer"
|
||||
typeStyle="caption"
|
||||
|
|
@ -705,6 +711,7 @@ export default {
|
|||
|
||||
return {
|
||||
packageLevel: def.packageLevel,
|
||||
isInsurance: def.isInsurance,
|
||||
item: match,
|
||||
};
|
||||
})
|
||||
|
|
@ -834,23 +841,11 @@ export default {
|
|||
false
|
||||
);
|
||||
}
|
||||
if (this.isInsuranceSelected && this.isQuotePageDiscountOnOrder) {
|
||||
let supportingItems = this.lineItems.supportingItems;
|
||||
supportingItems = supportingItems.filter((item) => {
|
||||
return item.partType != partTypeStrings.QUOTE_PAGE_DISCOUNT;
|
||||
});
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
||||
supportingItems,
|
||||
false
|
||||
);
|
||||
} else {
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
||||
this.lineItems.supportingItems,
|
||||
false
|
||||
);
|
||||
}
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
||||
this.lineItems.supportingItems,
|
||||
false
|
||||
);
|
||||
this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.lineItems.vaps, false);
|
||||
this.dispatchStoreAction(
|
||||
storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS,
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ describe("service-package-question.vue", () => {
|
|||
availableQuotePageDiscounts: [
|
||||
{
|
||||
packageLevel: packageNames.TIER_THREE,
|
||||
isInsurance: false,
|
||||
item: {
|
||||
description: null,
|
||||
kitPrice: 0,
|
||||
|
|
|
|||
|
|
@ -145,19 +145,18 @@ export default {
|
|||
buttonLabelSubCopy: this.getSubheaderTextFromCms(answer.SubWidgetName),
|
||||
buttonBodyCopy: this.getBodyTextFromCms(answer.SubWidgetName),
|
||||
//The package supports service-package-discount if it has the text value in CMS
|
||||
buttonAuxillaryCopy: this.isInsuranceSelected
|
||||
? this.getDiscountedPackagePriceString(answer.Name, false)
|
||||
: this.getDiscountedPackagePriceString(
|
||||
answer.Name,
|
||||
this.hasDiscountForPackage(answer.Name)
|
||||
),
|
||||
buttonAuxillaryCopy: this.getDiscountedPackagePriceString(
|
||||
answer.Name,
|
||||
this.hasDiscountForPackage(answer.Name)
|
||||
),
|
||||
buttonFooterCopy: this.getFooterTextFromCms(answer.SubWidgetName),
|
||||
additionalButtonData: {
|
||||
strikeThroughPrice: this.getPackagePriceString(answer.Name),
|
||||
hasDiscount: this.hasDiscountForPackage(answer.Name),
|
||||
Text: this.isInsuranceSelected
|
||||
? false
|
||||
: "Special: Save $" + this.getDiscountPrice(answer.Name),
|
||||
Text:
|
||||
"Special: Save $" +
|
||||
this.getDiscountPrice(answer.Name) +
|
||||
(this.isInsuranceSelected ? "*" : ""),
|
||||
isInsuranceSelected: this.isInsuranceSelected,
|
||||
},
|
||||
}));
|
||||
|
|
@ -297,9 +296,11 @@ export default {
|
|||
if (discountedPrice) {
|
||||
lineItemsToPrice.push(...removeVapsPromosFromPromoArray(this.activePromos));
|
||||
}
|
||||
let quotePageDiscountAmount = 0;
|
||||
if (quotePageDiscount) {
|
||||
const part = this.getDiscountPartForSelectedPackage(packageName);
|
||||
if (part) {
|
||||
quotePageDiscountAmount = baseMixin.methods.getTotalLineItemPrice(part);
|
||||
lineItemsToPrice.push(part);
|
||||
}
|
||||
}
|
||||
|
|
@ -310,6 +311,7 @@ export default {
|
|||
);
|
||||
|
||||
priceFloat += this.getVapsPrice(packageName, discountedPrice);
|
||||
this.isInsuranceSelected && (priceFloat += quotePageDiscountAmount);
|
||||
|
||||
return priceFloat;
|
||||
},
|
||||
|
|
@ -388,7 +390,9 @@ export default {
|
|||
getDiscountPartForSelectedPackage(packageName) {
|
||||
if (this.availableQuotePageDiscounts?.length > 0) {
|
||||
const match = this.availableQuotePageDiscounts.find(
|
||||
(discountInfo) => discountInfo.packageLevel === packageName
|
||||
(discountInfo) =>
|
||||
discountInfo.isInsurance === this.isInsuranceSelected &&
|
||||
discountInfo.packageLevel === packageName
|
||||
);
|
||||
return match?.item;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,6 +237,8 @@ import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigat
|
|||
import { applicationConfig } from "@/constants/application-config";
|
||||
import { Provider } from "@/layouts/service-location/classes/provider";
|
||||
import { partNumberStrings } from "@/constants/part-number-strings";
|
||||
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||
import { insuranceCompanyNameStrings } from "@/constants/insurance";
|
||||
|
||||
import store from "@/store";
|
||||
|
||||
|
|
@ -1608,6 +1610,19 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.isInsurance && supportingItems) {
|
||||
const insuranceCompanyName = this.$store.getters.policy.insuranceCompanyName;
|
||||
const removeQPDpartIndex = supportingItems.findIndex(
|
||||
(item) => item.partType == partTypeStrings.QUOTE_PAGE_DISCOUNT
|
||||
);
|
||||
if (
|
||||
removeQPDpartIndex >= 0 &&
|
||||
insuranceCompanyName.toLowerCase() === insuranceCompanyNameStrings.ERIE
|
||||
) {
|
||||
supportingItems.splice(removeQPDpartIndex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING,
|
||||
supportingItems,
|
||||
|
|
|
|||
|
|
@ -135,6 +135,15 @@ export default {
|
|||
});
|
||||
return filteredLineItems;
|
||||
},
|
||||
filterOutCashQuotePageDiscountPart(lineItems) {
|
||||
const filteredLineItems = lineItems?.filter((item) => {
|
||||
return !(
|
||||
item?.partType?.includes(partTypeStrings.QUOTE_PAGE_DISCOUNT) &&
|
||||
item?.partNumber?.includes("CSH")
|
||||
);
|
||||
});
|
||||
return filteredLineItems;
|
||||
},
|
||||
filterOutRecalibration(lineItems) {
|
||||
return getItemsWithoutRecalParts(lineItems);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue