diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index 5c056c934..5e12b0d9d 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -19,6 +19,7 @@ const queryStrings = { AUTH_CODE: "auth_code", TRANSACTION_ID: "transaction_id", TRANS_REFERENCE_NUMBER: "auth_trans_ref_no", + LAST_FOUR: "last_four", DISPLAY_PIA_ALERT: "displayPiaAlert", }; diff --git a/src/digital-components/question-chain/question-chain.spec.js b/src/digital-components/question-chain/question-chain.spec.js index 2444fd22d..d516afc03 100644 --- a/src/digital-components/question-chain/question-chain.spec.js +++ b/src/digital-components/question-chain/question-chain.spec.js @@ -265,8 +265,8 @@ describe("Question Chain component", () => { ], }, ], - index: 0, }); + await wrapper.setProps({ index: 0 }); //Act const result = wrapper.vm.getQuestionChainAnswerIfComplete(testReturnedAnswer); diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index cd50a8fda..2d268e81a 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -834,7 +834,7 @@ export default { display: flex; justify-content: space-between; padding: 0.5rem 1.5rem; - &:nth-last-child(-n + 3) { + &:nth-last-child(-n + 4) { background-color: $green-100; } &:last-child { diff --git a/src/layouts/capability-questions/capability-questions.vue b/src/layouts/capability-questions/capability-questions.vue index 717865e41..e46629bf1 100644 --- a/src/layouts/capability-questions/capability-questions.vue +++ b/src/layouts/capability-questions/capability-questions.vue @@ -5,11 +5,13 @@ :isMetaValid="meta.valid" :alertFewMoreQuestionsHeader="AlertFewMoreQuestionsHeader" :alertFewMoreQuestionsCopy="AlertFewMoreQuestionsCopy" + v-if="questionsData" :questionsData="questionsData" validationRules="questions-required" v-model="selectedAnswers" @forwardButtonAction="forwardButtonAction" @back-click="navigateBack" + :key="currentGlassIndex" :index="currentGlassIndex" /> @@ -55,7 +57,7 @@ export default { }, data() { return { - questionsData: [], + questionsData: null, selectedAnswers: {}, currentGlassIndex: 0, }; @@ -120,6 +122,12 @@ export default { return updatedGlass; }); + + // if no preanswered questions then make sure index starts with the correct value + this.currentGlassIndex = this.calculateQuestionIndex( + this.currentGlassIndex, + this.questionsData + ); }, async forwardButtonAction() { const questionAnswersArray = this.questionsData.map((glass) => { diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 45c73f096..d9fe2e479 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -145,6 +145,8 @@ export default { computed: { ShowCart() { if (this.isPia && store.getters.submittedOrder.settledTenderAmount == 0) { + // settleTenderAmount always shows 0 via localhost or dev. + // Temporarily set return true to see cart in localhost or dev environment return false; } diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index ee1b33a9f..b2d6804bc 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -5,11 +5,13 @@ :isMetaValid="meta.valid" :alertFewMoreQuestionsHeader="AlertFewMoreQuestionsHeader" :alertFewMoreQuestionsCopy="AlertFewMoreQuestionsCopy" + v-if="questionsData" :questionsData="questionsData" validationRules="questions-required" v-model="selectedAnswers" @forwardButtonAction="forwardButtonAction" @back-click="navigateBack" + :key="currentGlassIndex" :index="currentGlassIndex" /> @@ -55,7 +57,7 @@ export default { }, data() { return { - questionsData: [], + questionsData: null, selectedAnswers: {}, currentGlassIndex: 0, }; @@ -119,6 +121,12 @@ export default { return updatedGlass; }); + + // if no preanswered questions then make sure index starts with the correct value + this.currentGlassIndex = this.calculateQuestionIndex( + this.currentGlassIndex, + this.questionsData + ); }, async forwardButtonAction() { const questionAnswersArray = this.questionsData.map((glass) => { diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 113e91e42..9f4a13902 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -5,11 +5,13 @@ :isMetaValid="meta.valid" :alertFewMoreQuestionsHeader="AlertFewMoreQuestionsHeader" :alertFewMoreQuestionsCopy="AlertFewMoreQuestionsCopy" + v-if="questionsData" :questionsData="questionsData" validationRules="questions-required" v-model="selectedAnswers" @forwardButtonAction="forwardButtonAction" @back-click="navigateBack" + :key="currentGlassIndex" :index="currentGlassIndex" /> @@ -55,7 +57,7 @@ export default { }, data() { return { - questionsData: [], + questionsData: null, selectedAnswers: {}, currentGlassIndex: 0, }; @@ -71,7 +73,7 @@ export default { return this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS).partsOrQuestions; }, }, - created() { + mounted() { this.getInitialQuestionData(); }, methods: { @@ -117,6 +119,12 @@ export default { return updatedGlass; }); + + // if no preanswered questions then make sure index starts with the correct value + this.currentGlassIndex = this.calculateQuestionIndex( + this.currentGlassIndex, + this.questionsData + ); }, async forwardButtonAction() { const questionAnswersArray = this.questionsData.map((glass) => { diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 96f2fda75..ea9633157 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -15,10 +15,6 @@ -

- {{ noPiaDisclaimer }} -

-
@@ -56,6 +52,13 @@ v-model="paymentMethodInternalModel" validationRules="option-required" /> + + { + this.value = this.value.replace(ALPHANUMERIC_REGEX, ""); + }); }, }, components: { diff --git a/src/layouts/payment-pia-return/payment-pia-return.vue b/src/layouts/payment-pia-return/payment-pia-return.vue index 5b007fffe..45a68d91b 100644 --- a/src/layouts/payment-pia-return/payment-pia-return.vue +++ b/src/layouts/payment-pia-return/payment-pia-return.vue @@ -106,6 +106,7 @@ export default { const transReferenceNumber = getQuerystringParameter( queryStrings.TRANS_REFERENCE_NUMBER ); + const lastFour = getQuerystringParameter(queryStrings.LAST_FOUR); var ccToken = { subscriptionId: subscriptionID, @@ -119,6 +120,7 @@ export default { authCode: authCode, transactionId: transactionId, transReferenceNumber: transReferenceNumber, + lastFour: lastFour, }; baseMixin.methods.dispatchStoreAction(storeActions.SAVE_CCTOKEN, ccToken, false); await this.saveAndSubmitWorkOrder(); diff --git a/src/layouts/quote/afterpay-modal-banner/afterpay-modal-banner.vue b/src/layouts/quote/afterpay-modal-banner/afterpay-modal-banner.vue new file mode 100644 index 000000000..6eb8a5a87 --- /dev/null +++ b/src/layouts/quote/afterpay-modal-banner/afterpay-modal-banner.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index e48e8fff8..5c6b2d744 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -34,6 +34,11 @@ validationRules="option-required" isRequired /> + + diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index d79e4f5b3..d0fd9dd1b 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -146,6 +146,13 @@ export default { return glass; }, + calculateQuestionIndex(currentGlassIndex, questionsData) { + // if no preanswered questions then make sure index starts with the correct value + if (currentGlassIndex === 0) { + return questionsData?.findIndex((glass) => glass.questions?.length > 0); + } + return currentGlassIndex; + }, handleCompletedQuestionChainAnswers(answer, glassKey, vm) { // only runs when all questions in a question-chain have been answered // when selectedAnswers updates, user has completed this part's question chain and has a final answer diff --git a/src/mixins/vehicle-questions-mixin.spec.js b/src/mixins/vehicle-questions-mixin.spec.js index f87d7efdc..56f4425cc 100644 --- a/src/mixins/vehicle-questions-mixin.spec.js +++ b/src/mixins/vehicle-questions-mixin.spec.js @@ -411,6 +411,57 @@ describe("vehicle-questions-mixin", () => { }); }); + describe("calculateQuestionIndex", () => { + describe("if currentGlassIndex is zero...", () => { + test("should return index of first glass piece with questions", () => { + // Arrange + const questionsData = [ + { + glassName: "Single", + glassLocation: "Windshield", + }, + { + glassName: "Front", + glassLocation: "Driver", + questions: ["example question"], + }, + ]; + const glassIndex = 0; + const { wrapper } = setupMocks({}); + + // Act + const returnedIndex = wrapper.vm.calculateQuestionIndex(glassIndex, questionsData); + + // Assert + expect(returnedIndex).toBe(1); + }); + }); + describe("if currentGlassIndex is NOT zero...", () => { + test("should return currentGlassIndex value", () => { + // Arrange + const questionsData = [ + { + glassName: "Single", + glassLocation: "Windshield", + }, + { + glassName: "Front", + glassLocation: "Driver", + questions: ["example question"], + }, + ]; + const glassIndex = 1; + const { wrapper } = setupMocks({}); + + // Act + const returnedIndex = wrapper.vm.calculateQuestionIndex(glassIndex, questionsData); + + // Assert + expect(returnedIndex).toBe(1); + }); + }); + }); + describe("handleCompletedQuestionChainAnswers", () => { describe("selectedAnswers", () => { test("should be cleared to be empty", () => { diff --git a/src/store/index.js b/src/store/index.js index f023bd708..ce236d6b2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -115,6 +115,7 @@ const getDefaultState = () => { authCode: null, transactionId: null, transReferenceNumber: null, + lastFour: null, }, }, schedule: { @@ -274,6 +275,7 @@ export const mutations = { state.order.payment.ccToken.authCode = ccToken.authCode; state.order.payment.ccToken.transactionId = ccToken.transactionId; state.order.payment.ccToken.transReferenceNumber = ccToken.transReferenceNumber; + state.order.payment.ccToken.lastFour = ccToken.lastFour; }, updatePaypalToken(state, ppToken) { state.order.payment.paypalToken = ppToken; @@ -1680,6 +1682,7 @@ export const actions = { authCode: order.payment.ccToken.authCode, transactionId: order.payment.ccToken.transactionId, transReferenceNumber: order.payment.ccToken.transReferenceNumber, + lastFour: order.payment.ccToken.lastFour, }, }, serviceLocation: { diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 990e52f4f..81ef8f052 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -742,6 +742,7 @@ describe("Actions", () => { authCode: null, transactionId: null, transReferenceNumber: null, + lastFour: null, }, }, serviceLocation: {},