CASH-70: Add MSR fee to order for insurance but don't show in cart.
This commit is contained in:
parent
d51f7013f1
commit
26fab3ddba
6 changed files with 65 additions and 10 deletions
|
|
@ -105,6 +105,7 @@ const storeActions = {
|
|||
SAVE_PAYPAL_TOKEN: "savePaypalToken",
|
||||
SAVE_NEXTGEN_SETTLED_AMOUNT: "saveNextGenSettledAmount",
|
||||
SAVE_IS_RECAL_ACK_OPT_IN: "saveIsRecalAckOptIn",
|
||||
SAVE_IS_MSR_FEE_APPLICABLE: "saveIsMSRFeeApplicable",
|
||||
|
||||
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
|
||||
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ const storeMutations = {
|
|||
LOCK_TOKEN: "updateLockToken",
|
||||
UPDATE_SETTLED_TENDER_AMOUNT: "updateSettledTenderAmount",
|
||||
UPDATE_IS_RECAL_ACK_OPT_IN: "updateIsRecalAckOptIn",
|
||||
UPDATE_IS_MSR_FEE_APPLICABLE: "updateIsMSRFeeApplicable",
|
||||
|
||||
// EVENT BUS MUTATIONS
|
||||
ADD_EVENT_TO_BUS: "addEventToBus",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import cart from "@/fmg-components/cart/cart.vue";
|
|||
import { shallowMount } from "@vue/test-utils";
|
||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
|
||||
import store from "@/store";
|
||||
|
||||
global.$logger = {
|
||||
logInformation: jest.fn(),
|
||||
logWarning: jest.fn(),
|
||||
|
|
@ -266,6 +268,7 @@ describe("cart.vue", () => {
|
|||
// Mobile Fee Cart Item
|
||||
test("if there is mobile fee on the order, a mobile fee cart item should be added to the cart", () => {
|
||||
// Arrange
|
||||
store.getters.order.isMSRFeeApplicable = false;
|
||||
const lineItems = {
|
||||
glassParts: [],
|
||||
supportingItems: [
|
||||
|
|
@ -403,6 +406,7 @@ function setupMocks({ options, props }) {
|
|||
if (props) mountOptions.propsData = props;
|
||||
|
||||
mountOptions.global.mixins = [mockBaseMixin];
|
||||
mountOptions.global.mocks["$store"] = store;
|
||||
|
||||
const wrapper = shallowMount(cart, mountOptions);
|
||||
|
||||
|
|
|
|||
|
|
@ -750,7 +750,7 @@ export default {
|
|||
return this.getCmsContent("RecycleFeeTextWidget", "Text");
|
||||
},
|
||||
showRecycleFeeCartItem() {
|
||||
if (!this.isInsurance || this.isItac || this.isNoComp) {
|
||||
if (this.isCashItacNoComp) {
|
||||
// CASH, ITAC, NOCOMP ORDERS
|
||||
return !this.isRepair;
|
||||
} else {
|
||||
|
|
@ -843,11 +843,18 @@ export default {
|
|||
|
||||
return cartItem;
|
||||
},
|
||||
isCashItacNoComp() {
|
||||
return !this.isInsurance || this.isITAC || this.isNoComp;
|
||||
},
|
||||
getIsMSRFeeApplicableFromStore() {
|
||||
return this.$store.getters.order.isMSRFeeApplicable;
|
||||
},
|
||||
mobileFeeCartItemName() {
|
||||
return this.getCmsContent("MobileServiceTextWidget", "Text");
|
||||
},
|
||||
mobileFeeCartItem() {
|
||||
let cartItem = null;
|
||||
let showMobileFeeCartItem = false;
|
||||
const mobileFeeLineItem = this.supportingItems.find(
|
||||
(lineItem) => lineItem.partType == partTypeStrings.MOBILE_FEE
|
||||
);
|
||||
|
|
@ -857,7 +864,15 @@ export default {
|
|||
(mobileFeeLineItem?.laborAmount ?? 0) +
|
||||
(mobileFeeLineItem?.sellingPrice ?? 0);
|
||||
|
||||
if (mobileFeeLineItem && mobileTotal > 0) {
|
||||
if (mobileTotal > 0) {
|
||||
if (this.getIsMSRFeeApplicableFromStore) {
|
||||
showMobileFeeCartItem = this.isCashItacNoComp;
|
||||
} else {
|
||||
showMobileFeeCartItem = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mobileFeeLineItem && showMobileFeeCartItem) {
|
||||
cartItem = {
|
||||
name: this.mobileFeeCartItemName,
|
||||
category: cartItemCategories.SUPPORTING_ITEMS,
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ export default {
|
|||
return (
|
||||
this.displayMSR &&
|
||||
this.mobileFeePart?.partNumber == partNumberStrings.MOBILE_STATIC_RECAL_FEE &&
|
||||
(this.isInsurance && !this.isITAC ? this.mobileFeePart?.isInsurable : true)
|
||||
(this.isCashItacNoComp || this.mobileFeePart?.isInsurable)
|
||||
);
|
||||
},
|
||||
displayMSR() {
|
||||
|
|
@ -317,19 +317,25 @@ export default {
|
|||
?.toLowerCase() === "true"
|
||||
);
|
||||
},
|
||||
mobileFeeApplies() {
|
||||
if (
|
||||
isCashItacNoComp() {
|
||||
return !this.isInsurance || this.isITAC || this.isNoComp;
|
||||
},
|
||||
mobileFeeHasPrice() {
|
||||
return (
|
||||
this.mobileFeePart?.laborAmount > 0 ||
|
||||
this.mobileFeePart?.sellingPrice > 0 ||
|
||||
this.mobileFeePart?.kitPrice > 0
|
||||
) {
|
||||
return true;
|
||||
);
|
||||
},
|
||||
mobileFeeApplies() {
|
||||
if (this.isMobileStaticRecalibrationApplicable && this.mobileFeeHasPrice) {
|
||||
return this.isCashItacNoComp;
|
||||
} else {
|
||||
return false;
|
||||
return this.mobileFeeHasPrice;
|
||||
}
|
||||
},
|
||||
showMobileFreeAlert() {
|
||||
if (this.isServiceableMobile && !this.isInsurance && !this.mobileFeeApplies) {
|
||||
if (this.isServiceableMobile && !this.isInsurance && !this.mobileFeeHasPrice) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -387,6 +393,9 @@ export default {
|
|||
isITAC() {
|
||||
return store.getters.order.policy.isItac;
|
||||
},
|
||||
isNoComp() {
|
||||
return store.getters.order.policy.isNoComp;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
|
|
@ -572,8 +581,22 @@ export default {
|
|||
);
|
||||
}
|
||||
},
|
||||
updateAndSaveIsMSRFeeApplicable() {
|
||||
const isMSRFeeApplicable =
|
||||
this.isMobileStaticRecalibrationApplicable &&
|
||||
this.selectedAppointmentType == "Mobile";
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_IS_MSR_FEE_APPLICABLE,
|
||||
isMSRFeeApplicable
|
||||
);
|
||||
},
|
||||
updateAndSaveSupportingItems() {
|
||||
const supportingItems = store.getters.lineItems.supportingItems;
|
||||
let supportingItems = store.getters.lineItems.supportingItems;
|
||||
|
||||
supportingItems =
|
||||
!supportingItems && this.isMobileStaticRecalibrationApplicable
|
||||
? []
|
||||
: supportingItems;
|
||||
|
||||
// for insurance orders, fees can get removed causing supportingitems to be null or empty
|
||||
if (!supportingItems) {
|
||||
|
|
@ -676,6 +699,7 @@ export default {
|
|||
}
|
||||
|
||||
this.updateAndSaveSupportingItems();
|
||||
this.updateAndSaveIsMSRFeeApplicable();
|
||||
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
||||
},
|
||||
openModalAction(modalName) {
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ const getDefaultState = () => {
|
|||
lockToken: null,
|
||||
settledTenderAmount: 0,
|
||||
isRecalAckOptIn: false,
|
||||
isMSRFeeApplicable: false,
|
||||
},
|
||||
applicationUser: {
|
||||
eventBus: [],
|
||||
|
|
@ -315,6 +316,9 @@ export const mutations = {
|
|||
updateIsRecalAckOptIn(state, isRecalAckOptIn) {
|
||||
state.order.isRecalAckOptIn = isRecalAckOptIn;
|
||||
},
|
||||
updateIsMSRFeeApplicable(state, isMSRFeeApplicable) {
|
||||
state.order.isMSRFeeApplicable = isMSRFeeApplicable;
|
||||
},
|
||||
updateCCToken(state, ccToken) {
|
||||
state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId;
|
||||
state.order.payment.ccToken.expMonth = ccToken.expMonth;
|
||||
|
|
@ -634,6 +638,7 @@ export const mutations = {
|
|||
state.order.eon = sessionInformation.order.eon;
|
||||
state.order.customerPortalLoginToken = sessionInformation.order.CustomerPortalLoginToken;
|
||||
state.order.isRecalAckOptIn = sessionInformation.order.isRecalAckOptIn;
|
||||
state.order.isMSRFeeApplicable = sessionInformation.order.isMSRFeeApplicable;
|
||||
|
||||
if (state.order.vehicle.vin !== sessionInformation.order.vehicle?.vin) {
|
||||
state.applicationUser.pageData[fmgPageValues.PART_QUESTIONS] = null;
|
||||
|
|
@ -2233,6 +2238,7 @@ export const actions = {
|
|||
createUnscheduledStatusWorkOrderForPIA: createUnscheduledStatusWorkOrderForPIA,
|
||||
lockToken: order.lockToken,
|
||||
isRecalAckOptIn: order.isRecalAckOptIn,
|
||||
isMSRFeeApplicable: order.isMSRFeeApplicable,
|
||||
},
|
||||
},
|
||||
logApiCall: true,
|
||||
|
|
@ -2631,6 +2637,10 @@ export const actions = {
|
|||
context.commit(storeMutations.UPDATE_IS_RECAL_ACK_OPT_IN, isRecalAckOptIn);
|
||||
},
|
||||
|
||||
saveIsMSRFeeApplicable(context, isMSRFeeApplicable) {
|
||||
context.commit(storeMutations.UPDATE_IS_MSR_FEE_APPLICABLE, isMSRFeeApplicable);
|
||||
},
|
||||
|
||||
saveParentAccountNumber(context, parentAccountNumber) {
|
||||
context.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, parentAccountNumber);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue