Merge pull request #1202 from Safelite/feature/kroell/INSR-9415
INSR-9415: fix recal copy logic on payment-method
This commit is contained in:
commit
cc460e8fbc
5 changed files with 14 additions and 15 deletions
|
|
@ -14,7 +14,7 @@ import { useMainStore } from '@/store';
|
||||||
import { getPriceOfLineItems } from '@/helpers/price-calculator.js';
|
import { getPriceOfLineItems } from '@/helpers/price-calculator.js';
|
||||||
import coverageStatuses from '@/constants/coverage-statuses';
|
import coverageStatuses from '@/constants/coverage-statuses';
|
||||||
import coverageType from '@/constants/coverage-type';
|
import coverageType from '@/constants/coverage-type';
|
||||||
import { containsRecalParts } from '@/helpers/recal-helper';
|
import { isRecalOrder } from '@/helpers/recal-helper';
|
||||||
|
|
||||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||||
jest.mock('@/helpers/price-calculator.js', () => ({
|
jest.mock('@/helpers/price-calculator.js', () => ({
|
||||||
|
|
@ -34,7 +34,7 @@ jest.mock('@/helpers/text-helper', () => ({
|
||||||
}));
|
}));
|
||||||
|
|
||||||
jest.mock('@/helpers/recal-helper.js', () => ({
|
jest.mock('@/helpers/recal-helper.js', () => ({
|
||||||
containsRecalParts: jest.fn()
|
isRecalOrder: jest.fn()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const SAFELITE_PROVIDER = 'Safelite';
|
const SAFELITE_PROVIDER = 'Safelite';
|
||||||
|
|
@ -345,7 +345,7 @@ describe('coverageStatement.vue', () => {
|
||||||
});
|
});
|
||||||
test('returns true when a part in glassParts requires recalibration and recalibration has been added to order', () => {
|
test('returns true when a part in glassParts requires recalibration and recalibration has been added to order', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
containsRecalParts.mockReturnValue(true);
|
isRecalOrder.mockReturnValue(true);
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
lineItems: {
|
lineItems: {
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ import { getAvailableLineItems } from '@/helpers/cart-helper';
|
||||||
import coverageStatuses from '@/constants/coverage-statuses';
|
import coverageStatuses from '@/constants/coverage-statuses';
|
||||||
import coverageType from '@/constants/coverage-type';
|
import coverageType from '@/constants/coverage-type';
|
||||||
import oemEndorsementModal from '@/layouts/coverage-statement/oem-endorsement-modal/oem-endorsement-modal.vue';
|
import oemEndorsementModal from '@/layouts/coverage-statement/oem-endorsement-modal/oem-endorsement-modal.vue';
|
||||||
import { containsRecalParts } from '@/helpers/recal-helper';
|
import { isRecalOrder } from '@/helpers/recal-helper';
|
||||||
|
|
||||||
const RECAL_MODAL_REF_NAME = 'RecalModal';
|
const RECAL_MODAL_REF_NAME = 'RecalModal';
|
||||||
const CANCEL_CLAIM_REF_NAME = 'CancelClaimModal';
|
const CANCEL_CLAIM_REF_NAME = 'CancelClaimModal';
|
||||||
|
|
@ -308,13 +308,7 @@ export default {
|
||||||
return this.mainStore.isUnverified;
|
return this.mainStore.isUnverified;
|
||||||
},
|
},
|
||||||
isADAS() {
|
isADAS() {
|
||||||
const { glassParts } = useMainStore().order.lineItems;
|
return isRecalOrder(this.mainStore.order.lineItems);
|
||||||
const orderContainsRecalPart = containsRecalParts(glassParts);
|
|
||||||
return (
|
|
||||||
glassParts !== null
|
|
||||||
&& !!glassParts.find((part) => part.requiresRecalibration)
|
|
||||||
&& orderContainsRecalPart
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
totalServicePrice() {
|
totalServicePrice() {
|
||||||
return getPriceOfLineItems(this.baseServiceLineItems);
|
return getPriceOfLineItems(this.baseServiceLineItems);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { getStringWithCustomValues, processIfStatements } from '@/helpers/cms-content-helper';
|
import { getStringWithCustomValues, processIfStatements } from '@/helpers/cms-content-helper';
|
||||||
import { getGlassList } from '@/helpers/damage-helper';
|
import { getGlassList } from '@/helpers/damage-helper';
|
||||||
|
import { isRecalOrder } from '@/helpers/recal-helper';
|
||||||
import reviewBlock from '@/layouts/payment-method/review-dropdown/review-block/review-block.vue';
|
import reviewBlock from '@/layouts/payment-method/review-dropdown/review-block/review-block.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -34,12 +35,16 @@ export default {
|
||||||
customValueMap() {
|
customValueMap() {
|
||||||
return {
|
return {
|
||||||
glassList: this.glassList,
|
glassList: this.glassList,
|
||||||
|
isRecalibrationOnOrder: this.isRecalibrationOnOrder
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
glassList() {
|
glassList() {
|
||||||
const glassPieces = this.mainStore.lineItems.glassParts?.map((part) => part.partType.toLowerCase()) ?? [];
|
const glassPieces = this.mainStore.lineItems.glassParts?.map((part) => part.partType.toLowerCase()) ?? [];
|
||||||
return getGlassList(glassPieces);
|
return getGlassList(glassPieces);
|
||||||
},
|
},
|
||||||
|
isRecalibrationOnOrder() {
|
||||||
|
return isRecalOrder(this.mainStore.order.lineItems);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCmsContentWithCustomValues(widgetName, widgetField) {
|
getCmsContentWithCustomValues(widgetName, widgetField) {
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ import {
|
||||||
getMobileZipCodeData
|
getMobileZipCodeData
|
||||||
} from '@/helpers/service-location-helper';
|
} from '@/helpers/service-location-helper';
|
||||||
import { toTitleCase } from '@/helpers/text-helper.js';
|
import { toTitleCase } from '@/helpers/text-helper.js';
|
||||||
import { containsRecalParts } from '@/helpers/recal-helper';
|
import { isRecalOrder } from '@/helpers/recal-helper';
|
||||||
|
|
||||||
// Import Component
|
// Import Component
|
||||||
import alert from '@/ux-components/alert/alert.vue';
|
import alert from '@/ux-components/alert/alert.vue';
|
||||||
|
|
@ -244,7 +244,7 @@ export default {
|
||||||
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
|
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
|
||||||
},
|
},
|
||||||
isRecalibrationOnOrder() {
|
isRecalibrationOnOrder() {
|
||||||
return this.mainStore.hasRecalibrationPart && containsRecalParts(this.mainStore.order.lineItems);
|
return isRecalOrder(this.mainStore.order.lineItems);
|
||||||
},
|
},
|
||||||
isServiceableInshop() {
|
isServiceableInshop() {
|
||||||
if (this.isRecalibrationServiceableInshop !== null) {
|
if (this.isRecalibrationServiceableInshop !== null) {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import partTypeStrings from '@/constants/part-type-strings';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
import { getPriceOfLineItem } from '@/helpers/price-calculator';
|
import { getPriceOfLineItem } from '@/helpers/price-calculator';
|
||||||
import { shallowRef } from 'vue';
|
import { shallowRef } from 'vue';
|
||||||
import { containsRecalParts } from '@/helpers/recal-helper';
|
import { isRecalOrder } from '@/helpers/recal-helper';
|
||||||
|
|
||||||
const glassLocations = damageLocationsSelected;
|
const glassLocations = damageLocationsSelected;
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ export default {
|
||||||
return modifiedAnswers;
|
return modifiedAnswers;
|
||||||
},
|
},
|
||||||
isRecalibrationOnOrder() {
|
isRecalibrationOnOrder() {
|
||||||
return this.mainStore.hasRecalibrationPart && containsRecalParts(this.mainStore.order.lineItems);
|
return isRecalOrder(this.mainStore.order.lineItems);
|
||||||
},
|
},
|
||||||
frontWipersApplicableForTierTwo() {
|
frontWipersApplicableForTierTwo() {
|
||||||
const frontWipersAreAvailable = this.lineItemsContainsPartType(partTypeStrings.FRONT_WIPER);
|
const frontWipersAreAvailable = this.lineItemsContainsPartType(partTypeStrings.FRONT_WIPER);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue