Merge branch 'develop' into feature/csr-2147

This commit is contained in:
Chloe Herd 2024-09-17 11:27:03 -04:00
commit e7d7500500
11 changed files with 59 additions and 78 deletions

View file

@ -24,6 +24,11 @@ const applicationConfig = {
"//" +
location.host +
"/fmg/?fmgPage=payment-method&src=concept-funnel",
PIA_ERROR_URL:
location.protocol +
"//" +
location.host +
"/fmg/?fmgPage=payment-pia-return&src=concept-funnel",
CONFIRMATION_URL: location.protocol + "//" + location.host + "/fmg/?fmgPage=confirmation",
GOOGLE_CALENDAR: "https://www.google.com/calendar/render?action=TEMPLATE",
YAHOO_CALENDAR: "https://calendar.yahoo.com/?v=60",

View file

@ -134,7 +134,7 @@ const endpoints = {
},
PriceOrderItems: {
url: "/price/api/v1/price/order-items",
method: "GET",
method: "POST",
},
ValidatePromo: {
url: "/price/api/v1/price/order-promo",

View file

@ -305,9 +305,9 @@ export default {
if (!this.lineItems || this.lineItems.length < 1) return;
const lineItemsCopy = deepClone(this.lineItems);
lineItemsCopy.supportingItems = lineItemsCopy.supportingItems ? baseMixin.methods.filterOutRecalibration(
lineItemsCopy?.supportingItems
) : [];
lineItemsCopy.supportingItems = lineItemsCopy.supportingItems
? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.supportingItems)
: [];
return lineItemsCopy;
},
showCoverageAsPending() {
@ -438,13 +438,15 @@ export default {
packagePrice() {
let packagePrice = 0;
if (!this.isInsurance && this.shouldHideRecalibration) { // Update packagePrice if Cash only && is part of RemoveRecal experiment
if (!this.isInsurance && this.shouldHideRecalibration) {
// Update packagePrice if Cash only && is part of RemoveRecal experiment
packagePrice = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(
baseMixin.methods.filterOutRecalibration(this.availableLineItems) // Strip out recal before filtering out fees
)
);
} else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { // Update packagePrice if is verified insurance OR if Cash && not part of RemoveRecal experiment
} else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) {
// Update packagePrice if is verified insurance OR if Cash && not part of RemoveRecal experiment
packagePrice = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(this.availableLineItems)
);
@ -1001,7 +1003,7 @@ export default {
if (!this.lineItems || this.lineItems.length < 1) return;
return this.isInsurance || !this.shouldHideRecalibration
? baseMixin.methods.getSubTotal(this.lineItems) // calculate with recal (if on order)
: baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); // calculated without recal
: baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); // calculate without recal
},
salesTax() {
if (!this.lineItems || this.lineItems.length < 1) return;

View file

@ -170,9 +170,7 @@ export default {
},
computed: {
shouldHideRecalibration() {
return this.getSettingValue(
experimentSettings.RECAL_PRICE_REMOVE
);
return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE);
},
ShowCart() {
if (this.isPia && this.submittedOrder?.settledTenderAmount == 0) {

View file

@ -55,7 +55,9 @@
class="service-questions" />
<textBlock cmsWidgetName="CallOrTextWidget" justifyText="left" />
<hr class="my-5" />
<div class="d-flex flex-row checkbox-group" v-if="isRecalibrationOnOrder && shouldHideRecalibration">
<div
class="d-flex flex-row checkbox-group"
v-if="isRecalibrationOnOrder && shouldHideRecalibration">
<checkboxQuestion
cmsWidgetName="RecalConfirmWidget"
class="mb-5"
@ -592,9 +594,7 @@ export default {
);
},
shouldHideRecalibration() {
return this.getSettingValue(
experimentSettings.RECAL_PRICE_REMOVE
);
return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE);
},
showApplePay() {
return baseMixin.methods.showApplePay();

View file

@ -171,7 +171,7 @@
<input type="hidden" name="paypalSuccessUrl" :value="piaResponseUrl" />
<input type="hidden" name="paypalCancelUrl" :value="piaCancelUrl" />
<input type="hidden" name="sgCCDeclineURL" :value="piaCancelUrl" />
<input type="hidden" name="sgCCDeclineURL" :value="piaErrorUrl" />
<input type="hidden" name="sgCCTimeoutURL" :value="piaCancelUrl" />
<input type="hidden" name="sgTransactionType" value="authorization" />
@ -235,6 +235,7 @@ export default {
checkoutUrl: externalUrls.SAFELITE_HOP,
piaResponseUrl: applicationConfig.PIA_RESPONSE_URL,
piaCancelUrl: applicationConfig.PIA_CANCEL_URL,
piaErrorUrl: applicationConfig.PIA_ERROR_URL,
paymentType: this.getPaymentType(),
authToken: "",
authSignature: "",

View file

@ -750,7 +750,10 @@ function setupMocks({ customMountOptions }) {
baseMixin.methods.ResetExternalParamsAndHideModal = jest.fn();
baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true);
mountOptions.global.mocks["$store"] = store;
store.getters.experimentSettings = "test value";
mountOptions["attachTo"] = document.body;
const wrapper = shallowMount(quote, mountOptions);
wrapper.vm.setCmsContent = jest.fn();
return { wrapper };

View file

@ -32,6 +32,8 @@
:availableLineItems="availableLineItems"
:shouldHideRecalibration="shouldHideRecalibration"
:isInsuranceSelected="isInsuranceSelected"
:isRecalibrationOnOrder="isRecalibrationOnOrder"
:shouldHideRecalibration="shouldHideRecalibration"
@vapsItemsSelected="vapsItemsSelectedAction"
@servicePackageDiscountSelected="servicePackageDiscountSelectedAction"
:servicePackage="servicePackage"
@ -140,9 +142,6 @@ export default {
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const experimentForLogging = store.getters.applicationUser.experiments.find(
(e) => e.universeName === experimentUniverses.RECAL_PRICE_REMOVAL
);
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_WIPERS,
{
@ -210,30 +209,6 @@ export default {
...servicePackageDiscountPart,
];
// If the recal experiment is found then log the experiment exposure.
const isRecalibrationOnOrder = containsRecalParts(availableLineItems);
const canSafeliteRecalibrate = nullSafeGlassParts.some((glassPart) => {
return glassPart.partType === "WINDSHIELD" && glassPart.canSafeliteRecalibrate;
});
if (
experimentForLogging !== undefined &&
isRecalibrationOnOrder &&
canSafeliteRecalibrate
) {
// Log experiment exposure
baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.LOG_EXPERIMENT_EXPOSURE,
{
userId: getUserIdValue(),
sessionKey: getSessionKeyValue(),
pageName: to.query.fmgPage,
experiment: experimentForLogging,
},
"quote",
false
);
}
// When calling pricing from the quote page, always use the cash parent account
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_PARENT_ACCOUNT_NUMBER,

View file

@ -475,6 +475,7 @@ describe("service-package-question.vue, matching business rules for package disp
mockProps.availableLineItems.push(recalLineItem);
mockProps.availableLineItems.push(driverFrontWiperLineItem);
mockProps.availableLineItems.push(passengerFrontWiperLineItem);
mockProps.isRecalibrationOnOrder = true;
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
const wrapper = setupMocks({
mountOptionsMockData: {

View file

@ -50,6 +50,7 @@ export default {
availableLineItems: null,
activePromos: null,
servicePackage: null,
isRecalibrationOnOrder: Boolean,
shouldHideRecalibration: Boolean,
},
data() {
@ -143,9 +144,6 @@ export default {
}));
return modifiedAnswers;
},
isRecalibrationOnOrder() {
return containsRecalParts(this.nullSafeAvailableLineItems);
},
isServicePackageDiscountOnOrder() {
return containsLineItemWithPartType(
partTypeStrings.SERVICE_PACKAGE_DISCOUNT,
@ -241,7 +239,8 @@ export default {
},
getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) {
var lineItemsToPrice = [...this.nullSafeAvailableLineItems];
if (this.shouldHideRecalibration && this.isRecalibrationOnOrder) {
if (this.isRecalibrationOnOrder && this.shouldHideRecalibration) {
lineItemsToPrice = getItemsWithoutRecalParts(lineItemsToPrice);
}

View file

@ -2413,14 +2413,6 @@ export const actions = {
context,
{ payload: { availableLineItems, serviceZipCode, serviceZipCodeCtu }, pageNameToLog }
) {
const zipCodeToUse = serviceZipCode
? serviceZipCode
: context.getters.order.serviceLocation.zipCode;
const ctuToUse = serviceZipCodeCtu
? serviceZipCodeCtu
: context.getters.order.serviceLocation.zipCodeCtu;
const flattenedLineItemsWithChildParts =
getFlattenedArrayOfLineItemsWithChildParts(availableLineItems);
@ -2428,34 +2420,39 @@ export const actions = {
partNumber: lineItem.partNumber,
}));
const availableLineItemsFormattedForRequest =
buildQueryStringParameterFromArrayOfComplexObjects(
lineItemsWithOnlyPartNumbers,
"lineItems"
);
const vehicle = context.getters.order.vehicle;
// TODO: Insurance pricing...`ParentAccountNumber=${context.getters.order.payment.parentAccountNumber}`
let queryString =
`ParentAccountNumber=${context.getters.order.payment.parentAccountNumber}` +
`&CTU=${ctuToUse}` +
`&CarId=${vehicle.carId}` +
`&Make=${vehicle.make}` +
`&Model=${vehicle.model}` +
`&Year=${vehicle.year}` +
`&EON=${context.getters.order.eon}` +
`&ZipCode=${zipCodeToUse}` +
`&${availableLineItemsFormattedForRequest}`;
const lineItemServerData = context.getters.order.lineItems.serverData;
if (lineItemServerData) {
queryString += `&ServerData=${encodeURIComponent(lineItemServerData)}`;
const order = context.getters.order;
var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu;
if (providerNumber.startsWith("00")) {
providerNumber = providerNumber.substring(1);
}
const response = await globalMethods.callHttpClient({
method: endpoints.PriceOrderItems.method,
endpoint: `${endpoints.PriceOrderItems.url}?${queryString}`,
endpoint: endpoints.PriceOrderItems.url,
payload: {
parentAccountNumber: order.payment?.parentAccountNumber,
billToAccountNumber:
order.payment?.billToAccountNumber ??
applicationConfig.CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER,
providerNumber: providerNumber,
carId: order.vehicle.carId,
year: order.vehicle.year,
make: order.vehicle.make,
model: order.vehicle.model,
eon: order.eon,
state: order.serviceLocation?.state,
referralNumber: order.referralNumber,
referralSequenceNumber: order.referralSequenceNumber,
zipCode: order.serviceLocation?.zipCode,
serviceZipCode: serviceZipCode ?? order.serviceLocation?.zipCode,
referralDate: order.referralDate,
isReplacement: !order.damage.isRepair,
deductible: order.policy?.currentDeductible,
coverageStatus: order.payment?.insuranceCoverage?.coverageStatus,
lineItems: lineItemsWithOnlyPartNumbers,
serverData: order.lineItems.serverData ? order.lineItems.serverData : "",
},
logApiCall: true,
pageNameToLog: pageNameToLog,
});