changes to add supplies repair fee to cart and promo taxes
This commit is contained in:
CarlNation 2023-11-21 09:18:37 -05:00
parent 74cdc87509
commit 18c59e8d7e
4 changed files with 48 additions and 0 deletions

View file

@ -9,6 +9,7 @@ const cartItemTypes = {
MOBILE_FEE: "MOBILE FEE",
PROMOS: "PROMOS",
EARLY_BIRD: "EARLY BIRD",
SUPPLIES_REPAIR: "SUPPLIES-REPAIR",
};
export { cartItemTypes };

View file

@ -227,6 +227,10 @@ export default {
cartItems.push(this.recycleFeeCartItem);
}
if (this.suppliesRepairCartItem) {
cartItems.push(this.suppliesRepairCartItem);
}
if (this.mobileFeeCartItem) {
cartItems.push(this.mobileFeeCartItem);
}
@ -508,6 +512,43 @@ export default {
return cartItem;
},
suppliesRepairCartItemName() {
return this.getCmsContent("SuppliesRepairTextWidget", "Text");
},
suppliesRepairCartItem() {
let cartItem = null;
const suppliesRepairLineItem = this.supportingItems.find(
(supportingItem) => supportingItem.partType == partTypeStrings.REPAIR_FEE && supportingItem.partNumber != "WSREPAIR"
);
if (suppliesRepairLineItem) {
cartItem = {
name: this.suppliesRepairCartItemName,
category: cartItemCategories.SUPPORTING_ITEMS,
cartItemType: cartItemTypes.SUPPLIES_REPAIR,
isDisplayed: true,
isRemovable: false,
subTotal: 0,
salesTax: 0,
lineItems: [],
};
suppliesRepairLineItem.cartItemType = cartItem.cartItemType;
cartItem.lineItems.push(suppliesRepairLineItem);
cartItem.subTotal +=
(suppliesRepairLineItem.kitPrice ?? 0) +
(suppliesRepairLineItem.laborAmount ?? 0) +
(suppliesRepairLineItem.sellingPrice ?? 0);
cartItem.salesTax = suppliesRepairLineItem.salesTax ?? 0;
}
return cartItem;
},
mobileFeeCartItemName() {
return this.getCmsContent("MobileServiceTextWidget", "Text");
},

View file

@ -323,6 +323,9 @@ export default {
);
const newValidatedPromos = validatePromoResponse?.orderPromos ?? [];
newValidatedPromos.push(
...(revalidatePromoResponse ? revalidatePromoResponse.promoLineItems : [])
);
pricedLineItemsToTax.push(...newValidatedPromos);
// End of promo logic

View file

@ -149,6 +149,9 @@ export default {
if (lineItems.vaps) {
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.vaps, true);
}
if (lineItems.promos) {
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(lineItems.promos, true);
}
return ((amountDue * 100) / 100).toFixed(2);
},
scrollToPageTop() {