CSR-1953
GTM datalayer priceSubTotal and Price Total
This commit is contained in:
parent
4891888079
commit
f101a318ea
2 changed files with 43 additions and 28 deletions
|
|
@ -262,12 +262,23 @@ export default {
|
|||
isPricingAvailable &&
|
||||
combinedLineItems.every((lineItem) => isDefined(lineItem.salesTax));
|
||||
|
||||
//unverified (in scenarios we don’t display the price)
|
||||
if (
|
||||
order.payment.isInsurance &&
|
||||
isDefined(order.payment.insuranceCoverage.isVerified) &&
|
||||
!order.payment.insuranceCoverage.isVerified
|
||||
) {
|
||||
payload.priceSubTotal = null;
|
||||
payload.priceSubTotal = "";
|
||||
}
|
||||
//deductible (in scenarios we don’t display the price)
|
||||
else if (
|
||||
order.payment.isInsurance &&
|
||||
isDefined(order.payment.insuranceCoverage.isVerified) &&
|
||||
order.payment.insuranceCoverage.isVerified &&
|
||||
isDefined(order.policy.currentDeductible) &&
|
||||
order.policy.currentDeductible == 0
|
||||
) {
|
||||
payload.priceSubTotal = "";
|
||||
} else if (isPricingAvailable) {
|
||||
const subtotal = baseMixin.methods
|
||||
.getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, false)
|
||||
|
|
@ -277,12 +288,23 @@ export default {
|
|||
} else {
|
||||
payload.priceSubTotal = "";
|
||||
}
|
||||
//unverified (in scenarios we don’t display the price)
|
||||
if (
|
||||
order.payment.isInsurance &&
|
||||
isDefined(order.payment.insuranceCoverage.isVerified) &&
|
||||
!order.payment.insuranceCoverage.isVerified
|
||||
) {
|
||||
payload.priceTotal = null;
|
||||
payload.priceTotal = "";
|
||||
}
|
||||
//deductible (in scenarios we don’t display the price)
|
||||
else if (
|
||||
order.payment.isInsurance &&
|
||||
isDefined(order.payment.insuranceCoverage.isVerified) &&
|
||||
order.payment.insuranceCoverage.isVerified &&
|
||||
isDefined(order.policy.currentDeductible) &&
|
||||
order.policy.currentDeductible == 0
|
||||
) {
|
||||
payload.priceTotal = "";
|
||||
} else if (isTaxAvailable) {
|
||||
const total = baseMixin.methods
|
||||
.getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, true)
|
||||
|
|
@ -310,26 +332,26 @@ export default {
|
|||
if (order.payment.isInsurance) {
|
||||
payload.isInsuranceVerified = order.payment.insuranceCoverage.isVerified;
|
||||
if (!order.payment.insuranceCoverage.isVerified) {
|
||||
payload.isInsuranceItac = null;
|
||||
payload.isInsuranceNoComp = null;
|
||||
payload.isInsuranceItac = "";
|
||||
payload.isInsuranceNoComp = "";
|
||||
} else {
|
||||
payload.isInsuranceItac = order.policy.isItac || null;
|
||||
payload.isInsuranceNoComp = order.policy.isNoComp || null;
|
||||
payload.isInsuranceItac = order.policy.isItac || "";
|
||||
payload.isInsuranceNoComp = order.policy.isNoComp || "";
|
||||
}
|
||||
if (
|
||||
order.policy.isItac ||
|
||||
order.policy.isNoComp ||
|
||||
!order.payment.insuranceCoverage.isVerified
|
||||
) {
|
||||
payload.insuranceDeductible = null;
|
||||
payload.insuranceDeductible = "";
|
||||
} else {
|
||||
payload.insuranceDeductible = order.policy.currentDeductible || null;
|
||||
payload.insuranceDeductible = order.policy.currentDeductible || "";
|
||||
}
|
||||
} else {
|
||||
payload.isInsuranceVerified = null;
|
||||
payload.insuranceDeductible = null;
|
||||
payload.isInsuranceItac = null;
|
||||
payload.isInsuranceNoComp = null;
|
||||
payload.isInsuranceVerified = "";
|
||||
payload.insuranceDeductible = "";
|
||||
payload.isInsuranceItac = "";
|
||||
payload.isInsuranceNoComp = "";
|
||||
}
|
||||
|
||||
pushToDataLayerIfDefined(payload);
|
||||
|
|
|
|||
|
|
@ -458,10 +458,10 @@ describe("analyticsMixin.js", () => {
|
|||
result[key] === false ||
|
||||
!!result[key] ||
|
||||
(result["accountType"] === "cash"
|
||||
? result["isInsuranceVerified"] === null &&
|
||||
result["insuranceDeductible"] === null &&
|
||||
result["isInsuranceItac"] === null &&
|
||||
result["isInsuranceNoComp"] === null
|
||||
? result["isInsuranceVerified"] === "" &&
|
||||
result["insuranceDeductible"] === "" &&
|
||||
result["isInsuranceItac"] === "" &&
|
||||
result["isInsuranceNoComp"] === ""
|
||||
: false)
|
||||
);
|
||||
expect(allFieldsPopulated).toBe(true);
|
||||
|
|
@ -555,10 +555,10 @@ describe("analyticsMixin.js", () => {
|
|||
result[key] === false ||
|
||||
!!result[key] ||
|
||||
(result["accountType"] === "cash"
|
||||
? result["isInsuranceVerified"] === null &&
|
||||
result["insuranceDeductible"] === null &&
|
||||
result["isInsuranceItac"] === null &&
|
||||
result["isInsuranceNoComp"] === null
|
||||
? result["isInsuranceVerified"] === "" &&
|
||||
result["insuranceDeductible"] === "" &&
|
||||
result["isInsuranceItac"] === "" &&
|
||||
result["isInsuranceNoComp"] === ""
|
||||
: false)
|
||||
);
|
||||
expect(allFieldsPopulated).toBe(true);
|
||||
|
|
@ -646,14 +646,7 @@ describe("analyticsMixin.js", () => {
|
|||
// Assert
|
||||
console.log(result);
|
||||
const allFieldsPopulatedOrDefault = Object.keys(result).every(
|
||||
(key) =>
|
||||
result[key] === false ||
|
||||
!!result[key] ||
|
||||
result[key] === "" ||
|
||||
(result["isInsuranceVerified"] === null &&
|
||||
result["insuranceDeductible"] === null &&
|
||||
result["isInsuranceItac"] === null &&
|
||||
result["isInsuranceNoComp"] === null)
|
||||
(key) => result[key] === false || !!result[key] || result[key] === ""
|
||||
);
|
||||
expect(allFieldsPopulatedOrDefault).toBe(true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue