Update payment-method & cart for new recal

This commit is contained in:
Chloe Herd 2024-09-17 14:23:55 -04:00
parent 664e2a734a
commit 51655e7247
4 changed files with 13 additions and 12 deletions

View file

@ -305,8 +305,8 @@ export default {
if (!this.lineItems || this.lineItems.length < 1) return; if (!this.lineItems || this.lineItems.length < 1) return;
const lineItemsCopy = deepClone(this.lineItems); const lineItemsCopy = deepClone(this.lineItems);
lineItemsCopy.supportingItems = lineItemsCopy.supportingItems lineItemsCopy.glassParts = lineItemsCopy.glassParts
? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.supportingItems) ? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.glassParts)
: []; : [];
return lineItemsCopy; return lineItemsCopy;
}, },

View file

@ -153,6 +153,7 @@ import { partTypeStrings } from "@/constants/part-type-strings";
import { mapTaxedLineItemsToStoreFormat } from "../../store"; import { mapTaxedLineItemsToStoreFormat } from "../../store";
import { coverageStatus } from "@/constants/insurance"; import { coverageStatus } from "@/constants/insurance";
import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
import { containsRecalParts } from "@/helpers/recal-helper";
defineRule("payment-method-required", required(errorMessages.OPTION_REQUIRED)); defineRule("payment-method-required", required(errorMessages.OPTION_REQUIRED));
defineRule("recal-ack-required", required(errorMessages.RECAL_ACK_REQUIRED)); defineRule("recal-ack-required", required(errorMessages.RECAL_ACK_REQUIRED));
@ -588,10 +589,11 @@ export default {
}, },
computed: { computed: {
isRecalibrationOnOrder() { isRecalibrationOnOrder() {
return containsLineItemWithPartType( const order = baseMixin.methods.hasSubmittedOrder()
partTypeStrings.RECALIBRATION, ? baseMixin.methods.getSubmittedOrder()
this.$store.getters.order.lineItems?.supportingItems : this.$store.getters.order;
);
return containsRecalParts(order.lineItems);
}, },
shouldHideRecalibration() { shouldHideRecalibration() {
return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE); return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE);

View file

@ -8,6 +8,7 @@ import { queryStrings } from "@/constants/query-strings";
import { dynamicStrings } from "@/constants/dynamic-strings"; import { dynamicStrings } from "@/constants/dynamic-strings";
import { partTypeStrings } from "../constants/part-type-strings"; import { partTypeStrings } from "../constants/part-type-strings";
import { showFmgLoadingModal } from "@/helpers/loading-modal-helper"; import { showFmgLoadingModal } from "@/helpers/loading-modal-helper";
import { getItemsWithoutRecalParts } from "@/helpers/recal-helper";
export default { export default {
data() { data() {
@ -103,10 +104,7 @@ export default {
return filteredLineItems; return filteredLineItems;
}, },
filterOutRecalibration(lineItems) { filterOutRecalibration(lineItems) {
const filteredLineItems = lineItems.filter((item) => { return getItemsWithoutRecalParts(lineItems);
return !item.partType.includes(partTypeStrings.RECALIBRATION);
});
return filteredLineItems;
}, },
getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) { getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) {
let totalPrice = 0; let totalPrice = 0;

View file

@ -2422,8 +2422,9 @@ export const actions = {
})); }));
const order = context.getters.order; const order = context.getters.order;
var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; var providerNumber =
order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu;
if (providerNumber.startsWith("00") && providerNumber.length > 5) { if (providerNumber.startsWith("00") && providerNumber.length > 5) {
providerNumber = providerNumber.substring(1); providerNumber = providerNumber.substring(1);
} }