Merge pull request #1856 from Safelite/feature/CSR-2098

CSR-2098
This commit is contained in:
CarlNation 2024-05-20 10:35:22 -04:00 committed by GitHub
commit 142cde832c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 49 additions and 0 deletions

View file

@ -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() {

View file

@ -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 }) {