commit
142cde832c
2 changed files with 49 additions and 0 deletions
|
|
@ -152,6 +152,15 @@ export default {
|
|||
if (lineItems.promos) {
|
||||
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.promos, true);
|
||||
}
|
||||
|
||||
if (
|
||||
store.getters.payment.insuranceCoverage.isVerified &&
|
||||
!store.getters.policy.isNoComp &&
|
||||
!store.getters.policy.isItac
|
||||
) {
|
||||
amountDue += store.getters.policy.currentDeductible;
|
||||
}
|
||||
|
||||
return ((amountDue * 100) / 100).toFixed(2);
|
||||
},
|
||||
scrollToPageTop() {
|
||||
|
|
|
|||
|
|
@ -120,6 +120,46 @@ describe("baseMixin.js", () => {
|
|||
|
||||
expect(mixIn.methods.dispatchStoreActionWithLogging).toBeCalled();
|
||||
});
|
||||
|
||||
test("getAmountDue for verified deductible should be deductible plus any lineitems", () => {
|
||||
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: [],
|
||||
};
|
||||
|
||||
store.getters = {
|
||||
payment: { insuranceCoverage: { isVerified: true } },
|
||||
policy: { isNoComp: false, isItac: false, currentDeductible: 250 },
|
||||
};
|
||||
|
||||
var amtDue = mixIn.methods.getAmountDue(lineItems);
|
||||
|
||||
expect(amtDue).toEqual("303.00");
|
||||
});
|
||||
});
|
||||
|
||||
function getMixInInstance({ isDispatchSuccess = true }) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue