Merge pull request #1899 from Safelite/feature/CSR-2130

Feature/csr 2130
This commit is contained in:
CarlNation 2024-07-11 14:44:15 -04:00 committed by GitHub
commit e9905969a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 2 deletions

View file

@ -108,6 +108,9 @@ describe("Payment Method Question", () => {
function generateDefaultProps() { function generateDefaultProps() {
return { return {
modelValue: "modelValue", modelValue: "modelValue",
hasRecal: false,
isApplePay: true,
isInsurance: false,
}; };
} }

View file

@ -10,6 +10,8 @@
isRequired isRequired
:validationRules="validationRules" :validationRules="validationRules"
:hasRecal="hasRecal" :hasRecal="hasRecal"
:isApplePay="isApplePay"
:isInsurance="isInsurance"
v-model="selectedMethod" v-model="selectedMethod"
textPosition="text-start" /> textPosition="text-start" />
</div> </div>
@ -31,6 +33,8 @@ export default {
modelValue: String, modelValue: String,
validationRules: String, validationRules: String,
hasRecal: Boolean, hasRecal: Boolean,
isApplePay: Boolean,
isInsurance: Boolean,
}, },
methods: { methods: {
getAnswersNullSafe(widgetName) { getAnswersNullSafe(widgetName) {
@ -60,8 +64,27 @@ export default {
if (this.hasRecal) { if (this.hasRecal) {
cmsData = this.getAnswersNullSafe("PaymentMethodHasRecalWidget"); cmsData = this.getAnswersNullSafe("PaymentMethodHasRecalWidget");
} else { } else {
cmsData = this.getAnswersNullSafe("PaymentMethodWidget"); if (this.isApplePay) {
cmsData = this.getAnswersNullSafe("PaymentMethodWidget");
} else {
cmsData = this.getAnswersNullSafe("PaymentMethodHasRecalWidget");
}
} }
if (this.hasRecal || this.isInsurance) {
var tempItems = cmsData.map((answer) => {
return {
buttonLabel: answer.Text,
altText: answer.Text,
groupName: "payment-method",
value: answer.Name,
buttonImage: answer.AnswerImageUrl,
};
});
return tempItems.filter((a) => a.value != "Insurance");
}
return cmsData.map((answer) => { return cmsData.map((answer) => {
return { return {
buttonLabel: answer.Text, buttonLabel: answer.Text,

View file

@ -68,6 +68,8 @@
v-if="isPiaEnabled && totalAmountDue > 0" v-if="isPiaEnabled && totalAmountDue > 0"
v-model="paymentMethodInternalModel" v-model="paymentMethodInternalModel"
:hasRecal="hasRecal" :hasRecal="hasRecal"
:isApplePay="isApplePay"
:isInsurance="isInsurance"
validationRules="payment-method-required" /> validationRules="payment-method-required" />
<alert <alert
@ -344,7 +346,6 @@ export default {
availableVaps: [], availableVaps: [],
paymentMethodInternalModel: this.getPaymentMethodFromStore(), paymentMethodInternalModel: this.getPaymentMethodFromStore(),
inactivePromos: this.getInactivePromosFromStore(), inactivePromos: this.getInactivePromosFromStore(),
isAppleDevice: false,
isRecalAckOptIn: false, isRecalAckOptIn: false,
}; };
}, },
@ -574,6 +575,12 @@ export default {
} }
return false; return false;
}, },
isApplePay() {
if (window.ApplePaySession && window.ApplePaySession.canMakePayments()) {
return true;
}
return false;
},
damageInfo() { damageInfo() {
return this.$store.getters.damage; return this.$store.getters.damage;
}, },