From eca795a3412d479ce2ac4db2bb06da044dac9530 Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Wed, 26 Jan 2022 14:07:25 -0700 Subject: [PATCH 01/11] R36: UI Implementation 1. Added UI component , routing, UI validation 2. Added testcafe --- .../src/components/template/TheNavBar.vue | 17 +- frontend/src/router/index.js | 11 +- frontend/src/services/GroupMemberService.js | 7 +- .../CancelGroupMemberDependent.vue | 156 ++++++++++++++++++ .../src/views/groupmember/GroupMemberHome.vue | 3 +- .../groupmember/CancelGroupMemberDependent.js | 16 ++ .../CancelGroupMemberDependentTest.js | 105 ++++++++++++ 7 files changed, 300 insertions(+), 15 deletions(-) create mode 100644 frontend/src/views/groupmember/CancelGroupMemberDependent.vue create mode 100644 frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js create mode 100644 frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js diff --git a/frontend/src/components/template/TheNavBar.vue b/frontend/src/components/template/TheNavBar.vue index 01590faf..35559c61 100644 --- a/frontend/src/components/template/TheNavBar.vue +++ b/frontend/src/components/template/TheNavBar.vue @@ -9,10 +9,10 @@ @@ -30,10 +30,11 @@ @@ -88,7 +89,7 @@ export default { const hasPermission = this.$store.getters['auth/hasPermission'] return hasPermission('E45') || hasPermission('R15') || hasPermission('R41') }, - } + }, } diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index e1c858fc..242a60f2 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -20,6 +20,7 @@ import AddVisaResidentWithoutPHN from '../views/coverage/enrollment/AddVisaResid import GroupMemberHome from '../views/groupmember/GroupMemberHome.vue' import CancelGroupMember from '../views/groupmember/CancelGroupMember.vue' import UpdateNumberAndDept from '../views/groupmember/UpdateNumberAndDept.vue' +import CancelGroupMemberDependent from '../views/groupmember/CancelGroupMemberDependent.vue' import CoverageMaintenanceHome from '../views/coverage/maintenance/CoverageMaintenanceHome.vue' @@ -107,15 +108,19 @@ const routes = [ { path: 'updateNumberAndDept', name: 'UpdateNumberAndDept', - component: UpdateNumberAndDept, + component: UpdateNumberAndDept, }, { path: 'cancelGroupMember', name: 'CancelGroupMember', component: CancelGroupMember, }, - - ] + { + path: 'cancelGroupMemberDependent', + name: 'CancelGroupMemberDependent', + component: CancelGroupMemberDependent, + }, + ], }, { path: '/help', diff --git a/frontend/src/services/GroupMemberService.js b/frontend/src/services/GroupMemberService.js index ff5968df..d9b42423 100644 --- a/frontend/src/services/GroupMemberService.js +++ b/frontend/src/services/GroupMemberService.js @@ -2,11 +2,14 @@ import { apiRequest, resources } from './BaseService' export default { - updateNumberAndDept(request) { - return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.updateNumberAndDept, request)) + updateNumberAndDept(request) { + return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.updateNumberAndDept, request)) }, cancelGroupMember(request) { return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.cancelGroupMember, request)) }, + cancelGroupMemberDependent(request) { + return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.cancelGroupMemberDependent, request)) + }, } \ No newline at end of file diff --git a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue new file mode 100644 index 00000000..bf8fb312 --- /dev/null +++ b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/frontend/src/views/groupmember/GroupMemberHome.vue b/frontend/src/views/groupmember/GroupMemberHome.vue index 6dc73cf4..31384079 100644 --- a/frontend/src/views/groupmember/GroupMemberHome.vue +++ b/frontend/src/views/groupmember/GroupMemberHome.vue @@ -7,6 +7,7 @@ import SubNavTab from '../../components/template/SubNavTab.vue' + @@ -16,5 +17,3 @@ export default { name: 'GroupMemberHome', } - - diff --git a/frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js b/frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js new file mode 100644 index 00000000..826a2fb4 --- /dev/null +++ b/frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js @@ -0,0 +1,16 @@ +import { Selector } from 'testcafe' + +class CancelGroupMemberDependent { + constructor() { + this.phnInput = Selector('#phn') + this.dependentPhnInput = Selector('#dependentPhn') + this.groupNumberInput = Selector('#groupNumber') + this.cancelDateInput = Selector('#dp-input-cancelDate') + this.cancelReasonInput = Selector('#cancelReason') + this.submitButton = Selector('button[type="submit"]') + this.clearButton = Selector('button[type="button"]') + this.errorText = Selector('div').withAttribute('class', 'error-text') + } +} + +export default new CancelGroupMemberDependent() diff --git a/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js b/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js new file mode 100644 index 00000000..a510bfe7 --- /dev/null +++ b/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js @@ -0,0 +1,105 @@ +import AlertPage from '../../pages/AlertPage' +import CancelGroupMemberDependent from '../../pages/groupmember/CancelGroupMemberDependent' +import { SITE_UNDER_TEST } from '../../configuration' +import { regularAccUser } from '../../roles/roles' + +const ERROR_MESSAGE = 'Please correct errors before submitting' +const PHN_REQUIRED_MESSAGE = 'PHN is required' +const INVALID_PHN_ERROR_MESSAGE = 'PHN format is invalid' +const GROUP_NUMBER_REQUIRED_MESSAGE = 'Group Number is required' +const INVALID_GROUP_NUMBER_ERROR_MESSAGE = 'Group Number is invalid' +const COVERAGE_CANCEL_DATE_REQUIRED_MESSAGE = 'Coverage Cancel Date is required' +const DEPENDENT_PHN_REQUIRED_MESSAGE = 'PHN is required' +const CANCEL_REASON_REQUIRED_MESSAGE = 'Cancel Reason is required' +const RAPID_RESPONSE = 'RPBS0003 SUBSCRIBER PHN MUST BE ENTERED' + +const PAGE_TO_TEST = SITE_UNDER_TEST + '/groupmember/CancelGroupMemberDependent' + +fixture(`CancelGroupMemberDependent Page`).disablePageCaching`Test CancelGroupMemberDependent` + .beforeEach(async (t) => { + await t.useRole(regularAccUser) + }) + .page(PAGE_TO_TEST) + +test('Check required fields validation', async (t) => { + await t + // Given required fields aren't filled out (phn, dependent phn, group member, group member number, department) + // When I click the submit button + .click(CancelGroupMemberDependent.submitButton) + // I expect an error message stating the page had errors and individual error messages for each required field + .expect(AlertPage.alertBannerText.textContent) + .contains(ERROR_MESSAGE) + .expect(CancelGroupMemberDependent.errorText.nth(0).textContent) + .contains(GROUP_NUMBER_REQUIRED_MESSAGE) + .expect(CancelGroupMemberDependent.errorText.nth(1).textContent) + .contains(PHN_REQUIRED_MESSAGE) + .expect(CancelGroupMemberDependent.errorText.nth(2).textContent) + .contains(DEPENDENT_PHN_REQUIRED_MESSAGE) + .expect(CancelGroupMemberDependent.errorText.nth(3).textContent) + .contains(COVERAGE_CANCEL_DATE_REQUIRED_MESSAGE) + .expect(CancelGroupMemberDependent.errorText.nth(4).textContent) + .contains(CANCEL_REASON_REQUIRED_MESSAGE) +}) + +test('Check invalid formats validation', async (t) => { + await t + // Given I enter PHN, Dependent PHN, Group Number, and Cancel dates with invalid formats + .typeText(CancelGroupMemberDependent.phnInput, '9000448000') + .typeText(CancelGroupMemberDependent.dependentPhnInput, '9000448000') + .typeText(CancelGroupMemberDependent.groupNumberInput, '123') + // When I click the submit button + .click(CancelGroupMemberDependent.submitButton) + // I expect an error message stating the page had errors and an individual error message for the PHN and Group and Cancel Date formats + .expect(CancelGroupMemberDependent.errorText.nth(0).textContent) + .contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE) + .expect(CancelGroupMemberDependent.errorText.nth(1).textContent) + .contains(INVALID_PHN_ERROR_MESSAGE) + .expect(CancelGroupMemberDependent.errorText.nth(2).textContent) + .contains(INVALID_PHN_ERROR_MESSAGE) + .expect(AlertPage.alertBannerText.textContent) + .contains(ERROR_MESSAGE) +}) + +test('Check properly filled form passes validation', async (t) => { + await t + // Given I have a form filled out with data + .typeText(CancelGroupMemberDependent.phnInput, '9397105575') + .typeText(CancelGroupMemberDependent.dependentPhnInput, '9397105575') + .typeText(CancelGroupMemberDependent.cancelDateInput, '2022-12') + .pressKey('tab') + .click(CancelGroupMemberDependent.groupNumberInput) + .typeText(CancelGroupMemberDependent.groupNumberInput, '6243109') + .click(CancelGroupMemberDependent.cancelReasonInput) + .pressKey('down') + .pressKey('enter') + // When I click the submit button + .click(CancelGroupMemberDependent.submitButton) + // I expect a response from RAPID + .expect(AlertPage.alertBannerText.textContent) + .contains(RAPID_RESPONSE) +}) + +test('Check clear button clears the form', async (t) => { + await t + // Given I have a form filled out with data + .typeText(CancelGroupMemberDependent.phnInput, '9882807277') + .typeText(CancelGroupMemberDependent.dependentPhnInput, '9882807277') + .typeText(CancelGroupMemberDependent.groupNumberInput, '6337109') + .click(CancelGroupMemberDependent.cancelReasonInput) + .pressKey('down') + .typeText(CancelGroupMemberDependent.cancelDateInput, '2022-12') + .pressKey('tab') + // When I click the clear button + .click(CancelGroupMemberDependent.clearButton) + // I expect the form to be cleared + .expect(CancelGroupMemberDependent.phnInput.value) + .eql('') + .expect(CancelGroupMemberDependent.dependentPhnInput.value) + .eql('') + .expect(CancelGroupMemberDependent.groupNumberInput.value) + .eql('') + .expect(CancelGroupMemberDependent.cancelReasonInput.value) + .eql('') + .expect(CancelGroupMemberDependent.cancelDateInput.value) + .eql('') +}) From d1ca825fbb8ba941e259c266d6a7e3fda5aef6f9 Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Thu, 27 Jan 2022 11:22:26 -0700 Subject: [PATCH 02/11] R36: UI and Testcafe update 1. Added route 2. Added relationship field and validation 3 Updated testcafe --- frontend/src/services/BaseService.js | 3 ++- .../groupmember/CancelGroupMemberDependent.vue | 15 ++++++++++++++- .../groupmember/CancelGroupMemberDependent.js | 2 ++ .../CancelGroupMemberDependentTest.js | 16 ++++++++++------ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/frontend/src/services/BaseService.js b/frontend/src/services/BaseService.js index c3620d40..54a33bd4 100644 --- a/frontend/src/services/BaseService.js +++ b/frontend/src/services/BaseService.js @@ -16,9 +16,10 @@ export const resources = { groupMember: { updateNumberAndDept: '/group-member/update-number-and-dept', cancelGroupMember: '/group-member/cancel-group-member', + cancelGroupMemberDependent: '/group-member/cancel-group-member-dependent', }, user: { - permissions: '/user/permissions' + permissions: '/user/permissions', }, } diff --git a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue index bf8fb312..6b01f294 100644 --- a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue +++ b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue @@ -11,6 +11,11 @@ + + + + + @@ -59,6 +64,7 @@ export default { groupNumber: '', phn: '', dependentPhn: '', + relationship: '', cancelDate: null, cancelReason: '', result: { @@ -69,7 +75,11 @@ export default { cancelReasons: [ { text: 'Divorced', value: 'K' }, { text: 'No longer a child', value: 'E' }, - { text: 'out of province move', value: 'E' }, + { text: 'Out of province move', value: 'E' }, + ], + relationshipOption: [ + { text: 'Spouse', value: 'S' }, + { text: 'Dependent', value: 'D' }, ], } }, @@ -96,6 +106,7 @@ export default { phn: this.phn, dependentPhn: this.dependentPhn, groupNumber: this.groupNumber, + relationship: this.relationship, coverageCancelDate: this.cancelDateAdjusted, cancelReason: this.cancelReason, }) @@ -124,6 +135,7 @@ export default { this.phn = '' this.dependentPhn = '' this.groupNumber = '' + this.relationship = '' this.cancelDate = null this.cancelReason = '' this.result = null @@ -142,6 +154,7 @@ export default { required, validatePHN: helpers.withMessage(VALIDATE_PHN_MESSAGE, validatePHN), }, + relationship: {}, groupNumber: { required, validateGroupNumber: helpers.withMessage(VALIDATE_GROUP_NUMBER_MESSAGE, validateGroupNumber), diff --git a/frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js b/frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js index 826a2fb4..f5d5cf6a 100644 --- a/frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js +++ b/frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js @@ -5,10 +5,12 @@ class CancelGroupMemberDependent { this.phnInput = Selector('#phn') this.dependentPhnInput = Selector('#dependentPhn') this.groupNumberInput = Selector('#groupNumber') + this.relationshipInput = Selector('#relationship') this.cancelDateInput = Selector('#dp-input-cancelDate') this.cancelReasonInput = Selector('#cancelReason') this.submitButton = Selector('button[type="submit"]') this.clearButton = Selector('button[type="button"]') + this.divSelectedDate = Selector('div').withAttribute('class', 'dp__overlay_cell_active dp__overlay_cell_pad') this.errorText = Selector('div').withAttribute('class', 'error-text') } } diff --git a/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js b/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js index a510bfe7..ec3cfd2c 100644 --- a/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js +++ b/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js @@ -63,17 +63,17 @@ test('Check invalid formats validation', async (t) => { test('Check properly filled form passes validation', async (t) => { await t // Given I have a form filled out with data + .typeText(CancelGroupMemberDependent.groupNumberInput, '6243109') .typeText(CancelGroupMemberDependent.phnInput, '9397105575') .typeText(CancelGroupMemberDependent.dependentPhnInput, '9397105575') - .typeText(CancelGroupMemberDependent.cancelDateInput, '2022-12') - .pressKey('tab') - .click(CancelGroupMemberDependent.groupNumberInput) - .typeText(CancelGroupMemberDependent.groupNumberInput, '6243109') + .click(CancelGroupMemberDependent.cancelDateInput) + .click(CancelGroupMemberDependent.divSelectedDate) .click(CancelGroupMemberDependent.cancelReasonInput) .pressKey('down') .pressKey('enter') // When I click the submit button .click(CancelGroupMemberDependent.submitButton) + .wait(10000) // I expect a response from RAPID .expect(AlertPage.alertBannerText.textContent) .contains(RAPID_RESPONSE) @@ -85,10 +85,14 @@ test('Check clear button clears the form', async (t) => { .typeText(CancelGroupMemberDependent.phnInput, '9882807277') .typeText(CancelGroupMemberDependent.dependentPhnInput, '9882807277') .typeText(CancelGroupMemberDependent.groupNumberInput, '6337109') + .click(CancelGroupMemberDependent.relationshipInput) + .pressKey('down') + .pressKey('enter') .click(CancelGroupMemberDependent.cancelReasonInput) .pressKey('down') - .typeText(CancelGroupMemberDependent.cancelDateInput, '2022-12') - .pressKey('tab') + .pressKey('enter') + .click(CancelGroupMemberDependent.cancelDateInput) + .click(CancelGroupMemberDependent.divSelectedDate) // When I click the clear button .click(CancelGroupMemberDependent.clearButton) // I expect the form to be cleared From e225b47fdd0b8993f3a678fd3a980e50ea2499e5 Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Thu, 27 Jan 2022 19:25:01 -0700 Subject: [PATCH 03/11] R36: Backend Implementation 1. Added request and response 2. Added converter 3. Added RPBSPWP0 and WP0 message module 4. Added controller method 5. Added service method 6. Added unit test --- .../controller/GroupMemberController.java | 39 +++++++ .../converter/rapid/RPBSPWP0Converter.java | 53 +++++++++ .../gov/hlth/hnweb/model/rapid/RPBSPWP0.java | 42 +++++++ .../ca/bc/gov/hlth/hnweb/model/rapid/WP0.java | 87 ++++++++++++++ .../CancelGroupMemberDependentRequest.java | 59 ++++++++++ .../CancelGroupMemberDependentResponse.java | 21 ++++ .../hnweb/service/GroupMemberService.java | 30 +++++ .../controller/GroupMemberControllerTest.java | 107 ++++++++++++++++++ .../CancelGroupMemberDependent.vue | 10 +- 9 files changed, 443 insertions(+), 5 deletions(-) create mode 100644 backend/src/main/java/ca/bc/gov/hlth/hnweb/converter/rapid/RPBSPWP0Converter.java create mode 100644 backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/RPBSPWP0.java create mode 100644 backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/WP0.java create mode 100644 backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentRequest.java create mode 100644 backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentResponse.java diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java index a787f617..41d67601 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java @@ -21,6 +21,7 @@ import ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPED0Converter; import ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPEE0Converter; import ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPWC0Converter; +import ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPWP0Converter; import ca.bc.gov.hlth.hnweb.exception.HNWebException; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPED0; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPEE0; @@ -29,6 +30,9 @@ import ca.bc.gov.hlth.hnweb.model.rest.groupmember.UpdateNumberAndDeptRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.UpdateNumberAndDeptResponse; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWC0; +import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWP0; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentRequest; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberResponse; @@ -137,6 +141,41 @@ public ResponseEntity cancelGroupMember(@Valid @Reque } } + + /** + * Cancels a group member's dependent coverage. + * Maps to the legacy R36. + * + * @param cancelGroupMemberDependentRequest + * @return The result of the operation. + */ + @PostMapping("/cancel-group-member-dependent") + public ResponseEntity cancelGroupMemberDependent(@Valid @RequestBody CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest) { + + try { + RPBSPWP0Converter converter = new RPBSPWP0Converter(); + RPBSPWP0 rpbspwp0 = converter.convertRequest(cancelGroupMemberDependentRequest); + RPBSPWP0 rpbspwc0Response = groupMemberService.cancelGroupMemberDependent(rpbspwp0); + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = converter.convertResponse(rpbspwc0Response); + + ResponseEntity response = ResponseEntity.ok(cancelGroupMemberDependentResponse); + + logger.info("cancelGroupMemberResponse response: {} ", cancelGroupMemberDependentResponse); + return response; + } catch (HNWebException hwe) { + switch (hwe.getType()) { + case DOWNSTREAM_FAILURE: + throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, hwe.getMessage(), hwe); + default: + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member request", hwe); + } + } catch (WebClientException wce) { + throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, wce.getMessage(), wce); + } catch (Exception e) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member request", e); + } + + } private UpdateNumberAndDeptResponse handleUpdateGroupMemberResponse(UpdateNumberAndDeptResponse deptNumberResponse, UpdateNumberAndDeptResponse empNumberResponse) { UpdateNumberAndDeptResponse response = new UpdateNumberAndDeptResponse(); diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/converter/rapid/RPBSPWP0Converter.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/converter/rapid/RPBSPWP0Converter.java new file mode 100644 index 00000000..b9b35685 --- /dev/null +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/converter/rapid/RPBSPWP0Converter.java @@ -0,0 +1,53 @@ +package ca.bc.gov.hlth.hnweb.converter.rapid; + +import ca.bc.gov.hlth.hnweb.model.rapid.RPBSHeader; +import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWP0; +import ca.bc.gov.hlth.hnweb.model.rapid.WP0; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentRequest; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentResponse;; + +public class RPBSPWP0Converter extends BaseRapidConverter { + private static final String TRAN_CODE = "RPBSPWP0"; + + public RPBSPWP0Converter() { + super(); + } + + public RPBSPWP0 convertRequest(CancelGroupMemberDependentRequest request) { + RPBSHeader rpbsHeader = new RPBSHeader(); + rpbsHeader.setOrganization(userInfo.getOrganization()); + rpbsHeader.setTranCode(getTranCode()); + + WP0 wp0 = new WP0(); + wp0.setGroupNumber(request.getGroupNumber()); + wp0.setSubscriberPhn(request.getPhn()); + wp0.setBeneficiaryPhn(request.getDependentPhn()); + wp0.setCoverageCancelDate(formatDate(request.getCoverageCancelDate())); + wp0.setPayerCancelReason(request.getCancelReason()); + + RPBSPWP0 rpbspwp0 = new RPBSPWP0(); + rpbspwp0.setRpbsHeader(rpbsHeader); + rpbspwp0.setWp0(wp0); + + return rpbspwp0; + } + + + + public CancelGroupMemberDependentResponse convertResponse(RPBSPWP0 rpbspwp0) { + CancelGroupMemberDependentResponse response = new CancelGroupMemberDependentResponse(); + RPBSHeader header = rpbspwp0.getRpbsHeader(); + + handleStatus(header, response); + response.setPhn(rpbspwp0.getWp0().getSubscriberPhn()); + + return response; + } + + + @Override + public String getTranCode() { + return TRAN_CODE; + } + +} \ No newline at end of file diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/RPBSPWP0.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/RPBSPWP0.java new file mode 100644 index 00000000..edfd2649 --- /dev/null +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/RPBSPWP0.java @@ -0,0 +1,42 @@ +package ca.bc.gov.hlth.hnweb.model.rapid; + +import org.apache.commons.lang3.StringUtils; + +public class RPBSPWP0 { + private RPBSHeader rpbsHeader = new RPBSHeader(); + private WP0 wp0 = new WP0(); + + public RPBSPWP0() { + super(); + } + + public RPBSPWP0(String message) { + String headerText = StringUtils.substring(message, 0, RPBSHeader.SEGMENT_LENGTH); + String bodyText = StringUtils.substring(message, RPBSHeader.SEGMENT_LENGTH); + + rpbsHeader = new RPBSHeader(headerText); + + wp0 = new WP0(bodyText); + } + + public WP0 getWp0() { + return wp0; + } + + public void setWp0(WP0 wp0) { + this.wp0 = wp0; + } + + public RPBSHeader getRpbsHeader() { + return rpbsHeader; + } + + public void setRpbsHeader(RPBSHeader rpbsHeader) { + this.rpbsHeader = rpbsHeader; + } + + public String serialize() { + return rpbsHeader.serialize() + wp0.serialize(); + } + +} diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/WP0.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/WP0.java new file mode 100644 index 00000000..5422b97c --- /dev/null +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/WP0.java @@ -0,0 +1,87 @@ +package ca.bc.gov.hlth.hnweb.model.rapid; + +import org.apache.commons.lang3.StringUtils; + +public class WP0 { + + /** 1 PHN String No 0...10 1..1 */ + private String subscriberPhn; + /** 2 GroupNumber String No 0...7 1..1 */ + private String groupNumber; + /** 3 beneficiaryPhn String No 0...10 1..1 */ + private String beneficiaryPhn; + /** 4 CoverageCancelDate String No 0...10 1..1 */ + private String coverageCancelDate; + /** 5 PayerCancelReason String No 0...1 1..1 */ + private String payerCancelReason; + + public WP0() { + super(); + } + + public WP0(String message) { + super(); + subscriberPhn = StringUtils.substring(message, 0, 10); + groupNumber = StringUtils.substring(message, 10, 17); + beneficiaryPhn = StringUtils.substring(message, 17, 27); + coverageCancelDate = StringUtils.substring(message, 27, 37); + // K or E + payerCancelReason = StringUtils.substring(message, 37, 38); + } + + public String serialize() { + // Serialize is only used in when creating the request + StringBuilder sb = new StringBuilder(); + sb.append(StringUtils.rightPad(subscriberPhn, 10)); + sb.append(StringUtils.rightPad(groupNumber, 7)); + sb.append(StringUtils.rightPad(beneficiaryPhn, 10)); + sb.append(StringUtils.rightPad(coverageCancelDate, 10)); + sb.append(StringUtils.rightPad(payerCancelReason, 1)); + + return sb.toString(); + } + + public String getSubscriberPhn() { + return subscriberPhn; + } + + public void setSubscriberPhn(String subscriberPhn) { + this.subscriberPhn = subscriberPhn; + } + + public String getGroupNumber() { + return groupNumber; + } + + public void setGroupNumber(String groupNumber) { + this.groupNumber = groupNumber; + } + + public String getBeneficiaryPhn() { + return beneficiaryPhn; + } + + public void setBeneficiaryPhn(String beneficiaryPhn) { + this.beneficiaryPhn = beneficiaryPhn; + } + + public String getCoverageCancelDate() { + return coverageCancelDate; + } + + public void setCoverageCancelDate(String coverageCancelDate) { + this.coverageCancelDate = coverageCancelDate; + } + + public String getPayerCancelReason() { + return payerCancelReason; + } + + public void setPayerCancelReason(String payerCancelReason) { + this.payerCancelReason = payerCancelReason; + } + + + + +} diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentRequest.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentRequest.java new file mode 100644 index 00000000..7c2129a8 --- /dev/null +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentRequest.java @@ -0,0 +1,59 @@ +package ca.bc.gov.hlth.hnweb.model.rest.groupmember; + +import java.time.LocalDate; + +public class CancelGroupMemberDependentRequest { + private String phn; + private String groupNumber; + private String dependentPhn; + private LocalDate coverageCancelDate; + // Valid values are I, E and P + private String cancelReason; + + public String getPhn() { + return phn; + } + + public void setPhn(String phn) { + this.phn = phn; + } + + public String getGroupNumber() { + return groupNumber; + } + + public void setGroupNumber(String groupNumber) { + this.groupNumber = groupNumber; + } + + public String getDependentPhn() { + return dependentPhn; + } + + public void setDependentPhn(String dependentPhn) { + this.dependentPhn = dependentPhn; + } + + public LocalDate getCoverageCancelDate() { + return coverageCancelDate; + } + + public void setCoverageCancelDate(LocalDate coverageCancelDate) { + this.coverageCancelDate = coverageCancelDate; + } + + public String getCancelReason() { + return cancelReason; + } + + public void setCancelReason(String cancelReason) { + this.cancelReason = cancelReason; + } + + @Override + public String toString() { + return "CancelGroupMemberRequest [phn=" + phn + ", groupNumber=" + groupNumber + ",dependentPhn=" + dependentPhn + ", coverageCancelDate=" + coverageCancelDate + + ", cancelReason=" + cancelReason + "]"; + } + +} diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentResponse.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentResponse.java new file mode 100644 index 00000000..a8aa4ef7 --- /dev/null +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentResponse.java @@ -0,0 +1,21 @@ +package ca.bc.gov.hlth.hnweb.model.rest.groupmember; + +import ca.bc.gov.hlth.hnweb.model.rest.BaseResponse; + +public class CancelGroupMemberDependentResponse extends BaseResponse { + private String phn; + + public String getPhn() { + return phn; + } + + public void setPhn(String phn) { + this.phn = phn; + } + + @Override + public String toString() { + return "CancelGroupMemberResponse [phn=" + phn + ", status=" + status + ", message=" + message + "]"; + } + +} diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java index fdce2658..d0893be8 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java @@ -17,6 +17,7 @@ import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPED0; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPEE0; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWC0; +import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWP0; /** * Service for: @@ -35,6 +36,9 @@ public class GroupMemberService { @Value("${rapid.r35Path}") private String r35Path; + @Value("${rapid.r36Path}") + private String r36Path; + @Autowired private WebClient rapidWebClient; @@ -115,6 +119,32 @@ public RPBSPWC0 cancelGroupMember(RPBSPWC0 rpbspwc0) throws HNWebException { return rpbspwc0Response; } + + /** + * Cancels the group member's dependent coverage based on the R36/RPBSPWP0. + * + * @param rpbspwc0 + * @return The RPBSPWC0 response. + * @throws HNWebException + */ + public RPBSPWP0 cancelGroupMemberDependent(RPBSPWP0 rpbspwp0) throws HNWebException { + String rpbspwp0Str = rpbspwp0.serialize(); + + logger.info("Request {}", rpbspwp0Str); + + ResponseEntity response = postRapidRequest(r36Path, rpbspwp0Str); + + logger.debug("Response Status: {} ; Message:\n{}", response.getStatusCode(), response.getBody()); + + if (response.getStatusCode() != HttpStatus.OK) { + logger.error("Could not connect to downstream service. Service returned {}", response.getStatusCode()); + throw new HNWebException(ExceptionType.DOWNSTREAM_FAILURE); + } + + RPBSPWP0 rpbspwp0Response = new RPBSPWP0(response.getBody()); + + return rpbspwp0Response; + } private ResponseEntity postRapidRequest(String path, String body) { return rapidWebClient diff --git a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java index 0fe92e84..f37e051d 100644 --- a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java +++ b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java @@ -25,6 +25,8 @@ import ca.bc.gov.hlth.hnweb.model.rest.StatusEnum; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.UpdateNumberAndDeptRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.UpdateNumberAndDeptResponse; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentRequest; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberResponse; @@ -48,6 +50,10 @@ public class GroupMemberControllerTest { private static final String RPBSPWC0_ERROR_PHN_DOES_NOT_HAVE_COVERAGE = " RPBSPWC000000010 ERRORMSGRPBS0081PHN DOES NOT HAVE COVERAGE UNDER YOUR ORGANIZATION 934798407463371092022-01-31K"; private static final String RPBSPWC0_ERROR_FUTURE_CANCEL_DATE = " RPBSPWC000000010 ERRORMSGRPBS0048SUBSCRIBER HAS A FUTURE CANCEL DATE.PLS FORWARD DOCS TO MSP 987389592763371092022-12-31K"; private static final String RPBSPWC0_SUCCESS = " RPBSPWC000000010 RESPONSERPBS9014TRANSACTION SUCCESSFUL 987389592763371092022-12-31K"; + private static final String RPBSPWP0_SUCCESS = " RPBSPWP000000010 RESPONSERPBS9014TRANSACTION SUCCESSFUL 9873895927633710998828072772022-12-31P"; + private static final String RPBSPWP0_ERROR_SAME_DEPENDENT_PHN = " RPBSPWP000000010 ERRORMSGRPBS0097SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT. 9882807277624310998828072772022-01-31P"; + private static final String RPBSPWP0_PHN_NOT_IN_GROUP = " RPBSPWP000000010 ERRORMSGRPBS0104DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER. 9873895927633710998828072772022-01-31P"; + private static final String RPBSPWP0_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER= " RPBSPWP000000010 ERRORMSGRPBS0104DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER. 9331926919633710998828072772022-01-31P"; private static MockWebServer mockBackEnd; @@ -284,6 +290,107 @@ public void testCancelGroupMember_success() throws InterruptedException { assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); } + @Test + public void testCancelGroupMemberDependent_DependentNotUnderSubcriberCoverage() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody(RPBSPWP0_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9331926919"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9882807277"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setCancelReason("I"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("RPBS0104 DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER.", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9331926919", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } + + @Test + public void testCancelGroupMemberDependent_PhnNotInGroup() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody( RPBSPWP0_PHN_NOT_IN_GROUP) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9873895927"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9882807277"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setCancelReason("I"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("RPBS0105 PHN MUST BE A SUBSCRIBER IN GROUP.", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9873895927", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } + + @Test + public void testCancelGroupMemberDependent_SameDependentPhn() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody(RPBSPWP0_ERROR_SAME_DEPENDENT_PHN) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9882807277"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9882807277"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setCancelReason("I"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("RPBS0097 SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT.", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9882807277", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } + + + @Test + public void testCancelGroupMemberDependent_success() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody(RPBSPWP0_SUCCESS) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9873895927"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9397105575"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setCancelReason("K"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.SUCCESS, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("TRANSACTION SUCCESSFUL", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9873895927", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } + /** * The URL property used by the mocked endpoint needs to be set after the MockWebServer starts as the port it uses is * created dynamically on start up to ensure it uses an available port so it is not known before then. diff --git a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue index 6b01f294..e3c8a568 100644 --- a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue +++ b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue @@ -73,13 +73,13 @@ export default { message: '', }, cancelReasons: [ - { text: 'Divorced', value: 'K' }, - { text: 'No longer a child', value: 'E' }, + { text: 'Divorced', value: 'I' }, + { text: 'No longer a child', value: 'P' }, { text: 'Out of province move', value: 'E' }, ], relationshipOption: [ - { text: 'Spouse', value: 'S' }, - { text: 'Dependent', value: 'D' }, + { text: 'Spouse', value: 'SP' }, + { text: 'Dependent', value: 'DP' }, ], } }, @@ -102,7 +102,7 @@ export default { } this.result = ( - await GroupMemberService.cancelGroupMember({ + await GroupMemberService.cancelGroupMemberDependent({ phn: this.phn, dependentPhn: this.dependentPhn, groupNumber: this.groupNumber, From a16e7474fe8846f457ae168b3ce5b2beaf206991 Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Fri, 28 Jan 2022 16:51:36 -0700 Subject: [PATCH 04/11] R36: Committing overwritten files due to merge --- .../controller/GroupMemberController.java | 40 +++++++ .../hnweb/service/GroupMemberService.java | 33 ++++++ .../controller/GroupMemberControllerTest.java | 111 +++++++++++++++++- .../src/components/template/TheNavBar.vue | 1 + frontend/src/services/GroupMemberService.js | 3 + 5 files changed, 187 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java index 16b297fb..352487b8 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java @@ -21,15 +21,19 @@ import ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPED0Converter; import ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPEE0Converter; import ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPWC0Converter; +import ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPWP0Converter; import ca.bc.gov.hlth.hnweb.converter.rapid.RPBSPXP0Converter; import ca.bc.gov.hlth.hnweb.exception.HNWebException; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPED0; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPEE0; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWC0; +import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWP0; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPXP0; import ca.bc.gov.hlth.hnweb.model.rest.StatusEnum; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.AddGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.AddGroupMemberResponse; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentRequest; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.UpdateNumberAndDeptRequest; @@ -173,6 +177,42 @@ public ResponseEntity cancelGroupMember(@Valid @Reque } } + + /** + * Cancels a group member's dependent coverage. + * Maps to the legacy R36. + * + * @param cancelGroupMemberDependentRequest + * @return The result of the operation. + */ + @PostMapping("/cancel-group-member-dependent") + public ResponseEntity cancelGroupMemberDependent(@Valid @RequestBody CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest) { + + try { + RPBSPWP0Converter converter = new RPBSPWP0Converter(); + RPBSPWP0 rpbspwp0 = converter.convertRequest(cancelGroupMemberDependentRequest); + RPBSPWP0 rpbspwc0Response = groupMemberService.cancelGroupMemberDependent(rpbspwp0); + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = converter.convertResponse(rpbspwc0Response); + + ResponseEntity response = ResponseEntity.ok(cancelGroupMemberDependentResponse); + + logger.info("cancelGroupMemberResponse response: {} ", cancelGroupMemberDependentResponse); + return response; + } catch (HNWebException hwe) { + switch (hwe.getType()) { + case DOWNSTREAM_FAILURE: + throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, hwe.getMessage(), hwe); + default: + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member request", hwe); + } + } catch (WebClientException wce) { + throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, wce.getMessage(), wce); + } catch (Exception e) { + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member request", e); + } + + } + private UpdateNumberAndDeptResponse handleUpdateGroupMemberResponse(UpdateNumberAndDeptResponse deptNumberResponse, UpdateNumberAndDeptResponse empNumberResponse) { UpdateNumberAndDeptResponse response = new UpdateNumberAndDeptResponse(); diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java index daa8715f..e9e050b9 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java @@ -17,6 +17,7 @@ import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPED0; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPEE0; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWC0; +import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWP0; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPXP0; /** @@ -39,6 +40,9 @@ public class GroupMemberService { @Value("${rapid.r35Path}") private String r35Path; + @Value("${rapid.r36Path}") + private String r36Path; + @Autowired private WebClient rapidWebClient; @@ -145,6 +149,35 @@ public RPBSPWC0 cancelGroupMember(RPBSPWC0 rpbspwc0) throws HNWebException { return rpbspwc0Response; } + + /** + * Cancels the group member's dependent coverage based on the R36/RPBSPWP0. + * + * @param rpbspwc0 + * @return The RPBSPWC0 response. + * @throws HNWebException + */ + public RPBSPWP0 cancelGroupMemberDependent(RPBSPWP0 rpbspwp0) throws HNWebException { + String rpbspwp0Str = rpbspwp0.serialize(); + + logger.info("Request {}", rpbspwp0Str); + + ResponseEntity response = postRapidRequest(r36Path, rpbspwp0Str); + System.out.println(response.getBody()); + + logger.debug("Response Status: {} ; Message:\n{}", response.getStatusCode(), response.getBody()); + + if (response.getStatusCode() != HttpStatus.OK) { + logger.error("Could not connect to downstream service. Service returned {}", response.getStatusCode()); + throw new HNWebException(ExceptionType.DOWNSTREAM_FAILURE); + } + + RPBSPWP0 rpbspwp0Response = new RPBSPWP0(response.getBody()); + + return rpbspwp0Response; + } + + private ResponseEntity postRapidRequest(String path, String body) { return rapidWebClient diff --git a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java index d622c02b..97a97fc2 100644 --- a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java +++ b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java @@ -27,6 +27,8 @@ import ca.bc.gov.hlth.hnweb.model.rest.groupmember.UpdateNumberAndDeptResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.AddGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.AddGroupMemberResponse; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentRequest; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.MemberAddress; @@ -53,7 +55,11 @@ public class GroupMemberControllerTest { private static final String RPBSPXP0_ERROR_COVERAGE_ALREADY_EXISTS = " RPBSPXP000000010 ERRORMSGRPBS0065COVERAGE ALREADY EXISTS FOR THE PHN/GROUP NUMBER SPECIFIED 63371091111 222 2022-01-01 6045551234 9873895927 9873895927"; private static final String RPBSPXP0_SUCCESS = " RPBSPXP000000010 RESPONSERPBS9014TRANSACTION SUCCESSFUL 62431091111 222 2022-01-01123 main st V1V1V1 6045551234 9873895902 "; - + private static final String RPBSPWP0_SUCCESS = " RPBSPWP000000010 RESPONSERPBS9014TRANSACTION SUCCESSFUL 9873895927633710998828072772022-12-31P"; + private static final String RPBSPWP0_ERROR_SAME_DEPENDENT_PHN = " RPBSPWP000000010 ERRORMSGRPBS0097SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT. 9882807277624310998828072772022-01-31P"; + private static final String RPBSPWP0_PHN_NOT_IN_GROUP = " RPBSPWP000000010 ERRORMSGRPBS0104DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER. 9873895927633710998828072772022-01-31P"; + private static final String RPBSPWP0_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER= " RPBSPWP000000010 ERRORMSGRPBS0104DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER. 9331926919633710998828072772022-01-31P"; + private static MockWebServer mockBackEnd; private static MockedStatic mockStatic; @@ -351,6 +357,109 @@ public void testAddGroupMember_success() throws InterruptedException { assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); } + + @Test + public void testCancelGroupMemberDependent_DependentNotUnderSubcriberCoverage() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody(RPBSPWP0_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9331926919"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9882807277"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setCancelReason("I"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("RPBS0104 DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER.", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9331926919", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } + + @Test + public void testCancelGroupMemberDependent_PhnNotInGroup() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody( RPBSPWP0_PHN_NOT_IN_GROUP) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9873895927"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9882807277"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setCancelReason("I"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("RPBS0105 PHN MUST BE A SUBSCRIBER IN GROUP.", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9873895927", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } + + @Test + public void testCancelGroupMemberDependent_SameDependentPhn() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody(RPBSPWP0_ERROR_SAME_DEPENDENT_PHN) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9882807277"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9882807277"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setCancelReason("I"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("RPBS0097 SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT.", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9882807277", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } + + + @Test + public void testCancelGroupMemberDependent_success() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody(RPBSPWP0_SUCCESS) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9873895927"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9397105575"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setCancelReason("K"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.SUCCESS, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("TRANSACTION SUCCESSFUL", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9873895927", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } + + /** * The URL property used by the mocked endpoint needs to be set after the MockWebServer starts as the port it uses is * created dynamically on start up to ensure it uses an available port so it is not known before then. diff --git a/frontend/src/components/template/TheNavBar.vue b/frontend/src/components/template/TheNavBar.vue index b35a408a..7ce7d1b1 100644 --- a/frontend/src/components/template/TheNavBar.vue +++ b/frontend/src/components/template/TheNavBar.vue @@ -35,6 +35,7 @@ Add Group Member Update Group Member's Number and/or Department Cancel Group Member + Cancel Group Member's Dependent diff --git a/frontend/src/services/GroupMemberService.js b/frontend/src/services/GroupMemberService.js index 93105431..98d57125 100644 --- a/frontend/src/services/GroupMemberService.js +++ b/frontend/src/services/GroupMemberService.js @@ -11,5 +11,8 @@ export default { addGroupMember(request) { return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.addGroupMember, request)) }, + cancelGroupMemberDependent(request) { + return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.cancelGroupMemberDependent, request)) + }, } \ No newline at end of file From ec35a4d192a349fab3645e72e4b02dc00a36a676 Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Fri, 28 Jan 2022 18:14:20 -0700 Subject: [PATCH 05/11] R36: Added more unit tests for error scenario 1. Updated unit test 2. Corrected button text --- .../controller/GroupMemberControllerTest.java | 68 ++++++++++++++++--- .../CancelGroupMemberDependent.vue | 2 +- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java index 97a97fc2..b88e65f8 100644 --- a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java +++ b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java @@ -57,9 +57,11 @@ public class GroupMemberControllerTest { private static final String RPBSPXP0_SUCCESS = " RPBSPXP000000010 RESPONSERPBS9014TRANSACTION SUCCESSFUL 62431091111 222 2022-01-01123 main st V1V1V1 6045551234 9873895902 "; private static final String RPBSPWP0_SUCCESS = " RPBSPWP000000010 RESPONSERPBS9014TRANSACTION SUCCESSFUL 9873895927633710998828072772022-12-31P"; private static final String RPBSPWP0_ERROR_SAME_DEPENDENT_PHN = " RPBSPWP000000010 ERRORMSGRPBS0097SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT. 9882807277624310998828072772022-01-31P"; - private static final String RPBSPWP0_PHN_NOT_IN_GROUP = " RPBSPWP000000010 ERRORMSGRPBS0104DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER. 9873895927633710998828072772022-01-31P"; + private static final String RPBSPWP0_PHN_NOT_IN_GROUP = " RPBSPWP000000010 ERRORMSGRPBS0105PHN MUST BE A SUBSCRIBER IN GROUP 9340338122624310993290908952023-02-28I"; private static final String RPBSPWP0_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER= " RPBSPWP000000010 ERRORMSGRPBS0104DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER. 9331926919633710998828072772022-01-31P"; - + private static final String RPBSWP0_NO_ACTIVE_COVERAGES_FOUND= " RPBSPWP000000010 ERRORMSGRPBS0047NO ACTIVE COVERAGES FOUND. PLS FORWARD SOURCE DOCS TO MSP 9340338122633710993290908952022-01-31I"; + private static final String RPBSWP0_FUTURE_CANCEL_DATE= " RPBSPWP000000010 ERRORMSGRPBS0090DEPENDENT HAS A FUTURE CANCEL DATE. PLS FORWARD DOCS TO MSP 9340338122633710993290908952023-02-28I"; + private static MockWebServer mockBackEnd; private static MockedStatic mockStatic; @@ -390,18 +392,18 @@ public void testCancelGroupMemberDependent_PhnNotInGroup() throws InterruptedExc .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); - cancelGroupMemberDependentRequest.setPhn("9873895927"); - cancelGroupMemberDependentRequest.setGroupNumber("6337109"); - cancelGroupMemberDependentRequest.setDependentPhn("9882807277"); - cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setPhn("9340338122"); + cancelGroupMemberDependentRequest.setGroupNumber("6243109"); + cancelGroupMemberDependentRequest.setDependentPhn("9329090895"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2023, 02, 28)); cancelGroupMemberDependentRequest.setCancelReason("I"); ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); - assertEquals("RPBS0105 PHN MUST BE A SUBSCRIBER IN GROUP.", cancelGroupMemberDependentResponse.getMessage()); - assertEquals("9873895927", cancelGroupMemberDependentResponse.getPhn()); + assertEquals("RPBS0105 PHN MUST BE A SUBSCRIBER IN GROUP", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9340338122", cancelGroupMemberDependentResponse.getPhn()); // Check the client request is sent as expected RecordedRequest recordedRequest = mockBackEnd.takeRequest(); @@ -433,13 +435,61 @@ public void testCancelGroupMemberDependent_SameDependentPhn() throws Interrupted assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); } - + @Test + public void testCancelGroupMemberDependent_NoActiveCovereage() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody(RPBSWP0_NO_ACTIVE_COVERAGES_FOUND) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9340338122"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9329090895"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelGroupMemberDependentRequest.setCancelReason("I"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("RPBS0047 NO ACTIVE COVERAGES FOUND. PLS FORWARD SOURCE DOCS TO MSP", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9340338122", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } + @Test + public void testCancelGroupMemberDependent_FutureCancelDate() throws InterruptedException { + mockBackEnd.enqueue(new MockResponse() + .setBody(RPBSWP0_FUTURE_CANCEL_DATE) + .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); + cancelGroupMemberDependentRequest.setPhn("9340338122"); + cancelGroupMemberDependentRequest.setGroupNumber("6337109"); + cancelGroupMemberDependentRequest.setDependentPhn("9329090895"); + cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2023, 02, 28)); + cancelGroupMemberDependentRequest.setCancelReason("I"); + + ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + + CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); + assertEquals("RPBS0090 DEPENDENT HAS A FUTURE CANCEL DATE. PLS FORWARD DOCS TO MSP", cancelGroupMemberDependentResponse.getMessage()); + assertEquals("9340338122", cancelGroupMemberDependentResponse.getPhn()); + + // Check the client request is sent as expected + RecordedRequest recordedRequest = mockBackEnd.takeRequest(); + assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); + } @Test public void testCancelGroupMemberDependent_success() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() .setBody(RPBSPWP0_SUCCESS) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); + CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); cancelGroupMemberDependentRequest.setPhn("9873895927"); cancelGroupMemberDependentRequest.setGroupNumber("6337109"); diff --git a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue index e3c8a568..b6b8ed54 100644 --- a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue +++ b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue @@ -40,7 +40,7 @@

PHN: {{ result?.phn }}

- Cancel Another Group Member + Cancel Another Group Member's Dependent
From ae1aa548d535a2046368389b48685cdd485e20a3 Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Mon, 31 Jan 2022 11:39:19 -0700 Subject: [PATCH 06/11] R36: Minor updates 1. Code cleanup, fields, comments and method name correction --- .../hlth/hnweb/controller/GroupMemberController.java | 6 +++--- .../bc/gov/hlth/hnweb/service/GroupMemberService.java | 5 ++--- .../hnweb/controller/GroupMemberControllerTest.java | 10 +++++----- .../views/groupmember/CancelGroupMemberDependent.vue | 4 ++-- .../groupmember/CancelGroupMemberDependentTest.js | 3 +-- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java index 352487b8..0f8736cb 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java @@ -196,19 +196,19 @@ public ResponseEntity cancelGroupMemberDepen ResponseEntity response = ResponseEntity.ok(cancelGroupMemberDependentResponse); - logger.info("cancelGroupMemberResponse response: {} ", cancelGroupMemberDependentResponse); + logger.info("cancelGroupMemberDependentResponse response: {} ", cancelGroupMemberDependentResponse); return response; } catch (HNWebException hwe) { switch (hwe.getType()) { case DOWNSTREAM_FAILURE: throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, hwe.getMessage(), hwe); default: - throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member request", hwe); + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member-dependent request", hwe); } } catch (WebClientException wce) { throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, wce.getMessage(), wce); } catch (Exception e) { - throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member request", e); + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member-dependent request", e); } } diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java index e9e050b9..ab1618e0 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java @@ -153,8 +153,8 @@ public RPBSPWC0 cancelGroupMember(RPBSPWC0 rpbspwc0) throws HNWebException { /** * Cancels the group member's dependent coverage based on the R36/RPBSPWP0. * - * @param rpbspwc0 - * @return The RPBSPWC0 response. + * @param rpbspwp0 + * @return The RPBSPWP0 response. * @throws HNWebException */ public RPBSPWP0 cancelGroupMemberDependent(RPBSPWP0 rpbspwp0) throws HNWebException { @@ -163,7 +163,6 @@ public RPBSPWP0 cancelGroupMemberDependent(RPBSPWP0 rpbspwp0) throws HNWebExcept logger.info("Request {}", rpbspwp0Str); ResponseEntity response = postRapidRequest(r36Path, rpbspwp0Str); - System.out.println(response.getBody()); logger.debug("Response Status: {} ; Message:\n{}", response.getStatusCode(), response.getBody()); diff --git a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java index b88e65f8..8b3809aa 100644 --- a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java +++ b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java @@ -361,7 +361,7 @@ public void testAddGroupMember_success() throws InterruptedException { @Test - public void testCancelGroupMemberDependent_DependentNotUnderSubcriberCoverage() throws InterruptedException { + public void testCancelGroupMemberDependent_dependentNotUnderSubcriberCoverage() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() .setBody(RPBSPWP0_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); @@ -386,7 +386,7 @@ public void testCancelGroupMemberDependent_DependentNotUnderSubcriberCoverage() } @Test - public void testCancelGroupMemberDependent_PhnNotInGroup() throws InterruptedException { + public void testCancelGroupMemberDependent_subscriberPhnNotInGroup() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() .setBody( RPBSPWP0_PHN_NOT_IN_GROUP) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); @@ -411,7 +411,7 @@ public void testCancelGroupMemberDependent_PhnNotInGroup() throws InterruptedExc } @Test - public void testCancelGroupMemberDependent_SameDependentPhn() throws InterruptedException { + public void testCancelGroupMemberDependent_subscriberAndDependentPhnAreSame() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() .setBody(RPBSPWP0_ERROR_SAME_DEPENDENT_PHN) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); @@ -436,7 +436,7 @@ public void testCancelGroupMemberDependent_SameDependentPhn() throws Interrupted } @Test - public void testCancelGroupMemberDependent_NoActiveCovereage() throws InterruptedException { + public void testCancelGroupMemberDependent_noActiveCovereage() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() .setBody(RPBSWP0_NO_ACTIVE_COVERAGES_FOUND) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); @@ -460,7 +460,7 @@ public void testCancelGroupMemberDependent_NoActiveCovereage() throws Interrupte assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); } @Test - public void testCancelGroupMemberDependent_FutureCancelDate() throws InterruptedException { + public void testCancelGroupMemberDependent_futureCancelDate() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() .setBody(RPBSWP0_FUTURE_CANCEL_DATE) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); diff --git a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue index b6b8ed54..143b0ca4 100644 --- a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue +++ b/frontend/src/views/groupmember/CancelGroupMemberDependent.vue @@ -13,7 +13,7 @@
- + @@ -77,7 +77,7 @@ export default { { text: 'No longer a child', value: 'P' }, { text: 'Out of province move', value: 'E' }, ], - relationshipOption: [ + relationshipOptions: [ { text: 'Spouse', value: 'SP' }, { text: 'Dependent', value: 'DP' }, ], diff --git a/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js b/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js index ec3cfd2c..83a554aa 100644 --- a/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js +++ b/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js @@ -11,7 +11,7 @@ const INVALID_GROUP_NUMBER_ERROR_MESSAGE = 'Group Number is invalid' const COVERAGE_CANCEL_DATE_REQUIRED_MESSAGE = 'Coverage Cancel Date is required' const DEPENDENT_PHN_REQUIRED_MESSAGE = 'PHN is required' const CANCEL_REASON_REQUIRED_MESSAGE = 'Cancel Reason is required' -const RAPID_RESPONSE = 'RPBS0003 SUBSCRIBER PHN MUST BE ENTERED' +const RAPID_RESPONSE = 'RPBS0097 SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT.' const PAGE_TO_TEST = SITE_UNDER_TEST + '/groupmember/CancelGroupMemberDependent' @@ -73,7 +73,6 @@ test('Check properly filled form passes validation', async (t) => { .pressKey('enter') // When I click the submit button .click(CancelGroupMemberDependent.submitButton) - .wait(10000) // I expect a response from RAPID .expect(AlertPage.alertBannerText.textContent) .contains(RAPID_RESPONSE) From ee576491c4a383b6337f08fbc7950335ac4eff93 Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Tue, 1 Feb 2022 10:42:50 -0700 Subject: [PATCH 07/11] R36: Added url prop for r36 --- backend/src/test/resources/application-dev.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/test/resources/application-dev.yaml b/backend/src/test/resources/application-dev.yaml index e8ddd6cd..67da9bf7 100644 --- a/backend/src/test/resources/application-dev.yaml +++ b/backend/src/test/resources/application-dev.yaml @@ -13,7 +13,8 @@ rapid: url: r30Path: r34Path: - r35Path: + r35Path: + r36Path: r41Path: r42Path: user: From 7de8f54de097d635d93a90304d49d2d1fa5ed3c8 Mon Sep 17 00:00:00 2001 From: weskubo-cgi Date: Tue, 1 Feb 2022 10:38:21 -0800 Subject: [PATCH 08/11] Updated to use shorter labels. --- frontend/src/components/template/TheNavBar.vue | 4 ++-- frontend/src/views/groupmember/GroupMemberHome.vue | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/template/TheNavBar.vue b/frontend/src/components/template/TheNavBar.vue index 7ce7d1b1..34b9bae7 100644 --- a/frontend/src/components/template/TheNavBar.vue +++ b/frontend/src/components/template/TheNavBar.vue @@ -33,9 +33,9 @@ Manage Group Member diff --git a/frontend/src/views/groupmember/GroupMemberHome.vue b/frontend/src/views/groupmember/GroupMemberHome.vue index 45c1883b..ba35eb39 100644 --- a/frontend/src/views/groupmember/GroupMemberHome.vue +++ b/frontend/src/views/groupmember/GroupMemberHome.vue @@ -5,10 +5,10 @@ import SubNavTab from '../../components/template/SubNavTab.vue' From fa33e19ed64f62739cb79556f2d6b98cbb07cf1c Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Tue, 1 Feb 2022 15:12:16 -0700 Subject: [PATCH 09/11] Addressed review comments 1. Refactored/renamed class, method, variable name 2. Removed extra line 3. Corrected comments --- .../controller/GroupMemberController.java | 24 +-- .../converter/rapid/RPBSPWP0Converter.java | 15 +- .../ca/bc/gov/hlth/hnweb/model/rapid/WP0.java | 15 +- ...quest.java => CancelDependentRequest.java} | 2 +- ...onse.java => CancelDependentResponse.java} | 2 +- .../hnweb/service/GroupMemberService.java | 4 +- .../controller/GroupMemberControllerTest.java | 168 +++++++++--------- .../src/components/template/TheNavBar.vue | 20 +-- frontend/src/router/index.js | 30 ++-- frontend/src/services/BaseService.js | 2 +- frontend/src/services/GroupMemberService.js | 20 +-- ...emberDependent.vue => CancelDependent.vue} | 6 +- .../src/views/groupmember/GroupMemberHome.vue | 2 +- ...pMemberDependent.js => CancelDependent.js} | 4 +- ...ependentTest.js => CancelDependentTest.js} | 72 ++++---- 15 files changed, 188 insertions(+), 198 deletions(-) rename backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/{CancelGroupMemberDependentRequest.java => CancelDependentRequest.java} (96%) rename backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/{CancelGroupMemberDependentResponse.java => CancelDependentResponse.java} (84%) rename frontend/src/views/groupmember/{CancelGroupMemberDependent.vue => CancelDependent.vue} (96%) rename frontend/tests/e2e/pages/groupmember/{CancelGroupMemberDependent.js => CancelDependent.js} (89%) rename frontend/tests/e2e/tests/groupmember/{CancelGroupMemberDependentTest.js => CancelDependentTest.js} (53%) diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java index 0f8736cb..10da03a9 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberController.java @@ -32,8 +32,8 @@ import ca.bc.gov.hlth.hnweb.model.rest.StatusEnum; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.AddGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.AddGroupMemberResponse; -import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentRequest; -import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentResponse; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelDependentRequest; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelDependentResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.UpdateNumberAndDeptRequest; @@ -182,33 +182,33 @@ public ResponseEntity cancelGroupMember(@Valid @Reque * Cancels a group member's dependent coverage. * Maps to the legacy R36. * - * @param cancelGroupMemberDependentRequest + * @param cancelDependentRequest * @return The result of the operation. */ - @PostMapping("/cancel-group-member-dependent") - public ResponseEntity cancelGroupMemberDependent(@Valid @RequestBody CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest) { + @PostMapping("/cancel-dependent") + public ResponseEntity cancelDependent(@Valid @RequestBody CancelDependentRequest cancelDependentRequest) { try { RPBSPWP0Converter converter = new RPBSPWP0Converter(); - RPBSPWP0 rpbspwp0 = converter.convertRequest(cancelGroupMemberDependentRequest); - RPBSPWP0 rpbspwc0Response = groupMemberService.cancelGroupMemberDependent(rpbspwp0); - CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = converter.convertResponse(rpbspwc0Response); + RPBSPWP0 rpbspwp0 = converter.convertRequest(cancelDependentRequest); + RPBSPWP0 rpbspwc0Response = groupMemberService.cancelDependent(rpbspwp0); + CancelDependentResponse cancelDependentResponse = converter.convertResponse(rpbspwc0Response); - ResponseEntity response = ResponseEntity.ok(cancelGroupMemberDependentResponse); + ResponseEntity response = ResponseEntity.ok(cancelDependentResponse); - logger.info("cancelGroupMemberDependentResponse response: {} ", cancelGroupMemberDependentResponse); + logger.info("CancelDependentResponse response: {} ", cancelDependentResponse); return response; } catch (HNWebException hwe) { switch (hwe.getType()) { case DOWNSTREAM_FAILURE: throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, hwe.getMessage(), hwe); default: - throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member-dependent request", hwe); + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-dependent request", hwe); } } catch (WebClientException wce) { throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, wce.getMessage(), wce); } catch (Exception e) { - throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-group-member-dependent request", e); + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Bad /cancel-dependent request", e); } } diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/converter/rapid/RPBSPWP0Converter.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/converter/rapid/RPBSPWP0Converter.java index b9b35685..7ed1b8ce 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/converter/rapid/RPBSPWP0Converter.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/converter/rapid/RPBSPWP0Converter.java @@ -3,8 +3,8 @@ import ca.bc.gov.hlth.hnweb.model.rapid.RPBSHeader; import ca.bc.gov.hlth.hnweb.model.rapid.RPBSPWP0; import ca.bc.gov.hlth.hnweb.model.rapid.WP0; -import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentRequest; -import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentResponse;; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelDependentRequest; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelDependentResponse;; public class RPBSPWP0Converter extends BaseRapidConverter { private static final String TRAN_CODE = "RPBSPWP0"; @@ -13,7 +13,7 @@ public RPBSPWP0Converter() { super(); } - public RPBSPWP0 convertRequest(CancelGroupMemberDependentRequest request) { + public RPBSPWP0 convertRequest(CancelDependentRequest request) { RPBSHeader rpbsHeader = new RPBSHeader(); rpbsHeader.setOrganization(userInfo.getOrganization()); rpbsHeader.setTranCode(getTranCode()); @@ -31,11 +31,9 @@ public RPBSPWP0 convertRequest(CancelGroupMemberDependentRequest request) { return rpbspwp0; } - - - - public CancelGroupMemberDependentResponse convertResponse(RPBSPWP0 rpbspwp0) { - CancelGroupMemberDependentResponse response = new CancelGroupMemberDependentResponse(); + + public CancelDependentResponse convertResponse(RPBSPWP0 rpbspwp0) { + CancelDependentResponse response = new CancelDependentResponse(); RPBSHeader header = rpbspwp0.getRpbsHeader(); handleStatus(header, response); @@ -44,7 +42,6 @@ public CancelGroupMemberDependentResponse convertResponse(RPBSPWP0 rpbspwp0) { return response; } - @Override public String getTranCode() { return TRAN_CODE; diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/WP0.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/WP0.java index 5422b97c..946a6e38 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/WP0.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rapid/WP0.java @@ -4,15 +4,15 @@ public class WP0 { - /** 1 PHN String No 0...10 1..1 */ + /** 1 SubscriberPHN String No 0...10 */ private String subscriberPhn; - /** 2 GroupNumber String No 0...7 1..1 */ + /** 2 GroupNumber String No 0...7 */ private String groupNumber; - /** 3 beneficiaryPhn String No 0...10 1..1 */ + /** 3 BeneficiaryPHN String No 0...10 */ private String beneficiaryPhn; - /** 4 CoverageCancelDate String No 0...10 1..1 */ + /** 4 CoverageCancelDate String No 0...10 */ private String coverageCancelDate; - /** 5 PayerCancelReason String No 0...1 1..1 */ + /** 5 PayerCancelReason String No 0...1 */ private String payerCancelReason; public WP0() { @@ -25,7 +25,7 @@ public WP0(String message) { groupNumber = StringUtils.substring(message, 10, 17); beneficiaryPhn = StringUtils.substring(message, 17, 27); coverageCancelDate = StringUtils.substring(message, 27, 37); - // K or E + // I , E or P payerCancelReason = StringUtils.substring(message, 37, 38); } @@ -81,7 +81,4 @@ public void setPayerCancelReason(String payerCancelReason) { this.payerCancelReason = payerCancelReason; } - - - } diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentRequest.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelDependentRequest.java similarity index 96% rename from backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentRequest.java rename to backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelDependentRequest.java index 7c2129a8..8b7363f9 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentRequest.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelDependentRequest.java @@ -2,7 +2,7 @@ import java.time.LocalDate; -public class CancelGroupMemberDependentRequest { +public class CancelDependentRequest { private String phn; private String groupNumber; private String dependentPhn; diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentResponse.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelDependentResponse.java similarity index 84% rename from backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentResponse.java rename to backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelDependentResponse.java index a8aa4ef7..7a48cb97 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelGroupMemberDependentResponse.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/groupmember/CancelDependentResponse.java @@ -2,7 +2,7 @@ import ca.bc.gov.hlth.hnweb.model.rest.BaseResponse; -public class CancelGroupMemberDependentResponse extends BaseResponse { +public class CancelDependentResponse extends BaseResponse { private String phn; public String getPhn() { diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java index ab1618e0..0257a853 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/GroupMemberService.java @@ -157,7 +157,7 @@ public RPBSPWC0 cancelGroupMember(RPBSPWC0 rpbspwc0) throws HNWebException { * @return The RPBSPWP0 response. * @throws HNWebException */ - public RPBSPWP0 cancelGroupMemberDependent(RPBSPWP0 rpbspwp0) throws HNWebException { + public RPBSPWP0 cancelDependent(RPBSPWP0 rpbspwp0) throws HNWebException { String rpbspwp0Str = rpbspwp0.serialize(); logger.info("Request {}", rpbspwp0Str); @@ -176,8 +176,6 @@ public RPBSPWP0 cancelGroupMemberDependent(RPBSPWP0 rpbspwp0) throws HNWebExcept return rpbspwp0Response; } - - private ResponseEntity postRapidRequest(String path, String body) { return rapidWebClient .post() diff --git a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java index 8b3809aa..c641fccf 100644 --- a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java +++ b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/GroupMemberControllerTest.java @@ -27,8 +27,8 @@ import ca.bc.gov.hlth.hnweb.model.rest.groupmember.UpdateNumberAndDeptResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.AddGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.AddGroupMemberResponse; -import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentRequest; -import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberDependentResponse; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelDependentRequest; +import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelDependentResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberRequest; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.CancelGroupMemberResponse; import ca.bc.gov.hlth.hnweb.model.rest.groupmember.MemberAddress; @@ -55,12 +55,13 @@ public class GroupMemberControllerTest { private static final String RPBSPXP0_ERROR_COVERAGE_ALREADY_EXISTS = " RPBSPXP000000010 ERRORMSGRPBS0065COVERAGE ALREADY EXISTS FOR THE PHN/GROUP NUMBER SPECIFIED 63371091111 222 2022-01-01 6045551234 9873895927 9873895927"; private static final String RPBSPXP0_SUCCESS = " RPBSPXP000000010 RESPONSERPBS9014TRANSACTION SUCCESSFUL 62431091111 222 2022-01-01123 main st V1V1V1 6045551234 9873895902 "; + private static final String RPBSPWP0_SUCCESS = " RPBSPWP000000010 RESPONSERPBS9014TRANSACTION SUCCESSFUL 9873895927633710998828072772022-12-31P"; private static final String RPBSPWP0_ERROR_SAME_DEPENDENT_PHN = " RPBSPWP000000010 ERRORMSGRPBS0097SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT. 9882807277624310998828072772022-01-31P"; - private static final String RPBSPWP0_PHN_NOT_IN_GROUP = " RPBSPWP000000010 ERRORMSGRPBS0105PHN MUST BE A SUBSCRIBER IN GROUP 9340338122624310993290908952023-02-28I"; - private static final String RPBSPWP0_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER= " RPBSPWP000000010 ERRORMSGRPBS0104DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER. 9331926919633710998828072772022-01-31P"; - private static final String RPBSWP0_NO_ACTIVE_COVERAGES_FOUND= " RPBSPWP000000010 ERRORMSGRPBS0047NO ACTIVE COVERAGES FOUND. PLS FORWARD SOURCE DOCS TO MSP 9340338122633710993290908952022-01-31I"; - private static final String RPBSWP0_FUTURE_CANCEL_DATE= " RPBSPWP000000010 ERRORMSGRPBS0090DEPENDENT HAS A FUTURE CANCEL DATE. PLS FORWARD DOCS TO MSP 9340338122633710993290908952023-02-28I"; + private static final String RPBSPWP0_ERROR_PHN_NOT_IN_GROUP = " RPBSPWP000000010 ERRORMSGRPBS0105PHN MUST BE A SUBSCRIBER IN GROUP 9340338122624310993290908952023-02-28I"; + private static final String RPBSPWP0_ERROR_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER= " RPBSPWP000000010 ERRORMSGRPBS0104DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER. 9331926919633710998828072772022-01-31P"; + private static final String RPBSPWP0_ERROR_NO_ACTIVE_COVERAGES_FOUND= " RPBSPWP000000010 ERRORMSGRPBS0047NO ACTIVE COVERAGES FOUND. PLS FORWARD SOURCE DOCS TO MSP 9340338122633710993290908952022-01-31I"; + private static final String RPBSPWP0_ERROR_FUTURE_CANCEL_DATE= " RPBSPWP000000010 ERRORMSGRPBS0090DEPENDENT HAS A FUTURE CANCEL DATE. PLS FORWARD DOCS TO MSP 9340338122633710993290908952023-02-28I"; private static MockWebServer mockBackEnd; @@ -361,24 +362,24 @@ public void testAddGroupMember_success() throws InterruptedException { @Test - public void testCancelGroupMemberDependent_dependentNotUnderSubcriberCoverage() throws InterruptedException { + public void testCancelDependent_dependentNotUnderSubcriberCoverage() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() - .setBody(RPBSPWP0_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER) + .setBody(RPBSPWP0_ERROR_DEPENDENT_HAS_NO_COVERAGE_UNDER_SUBSCRIBER) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); - CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); - cancelGroupMemberDependentRequest.setPhn("9331926919"); - cancelGroupMemberDependentRequest.setGroupNumber("6337109"); - cancelGroupMemberDependentRequest.setDependentPhn("9882807277"); - cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); - cancelGroupMemberDependentRequest.setCancelReason("I"); + CancelDependentRequest cancelDependentRequest = new CancelDependentRequest(); + cancelDependentRequest.setPhn("9331926919"); + cancelDependentRequest.setGroupNumber("6337109"); + cancelDependentRequest.setDependentPhn("9882807277"); + cancelDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelDependentRequest.setCancelReason("I"); - ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + ResponseEntity response = groupMemberController.cancelDependent(cancelDependentRequest); - CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); - assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); - assertEquals("RPBS0104 DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER.", cancelGroupMemberDependentResponse.getMessage()); - assertEquals("9331926919", cancelGroupMemberDependentResponse.getPhn()); + CancelDependentResponse cancelDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelDependentResponse.getStatus()); + assertEquals("RPBS0104 DEPENDENT MUST HAVE COVERAGE UNDER SUBSCRIBER.", cancelDependentResponse.getMessage()); + assertEquals("9331926919", cancelDependentResponse.getPhn()); // Check the client request is sent as expected RecordedRequest recordedRequest = mockBackEnd.takeRequest(); @@ -386,24 +387,24 @@ public void testCancelGroupMemberDependent_dependentNotUnderSubcriberCoverage() } @Test - public void testCancelGroupMemberDependent_subscriberPhnNotInGroup() throws InterruptedException { + public void testCancelDependent_subscriberPhnNotInGroup() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() - .setBody( RPBSPWP0_PHN_NOT_IN_GROUP) + .setBody( RPBSPWP0_ERROR_PHN_NOT_IN_GROUP) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); - CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); - cancelGroupMemberDependentRequest.setPhn("9340338122"); - cancelGroupMemberDependentRequest.setGroupNumber("6243109"); - cancelGroupMemberDependentRequest.setDependentPhn("9329090895"); - cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2023, 02, 28)); - cancelGroupMemberDependentRequest.setCancelReason("I"); + CancelDependentRequest cancelDependentRequest = new CancelDependentRequest(); + cancelDependentRequest.setPhn("9340338122"); + cancelDependentRequest.setGroupNumber("6243109"); + cancelDependentRequest.setDependentPhn("9329090895"); + cancelDependentRequest.setCoverageCancelDate(LocalDate.of(2023, 02, 28)); + cancelDependentRequest.setCancelReason("I"); - ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + ResponseEntity response = groupMemberController.cancelDependent(cancelDependentRequest); - CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); - assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); - assertEquals("RPBS0105 PHN MUST BE A SUBSCRIBER IN GROUP", cancelGroupMemberDependentResponse.getMessage()); - assertEquals("9340338122", cancelGroupMemberDependentResponse.getPhn()); + CancelDependentResponse cancelDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelDependentResponse.getStatus()); + assertEquals("RPBS0105 PHN MUST BE A SUBSCRIBER IN GROUP", cancelDependentResponse.getMessage()); + assertEquals("9340338122", cancelDependentResponse.getPhn()); // Check the client request is sent as expected RecordedRequest recordedRequest = mockBackEnd.takeRequest(); @@ -411,24 +412,24 @@ public void testCancelGroupMemberDependent_subscriberPhnNotInGroup() throws Inte } @Test - public void testCancelGroupMemberDependent_subscriberAndDependentPhnAreSame() throws InterruptedException { + public void testCancelDependent_subscriberAndDependentPhnAreSame() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() .setBody(RPBSPWP0_ERROR_SAME_DEPENDENT_PHN) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); - CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); - cancelGroupMemberDependentRequest.setPhn("9882807277"); - cancelGroupMemberDependentRequest.setGroupNumber("6337109"); - cancelGroupMemberDependentRequest.setDependentPhn("9882807277"); - cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); - cancelGroupMemberDependentRequest.setCancelReason("I"); + CancelDependentRequest cancelDependentRequest = new CancelDependentRequest(); + cancelDependentRequest.setPhn("9882807277"); + cancelDependentRequest.setGroupNumber("6337109"); + cancelDependentRequest.setDependentPhn("9882807277"); + cancelDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelDependentRequest.setCancelReason("I"); - ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + ResponseEntity response = groupMemberController.cancelDependent(cancelDependentRequest); - CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); - assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); - assertEquals("RPBS0097 SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT.", cancelGroupMemberDependentResponse.getMessage()); - assertEquals("9882807277", cancelGroupMemberDependentResponse.getPhn()); + CancelDependentResponse cancelDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelDependentResponse.getStatus()); + assertEquals("RPBS0097 SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT.", cancelDependentResponse.getMessage()); + assertEquals("9882807277", cancelDependentResponse.getPhn()); // Check the client request is sent as expected RecordedRequest recordedRequest = mockBackEnd.takeRequest(); @@ -436,80 +437,79 @@ public void testCancelGroupMemberDependent_subscriberAndDependentPhnAreSame() th } @Test - public void testCancelGroupMemberDependent_noActiveCovereage() throws InterruptedException { + public void testCancelDependent_noActiveCoverage() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() - .setBody(RPBSWP0_NO_ACTIVE_COVERAGES_FOUND) + .setBody(RPBSPWP0_ERROR_NO_ACTIVE_COVERAGES_FOUND) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); - CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); - cancelGroupMemberDependentRequest.setPhn("9340338122"); - cancelGroupMemberDependentRequest.setGroupNumber("6337109"); - cancelGroupMemberDependentRequest.setDependentPhn("9329090895"); - cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); - cancelGroupMemberDependentRequest.setCancelReason("I"); + CancelDependentRequest cancelDependentRequest = new CancelDependentRequest(); + cancelDependentRequest.setPhn("9340338122"); + cancelDependentRequest.setGroupNumber("6337109"); + cancelDependentRequest.setDependentPhn("9329090895"); + cancelDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelDependentRequest.setCancelReason("I"); - ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + ResponseEntity response = groupMemberController.cancelDependent(cancelDependentRequest); - CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); - assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); - assertEquals("RPBS0047 NO ACTIVE COVERAGES FOUND. PLS FORWARD SOURCE DOCS TO MSP", cancelGroupMemberDependentResponse.getMessage()); - assertEquals("9340338122", cancelGroupMemberDependentResponse.getPhn()); + CancelDependentResponse cancelDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelDependentResponse.getStatus()); + assertEquals("RPBS0047 NO ACTIVE COVERAGES FOUND. PLS FORWARD SOURCE DOCS TO MSP", cancelDependentResponse.getMessage()); + assertEquals("9340338122", cancelDependentResponse.getPhn()); // Check the client request is sent as expected RecordedRequest recordedRequest = mockBackEnd.takeRequest(); assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); } @Test - public void testCancelGroupMemberDependent_futureCancelDate() throws InterruptedException { + public void testCancelDependent_futureCancelDate() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() - .setBody(RPBSWP0_FUTURE_CANCEL_DATE) + .setBody(RPBSPWP0_ERROR_FUTURE_CANCEL_DATE) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); - CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); - cancelGroupMemberDependentRequest.setPhn("9340338122"); - cancelGroupMemberDependentRequest.setGroupNumber("6337109"); - cancelGroupMemberDependentRequest.setDependentPhn("9329090895"); - cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2023, 02, 28)); - cancelGroupMemberDependentRequest.setCancelReason("I"); + CancelDependentRequest cancelDependentRequest = new CancelDependentRequest(); + cancelDependentRequest.setPhn("9340338122"); + cancelDependentRequest.setGroupNumber("6337109"); + cancelDependentRequest.setDependentPhn("9329090895"); + cancelDependentRequest.setCoverageCancelDate(LocalDate.of(2023, 02, 28)); + cancelDependentRequest.setCancelReason("I"); - ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + ResponseEntity response = groupMemberController.cancelDependent(cancelDependentRequest); - CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); - assertEquals(StatusEnum.ERROR, cancelGroupMemberDependentResponse.getStatus()); - assertEquals("RPBS0090 DEPENDENT HAS A FUTURE CANCEL DATE. PLS FORWARD DOCS TO MSP", cancelGroupMemberDependentResponse.getMessage()); - assertEquals("9340338122", cancelGroupMemberDependentResponse.getPhn()); + CancelDependentResponse cancelDependentResponse = response.getBody(); + assertEquals(StatusEnum.ERROR, cancelDependentResponse.getStatus()); + assertEquals("RPBS0090 DEPENDENT HAS A FUTURE CANCEL DATE. PLS FORWARD DOCS TO MSP", cancelDependentResponse.getMessage()); + assertEquals("9340338122", cancelDependentResponse.getPhn()); // Check the client request is sent as expected RecordedRequest recordedRequest = mockBackEnd.takeRequest(); assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); } @Test - public void testCancelGroupMemberDependent_success() throws InterruptedException { + public void testCancelDependent_success() throws InterruptedException { mockBackEnd.enqueue(new MockResponse() .setBody(RPBSPWP0_SUCCESS) .addHeader(CONTENT_TYPE, MediaType.TEXT_PLAIN.toString())); - CancelGroupMemberDependentRequest cancelGroupMemberDependentRequest = new CancelGroupMemberDependentRequest(); - cancelGroupMemberDependentRequest.setPhn("9873895927"); - cancelGroupMemberDependentRequest.setGroupNumber("6337109"); - cancelGroupMemberDependentRequest.setDependentPhn("9397105575"); - cancelGroupMemberDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); - cancelGroupMemberDependentRequest.setCancelReason("K"); + CancelDependentRequest cancelDependentRequest = new CancelDependentRequest(); + cancelDependentRequest.setPhn("9873895927"); + cancelDependentRequest.setGroupNumber("6337109"); + cancelDependentRequest.setDependentPhn("9397105575"); + cancelDependentRequest.setCoverageCancelDate(LocalDate.of(2022, 01, 31)); + cancelDependentRequest.setCancelReason("K"); - ResponseEntity response = groupMemberController.cancelGroupMemberDependent(cancelGroupMemberDependentRequest); + ResponseEntity response = groupMemberController.cancelDependent(cancelDependentRequest); - CancelGroupMemberDependentResponse cancelGroupMemberDependentResponse = response.getBody(); - assertEquals(StatusEnum.SUCCESS, cancelGroupMemberDependentResponse.getStatus()); - assertEquals("TRANSACTION SUCCESSFUL", cancelGroupMemberDependentResponse.getMessage()); - assertEquals("9873895927", cancelGroupMemberDependentResponse.getPhn()); + CancelDependentResponse cancelDependentResponse = response.getBody(); + assertEquals(StatusEnum.SUCCESS, cancelDependentResponse.getStatus()); + assertEquals("TRANSACTION SUCCESSFUL", cancelDependentResponse.getMessage()); + assertEquals("9873895927", cancelDependentResponse.getPhn()); // Check the client request is sent as expected RecordedRequest recordedRequest = mockBackEnd.takeRequest(); assertEquals(HttpMethod.POST.name(), recordedRequest.getMethod()); } - - + /** * The URL property used by the mocked endpoint needs to be set after the MockWebServer starts as the port it uses is * created dynamically on start up to ensure it uses an available port so it is not known before then. diff --git a/frontend/src/components/template/TheNavBar.vue b/frontend/src/components/template/TheNavBar.vue index 34b9bae7..dc42e210 100644 --- a/frontend/src/components/template/TheNavBar.vue +++ b/frontend/src/components/template/TheNavBar.vue @@ -9,10 +9,10 @@ @@ -30,12 +30,12 @@ @@ -90,7 +90,7 @@ export default { const hasPermission = this.$store.getters['auth/hasPermission'] return hasPermission('E45') || hasPermission('R15') || hasPermission('R41') }, - } + }, } diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index ada32771..408b2131 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -1,24 +1,24 @@ import { createRouter, createWebHistory } from 'vue-router' -import Help from './../views/Help.vue' -import Home from './../views/Home.vue' -import CheckEligibility from './../views/eligibility/CheckEligibility.vue' -import CoverageStatusCheck from './../views/eligibility/CoverageStatusCheck.vue' -import store from '../store' -import NotFound from '../views/NotFound.vue' -import Unauthorized from '../views/Unauthorized.vue' +import AddGroupMember from '../views/groupmember/AddGroupMember.vue' import AddVisaResidentWithPHN from '../views/coverage/enrollment/AddVisaResidentWithPHN.vue' import AddVisaResidentWithoutPHN from '../views/coverage/enrollment/AddVisaResidentWithoutPHN.vue' +import CancelDependent from '../views/groupmember/CancelDependent.vue' +import CancelGroupMember from '../views/groupmember/CancelGroupMember.vue' +import CheckEligibility from './../views/eligibility/CheckEligibility.vue' import CoverageEnrollmentHome from '../views/coverage/enrollment/CoverageEnrollmentHome.vue' import CoverageMaintenanceHome from '../views/coverage/maintenance/CoverageMaintenanceHome.vue' +import CoverageStatusCheck from './../views/eligibility/CoverageStatusCheck.vue' import EligibilityHome from '../views/eligibility/EligibilityHome.vue' +import GroupMemberHome from '../views/groupmember/GroupMemberHome.vue' +import Help from './../views/Help.vue' +import Home from './../views/Home.vue' +import NotFound from '../views/NotFound.vue' import PhnInquiry from '../views/eligibility/PhnInquiry.vue' import PhnLookup from '../views/eligibility/PhnLookup.vue' -import AddGroupMember from '../views/groupmember/AddGroupMember.vue' -import CancelGroupMember from '../views/groupmember/CancelGroupMember.vue' -import GroupMemberHome from '../views/groupmember/GroupMemberHome.vue' +import Unauthorized from '../views/Unauthorized.vue' import UpdateNumberAndDept from '../views/groupmember/UpdateNumberAndDept.vue' -import CancelGroupMemberDependent from '../views/groupmember/CancelGroupMemberDependent.vue' +import store from '../store' const routes = [ { @@ -104,7 +104,7 @@ const routes = [ { path: 'addGroupMember', name: 'AddGroupMember', - component: AddGroupMember, + component: AddGroupMember, }, { path: 'updateNumberAndDept', @@ -117,9 +117,9 @@ const routes = [ component: CancelGroupMember, }, { - path: 'cancelGroupMemberDependent', - name: 'CancelGroupMemberDependent', - component: CancelGroupMemberDependent, + path: 'cancelDependent', + name: 'CancelDependent', + component: CancelDependent, }, ], }, diff --git a/frontend/src/services/BaseService.js b/frontend/src/services/BaseService.js index 2eb94d57..3c421701 100644 --- a/frontend/src/services/BaseService.js +++ b/frontend/src/services/BaseService.js @@ -17,7 +17,7 @@ export const resources = { addGroupMember: '/group-member/add-group-member', updateNumberAndDept: '/group-member/update-number-and-dept', cancelGroupMember: '/group-member/cancel-group-member', - cancelGroupMemberDependent: '/group-member/cancel-group-member-dependent', + cancelDependent: '/group-member/cancel-dependent', }, user: { permissions: '/user/permissions', diff --git a/frontend/src/services/GroupMemberService.js b/frontend/src/services/GroupMemberService.js index 98d57125..f053a799 100644 --- a/frontend/src/services/GroupMemberService.js +++ b/frontend/src/services/GroupMemberService.js @@ -1,18 +1,16 @@ import { apiRequest, resources } from './BaseService' export default { - - updateNumberAndDept(request) { - return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.updateNumberAndDept, request)) + updateNumberAndDept(request) { + return apiRequest().then((axiosInstance) => axiosInstance.post(resources.groupMember.updateNumberAndDept, request)) }, cancelGroupMember(request) { - return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.cancelGroupMember, request)) + return apiRequest().then((axiosInstance) => axiosInstance.post(resources.groupMember.cancelGroupMember, request)) }, - addGroupMember(request) { - return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.addGroupMember, request)) - }, - cancelGroupMemberDependent(request) { - return apiRequest().then(axiosInstance => axiosInstance.post(resources.groupMember.cancelGroupMemberDependent, request)) + addGroupMember(request) { + return apiRequest().then((axiosInstance) => axiosInstance.post(resources.groupMember.addGroupMember, request)) }, - -} \ No newline at end of file + cancelDependent(request) { + return apiRequest().then((axiosInstance) => axiosInstance.post(resources.groupMember.cancelDependent, request)) + }, +} diff --git a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue b/frontend/src/views/groupmember/CancelDependent.vue similarity index 96% rename from frontend/src/views/groupmember/CancelGroupMemberDependent.vue rename to frontend/src/views/groupmember/CancelDependent.vue index 143b0ca4..47047d84 100644 --- a/frontend/src/views/groupmember/CancelGroupMemberDependent.vue +++ b/frontend/src/views/groupmember/CancelDependent.vue @@ -1,5 +1,5 @@ diff --git a/frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js b/frontend/tests/e2e/pages/groupmember/CancelDependent.js similarity index 89% rename from frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js rename to frontend/tests/e2e/pages/groupmember/CancelDependent.js index f5d5cf6a..ee3d69d5 100644 --- a/frontend/tests/e2e/pages/groupmember/CancelGroupMemberDependent.js +++ b/frontend/tests/e2e/pages/groupmember/CancelDependent.js @@ -1,6 +1,6 @@ import { Selector } from 'testcafe' -class CancelGroupMemberDependent { +class CancelDependent { constructor() { this.phnInput = Selector('#phn') this.dependentPhnInput = Selector('#dependentPhn') @@ -15,4 +15,4 @@ class CancelGroupMemberDependent { } } -export default new CancelGroupMemberDependent() +export default new CancelDependent() diff --git a/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js b/frontend/tests/e2e/tests/groupmember/CancelDependentTest.js similarity index 53% rename from frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js rename to frontend/tests/e2e/tests/groupmember/CancelDependentTest.js index 83a554aa..56985ee1 100644 --- a/frontend/tests/e2e/tests/groupmember/CancelGroupMemberDependentTest.js +++ b/frontend/tests/e2e/tests/groupmember/CancelDependentTest.js @@ -1,5 +1,5 @@ import AlertPage from '../../pages/AlertPage' -import CancelGroupMemberDependent from '../../pages/groupmember/CancelGroupMemberDependent' +import CancelDependent from '../../pages/groupmember/CancelDependent' import { SITE_UNDER_TEST } from '../../configuration' import { regularAccUser } from '../../roles/roles' @@ -13,9 +13,9 @@ const DEPENDENT_PHN_REQUIRED_MESSAGE = 'PHN is required' const CANCEL_REASON_REQUIRED_MESSAGE = 'Cancel Reason is required' const RAPID_RESPONSE = 'RPBS0097 SUBSCRIBER AND DEPENDENT PHN MUST BE DIFFERENT.' -const PAGE_TO_TEST = SITE_UNDER_TEST + '/groupmember/CancelGroupMemberDependent' +const PAGE_TO_TEST = SITE_UNDER_TEST + '/groupmember/CancelDependent' -fixture(`CancelGroupMemberDependent Page`).disablePageCaching`Test CancelGroupMemberDependent` +fixture(`CancelDependent Page`).disablePageCaching`Test CancelDependent` .beforeEach(async (t) => { await t.useRole(regularAccUser) }) @@ -25,36 +25,36 @@ test('Check required fields validation', async (t) => { await t // Given required fields aren't filled out (phn, dependent phn, group member, group member number, department) // When I click the submit button - .click(CancelGroupMemberDependent.submitButton) + .click(CancelDependent.submitButton) // I expect an error message stating the page had errors and individual error messages for each required field .expect(AlertPage.alertBannerText.textContent) .contains(ERROR_MESSAGE) - .expect(CancelGroupMemberDependent.errorText.nth(0).textContent) + .expect(CancelDependent.errorText.nth(0).textContent) .contains(GROUP_NUMBER_REQUIRED_MESSAGE) - .expect(CancelGroupMemberDependent.errorText.nth(1).textContent) + .expect(CancelDependent.errorText.nth(1).textContent) .contains(PHN_REQUIRED_MESSAGE) - .expect(CancelGroupMemberDependent.errorText.nth(2).textContent) + .expect(CancelDependent.errorText.nth(2).textContent) .contains(DEPENDENT_PHN_REQUIRED_MESSAGE) - .expect(CancelGroupMemberDependent.errorText.nth(3).textContent) + .expect(CancelDependent.errorText.nth(3).textContent) .contains(COVERAGE_CANCEL_DATE_REQUIRED_MESSAGE) - .expect(CancelGroupMemberDependent.errorText.nth(4).textContent) + .expect(CancelDependent.errorText.nth(4).textContent) .contains(CANCEL_REASON_REQUIRED_MESSAGE) }) test('Check invalid formats validation', async (t) => { await t // Given I enter PHN, Dependent PHN, Group Number, and Cancel dates with invalid formats - .typeText(CancelGroupMemberDependent.phnInput, '9000448000') - .typeText(CancelGroupMemberDependent.dependentPhnInput, '9000448000') - .typeText(CancelGroupMemberDependent.groupNumberInput, '123') + .typeText(CancelDependent.phnInput, '9000448000') + .typeText(CancelDependent.dependentPhnInput, '9000448000') + .typeText(CancelDependent.groupNumberInput, '123') // When I click the submit button - .click(CancelGroupMemberDependent.submitButton) + .click(CancelDependent.submitButton) // I expect an error message stating the page had errors and an individual error message for the PHN and Group and Cancel Date formats - .expect(CancelGroupMemberDependent.errorText.nth(0).textContent) + .expect(CancelDependent.errorText.nth(0).textContent) .contains(INVALID_GROUP_NUMBER_ERROR_MESSAGE) - .expect(CancelGroupMemberDependent.errorText.nth(1).textContent) + .expect(CancelDependent.errorText.nth(1).textContent) .contains(INVALID_PHN_ERROR_MESSAGE) - .expect(CancelGroupMemberDependent.errorText.nth(2).textContent) + .expect(CancelDependent.errorText.nth(2).textContent) .contains(INVALID_PHN_ERROR_MESSAGE) .expect(AlertPage.alertBannerText.textContent) .contains(ERROR_MESSAGE) @@ -63,16 +63,16 @@ test('Check invalid formats validation', async (t) => { test('Check properly filled form passes validation', async (t) => { await t // Given I have a form filled out with data - .typeText(CancelGroupMemberDependent.groupNumberInput, '6243109') - .typeText(CancelGroupMemberDependent.phnInput, '9397105575') - .typeText(CancelGroupMemberDependent.dependentPhnInput, '9397105575') - .click(CancelGroupMemberDependent.cancelDateInput) - .click(CancelGroupMemberDependent.divSelectedDate) - .click(CancelGroupMemberDependent.cancelReasonInput) + .typeText(CancelDependent.groupNumberInput, '6243109') + .typeText(CancelDependent.phnInput, '9397105575') + .typeText(CancelDependent.dependentPhnInput, '9397105575') + .click(CancelDependent.cancelDateInput) + .click(CancelDependent.divSelectedDate) + .click(CancelDependent.cancelReasonInput) .pressKey('down') .pressKey('enter') // When I click the submit button - .click(CancelGroupMemberDependent.submitButton) + .click(CancelDependent.submitButton) // I expect a response from RAPID .expect(AlertPage.alertBannerText.textContent) .contains(RAPID_RESPONSE) @@ -81,28 +81,28 @@ test('Check properly filled form passes validation', async (t) => { test('Check clear button clears the form', async (t) => { await t // Given I have a form filled out with data - .typeText(CancelGroupMemberDependent.phnInput, '9882807277') - .typeText(CancelGroupMemberDependent.dependentPhnInput, '9882807277') - .typeText(CancelGroupMemberDependent.groupNumberInput, '6337109') - .click(CancelGroupMemberDependent.relationshipInput) + .typeText(CancelDependent.phnInput, '9882807277') + .typeText(CancelDependent.dependentPhnInput, '9882807277') + .typeText(CancelDependent.groupNumberInput, '6337109') + .click(CancelDependent.relationshipInput) .pressKey('down') .pressKey('enter') - .click(CancelGroupMemberDependent.cancelReasonInput) + .click(CancelDependent.cancelReasonInput) .pressKey('down') .pressKey('enter') - .click(CancelGroupMemberDependent.cancelDateInput) - .click(CancelGroupMemberDependent.divSelectedDate) + .click(CancelDependent.cancelDateInput) + .click(CancelDependent.divSelectedDate) // When I click the clear button - .click(CancelGroupMemberDependent.clearButton) + .click(CancelDependent.clearButton) // I expect the form to be cleared - .expect(CancelGroupMemberDependent.phnInput.value) + .expect(CancelDependent.phnInput.value) .eql('') - .expect(CancelGroupMemberDependent.dependentPhnInput.value) + .expect(CancelDependent.dependentPhnInput.value) .eql('') - .expect(CancelGroupMemberDependent.groupNumberInput.value) + .expect(CancelDependent.groupNumberInput.value) .eql('') - .expect(CancelGroupMemberDependent.cancelReasonInput.value) + .expect(CancelDependent.cancelReasonInput.value) .eql('') - .expect(CancelGroupMemberDependent.cancelDateInput.value) + .expect(CancelDependent.cancelDateInput.value) .eql('') }) From 0a2f01c2b690ff209f7f398516c277a4dde87b7a Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Tue, 1 Feb 2022 18:47:48 -0700 Subject: [PATCH 10/11] R36: Removed validation for relationship field --- frontend/src/views/groupmember/CancelDependent.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/views/groupmember/CancelDependent.vue b/frontend/src/views/groupmember/CancelDependent.vue index 47047d84..0806ba0f 100644 --- a/frontend/src/views/groupmember/CancelDependent.vue +++ b/frontend/src/views/groupmember/CancelDependent.vue @@ -13,7 +13,7 @@ - + @@ -154,7 +154,6 @@ export default { required, validatePHN: helpers.withMessage(VALIDATE_PHN_MESSAGE, validatePHN), }, - relationship: {}, groupNumber: { required, validateGroupNumber: helpers.withMessage(VALIDATE_GROUP_NUMBER_MESSAGE, validateGroupNumber), From 8d032ffe3d5a7f3305e1bb0d40ac748440cf8f69 Mon Sep 17 00:00:00 2001 From: AnumehaSrivastava05 Date: Wed, 2 Feb 2022 10:23:00 -0700 Subject: [PATCH 11/11] R36: Removed e-model for relationship field --- frontend/src/views/groupmember/CancelDependent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/groupmember/CancelDependent.vue b/frontend/src/views/groupmember/CancelDependent.vue index 0806ba0f..80084481 100644 --- a/frontend/src/views/groupmember/CancelDependent.vue +++ b/frontend/src/views/groupmember/CancelDependent.vue @@ -13,7 +13,7 @@ - +