Merge branch 'develop' into nation/CASH-2466
This commit is contained in:
commit
8d314a40b3
9 changed files with 17 additions and 138 deletions
|
|
@ -61,7 +61,7 @@ const endpoints = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
GetWipers: {
|
GetWipers: {
|
||||||
url: "/parts/api/v1/parts/wipers",
|
url: "/parts/api/v2/parts/wipers",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
GetRainRepel: {
|
GetRainRepel: {
|
||||||
|
|
|
||||||
|
|
@ -970,8 +970,7 @@ export default {
|
||||||
const msrFeeLineItem = this.getMsrFeeLineItem;
|
const msrFeeLineItem = this.getMsrFeeLineItem;
|
||||||
const shouldCreateMsrFeeCartItem =
|
const shouldCreateMsrFeeCartItem =
|
||||||
this.isMSRFeeApplicable &&
|
this.isMSRFeeApplicable &&
|
||||||
this.isInsurance &&
|
(!this.isInsurance || !this.IsMSRFeeCoveredByInsurance) &&
|
||||||
!this.IsMSRFeeCoveredByInsurance &&
|
|
||||||
msrFeeLineItem &&
|
msrFeeLineItem &&
|
||||||
this.msrFeeAmount > 0;
|
this.msrFeeAmount > 0;
|
||||||
|
|
||||||
|
|
@ -980,7 +979,7 @@ export default {
|
||||||
name: this.msrFeeCartItemName,
|
name: this.msrFeeCartItemName,
|
||||||
category: cartItemCategories.SUPPORTING_ITEMS,
|
category: cartItemCategories.SUPPORTING_ITEMS,
|
||||||
cartItemType: cartItemTypes.MOBILE_FEE,
|
cartItemType: cartItemTypes.MOBILE_FEE,
|
||||||
isDisplayed: this.isInsurance,
|
isDisplayed: true,
|
||||||
isRemovable: true,
|
isRemovable: true,
|
||||||
subTotal: 0,
|
subTotal: 0,
|
||||||
salesTax: 0,
|
salesTax: 0,
|
||||||
|
|
@ -1007,8 +1006,10 @@ export default {
|
||||||
return this.getCmsContent("RecycleTextBlock", "Text");
|
return this.getCmsContent("RecycleTextBlock", "Text");
|
||||||
},
|
},
|
||||||
msrToolTipBodyText() {
|
msrToolTipBodyText() {
|
||||||
let cmsContentText = this.getCmsContent("MSRModal", "BodyText");
|
let cmsContentText = this.isInsurance
|
||||||
if (cmsContentText) {
|
? this.getCmsContent("MSRModal", "BodyText")
|
||||||
|
: this.getCmsContent("MSRModal", "BodyText2");
|
||||||
|
if (this.isInsurance && cmsContentText) {
|
||||||
cmsContentText = cmsContentText.replaceAll(
|
cmsContentText = cmsContentText.replaceAll(
|
||||||
"{custom:mobileFee}",
|
"{custom:mobileFee}",
|
||||||
formatToUSDollar(this.msrFeeAmount)
|
formatToUSDollar(this.msrFeeAmount)
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,8 @@ export default {
|
||||||
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_WIPERS,
|
storeActions.GET_WIPERS,
|
||||||
{
|
{
|
||||||
serviceZipCode: submittedOrder.serviceLocation.zipCode,
|
|
||||||
carId: submittedOrder.vehicle.carId,
|
carId: submittedOrder.vehicle.carId,
|
||||||
|
accountNumber: submittedOrder.payment?.parentAccountNumber,
|
||||||
},
|
},
|
||||||
"confirmation"
|
"confirmation"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -187,118 +187,6 @@ describe("payment-adyen.vue", () => {
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("splitStreetAddress", () => {
|
|
||||||
const setInShopStreet = (streetAddress) => {
|
|
||||||
store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.IN_SHOP;
|
|
||||||
store.getters.order.serviceLocation.provider.address.streetAddress = streetAddress;
|
|
||||||
};
|
|
||||||
|
|
||||||
test("splits typical address into first token as number and remainder as street", () => {
|
|
||||||
setInShopStreet("123 West Elm St");
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "123",
|
|
||||||
street: "West Elm St",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("two tokens: number and single-word street", () => {
|
|
||||||
setInShopStreet("456 Oak");
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "456",
|
|
||||||
street: "Oak",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("single token with no spaces: full string in number, empty street", () => {
|
|
||||||
setInShopStreet("123OakStreet");
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "123OakStreet",
|
|
||||||
street: "",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("collapses multiple spaces between words", () => {
|
|
||||||
setInShopStreet("123 West Elm St");
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "123",
|
|
||||||
street: "West Elm St",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("trims leading and trailing whitespace on full address", () => {
|
|
||||||
setInShopStreet(" 99 Maple Ave ");
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "99",
|
|
||||||
street: "Maple Ave",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("empty string yields empty number and street", () => {
|
|
||||||
setInShopStreet("");
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "",
|
|
||||||
street: "",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("whitespace-only address yields empty number and street", () => {
|
|
||||||
setInShopStreet(" \t ");
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "",
|
|
||||||
street: "",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("null address yields empty number and street", () => {
|
|
||||||
setInShopStreet(null);
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "",
|
|
||||||
street: "",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("uses mobile service address when appointment is mobile", () => {
|
|
||||||
store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
|
|
||||||
store.getters.order.serviceLocation.address = "700 Broadway Blvd";
|
|
||||||
store.getters.order.serviceLocation.city = "Columbus";
|
|
||||||
store.getters.order.serviceLocation.state = "OH";
|
|
||||||
store.getters.order.serviceLocation.zipCode = "43235";
|
|
||||||
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "700",
|
|
||||||
street: "Broadway Blvd",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test("splits on tabs and other whitespace runs", () => {
|
|
||||||
setInShopStreet("10\tPine\tLane");
|
|
||||||
const wrapper = setupMocks({});
|
|
||||||
|
|
||||||
expect(wrapper.vm.splitStreetAddress).toEqual({
|
|
||||||
number: "10",
|
|
||||||
street: "Pine Lane",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ customMountOptions } = {}) {
|
function setupMocks({ customMountOptions } = {}) {
|
||||||
|
|
|
||||||
|
|
@ -455,8 +455,8 @@ export default {
|
||||||
zipCodeCtu: this.locationInfo.zipCodeCtu,
|
zipCodeCtu: this.locationInfo.zipCodeCtu,
|
||||||
amount: this.adyenPriceTotal,
|
amount: this.adyenPriceTotal,
|
||||||
city: this.locationInfo.city,
|
city: this.locationInfo.city,
|
||||||
houseNumberOrName: this.splitStreetAddress.number,
|
street: this.locationInfo.address ?? "",
|
||||||
street: this.splitStreetAddress.street,
|
houseNumberOrName: this.locationInfo.address2 ?? "",
|
||||||
zipCode: this.locationInfo.zipCode,
|
zipCode: this.locationInfo.zipCode,
|
||||||
stateOrProvince: this.locationInfo.state,
|
stateOrProvince: this.locationInfo.state,
|
||||||
returnUrl: applicationConfig.PIA_ADYEN_RETURN_URL,
|
returnUrl: applicationConfig.PIA_ADYEN_RETURN_URL,
|
||||||
|
|
@ -515,18 +515,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
splitStreetAddress() {
|
|
||||||
const address = (this.locationInfo?.address ?? "").trim();
|
|
||||||
const tokens = address.length ? address.split(/\s+/) : [""];
|
|
||||||
const number = tokens[0] ?? "";
|
|
||||||
const street = tokens.length > 1 ? tokens.slice(1).join(" ") : "";
|
|
||||||
|
|
||||||
return {
|
|
||||||
number,
|
|
||||||
street,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
sourceSystem() {
|
sourceSystem() {
|
||||||
return "FMG-2.0";
|
return "FMG-2.0";
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -226,8 +226,8 @@ export default {
|
||||||
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_WIPERS,
|
storeActions.GET_WIPERS,
|
||||||
{
|
{
|
||||||
serviceZipCode: store.getters.order.serviceLocation.zipCode,
|
|
||||||
carId: store.getters.vehicle.carId,
|
carId: store.getters.vehicle.carId,
|
||||||
|
accountNumber: store.getters.order.payment?.parentAccountNumber,
|
||||||
},
|
},
|
||||||
"payment-method"
|
"payment-method"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ export default {
|
||||||
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_WIPERS,
|
storeActions.GET_WIPERS,
|
||||||
{
|
{
|
||||||
serviceZipCode: store.getters.order.serviceLocation.zipCode,
|
|
||||||
carId: store.getters.vehicle.carId,
|
carId: store.getters.vehicle.carId,
|
||||||
|
accountNumber: store.getters.order.payment?.parentAccountNumber,
|
||||||
},
|
},
|
||||||
"review"
|
"review"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -217,8 +217,10 @@ export default {
|
||||||
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_WIPERS,
|
storeActions.GET_WIPERS,
|
||||||
{
|
{
|
||||||
serviceZipCode: store.getters.order.serviceLocation.zipCode,
|
|
||||||
carId: store.getters.vehicle.carId,
|
carId: store.getters.vehicle.carId,
|
||||||
|
accountNumber:
|
||||||
|
store.getters.order.payment?.parentAccountNumber ??
|
||||||
|
applicationConfig.CASH_PARENT_ACCOUNT_NUMBER,
|
||||||
},
|
},
|
||||||
"quote"
|
"quote"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1977,12 +1977,12 @@ export const actions = {
|
||||||
|
|
||||||
async getWipers(context, { payload, pageNameToLog }) {
|
async getWipers(context, { payload, pageNameToLog }) {
|
||||||
const carId = payload.carId;
|
const carId = payload.carId;
|
||||||
const serviceZipCode = payload.serviceZipCode;
|
const accountNumber = payload.accountNumber;
|
||||||
|
|
||||||
const response = await globalMethods
|
const response = await globalMethods
|
||||||
.callHttpClient({
|
.callHttpClient({
|
||||||
method: endpoints.GetWipers.method,
|
method: endpoints.GetWipers.method,
|
||||||
endpoint: `${endpoints.GetWipers.url}/${carId}/${serviceZipCode}`,
|
endpoint: `${endpoints.GetWipers.url}/${carId}/${accountNumber}`,
|
||||||
logApiCall: true,
|
logApiCall: true,
|
||||||
pageNameToLog: pageNameToLog,
|
pageNameToLog: pageNameToLog,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue