CASH-69: Get MSR fee and offer mobile service if applicable for cash and insurance
This commit is contained in:
parent
32fc82176b
commit
d9933d861c
3 changed files with 51 additions and 8 deletions
|
|
@ -11,7 +11,10 @@ export async function getPricedMobileFeePart(serviceZipCode, pageNameToLog) {
|
||||||
// Get the Mobile Fee Part
|
// Get the Mobile Fee Part
|
||||||
const mobileFeePart = await baseMixin.methods.dispatchStoreActionWithLogging(
|
const mobileFeePart = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_MOBILE_FEE_PART,
|
storeActions.GET_MOBILE_FEE_PART,
|
||||||
null,
|
{
|
||||||
|
serviceZipCode: serviceZipCode,
|
||||||
|
serviceZipCodeCtu: zipCodeData.zipCodeCtu,
|
||||||
|
},
|
||||||
pageNameToLog,
|
pageNameToLog,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@ import { defineRule } from "vee-validate";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
|
|
||||||
const MOBILE_FEE_PART_TYPE = "MOBILE FEE";
|
const MOBILE_FEE_PART_TYPE = "MOBILE FEE";
|
||||||
|
const MOBILE_STATIC_RECAL_FEE_PART_NUMBER = "RECAL MOBILE";
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("mobile-location-required", (value) => {
|
defineRule("mobile-location-required", (value) => {
|
||||||
|
|
@ -309,14 +310,27 @@ export default {
|
||||||
isServiceableMobile() {
|
isServiceableMobile() {
|
||||||
if (this.isRecalibrationServiceableMobile !== null) {
|
if (this.isRecalibrationServiceableMobile !== null) {
|
||||||
return (
|
return (
|
||||||
this.isGlassServiceableMobile &&
|
(this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile) ||
|
||||||
this.isRecalibrationServiceableMobile &&
|
this.isMobileStaticRecalibrationApplicable
|
||||||
this.isVehicleMobileStaticRecalibrationApplicable
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return this.isGlassServiceableMobile;
|
return this.isGlassServiceableMobile;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
isMobileStaticRecalibrationApplicable() {
|
||||||
|
if (!this.isInsurance) {
|
||||||
|
return (
|
||||||
|
this.isVehicleMobileStaticRecalibrationApplicable &&
|
||||||
|
this.mobileFeePart?.partNumber == MOBILE_STATIC_RECAL_FEE_PART_NUMBER
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
this.isVehicleMobileStaticRecalibrationApplicable &&
|
||||||
|
this.mobileFeePart?.partNumber == MOBILE_STATIC_RECAL_FEE_PART_NUMBER &&
|
||||||
|
this.mobileFeePart?.isInsurable
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
mobileFeeApplies() {
|
mobileFeeApplies() {
|
||||||
if (
|
if (
|
||||||
this.mobileFeePart?.laborAmount > 0 ||
|
this.mobileFeePart?.laborAmount > 0 ||
|
||||||
|
|
@ -355,7 +369,8 @@ export default {
|
||||||
return (
|
return (
|
||||||
this.isServiceableInshop &&
|
this.isServiceableInshop &&
|
||||||
this.isGlassServiceableMobile &&
|
this.isGlassServiceableMobile &&
|
||||||
this.isRecalibrationServiceableMobile === false
|
this.isRecalibrationServiceableMobile === false &&
|
||||||
|
!this.isMobileStaticRecalibrationApplicable
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
displayRecalibrationWarning() {
|
displayRecalibrationWarning() {
|
||||||
|
|
|
||||||
|
|
@ -1607,7 +1607,7 @@ export const actions = {
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
|
||||||
getMobileFeePart(context, { pageNameToLog }) {
|
getMobileFeePart(context, { payload: { serviceZipCode, serviceZipCodeCtu }, pageNameToLog }) {
|
||||||
const serviceType = context.getters.damage.isRepair ? "Repair" : "Install";
|
const serviceType = context.getters.damage.isRepair ? "Repair" : "Install";
|
||||||
const facilityType = "Mobile";
|
const facilityType = "Mobile";
|
||||||
const parentAccountNumber = context.getters.payment.parentAccountNumber;
|
const parentAccountNumber = context.getters.payment.parentAccountNumber;
|
||||||
|
|
@ -1619,16 +1619,31 @@ export const actions = {
|
||||||
const coverageStatus = coverageStatusEnum(order.payment?.insuranceCoverage?.coverageStatus);
|
const coverageStatus = coverageStatusEnum(order.payment?.insuranceCoverage?.coverageStatus);
|
||||||
const coverageType = coverageTypeEnum(order.payment?.insuranceCoverage?.coverageType);
|
const coverageType = coverageTypeEnum(order.payment?.insuranceCoverage?.coverageType);
|
||||||
const isItacOptimized = order.policy?.isItac ?? false;
|
const isItacOptimized = order.policy?.isItac ?? false;
|
||||||
|
const isMobileStaticRecalibrationApplicable =
|
||||||
|
order.vehicle?.isMobileStaticRecalibrationApplicable;
|
||||||
const zipCode =
|
const zipCode =
|
||||||
order.serviceLocation?.provider?.address?.zipCode ?? order.serviceLocation?.zipCode;
|
serviceZipCode ??
|
||||||
|
order.serviceLocation?.provider?.address?.zipCode ??
|
||||||
|
order.serviceLocation?.zipCode;
|
||||||
|
|
||||||
var providerNumber =
|
var providerNumber =
|
||||||
order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu;
|
serviceZipCodeCtu ??
|
||||||
|
order.serviceLocation?.provider?.providerNumber ??
|
||||||
|
order.serviceLocation?.zipCodeCtu;
|
||||||
if (providerNumber.startsWith("00") && providerNumber.length > 5) {
|
if (providerNumber.startsWith("00") && providerNumber.length > 5) {
|
||||||
providerNumber = providerNumber.substring(1);
|
providerNumber = providerNumber.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var endPoint = `${endpoints.GetMobileFeePart.url}/?serviceType=${serviceType}&facilityType=${facilityType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItacOptimized=${isItacOptimized}&zipCode=${zipCode}`;
|
var endPoint = `${endpoints.GetMobileFeePart.url}/?serviceType=${serviceType}&facilityType=${facilityType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItacOptimized=${isItacOptimized}&zipCode=${zipCode}`;
|
||||||
|
|
||||||
|
if (isMobileStaticRecalibrationApplicable) {
|
||||||
|
const staticRecalPartNumber = getStaticRecalPartNumber(order.lineItems?.glassParts[0]);
|
||||||
|
const carId = order.vehicle?.carId;
|
||||||
|
if (staticRecalPartNumber && carId) {
|
||||||
|
endPoint = `${endPoint}&partNumbers=${staticRecalPartNumber}&carId=${carId}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (coverageStatus) {
|
if (coverageStatus) {
|
||||||
endPoint = `${endPoint}&coverageStatus=${coverageStatus}`;
|
endPoint = `${endPoint}&coverageStatus=${coverageStatus}`;
|
||||||
}
|
}
|
||||||
|
|
@ -3666,3 +3681,13 @@ function getExternalParameterDefaultState() {
|
||||||
function saveExternalParameterState(externalParameterState) {
|
function saveExternalParameterState(externalParameterState) {
|
||||||
window.sessionStorage.setItem("externalParameterState", JSON.stringify(externalParameterState));
|
window.sessionStorage.setItem("externalParameterState", JSON.stringify(externalParameterState));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//This function checks if static recalibration is available for the vehicle and returns the part number for it.
|
||||||
|
function getStaticRecalPartNumber(glassPartsArray) {
|
||||||
|
const recalPart = glassPartsArray.childParts.find((item) => item.partNumber === "RECAL STATIC");
|
||||||
|
if (recalPart) {
|
||||||
|
return recalPart.partNumber;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue