Merge pull request #3188 from Safelite/feature/CASH-2747
CASH-2747: New bailout code for part not found
This commit is contained in:
commit
71e12d6655
5 changed files with 18 additions and 18 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
const bailoutCodes = {
|
const bailoutCodes = {
|
||||||
PARTS_NOT_FOUND: 10,
|
PART_NOT_FOUND: 18,
|
||||||
};
|
};
|
||||||
|
|
||||||
export { bailoutCodes };
|
export { bailoutCodes };
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
getSubHeaderWidget() {
|
getSubHeaderWidget() {
|
||||||
switch (this.bailoutCode) {
|
switch (this.bailoutCode) {
|
||||||
case bailoutCodes.PARTS_NOT_FOUND:
|
case bailoutCodes.PART_NOT_FOUND:
|
||||||
return "PartsNotFoundSubHeaderWidget";
|
return "PartsNotFoundSubHeaderWidget";
|
||||||
default:
|
default:
|
||||||
return "FunnelSubHeaderWidget";
|
return "FunnelSubHeaderWidget";
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ describe("bailout-mixin.js", () => {
|
||||||
test("navigateToBailoutPage: dispatches SAVE_BAILOUT_CODE action with bailout code", async () => {
|
test("navigateToBailoutPage: dispatches SAVE_BAILOUT_CODE action with bailout code", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mockVm = createMockVm();
|
const mockVm = createMockVm();
|
||||||
const bailoutCode = bailoutCodes.PARTS_NOT_FOUND;
|
const bailoutCode = bailoutCodes.PART_NOT_FOUND;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await bailoutMixin.methods.navigateToBailoutPage(mockVm, bailoutCode);
|
await bailoutMixin.methods.navigateToBailoutPage(mockVm, bailoutCode);
|
||||||
|
|
@ -22,7 +22,7 @@ describe("bailout-mixin.js", () => {
|
||||||
test("navigateToBailoutPage: navigates to bailout page after saving bailout code", async () => {
|
test("navigateToBailoutPage: navigates to bailout page after saving bailout code", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mockVm = createMockVm();
|
const mockVm = createMockVm();
|
||||||
const bailoutCode = bailoutCodes.PARTS_NOT_FOUND;
|
const bailoutCode = bailoutCodes.PART_NOT_FOUND;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await bailoutMixin.methods.navigateToBailoutPage(mockVm, bailoutCode);
|
await bailoutMixin.methods.navigateToBailoutPage(mockVm, bailoutCode);
|
||||||
|
|
@ -46,7 +46,7 @@ describe("bailout-mixin.js", () => {
|
||||||
pageName: "test-page",
|
pageName: "test-page",
|
||||||
};
|
};
|
||||||
|
|
||||||
const bailoutCode = bailoutCodes.PARTS_NOT_FOUND;
|
const bailoutCode = bailoutCodes.PART_NOT_FOUND;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await bailoutMixin.methods.navigateToBailoutPage.call(mockThis, undefined, bailoutCode);
|
await bailoutMixin.methods.navigateToBailoutPage.call(mockThis, undefined, bailoutCode);
|
||||||
|
|
@ -78,7 +78,7 @@ describe("bailout-mixin.js", () => {
|
||||||
const mockVm = createMockVm();
|
const mockVm = createMockVm();
|
||||||
const mockPageName = "vehicle-damage";
|
const mockPageName = "vehicle-damage";
|
||||||
mockVm.pageName = mockPageName;
|
mockVm.pageName = mockPageName;
|
||||||
const bailoutCode = bailoutCodes.PARTS_NOT_FOUND;
|
const bailoutCode = bailoutCodes.PART_NOT_FOUND;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await bailoutMixin.methods.navigateToBailoutPage(mockVm, bailoutCode);
|
await bailoutMixin.methods.navigateToBailoutPage(mockVm, bailoutCode);
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ export default {
|
||||||
pageNameToLog: pageName,
|
pageNameToLog: pageName,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.PartsNotFound) {
|
if (result.PartNotFound) {
|
||||||
bailoutMixin.methods.navigateToBailoutPage(this, bailoutCodes.PARTS_NOT_FOUND);
|
bailoutMixin.methods.navigateToBailoutPage(this, bailoutCodes.PART_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
const partsOrQuestions = result.data.partsOrQuestions;
|
const partsOrQuestions = result.data.partsOrQuestions;
|
||||||
|
|
|
||||||
|
|
@ -1949,21 +1949,21 @@ export const actions = {
|
||||||
pageNameToLog: pageNameToLog,
|
pageNameToLog: pageNameToLog,
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.status == 500) {
|
// if (error.status == 500) {
|
||||||
return { PartsNotFound: true };
|
// return { PartNotFound: true };
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Triggers bailout
|
// Triggers bailout
|
||||||
if (response.PartsNotFound) {
|
// if (response.PartNotFound) {
|
||||||
return response;
|
// return response;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Check if we only have MISC parts to trigger bailout
|
// Check if we only have MISC parts to trigger bailout
|
||||||
const miscPartsResponse = checkIfMiscParts(response.data.partsOrQuestions);
|
// const miscPartsResponse = checkIfMiscParts(response.data.partsOrQuestions);
|
||||||
if (miscPartsResponse.PartsNotFound) {
|
// if (miscPartsResponse.PartNotFound) {
|
||||||
return miscPartsResponse;
|
// return miscPartsResponse;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Flatten location and name properties
|
// Flatten location and name properties
|
||||||
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(
|
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue