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