Partial work
This commit is contained in:
parent
e1b36a1526
commit
cbb80a0cd5
1 changed files with 41 additions and 40 deletions
|
|
@ -2,16 +2,16 @@
|
||||||
/* eslint-disable no-use-before-define */
|
/* eslint-disable no-use-before-define */
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { endpoints } from '@/constants/endpoints';
|
import { endpoints } from '@/constants/endpoints.js';
|
||||||
// eslint-disable-next-line import/no-cycle
|
// eslint-disable-next-line import/no-cycle
|
||||||
import { getDateForSavedSessionTimeout } from '@/helpers/session-helper';
|
import { getDateForSavedSessionTimeout } from '@/helpers/session-helper.js';
|
||||||
// eslint-disable-next-line import/no-cycle
|
// eslint-disable-next-line import/no-cycle
|
||||||
import globalMethods from '@/global-methods';
|
import globalMethods from '@/global-methods.js';
|
||||||
import { experimentTriggers } from '@/constants/experiments';
|
import { experimentTriggers } from '@/constants/experiments.js';
|
||||||
import { applicationConfig } from '@/constants/application-config';
|
import { applicationConfig } from '@/constants/application-config.js';
|
||||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
import { issPageValues } from '@/router/router-constants/issPage-values.js';
|
||||||
import { damageLocationsSelected } from '@/constants/damage-locations-selected';
|
import { damageLocationsSelected } from '@/constants/damage-locations-selected.js';
|
||||||
import { coverageStatuses } from '@/constants/coverage-statuses';
|
import { coverageStatuses } from '@/constants/coverage-statuses.js';
|
||||||
|
|
||||||
const storeId = 'main';
|
const storeId = 'main';
|
||||||
|
|
||||||
|
|
@ -121,8 +121,7 @@ const getDefaultState = () =>
|
||||||
jobMaxMinutes: null
|
jobMaxMinutes: null
|
||||||
},
|
},
|
||||||
referralNumber: null,
|
referralNumber: null,
|
||||||
referralDate: null,
|
referralDate: null
|
||||||
eon: null // TODO add
|
|
||||||
},
|
},
|
||||||
applicationUser: {
|
applicationUser: {
|
||||||
experiments: [],
|
experiments: [],
|
||||||
|
|
@ -709,7 +708,7 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
saveSession() {
|
saveSession() {
|
||||||
// TODO use pieces of actual store
|
// TODO use pieces of actual store
|
||||||
const { vehicle, damage, order, applicationUser, lineItems } = this.order;
|
const { vehicle, damage, policy, order, applicationUser, lineItems } = this.order;
|
||||||
|
|
||||||
// TODO what does this method do
|
// TODO what does this method do
|
||||||
const newGlassToReplace = convertGlassPieceNamingForApi(damage.glassToReplace);
|
const newGlassToReplace = convertGlassPieceNamingForApi(damage.glassToReplace);
|
||||||
|
|
@ -717,8 +716,8 @@ export const useMainStore = defineStore({
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.SaveSession.method,
|
method: endpoints.SaveSession.method,
|
||||||
endpoint: endpoints.SaveSession.url,
|
endpoint: endpoints.SaveSession.url,
|
||||||
// TODO update with payload for our store
|
|
||||||
payload: {
|
payload: {
|
||||||
|
// done
|
||||||
applicationUser: {
|
applicationUser: {
|
||||||
crmCustomerId: applicationUser.crmCustomerId,
|
crmCustomerId: applicationUser.crmCustomerId,
|
||||||
experiments: applicationUser.experiments,
|
experiments: applicationUser.experiments,
|
||||||
|
|
@ -754,46 +753,48 @@ export const useMainStore = defineStore({
|
||||||
moldingQuestionAnswers: order.damage.moldingQuestionAnswers,
|
moldingQuestionAnswers: order.damage.moldingQuestionAnswers,
|
||||||
capabilityQuestionAnswers: order.damage.capabilityQuestionAnswers
|
capabilityQuestionAnswers: order.damage.capabilityQuestionAnswers
|
||||||
},
|
},
|
||||||
|
policy: {
|
||||||
|
policyNumber: policy.policyNumber,
|
||||||
|
policyZipCode: policy.policyZipCode,
|
||||||
|
dateOfLoss: policy.dateOfLoss,
|
||||||
|
damageCause: policy.damageCause,
|
||||||
|
damageState: policy.damageState,
|
||||||
|
damageCity: policy.damageCity,
|
||||||
|
isDamageGlassOnly: policy.isDamageGlassOnly,
|
||||||
|
noCoverage: policy.noCoverage
|
||||||
|
// deductible: {
|
||||||
|
// repair: policy.deductible.repair,
|
||||||
|
// replace: policy.deductible.replace
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
// NOTE using only customer info for now; ignoring contact details
|
||||||
customer: {
|
customer: {
|
||||||
emailAddress: order.contactInfo.emailAddress ?? order.customer.emailAddress,
|
emailAddress: order.customer.emailAddress,
|
||||||
firstName: order.contactInfo.firstName ?? order.customer.firstName,
|
firstName: order.customer.firstName,
|
||||||
lastName: order.contactInfo.lastName ?? order.customer.lastName,
|
lastName: order.customer.lastName,
|
||||||
phoneNumber: order.contactInfo.phoneNumber ?? order.customer.phoneNumber, // TODO contact info or customer?
|
phoneNumber: order.customer.phoneNumber,
|
||||||
optInSms: order.contactInfo.requestTextUpdates ?? false
|
optInSms: order.contactInfo.requestTextUpdates ?? false
|
||||||
},
|
},
|
||||||
lineItems: {
|
lineItems: {
|
||||||
glassParts: lineItems.glassParts,
|
glassParts: lineItems.glassParts,
|
||||||
|
otherData: lineItems.otherData,
|
||||||
supportingItems: lineItems.supportingItems,
|
supportingItems: lineItems.supportingItems,
|
||||||
vaps: lineItems.vaps,
|
vaps: lineItems.vaps
|
||||||
serverData: lineItems.serverData,
|
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
InsuranceCoverage: {
|
InsuranceCoverage: {
|
||||||
isVerified: order.payment.insuranceCoverage.isVerified ?? false,
|
isVerified: order.payment.insuranceCoverage.isVerified ?? false,
|
||||||
|
coverageStatus: order.payment.insuranceCoverage.coverageStatus
|
||||||
},
|
},
|
||||||
isInsurance: order.payment.isInsurance ?? false,
|
isInsurance: order.payment.isInsurance ?? true,
|
||||||
parentAccountNumber: order.payment.parentAccountNumber,
|
parentAccountNumber: order.payment.parentAccountNumber
|
||||||
},
|
},
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
streetAddress: order.serviceLocation.address,
|
streetAddress: order.serviceLocation.address,
|
||||||
streetAddress2: order.serviceLocation.address2,
|
|
||||||
city: order.serviceLocation.city,
|
city: order.serviceLocation.city,
|
||||||
state: order.serviceLocation.state,
|
state: order.serviceLocation.state,
|
||||||
zipCode: order.serviceLocation.zipCode,
|
zipCode: order.serviceLocation.zipCode,
|
||||||
zipCodeCtu: order.serviceLocation.zipCodeCtu,
|
zipCodeCtu: order.serviceLocation.zipCodeCtu
|
||||||
appointmentType: order.serviceLocation.appointmentType,
|
|
||||||
isVehicleProtected: order.serviceLocation.isVehicleProtected,
|
|
||||||
provider: {
|
|
||||||
providerNumber: order.serviceLocation.provider?.providerNumber,
|
|
||||||
address: {
|
|
||||||
streetAddress:
|
|
||||||
order.serviceLocation.provider?.address?.streetAddress,
|
|
||||||
city: order.serviceLocation.provider?.address?.city,
|
|
||||||
state: order.serviceLocation.provider?.address?.state,
|
|
||||||
zipCode: order.serviceLocation.provider?.address?.zipCode,
|
|
||||||
zipCodeCtu: order.serviceLocation.provider?.address?.zipCodeCtu,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
schedule: {
|
schedule: {
|
||||||
date: order.schedule?.date,
|
date: order.schedule?.date,
|
||||||
|
|
@ -802,14 +803,14 @@ export const useMainStore = defineStore({
|
||||||
routeCode: order.schedule?.routeCode,
|
routeCode: order.schedule?.routeCode,
|
||||||
jobMaxMinutes: order.schedule?.jobMaxMinutes,
|
jobMaxMinutes: order.schedule?.jobMaxMinutes,
|
||||||
},
|
},
|
||||||
existingPromoCode: null,
|
|
||||||
referralCorrelationId: order.referralCorrelationId,
|
|
||||||
referralDate: order.referralDate,
|
referralDate: order.referralDate,
|
||||||
referralNumber: order.referralNumber?.toString(), // TODO It'd be nice to save these as strings in the first place
|
referralNumber: order.referralNumber?.toString(),
|
||||||
referralSequenceNumber: order.referralNumber?.toString(), // TODO Pass the referralSequence number once insurance flow creates it
|
// TODO set
|
||||||
eon: order.eon
|
originalDeductible: 0,
|
||||||
|
currentDeductible: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// TODO maybe modify
|
||||||
additionalSuccessEventDataHandler: (response) =>
|
additionalSuccessEventDataHandler: (response) =>
|
||||||
`Email provided: ${order.customer.emailAddress ? 'true' : 'false'}`
|
`Email provided: ${order.customer.emailAddress ? 'true' : 'false'}`
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue