Updates on some of the logic.
This commit is contained in:
parent
0a631a6dc4
commit
4ddd961d18
1 changed files with 31 additions and 56 deletions
|
|
@ -178,12 +178,8 @@ export default {
|
||||||
payload.damageType = "";
|
payload.damageType = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Account Type
|
// Account Type - always insurance for ISS
|
||||||
if (isDefined(order.payment.isInsurance)) {
|
payload.accountType = "insurance";
|
||||||
payload.accountType = order.payment.isInsurance ? "insurance" : "cash";
|
|
||||||
} else {
|
|
||||||
payload.accountType = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Promo Codes
|
// Promo Codes
|
||||||
const promos = order.lineItems.promos ?? [];
|
const promos = order.lineItems.promos ?? [];
|
||||||
|
|
@ -289,23 +285,16 @@ export default {
|
||||||
combinedLineItems.every((lineItem) => isDefined(lineItem.salesTax));
|
combinedLineItems.every((lineItem) => isDefined(lineItem.salesTax));
|
||||||
|
|
||||||
//unverified (in scenarios we don’t display the price)
|
//unverified (in scenarios we don’t display the price)
|
||||||
if (
|
if (!store.isVerified) {
|
||||||
order.payment.isInsurance &&
|
|
||||||
isDefined(order.payment.insuranceCoverage.isVerified) &&
|
|
||||||
!order.payment.insuranceCoverage.isVerified
|
|
||||||
) {
|
|
||||||
payload.priceSubTotal = "";
|
payload.priceSubTotal = "";
|
||||||
}
|
}
|
||||||
//deductible (in scenarios we don’t display the price)
|
//deductible (in scenarios we don’t display the price)
|
||||||
// TODO: Need to redo this for ISS 2.0
|
// TODO: Need to redo this for ISS 2.0
|
||||||
else if (
|
else if (
|
||||||
order.payment.isInsurance &&
|
store.isVerified &&
|
||||||
isDefined(order.payment.insuranceCoverage.isVerified) &&
|
store.currentDeductible >= 0 &&
|
||||||
order.payment.insuranceCoverage.isVerified &&
|
!store.isItac &&
|
||||||
isDefined(order.policy.currentDeductible) &&
|
!store.isNoComp
|
||||||
order.policy.currentDeductible >= 0 &&
|
|
||||||
!order.policy.isItac &&
|
|
||||||
!order.policy.isNoComp
|
|
||||||
) {
|
) {
|
||||||
payload.priceSubTotal = "";
|
payload.priceSubTotal = "";
|
||||||
} else if (isPricingAvailable) {
|
} else if (isPricingAvailable) {
|
||||||
|
|
@ -317,25 +306,18 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cash Quote or Cash Price Sub Total
|
// Cash Quote or Cash Price Sub Total
|
||||||
payload.cashPriceSubTotal = order?.cashPriceSubTotal ?? "";
|
payload.cashPriceSubTotal = getSubtotal(order).toString();
|
||||||
|
|
||||||
//unverified (in scenarios we don’t display the price)
|
//unverified (in scenarios we don’t display the price)
|
||||||
if (
|
if (!store.isVerified) {
|
||||||
order.payment.isInsurance &&
|
|
||||||
isDefined(order.payment.insuranceCoverage.isVerified) &&
|
|
||||||
!order.payment.insuranceCoverage.isVerified
|
|
||||||
) {
|
|
||||||
payload.priceTotal = "";
|
payload.priceTotal = "";
|
||||||
}
|
}
|
||||||
//deductible (in scenarios we don’t display the price)
|
//deductible (in scenarios we don’t display the price)
|
||||||
else if (
|
else if (
|
||||||
order.payment.isInsurance &&
|
store.isVerified &&
|
||||||
isDefined(order.payment.insuranceCoverage.isVerified) &&
|
store.currentDeductible >= 0 &&
|
||||||
order.payment.insuranceCoverage.isVerified &&
|
!store.isItac &&
|
||||||
isDefined(order.policy.currentDeductible) &&
|
!store.isNoComp
|
||||||
order.policy.currentDeductible >= 0 &&
|
|
||||||
!order.policy.isItac &&
|
|
||||||
!order.policy.isNoComp
|
|
||||||
) {
|
) {
|
||||||
payload.priceTotal = "";
|
payload.priceTotal = "";
|
||||||
} else if (isTaxAvailable) {
|
} else if (isTaxAvailable) {
|
||||||
|
|
@ -351,7 +333,7 @@ export default {
|
||||||
if (hasSubmittedOrder) {
|
if (hasSubmittedOrder) {
|
||||||
payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnSubmittedState;
|
payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnSubmittedState;
|
||||||
} else {
|
} else {
|
||||||
payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnOrder;
|
payload.isRecalibrationOnOrder = store.hasRecalibrationPart && containsRecalParts(order.lineItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appointment Type
|
// Appointment Type
|
||||||
|
|
@ -360,33 +342,26 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
payload.appointmentType = "";
|
payload.appointmentType = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Insurance
|
//Insurance
|
||||||
// TODO: Find equivalent ISS methods.
|
// TODO: Find equivalent ISS methods. Using store atm need to run off order object.
|
||||||
if (order.payment.isInsurance) {
|
payload.isInsuranceVerified = store.isVerified;
|
||||||
payload.isInsuranceVerified = order.payment.insuranceCoverage.isVerified ?? "";
|
payload.insuranceCompanyName = store.issConfig.clientName ?? "";
|
||||||
payload.insuranceCompanyName = order.policy.insuranceCompanyName ?? "";
|
if (!store.isVerified) {
|
||||||
if (!order.payment.insuranceCoverage.isVerified) {
|
|
||||||
payload.isInsuranceItac = "";
|
|
||||||
payload.isInsuranceNoComp = "";
|
|
||||||
} else {
|
|
||||||
payload.isInsuranceItac = order.policy.isItac ?? "";
|
|
||||||
payload.isInsuranceNoComp = order.policy.isNoComp ?? "";
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
order.policy.isItac ||
|
|
||||||
order.policy.isNoComp ||
|
|
||||||
!order.payment.insuranceCoverage.isVerified
|
|
||||||
) {
|
|
||||||
payload.insuranceDeductible = "";
|
|
||||||
} else {
|
|
||||||
payload.insuranceDeductible = order.policy.currentDeductible ?? "";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
payload.isInsuranceVerified = "";
|
|
||||||
payload.insuranceDeductible = "";
|
|
||||||
payload.isInsuranceItac = "";
|
payload.isInsuranceItac = "";
|
||||||
payload.isInsuranceNoComp = "";
|
payload.isInsuranceNoComp = "";
|
||||||
payload.insuranceCompanyName = "";
|
} else {
|
||||||
|
payload.isInsuranceItac = store.isItac ?? "";
|
||||||
|
payload.isInsuranceNoComp = store.isNoComp ?? "";
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
store.isItac ||
|
||||||
|
store.isNoComp ||
|
||||||
|
!store.isVerified
|
||||||
|
) {
|
||||||
|
payload.insuranceDeductible = "";
|
||||||
|
} else {
|
||||||
|
payload.insuranceDeductible = store.currentDeductible ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
pushToDataLayerIfDefined(payload);
|
pushToDataLayerIfDefined(payload);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue