Merge pull request #848 from Safelite/defect/digital/SSR-1485

SSR-1485 Fix Non PIA navigating to payment-page
This commit is contained in:
Josh Dassinger 2024-09-19 15:15:32 -05:00 committed by GitHub
commit f43bf922ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 90 additions and 2 deletions

View file

@ -93,7 +93,12 @@ describe('payment-method.vue', () => {
payment: {
isPayInAdvance: true,
payInAdvanceType: payInAdvanceMethod
}
},
insuranceCoverage: {
coverageStatus: coverageStatuses.VERIFIED,
coverageType: coverageType.Deductible
},
currentDeductible: 1000
}
};
const wrapper = setupMocks({}, store);
@ -101,6 +106,88 @@ describe('payment-method.vue', () => {
// Act
const paymethod = wrapper.vm.getPaymentMethodFromStore();
// Assert
expect(paymethod).toBe(payInAdvanceMethod);
});
test('getting PAY_AT_TIME_OF_SERVICE when deductible is 0', async () => {
// Arrange
const payInAdvanceMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE;
const store = {
order: {
payment: {
isPayInAdvance: true,
payInAdvanceType: payInAdvanceMethod
},
insuranceCoverage: {
coverageStatus: coverageStatuses.VERIFIED,
coverageType: coverageType.Deductible
},
currentDeductible: 0
}
};
const wrapper = setupMocks({}, store);
// Act
const paymethod = wrapper.vm.getPaymentMethodFromStore();
// Assert
expect(paymethod).toBe(payInAdvanceMethod);
});
test('getting PAY_AT_TIME_OF_SERVICE when Unverified', async () => {
// Arrange
const payInAdvanceMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE;
const store = {
order: {
payment: {
isPayInAdvance: true,
payInAdvanceType: payInAdvanceMethod
},
insuranceCoverage: {
coverageStatus: coverageStatuses.PENDING,
coverageType: coverageType.Deductible
},
currentDeductible: 1000
}
};
const wrapper = setupMocks({}, store);
// Act
const paymethod = wrapper.vm.getPaymentMethodFromStore();
// Assert
expect(paymethod).toBe(payInAdvanceMethod);
});
test('getting PAY_AT_TIME_OF_SERVICE when PIA Experiment disabled', async () => {
// Arrange
const payInAdvanceMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE;
const mixin = {
methods: {
getSettingValue: jest.fn((settingName) => {
if (settingName === experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE) {
return 'false';
}
return 'false';
})
}
};
const store = {
order: {
payment: {
isPayInAdvance: true,
payInAdvanceType: payInAdvanceMethod
},
insuranceCoverage: {
coverageStatus: coverageStatuses.VERIFIED,
coverageType: coverageType.Deductible
},
currentDeductible: 1000
}
};
const wrapper = setupMocks({}, store, mixin);
// Act
const paymethod = wrapper.vm.getPaymentMethodFromStore();
// Assert
expect(paymethod).toBe(payInAdvanceMethod);
});

View file

@ -254,7 +254,8 @@ export default {
const { payInAdvanceType } = useMainStore().order.payment;
const isPayInAdvance =
useMainStore().order.payment.isPayInAdvance
&& !!payInAdvanceType;
&& !!payInAdvanceType
&& !this.isPayInAdvanceDisabled;
return isPayInAdvance
? payInAdvanceType