First pass
This commit is contained in:
parent
11e81b215a
commit
b16fe6656e
4 changed files with 278 additions and 171 deletions
7
src/constants/coverage-statuses.js
Normal file
7
src/constants/coverage-statuses.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
const coverageStatuses = {
|
||||
PENDING: "Pending",
|
||||
NO_COMP: "No Comp",
|
||||
VERIFIED: "Verified",
|
||||
};
|
||||
|
||||
export { coverageStatuses };
|
||||
|
|
@ -58,6 +58,7 @@ import { settleAllPromises } from '@/helpers/layout-helper';
|
|||
import { getDamageString } from '@/helpers/damage-helper.js';
|
||||
import { useMainStore } from "@/store";
|
||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||
import { coverageStatuses } from '../../constants/coverage-statuses';
|
||||
|
||||
export default {
|
||||
name: 'coverage-statement',
|
||||
|
|
@ -76,11 +77,11 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
bodyText() {
|
||||
if (useMainStore().order.damage.isRepair) {
|
||||
if (useMainStore().damage.isRepair) {
|
||||
return this.unverifiedNonADASRepairBodyText;
|
||||
}
|
||||
else {
|
||||
let parts = useMainStore().order.lineItems.glassParts;
|
||||
let parts = useMainStore().lineItems.glassParts;
|
||||
|
||||
// if ADAS, display ADASNextSteps
|
||||
if (parts.filter(part => part.requiresRecalibration).length > 0) {
|
||||
|
|
@ -124,16 +125,65 @@ export default {
|
|||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
});
|
||||
},
|
||||
async mounted() {
|
||||
let registerClaimResponse = null;
|
||||
if (useMainStore().isClaimRegistrationRequired){
|
||||
registerClaimResponse = await this.getRegisterClaimResponse();
|
||||
}
|
||||
this.setInsuranceCoverageValues(registerClaimResponse);
|
||||
},
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
if (useMainStore().order.vehicle.vin) {
|
||||
if (useMainStore().vehicle.vin) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
async getRegisterClaimResponse() {
|
||||
try {
|
||||
registerClaimResponse = await useMainStore().registerClaim();
|
||||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: 'registerClaimResponse',
|
||||
promise: registerClaimResponse
|
||||
},
|
||||
];
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
return resultMap.registerClaimResponse;
|
||||
}
|
||||
catch(responseError) {
|
||||
return {
|
||||
error: {
|
||||
status: responseError.status
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// TODO wait for confirmation from Jeremy
|
||||
setInsuranceCoverageValues(registerClaimResponse) {
|
||||
// null => claim reg not required
|
||||
// success => verified
|
||||
// failed => not verified
|
||||
|
||||
const registerClaimFailed = registerClaimResponse.error;
|
||||
if (useMainStore().isClaimRegistrationRequired) {
|
||||
useMainStore().payment.insuranceCoverage.isVerified = !registerClaimFailed;
|
||||
useMainStore().payment.insuranceCoverage.coverageStatus = registerClaimFailed
|
||||
? coverageStatuses.PENDING
|
||||
: coverageStatuses.VERIFIED; // TODO include no comp case as well
|
||||
}
|
||||
else { // TODO confirm
|
||||
useMainStore().payment.insuranceCoverage.isVerified = true;
|
||||
// What about no comp???
|
||||
useMainStore().payment.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED;
|
||||
}
|
||||
},
|
||||
|
||||
async forwardButtonAction() {
|
||||
return this.navigateForward();
|
||||
|
|
|
|||
|
|
@ -315,170 +315,170 @@ export default {
|
|||
this.selectedGlassToReplace(),
|
||||
this.selectedWindshieldOptions.selectedWindshieldChipCount);
|
||||
return this.navigateForward();
|
||||
},
|
||||
},
|
||||
|
||||
navigateForward() {
|
||||
if (this.mainStore.damage.isRepair) {
|
||||
navigateForward() {
|
||||
if (this.mainStore.damage.isRepair) {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_REPAIR,
|
||||
this.$route
|
||||
);
|
||||
}
|
||||
else {
|
||||
// If vin already exists, navigate directly to vin-lookup
|
||||
if (this.mainStore.order.vehicle.vin) {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_REPAIR,
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_VIN,
|
||||
this.$route
|
||||
);
|
||||
} else {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
||||
this.$route
|
||||
);
|
||||
}
|
||||
else {
|
||||
// If vin already exists, navigate directly to vin-lookup
|
||||
if (this.mainStore.order.vehicle.vin) {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_VIN,
|
||||
this.$route
|
||||
);
|
||||
} else {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
||||
this.$route
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
selectedGlassToReplace() {
|
||||
const selectedGlassToReplace = [];
|
||||
if (this.isWindshieldDamageLocation && !this.isWindshieldRepair) {
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach(
|
||||
(wsItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.WINDSHIELD,
|
||||
glassName: wsItem,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (this.isDriverSideReplace) {
|
||||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.forEach((driverItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.DRIVER,
|
||||
glassName: driverItem,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (this.isPassengerSideReplace) {
|
||||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.forEach(
|
||||
(passengerItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.PASSENGER,
|
||||
glassName: passengerItem,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (this.isRearWindowDamageLocation) {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.REAR,
|
||||
glassName: this.selectedRearReplaceOptions,
|
||||
});
|
||||
}
|
||||
|
||||
return selectedGlassToReplace;
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
isWindshieldDamageLocation() {
|
||||
return this.selectedDamageLocations.some((selectedDamages) => {
|
||||
return selectedDamages.toUpperCase() === damageLocationsCms.WINDSHIELD;
|
||||
});
|
||||
},
|
||||
isSideDoorDamageLocation() {
|
||||
return this.selectedDamageLocations.some((selectedDamages) => {
|
||||
return selectedDamages.toUpperCase() === damageLocationsCms.SIDEDOOR;
|
||||
});
|
||||
},
|
||||
isRearWindowDamageLocation() {
|
||||
return this.selectedDamageLocations.some((selectedDamages) => {
|
||||
return selectedDamages.toUpperCase() === damageLocationsCms.REARWINDOW;
|
||||
});
|
||||
},
|
||||
isWindshieldRepair() {
|
||||
return (
|
||||
this.isWindshieldDamageLocation &&
|
||||
this.selectedWindshieldOptions.selectedWindshieldDamageType ===
|
||||
damageLocationsSelected.REPAIR
|
||||
);
|
||||
},
|
||||
isDriverSideReplace() {
|
||||
if (!this.isSideDoorDamageLocation) return false;
|
||||
|
||||
return this.sideDoorOptionsData.selectedDoorSides.some((selectedDriverSide) => {
|
||||
return selectedDriverSide.toUpperCase() === damageLocationsCms.DRIVERSIDE;
|
||||
});
|
||||
},
|
||||
isPassengerSideReplace() {
|
||||
if (!this.isSideDoorDamageLocation) return false;
|
||||
|
||||
return this.sideDoorOptionsData.selectedDoorSides.some((selectedPassengerSide) => {
|
||||
return selectedPassengerSide.toUpperCase() === damageLocationsCms.PASSENGERSIDE;
|
||||
});
|
||||
},
|
||||
hasRepairReplaceConflict() {
|
||||
return (
|
||||
this.isWindshieldDamageLocation &&
|
||||
this.selectedDamageLocations.length > 1 &&
|
||||
this.isWindshieldRepair
|
||||
);
|
||||
},
|
||||
hasSplitSingleConflict() {
|
||||
if (
|
||||
!this.selectedDamageLocations?.includes("Windshield") ||
|
||||
this.selectedWindshieldOptions.selectedWindshieldDamageType ===
|
||||
damageLocationsSelected.REPAIR ||
|
||||
!this.selectedWindshieldOptions.selectedWindshieldReplaceOptions
|
||||
)
|
||||
return false;
|
||||
|
||||
return (
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
||||
(selectedSingleWindshield) => {
|
||||
return (
|
||||
selectedSingleWindshield.toUpperCase() ===
|
||||
damageLocationsSelected.SINGLE.toUpperCase()
|
||||
);
|
||||
}
|
||||
) &&
|
||||
(this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
||||
(selectedDriverWindshield) => {
|
||||
return (
|
||||
selectedDriverWindshield.toUpperCase() ===
|
||||
damageLocationsSelected.DRIVER.toUpperCase()
|
||||
);
|
||||
}
|
||||
) ||
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
||||
(selectedPassengerWindshield) => {
|
||||
return (
|
||||
selectedPassengerWindshield.toUpperCase() ===
|
||||
damageLocationsSelected.PASSENGER.toUpperCase()
|
||||
);
|
||||
}
|
||||
))
|
||||
);
|
||||
},
|
||||
shouldDisplayVehicleChangeAlert() {
|
||||
return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT];
|
||||
}
|
||||
},
|
||||
|
||||
components: {
|
||||
siteHeader,
|
||||
siteFooter,
|
||||
vehicleBanner,
|
||||
siteSubHeader,
|
||||
sideDoorOptions,
|
||||
damageLocationQuestion,
|
||||
windshieldOptions,
|
||||
replaceOptionsQuestion,
|
||||
Form,
|
||||
alert,
|
||||
selectedGlassToReplace() {
|
||||
const selectedGlassToReplace = [];
|
||||
if (this.isWindshieldDamageLocation && !this.isWindshieldRepair) {
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach(
|
||||
(wsItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.WINDSHIELD,
|
||||
glassName: wsItem,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (this.isDriverSideReplace) {
|
||||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.forEach((driverItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.DRIVER,
|
||||
glassName: driverItem,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (this.isPassengerSideReplace) {
|
||||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.forEach(
|
||||
(passengerItem) => {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.PASSENGER,
|
||||
glassName: passengerItem,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (this.isRearWindowDamageLocation) {
|
||||
selectedGlassToReplace.push({
|
||||
glassLocation: damageLocationsSelected.REAR,
|
||||
glassName: this.selectedRearReplaceOptions,
|
||||
});
|
||||
}
|
||||
|
||||
return selectedGlassToReplace;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
},
|
||||
computed: {
|
||||
isWindshieldDamageLocation() {
|
||||
return this.selectedDamageLocations.some((selectedDamages) => {
|
||||
return selectedDamages.toUpperCase() === damageLocationsCms.WINDSHIELD;
|
||||
});
|
||||
},
|
||||
isSideDoorDamageLocation() {
|
||||
return this.selectedDamageLocations.some((selectedDamages) => {
|
||||
return selectedDamages.toUpperCase() === damageLocationsCms.SIDEDOOR;
|
||||
});
|
||||
},
|
||||
isRearWindowDamageLocation() {
|
||||
return this.selectedDamageLocations.some((selectedDamages) => {
|
||||
return selectedDamages.toUpperCase() === damageLocationsCms.REARWINDOW;
|
||||
});
|
||||
},
|
||||
isWindshieldRepair() {
|
||||
return (
|
||||
this.isWindshieldDamageLocation &&
|
||||
this.selectedWindshieldOptions.selectedWindshieldDamageType ===
|
||||
damageLocationsSelected.REPAIR
|
||||
);
|
||||
},
|
||||
isDriverSideReplace() {
|
||||
if (!this.isSideDoorDamageLocation) return false;
|
||||
|
||||
return this.sideDoorOptionsData.selectedDoorSides.some((selectedDriverSide) => {
|
||||
return selectedDriverSide.toUpperCase() === damageLocationsCms.DRIVERSIDE;
|
||||
});
|
||||
},
|
||||
isPassengerSideReplace() {
|
||||
if (!this.isSideDoorDamageLocation) return false;
|
||||
|
||||
return this.sideDoorOptionsData.selectedDoorSides.some((selectedPassengerSide) => {
|
||||
return selectedPassengerSide.toUpperCase() === damageLocationsCms.PASSENGERSIDE;
|
||||
});
|
||||
},
|
||||
hasRepairReplaceConflict() {
|
||||
return (
|
||||
this.isWindshieldDamageLocation &&
|
||||
this.selectedDamageLocations.length > 1 &&
|
||||
this.isWindshieldRepair
|
||||
);
|
||||
},
|
||||
hasSplitSingleConflict() {
|
||||
if (
|
||||
!this.selectedDamageLocations?.includes("Windshield") ||
|
||||
this.selectedWindshieldOptions.selectedWindshieldDamageType ===
|
||||
damageLocationsSelected.REPAIR ||
|
||||
!this.selectedWindshieldOptions.selectedWindshieldReplaceOptions
|
||||
)
|
||||
return false;
|
||||
|
||||
return (
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
||||
(selectedSingleWindshield) => {
|
||||
return (
|
||||
selectedSingleWindshield.toUpperCase() ===
|
||||
damageLocationsSelected.SINGLE.toUpperCase()
|
||||
);
|
||||
}
|
||||
) &&
|
||||
(this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
||||
(selectedDriverWindshield) => {
|
||||
return (
|
||||
selectedDriverWindshield.toUpperCase() ===
|
||||
damageLocationsSelected.DRIVER.toUpperCase()
|
||||
);
|
||||
}
|
||||
) ||
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions?.some(
|
||||
(selectedPassengerWindshield) => {
|
||||
return (
|
||||
selectedPassengerWindshield.toUpperCase() ===
|
||||
damageLocationsSelected.PASSENGER.toUpperCase()
|
||||
);
|
||||
}
|
||||
))
|
||||
);
|
||||
},
|
||||
shouldDisplayVehicleChangeAlert() {
|
||||
return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT];
|
||||
}
|
||||
},
|
||||
|
||||
components: {
|
||||
siteHeader,
|
||||
siteFooter,
|
||||
vehicleBanner,
|
||||
siteSubHeader,
|
||||
sideDoorOptions,
|
||||
damageLocationQuestion,
|
||||
windshieldOptions,
|
||||
replaceOptionsQuestion,
|
||||
Form,
|
||||
alert,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { experimentTriggers } from '@/constants/experiments';
|
|||
import { applicationConfig } from '@/constants/application-config';
|
||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||
import { damageLocationsSelected } from '@/constants/damage-locations-selected';
|
||||
import { coverageStatuses } from '@/constants/coverage-statuses';
|
||||
|
||||
const storeId = 'main';
|
||||
|
||||
|
|
@ -48,7 +49,12 @@ const getDefaultState = () => {
|
|||
damageCause: null,
|
||||
damageState: null,
|
||||
damageCity: null,
|
||||
isDamageGlassOnly: null
|
||||
isDamageGlassOnly: null,
|
||||
// TODO set these in code
|
||||
deductable: {
|
||||
repair: null, // numerical value; how much customer owes on deductable in repair case
|
||||
replace: null // numerical value; how much customer owes on deductible in replace case
|
||||
}
|
||||
},
|
||||
customer: {
|
||||
address: {
|
||||
|
|
@ -79,7 +85,8 @@ const getDefaultState = () => {
|
|||
payment: {
|
||||
isInsurance: true,
|
||||
insuranceCoverage: {
|
||||
isVerified: false
|
||||
isVerified: false,
|
||||
coverageStatus: coverageStatuses.PENDING
|
||||
}
|
||||
},
|
||||
referralNumber: null,
|
||||
|
|
@ -125,7 +132,9 @@ export const useMainStore = defineStore({
|
|||
vehicle: (state) => state.order.vehicle,
|
||||
damage: (state) => state.order.damage,
|
||||
lineItems: (state) => state.order.lineItems,
|
||||
payment: (state) => state.order.payment,
|
||||
hasAnyNonWindshieldGlassParts: (state) => !state.order.policy.isDamageGlassOnly,
|
||||
isClaimRegistrationRequired: (state) => state.issConfig.isClaimRegistrationRequired,
|
||||
eventBusItem: (state) => ( eventCategory, eventSubCategory) => {
|
||||
|
||||
const matchedEvent = state.applicationUser.eventBus.find(
|
||||
|
|
@ -327,7 +336,7 @@ export const useMainStore = defineStore({
|
|||
}
|
||||
},
|
||||
getCoveragePolicyInfo({accountNumber, policyNumber, dateOfLoss, zipCode}){
|
||||
//todo: replace place holder correlationId with the real thing
|
||||
//TODO: replace place holder correlationId with the real thing
|
||||
const placeHolderCorrelationId = "00000000-0000-0000-0000-000000000000";
|
||||
try{
|
||||
const response = globalMethods.callHttpClient({
|
||||
|
|
@ -350,17 +359,58 @@ export const useMainStore = defineStore({
|
|||
};
|
||||
}
|
||||
},
|
||||
// TODO determine what inputs are required to get a response
|
||||
registerClaim() {
|
||||
try {
|
||||
// TODO: replace place holder correlationId with the real thing
|
||||
const placeHolderCorrelationId = "00000000-0000-0000-0000-000000000000";
|
||||
const response = globalMethods.callHttpClient({
|
||||
method: endpoints.RegisterClaim.method,
|
||||
endpoint: endpoints.RegisterClaim.url,
|
||||
payload: {
|
||||
// accountNumber: accountNumber,
|
||||
// policyNumber: policyNumber,
|
||||
// dateOfLoss: dateOfLoss,
|
||||
// zipCode: zipCode
|
||||
payload:
|
||||
{
|
||||
correlationId: placeHolderCorrelationId,
|
||||
accountNumber: this.issConfig.accountNumber.toString(),
|
||||
insured: {
|
||||
firstName: this.order.customer.firstName,
|
||||
lastName: this.order.customer.lastName,
|
||||
address: {
|
||||
addressLine1: this.order.customer.address.streetAddress,
|
||||
addressLine2: this.order.customer.address.streetAddress2,
|
||||
city: this.order.customer.address.city,
|
||||
state: this.order.customer.address.state,
|
||||
zipCode: this.order.customer.address.zipCode,
|
||||
country: "US" // TODO set from store
|
||||
},
|
||||
homePhone: {
|
||||
number: this.order.customer.phoneNumber
|
||||
}
|
||||
},
|
||||
caller: {
|
||||
homePhone: {}
|
||||
},
|
||||
policyInfo: {
|
||||
policyNumber: this.order.policy.policyNumber,
|
||||
safelitePolicy: {
|
||||
policies: []
|
||||
}
|
||||
},
|
||||
lossInfo: {
|
||||
dateOfLoss: this.order.policy.dateOfLoss,
|
||||
// TODO set from store or assume based on user info?
|
||||
location: {
|
||||
city: "Somersworth",
|
||||
state: "NH",
|
||||
country: "US"
|
||||
},
|
||||
vehicle: {
|
||||
year: this.order.vehicle.year.toString(),
|
||||
make: this.order.vehicle.make,
|
||||
model: this.order.vehicle.model,
|
||||
vin: this.order.vehicle.vin
|
||||
},
|
||||
},
|
||||
// TODO is damage cause sufficient?
|
||||
damageDescription: this.order.policy.damageCause
|
||||
}
|
||||
});
|
||||
return response;
|
||||
|
|
|
|||
Loading…
Reference in a new issue