diff --git a/src/iss-components/cart-dropdown/cart-dropdown.vue b/src/iss-components/cart-dropdown/cart-dropdown.vue index d99747a4..03570058 100644 --- a/src/iss-components/cart-dropdown/cart-dropdown.vue +++ b/src/iss-components/cart-dropdown/cart-dropdown.vue @@ -193,6 +193,7 @@ export default { isInitiallyExpanded: Boolean, submittedOrder: Object }, + emits: ['amountDueUpdated'], data() { return { isExpanded: this.isInitiallyExpanded, @@ -249,7 +250,9 @@ export default { return getCartTotal(this.cartOrder); }, amountDue() { - return this.showAsPaid ? 0 : this.total; + const newAmountDue = this.showAsPaid ? 0 : this.total; + this.$emit('amountDueUpdated', newAmountDue); + return newAmountDue; }, amountPaid() { return !this.showAsPaid ? 0 : this.total; diff --git a/src/layouts/payment-method/payment-method.spec.js b/src/layouts/payment-method/payment-method.spec.js index 3e526b84..c3261972 100644 --- a/src/layouts/payment-method/payment-method.spec.js +++ b/src/layouts/payment-method/payment-method.spec.js @@ -184,10 +184,11 @@ describe('payment-method.vue', () => { // Assert expect(result).toBeTruthy(); }); - test('returns false when coverageStatus is verified', () => { + test('returns false when coverageStatus is verified and cartAmountDue > 0', () => { // Arrange store.order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED; const wrapper = setupMocks({}, store, mixin); + wrapper.vm.cartAmountDue = 34.99; // Act const result = wrapper.vm.isPayInAdvanceDisabled; @@ -195,6 +196,18 @@ describe('payment-method.vue', () => { // Assert expect(result).toBeFalsy(); }); + test('returns true when coverageStatus is verified and cartAmountDue = 0', () => { + // Arrange + store.order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED; + const wrapper = setupMocks({}, store, mixin); + wrapper.vm.cartAmountDue = 0; + + // Act + const result = wrapper.vm.isPayInAdvanceDisabled; + + // Assert + expect(result).toBeTruthy(); + }); test('returns true when pia not enabled', () => { // Arrange mixin = { diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 164c6bbe..f92340a9 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -32,7 +32,8 @@ :showDropdownHeader="true" :isInitiallyExpanded="false" recyclingModalCmsWidgetName="RecycleModal" - servicePackageTitleWidgetName="ServicePackageTitle" /> + servicePackageTitleWidgetName="ServicePackageTitle" + @amountDueUpdated="updateAmountDue" />