Merge pull request #1823 from Safelite/feature/Digital/CSR-1953

CSR-1953
This commit is contained in:
hiteshkumar87 2024-04-12 16:11:52 +05:30 committed by GitHub
commit e88e17cd80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 67 additions and 8 deletions

View file

@ -262,7 +262,13 @@ export default {
isPricingAvailable &&
combinedLineItems.every((lineItem) => isDefined(lineItem.salesTax));
if (isPricingAvailable) {
if (
order.payment.isInsurance &&
isDefined(order.payment.insuranceCoverage.isVerified) &&
!order.payment.insuranceCoverage.isVerified
) {
payload.priceSubTotal = null;
} else if (isPricingAvailable) {
const subtotal = baseMixin.methods
.getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, false)
.toFixed(2);
@ -271,8 +277,13 @@ export default {
} else {
payload.priceSubTotal = "";
}
if (isTaxAvailable) {
if (
order.payment.isInsurance &&
isDefined(order.payment.insuranceCoverage.isVerified) &&
!order.payment.insuranceCoverage.isVerified
) {
payload.priceTotal = null;
} else if (isTaxAvailable) {
const total = baseMixin.methods
.getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, true)
.toFixed(2);
@ -295,6 +306,31 @@ export default {
} else {
payload.appointmentType = "";
}
//Insurance
if (order.payment.isInsurance) {
payload.isInsuranceVerified = order.payment.insuranceCoverage.isVerified;
if (!order.payment.insuranceCoverage.isVerified) {
payload.isInsuranceItac = null;
payload.isInsuranceNoComp = null;
} else {
payload.isInsuranceItac = order.policy.isItac || null;
payload.isInsuranceNoComp = order.policy.isNoComp || null;
}
if (
order.policy.isItac ||
order.policy.isNoComp ||
!order.payment.insuranceCoverage.isVerified
) {
payload.insuranceDeductible = null;
} else {
payload.insuranceDeductible = order.policy.currentDeductible || null;
}
} else {
payload.isInsuranceVerified = null;
payload.insuranceDeductible = null;
payload.isInsuranceItac = null;
payload.isInsuranceNoComp = null;
}
pushToDataLayerIfDefined(payload);
},

View file

@ -454,7 +454,15 @@ describe("analyticsMixin.js", () => {
// Assert
console.log(result);
const allFieldsPopulated = Object.keys(result).every(
(key) => result[key] === false || !!result[key]
(key) =>
result[key] === false ||
!!result[key] ||
(result["accountType"] === "cash"
? result["isInsuranceVerified"] === null &&
result["insuranceDeductible"] === null &&
result["isInsuranceItac"] === null &&
result["isInsuranceNoComp"] === null
: false)
);
expect(allFieldsPopulated).toBe(true);
});
@ -543,7 +551,15 @@ describe("analyticsMixin.js", () => {
// Assert
console.log(result);
const allFieldsPopulated = Object.keys(result).every(
(key) => result[key] === false || !!result[key]
(key) =>
result[key] === false ||
!!result[key] ||
(result["accountType"] === "cash"
? result["isInsuranceVerified"] === null &&
result["insuranceDeductible"] === null &&
result["isInsuranceItac"] === null &&
result["isInsuranceNoComp"] === null
: false)
);
expect(allFieldsPopulated).toBe(true);
});
@ -630,7 +646,14 @@ describe("analyticsMixin.js", () => {
// Assert
console.log(result);
const allFieldsPopulatedOrDefault = Object.keys(result).every(
(key) => result[key] === false || !!result[key] || result[key] === ""
(key) =>
result[key] === false ||
!!result[key] ||
result[key] === "" ||
(result["isInsuranceVerified"] === null &&
result["insuranceDeductible"] === null &&
result["isInsuranceItac"] === null &&
result["isInsuranceNoComp"] === null)
);
expect(allFieldsPopulatedOrDefault).toBe(true);
});

View file

@ -10,7 +10,7 @@ $blue-200: #c1dfee;
$blue-300: #9fcee6;
$blue-400: #69adcf; // Used in theme
$blue-500: #3b8fb8;
$blue: #0070D1; // Default Blue
$blue: #0070d1; // Default Blue
$blue-700: #06577c;
$blue-800: #003d58;
$blue-900: #002433; // Used in theme
@ -20,7 +20,7 @@ $red-100: #ffe6e4;
$red-200: #fcbfbb;
$red-300: #f89892;
$red-400: #e65c53;
$red: #DB0020; // Default Red
$red: #db0020; // Default Red
$red-600: #ac160b;
$red-700: #840900;
$red-800: #5b0600;