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

View file

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

View file

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