Merge pull request #2296 from Safelite/feature/CASH-201
CASH-201 | Add "Pay on my own" link
This commit is contained in:
commit
d8eadc27e4
3 changed files with 72 additions and 1 deletions
|
|
@ -16,6 +16,13 @@
|
||||||
v-model="parentAccountNumber"
|
v-model="parentAccountNumber"
|
||||||
:originalList="originalList" />
|
:originalList="originalList" />
|
||||||
</div>
|
</div>
|
||||||
|
<textLink
|
||||||
|
id="payOnMyOwnBackButton"
|
||||||
|
useLoadingModal
|
||||||
|
linkType="text"
|
||||||
|
:text="payWithCashButtonCopy"
|
||||||
|
href="javascript:void(0)"
|
||||||
|
@click-event="backButtonAction(foreceCashSelectionOnQuote = true)" />
|
||||||
|
|
||||||
<navbar
|
<navbar
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
|
|
@ -36,6 +43,7 @@ import navbar from "@/fmg-components/nav-bar/nav-bar";
|
||||||
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
||||||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
import insuranceCompanyQuestion from "@/layouts/insurance-company/insurance-company-question";
|
import insuranceCompanyQuestion from "@/layouts/insurance-company/insurance-company-question";
|
||||||
|
import textLink from "../../ux-components/text-link/text-link.vue";
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
|
|
@ -92,6 +100,9 @@ export default {
|
||||||
isParentAccountNumber() {
|
isParentAccountNumber() {
|
||||||
return !!this.parentAccountNumber;
|
return !!this.parentAccountNumber;
|
||||||
},
|
},
|
||||||
|
payWithCashButtonCopy() {
|
||||||
|
return this.getCmsContent("PayWithCashWidget", "Text");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isCashParentAccountNumber() {
|
isCashParentAccountNumber() {
|
||||||
|
|
@ -109,8 +120,13 @@ export default {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return store.getters.order.payment.isInsurance === true;
|
return store.getters.order.payment.isInsurance === true;
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction(forceCashSelectionOnQuote) {
|
||||||
// Go back to Quote page
|
// Go back to Quote page
|
||||||
|
if (forceCashSelectionOnQuote) {
|
||||||
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route, {"isCashSelected": true});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
|
|
@ -157,6 +173,7 @@ export default {
|
||||||
Form,
|
Form,
|
||||||
loadingModal,
|
loadingModal,
|
||||||
insuranceCompanyQuestion,
|
insuranceCompanyQuestion,
|
||||||
|
textLink,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -577,6 +577,56 @@ describe("quote.vue", () => {
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.isInsuranceSelected).toBe(false);
|
expect(wrapper.vm.isInsuranceSelected).toBe(false);
|
||||||
});
|
});
|
||||||
|
test("should default to cash if isCashSelected is true, despite all other checks pointing to insurance selection", async () => {
|
||||||
|
// Also needs no query parameter or previous selection in store to be present
|
||||||
|
//Arrange
|
||||||
|
|
||||||
|
store.getters = {
|
||||||
|
lineItems: {
|
||||||
|
glassParts: ["item", "item2"],
|
||||||
|
},
|
||||||
|
applicationUser: {
|
||||||
|
experiments: [],
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
glassParts: ["item", "item2"],
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
isInsurance: true,
|
||||||
|
},
|
||||||
|
customer: {
|
||||||
|
emailAddress: "test@test.com",
|
||||||
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
state: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
vehicle: {
|
||||||
|
cardId: "123",
|
||||||
|
},
|
||||||
|
experimentSettings: {
|
||||||
|
settingName: "SERVICE_PACKAGE_DISCOUNT",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
mockTierOnePrice = 505;
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
||||||
|
//Act
|
||||||
|
await quote.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "quote",
|
||||||
|
isInsuranceSelected: true,
|
||||||
|
isCashSelected: true,
|
||||||
|
} },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(wrapper.vm.isInsuranceSelected).toBe(false);
|
||||||
|
});
|
||||||
test("should default to insurance if total economy package price is over $500", async () => {
|
test("should default to insurance if total economy package price is over $500", async () => {
|
||||||
// Also needs no query parameter or previous selection in store to be present
|
// Also needs no query parameter or previous selection in store to be present
|
||||||
//Arrange
|
//Arrange
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,10 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getIsInsuranceSelectedValue = (availableLineItems, insuranceThreshold) => {
|
const getIsInsuranceSelectedValue = (availableLineItems, insuranceThreshold) => {
|
||||||
|
// query param checked here is set on insurance-selection "Pay on my own" link click
|
||||||
|
if (to.query?.isCashSelected || to.query?.iscashselected) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const serviceLocationState = store.getters.order.serviceLocation.state;
|
const serviceLocationState = store.getters.order.serviceLocation.state;
|
||||||
|
|
||||||
// usually true when returning from heritage but can be false when returning from heritage on a save quote
|
// usually true when returning from heritage but can be false when returning from heritage on a save quote
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue