update to only use 0 check on deductible coverage

small linting update
This commit is contained in:
Bill Richardson 2024-06-10 16:01:59 -04:00
parent c99fb974ca
commit 159698c438
3 changed files with 18 additions and 22 deletions

View file

@ -193,7 +193,7 @@ export default {
isInitiallyExpanded: Boolean, isInitiallyExpanded: Boolean,
submittedOrder: Object submittedOrder: Object
}, },
emits: ['amountDueUpdated'], emits: ['deductibleTotalUpdated'],
data() { data() {
return { return {
isExpanded: this.isInitiallyExpanded, isExpanded: this.isInitiallyExpanded,
@ -216,7 +216,9 @@ export default {
}, },
computed: { computed: {
deductible() { deductible() {
return getDeductible(this.cartOrder); const newDeductibleTotal = getDeductible(this.cartOrder);
this.$emit('deductibleTotalUpdated', newDeductibleTotal);
return newDeductibleTotal;
}, },
showDeductibleCartItem() { showDeductibleCartItem() {
return this.isUnverified || (!this.isNoComp && !this.isITAC); return this.isUnverified || (!this.isNoComp && !this.isITAC);
@ -250,9 +252,7 @@ export default {
return getCartTotal(this.cartOrder); return getCartTotal(this.cartOrder);
}, },
amountDue() { amountDue() {
const newAmountDue = this.showAsPaid ? 0 : this.total; return this.showAsPaid ? 0 : this.total;
this.$emit('amountDueUpdated', newAmountDue);
return newAmountDue;
}, },
amountPaid() { amountPaid() {
return !this.showAsPaid ? 0 : this.total; return !this.showAsPaid ? 0 : this.total;

View file

@ -184,11 +184,11 @@ describe('payment-method.vue', () => {
// Assert // Assert
expect(result).toBeTruthy(); expect(result).toBeTruthy();
}); });
test('returns false when coverageStatus is verified and cartAmountDue > 0', () => { test('returns false when coverageStatus is verified and deductibleTotal > 0', () => {
// Arrange // Arrange
store.order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED; store.order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED;
const wrapper = setupMocks({}, store, mixin); const wrapper = setupMocks({}, store, mixin);
wrapper.vm.cartAmountDue = 34.99; wrapper.vm.deductibleTotal = 34.99;
// Act // Act
const result = wrapper.vm.isPayInAdvanceDisabled; const result = wrapper.vm.isPayInAdvanceDisabled;
@ -196,11 +196,11 @@ describe('payment-method.vue', () => {
// Assert // Assert
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });
test('returns true when coverageStatus is verified and cartAmountDue = 0', () => { test('returns true when coverageStatus is verified and deductibleTotal = 0', () => {
// Arrange // Arrange
store.order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED; store.order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED;
const wrapper = setupMocks({}, store, mixin); const wrapper = setupMocks({}, store, mixin);
wrapper.vm.cartAmountDue = 0; wrapper.vm.deductibleTotal = 0;
// Act // Act
const result = wrapper.vm.isPayInAdvanceDisabled; const result = wrapper.vm.isPayInAdvanceDisabled;

View file

@ -33,7 +33,7 @@
:isInitiallyExpanded="false" :isInitiallyExpanded="false"
recyclingModalCmsWidgetName="RecycleModal" recyclingModalCmsWidgetName="RecycleModal"
servicePackageTitleWidgetName="ServicePackageTitle" servicePackageTitleWidgetName="ServicePackageTitle"
@amountDueUpdated="updateAmountDue" /> @deductibleTotalUpdated="updateDeductibleTotal" />
<hr class="mt-0 mb-5" /> <hr class="mt-0 mb-5" />
<alert <alert
v-if="displayPayInAdvanceAlert" v-if="displayPayInAdvanceAlert"
@ -163,7 +163,7 @@ export default {
}, },
data() { data() {
return { return {
cartAmountDue: 0, deductibleTotal: 0,
paymentMethodInternalModel: this.getPaymentMethodFromStore(), paymentMethodInternalModel: this.getPaymentMethodFromStore(),
rules: { rules: {
optionRequired: globalRules.OPTION_REQUIRED optionRequired: globalRules.OPTION_REQUIRED
@ -189,9 +189,9 @@ export default {
isPayInAdvanceDisabled() { isPayInAdvanceDisabled() {
const piaExperience = this.getSettingValue(experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE); const piaExperience = this.getSettingValue(experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE);
const isEnabled = piaExperience === 'true'; const isEnabled = piaExperience === 'true';
const isAmountDueEqualToZero = this.cartAmountDue === 0; const isDeductibleTotalEqualToZero = this.deductibleTotal === 0;
return !isEnabled || useMainStore().isUnverified || isAmountDueEqualToZero; return !isEnabled || useMainStore().isUnverified || (useMainStore().isDeductible && isDeductibleTotalEqualToZero);
}, },
paymentMethod() { paymentMethod() {
return this.paymentMethodInternalModel; return this.paymentMethodInternalModel;
@ -245,11 +245,8 @@ export default {
&& providerLocation.zipCode && providerLocation.zipCode
); );
const isMobile = const isMobile = serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE
serviceLocation.appointmentType || serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
=== AppointmentTypeStrings.MOBILE
|| serviceLocation.appointmentType
=== AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP;
const serviceLocationReqs = const serviceLocationReqs =
(isMobile && mobileReqs) || (!isMobile && dropOffInshopReqs); (isMobile && mobileReqs) || (!isMobile && dropOffInshopReqs);
@ -265,8 +262,7 @@ export default {
); );
// Customer // Customer
const { firstName, lastName, emailAddress } = const { firstName, lastName, emailAddress } = useMainStore().order.customer;
useMainStore().order.customer;
const customerReqs = !!(firstName && lastName && emailAddress); const customerReqs = !!(firstName && lastName && emailAddress);
// Contact Info // Contact Info
@ -298,8 +294,8 @@ export default {
? payInAdvanceType ? payInAdvanceType
: paymentMethods.PAY_AT_TIME_OF_SERVICE; : paymentMethods.PAY_AT_TIME_OF_SERVICE;
}, },
updateAmountDue(newAmountDue) { updateDeductibleTotal(newDeductibleTotal) {
this.cartAmountDue = newAmountDue; this.deductibleTotal = newDeductibleTotal;
}, },
updateFooterButtonText(newValue) { updateFooterButtonText(newValue) {
this.$refs.siteFooter.updateButtonText(newValue); this.$refs.siteFooter.updateButtonText(newValue);