Merge pull request #1876 from Safelite/feature/csr-2108
Feature/csr 2108
This commit is contained in:
commit
a4da02f6cc
2 changed files with 78 additions and 8 deletions
|
|
@ -158,12 +158,17 @@ export default {
|
||||||
includeTax
|
includeTax
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const order = store.getters.hasSubmittedOrder
|
||||||
|
? store.getters.submittedOrder
|
||||||
|
: store.getters.order;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
store.getters.payment.insuranceCoverage.isVerified &&
|
order.payment.insuranceCoverage.isVerified &&
|
||||||
!store.getters.policy.isNoComp &&
|
!order.policy.isNoComp &&
|
||||||
!store.getters.policy.isItac
|
!order.policy.isItac
|
||||||
) {
|
) {
|
||||||
amountDue += store.getters.policy.currentDeductible;
|
amountDue += order.policy.currentDeductible;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((amountDue * 100) / 100).toFixed(2);
|
return ((amountDue * 100) / 100).toFixed(2);
|
||||||
|
|
|
||||||
|
|
@ -175,9 +175,66 @@ describe("baseMixin.js", () => {
|
||||||
promos: [],
|
promos: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const payment = { insuranceCoverage: { isVerified: true } };
|
||||||
|
const policy = { isNoComp: false, isItac: false, currentDeductible: 250 };
|
||||||
|
|
||||||
store.getters = {
|
store.getters = {
|
||||||
payment: { insuranceCoverage: { isVerified: true } },
|
payment: payment,
|
||||||
policy: { isNoComp: false, isItac: false, currentDeductible: 250 },
|
policy: policy,
|
||||||
|
order: {
|
||||||
|
payment: payment,
|
||||||
|
policy: policy,
|
||||||
|
},
|
||||||
|
hasSubmittedOrder: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
var amtDue = mixIn.methods.getAmountDue(lineItems);
|
||||||
|
|
||||||
|
expect(amtDue).toEqual("303.00");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("getAmountDue should function with a submitted order", () => {
|
||||||
|
const mixIn = getMixInInstance({});
|
||||||
|
const lineItems = {
|
||||||
|
glassParts: [],
|
||||||
|
supportingItems: [],
|
||||||
|
vaps: [
|
||||||
|
{
|
||||||
|
cartItemType: "FRONT WIPERS",
|
||||||
|
description: 'WIPER BLADE STANDARD 18"',
|
||||||
|
kitPrice: 0,
|
||||||
|
laborAmount: 0,
|
||||||
|
partNumber: "WB18",
|
||||||
|
partType: "FRONT WIPER",
|
||||||
|
salesTax: 2.0,
|
||||||
|
sellingPrice: 30.0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cartItemType: "FRONT WIPERS",
|
||||||
|
description: 'WIPER BLADE STANDARD 26"',
|
||||||
|
kitPrice: 0,
|
||||||
|
laborAmount: 0,
|
||||||
|
partNumber: "WB26",
|
||||||
|
partType: "FRONT WIPER",
|
||||||
|
salesTax: 1.0,
|
||||||
|
sellingPrice: 20.0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
promos: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const payment = { insuranceCoverage: { isVerified: true } };
|
||||||
|
const policy = { isNoComp: false, isItac: false, currentDeductible: 250 };
|
||||||
|
|
||||||
|
store.getters = {
|
||||||
|
payment: {},
|
||||||
|
policy: {},
|
||||||
|
order: {},
|
||||||
|
submittedOrder: {
|
||||||
|
payment: payment,
|
||||||
|
policy: policy,
|
||||||
|
},
|
||||||
|
hasSubmittedOrder: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
var amtDue = mixIn.methods.getAmountDue(lineItems);
|
var amtDue = mixIn.methods.getAmountDue(lineItems);
|
||||||
|
|
@ -241,9 +298,17 @@ describe("baseMixin.js", () => {
|
||||||
promos: [],
|
promos: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const payment = { isInsurance: null, insuranceCoverage: { isVerified: null } };
|
||||||
|
const policy = { isNoComp: false, isItac: false, currentDeductible: 0 };
|
||||||
|
|
||||||
store.getters = {
|
store.getters = {
|
||||||
payment: { isInsurance: null, insuranceCoverage: { isVerified: null } },
|
payment: payment,
|
||||||
policy: { isNoComp: false, isItac: false, currentDeductible: 0 },
|
policy: policy,
|
||||||
|
order: {
|
||||||
|
payment: payment,
|
||||||
|
policy: policy,
|
||||||
|
},
|
||||||
|
hasSubmittedOrder: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
var amtDue = mixIn.methods.getAmountDue(lineItems);
|
var amtDue = mixIn.methods.getAmountDue(lineItems);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue