From 3069fbb3fd5c3356f7c5fe8b472b38613b52d593 Mon Sep 17 00:00:00 2001 From: daveb-hni <80367247+daveb-hni@users.noreply.github.com> Date: Tue, 7 Mar 2023 12:40:11 -0800 Subject: [PATCH] 9067 pbf disable search for inactive payees (#181) * 9067: Added the Payee Status to the mapping response * 9067: Updated validation to make cancel date still active * 9067: Updated test for payee mappings * 9067: Added validation for non active payee * 9067: Updated to return first active payee record * 9067: Updated to check if payee is active * 9067: Renamed method * 9067: Updates from code review * 9067: Added parameter for contact number * 9067: Updated message --- .../BcscPayeeMappingController.java | 10 ++- .../PatientRegistrationController.java | 19 ++++- .../rest/pbf/BcscPayeeMappingResponse.java | 19 ++++- .../entity/pbf/PBFClinicPayee.java | 6 ++ .../pbf/PBFClinicPayeeRepository.java | 13 ++++ .../hnweb/service/PBFClinicPayeeService.java | 38 ++++++++++ .../BcscPayeeMappingControllerTest.java | 40 +++++++++- .../PatientRegistrationControllerTest.java | 30 +++++++- .../service/PBFClinicPayeeServiceTest.java | 76 +++++++++++++++++++ .../resources/scripts/bcsc_payee_mapping.sql | 3 +- .../resources/scripts/pbf_clinic_payee.sql | 14 ++++ frontend/env_config/.env.development | 3 +- .../ViewPatientRegistration.vue | 11 ++- 13 files changed, 264 insertions(+), 18 deletions(-) create mode 100644 backend/src/main/java/ca/bc/gov/hlth/hnweb/service/PBFClinicPayeeService.java create mode 100644 backend/src/test/java/ca/bc/gov/hlth/hnweb/service/PBFClinicPayeeServiceTest.java create mode 100644 backend/src/test/resources/scripts/pbf_clinic_payee.sql diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/BcscPayeeMappingController.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/BcscPayeeMappingController.java index 12c2ce1c..037b63da 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/BcscPayeeMappingController.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/BcscPayeeMappingController.java @@ -23,6 +23,7 @@ import ca.bc.gov.hlth.hnweb.model.rest.pbf.BcscPayeeMappingResponse; import ca.bc.gov.hlth.hnweb.persistence.entity.pbf.BcscPayeeMapping; import ca.bc.gov.hlth.hnweb.service.BcscPayeeMappingService; +import ca.bc.gov.hlth.hnweb.service.PBFClinicPayeeService; /** * Controller to handle CRUD requests for maintaining BC Services Card (BCSC) Users to their PBF MSP Payee Number mappings. @@ -36,6 +37,9 @@ public class BcscPayeeMappingController { @Autowired private BcscPayeeMappingService bcscPayeeMappingService; + + @Autowired + private PBFClinicPayeeService pbfClinicPayeeService; /** * Create a BCSC User to MSP Payee Number mapping @@ -93,7 +97,11 @@ public ResponseEntity getBcscPayeeMapping(@PathVariabl throw new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Entity not found for ID %s", id)); } - BcscPayeeMappingResponse bcscPayeeMappingResponse = mapEntityToRepsonse(bcscPayeeMappingOptional.get()); + BcscPayeeMapping bcscPayeeMapping = bcscPayeeMappingOptional.get(); + BcscPayeeMappingResponse bcscPayeeMappingResponse = mapEntityToRepsonse(bcscPayeeMapping); + + bcscPayeeMappingResponse.setPayeeIsActive(pbfClinicPayeeService.getPayeeActiveStatus(bcscPayeeMapping.getPayeeNumber())); + return ResponseEntity.ok(bcscPayeeMappingResponse); } diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/PatientRegistrationController.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/PatientRegistrationController.java index 561bab91..8438afe7 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/PatientRegistrationController.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/controller/PatientRegistrationController.java @@ -45,6 +45,7 @@ import ca.bc.gov.hlth.hnweb.security.UserInfo; import ca.bc.gov.hlth.hnweb.service.BcscPayeeMappingService; import ca.bc.gov.hlth.hnweb.service.EnrollmentService; +import ca.bc.gov.hlth.hnweb.service.PBFClinicPayeeService; import ca.bc.gov.hlth.hnweb.service.PatientRegistrationService; /** @@ -77,7 +78,10 @@ public class PatientRegistrationController extends BaseController { @Autowired private BcscPayeeMappingService bcscPayeeMappingService; - @PostMapping("/get-patient-registration") + @Autowired + private PBFClinicPayeeService pbfClinicPayeeService; + + @PostMapping("/get-patient-registration") public ResponseEntity getPatientRegistration( @Valid @RequestBody PatientRegistrationRequest patientRegistrationRequest, HttpServletRequest request) { @@ -150,10 +154,17 @@ private void validatePayeeNumberMapping(PatientRegistrationRequest patientRegist logger.error("No Payee Number mapping was found for the current user"); throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "No Payee Number mapping was found for the current user"); } - if (!StringUtils.equals(patientRegistrationRequest.getPayee(), bcscPayeeMappingOptional.get().getPayeeNumber())) { - logger.error("Payee field value {} does not match the Payee Number mapped to this user", patientRegistrationRequest.getPayee()); - throw new ResponseStatusException(HttpStatus.BAD_REQUEST, String.format("Payee field value %s does not match the Payee Number mapped to this user", patientRegistrationRequest.getPayee())); + String mappedPayeeNumber = bcscPayeeMappingOptional.get().getPayeeNumber(); + String requestPayeeNumber = patientRegistrationRequest.getPayee(); + if (!StringUtils.equals(requestPayeeNumber, mappedPayeeNumber)) { + logger.error("Payee field value {} does not match the Payee Number mapped to this user", requestPayeeNumber); + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, String.format("Payee field value %s does not match the Payee Number mapped to this user", requestPayeeNumber)); } + boolean isActive = pbfClinicPayeeService.getPayeeActiveStatus(mappedPayeeNumber); + if (!isActive) { + logger.error("Payee {} is not active", requestPayeeNumber); + throw new ResponseStatusException(HttpStatus.BAD_REQUEST, String.format("Payee %s is not active", requestPayeeNumber)); + } } private PatientRegistrationResponse handlePatientRegistrationResponse( diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/pbf/BcscPayeeMappingResponse.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/pbf/BcscPayeeMappingResponse.java index 732967db..38e92f36 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/pbf/BcscPayeeMappingResponse.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/model/rest/pbf/BcscPayeeMappingResponse.java @@ -5,6 +5,8 @@ public class BcscPayeeMappingResponse { private String bcscGuid; private String payeeNumber; + + private Boolean payeeIsActive; public String getBcscGuid() { return bcscGuid; @@ -22,9 +24,18 @@ public void setPayeeNumber(String payeeNumber) { this.payeeNumber = payeeNumber; } - @Override - public String toString() { - return "BcscPayeeMapping [bcscGuid=" + bcscGuid + ", payeeNumber=" + payeeNumber + "]"; - } + public Boolean getPayeeIsActive() { + return payeeIsActive; + } + + public void setPayeeIsActive(Boolean payeeIsActive) { + this.payeeIsActive = payeeIsActive; + } + + @Override + public String toString() { + return "BcscPayeeMappingResponse [bcscGuid=" + bcscGuid + ", payeeNumber=" + payeeNumber + ", payeeIsActive=" + + payeeIsActive + "]"; + } } diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/persistence/entity/pbf/PBFClinicPayee.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/persistence/entity/pbf/PBFClinicPayee.java index ad1cde8d..2ffab0f4 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/persistence/entity/pbf/PBFClinicPayee.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/persistence/entity/pbf/PBFClinicPayee.java @@ -85,4 +85,10 @@ public void setArchived(Boolean archived) { this.archived = archived; } + @Override + public String toString() { + return "PBFClinicPayee [pbfClinicPayeeId=" + pbfClinicPayeeId + ", payeeNumber=" + payeeNumber + + ", effectiveDate=" + effectiveDate + ", cancelDate=" + cancelDate + ", reportGroup=" + reportGroup + + ", archived=" + archived + "]"; + } } \ No newline at end of file diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/persistence/repository/pbf/PBFClinicPayeeRepository.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/persistence/repository/pbf/PBFClinicPayeeRepository.java index 3858aadf..eede5d69 100644 --- a/backend/src/main/java/ca/bc/gov/hlth/hnweb/persistence/repository/pbf/PBFClinicPayeeRepository.java +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/persistence/repository/pbf/PBFClinicPayeeRepository.java @@ -1,9 +1,22 @@ package ca.bc.gov.hlth.hnweb.persistence.repository.pbf; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import ca.bc.gov.hlth.hnweb.persistence.entity.pbf.PBFClinicPayee; public interface PBFClinicPayeeRepository extends JpaRepository { + /** + * Counts the number of active records for a payee + * + * @param payeeNumber + * @return the number of active records for a payee + */ + @Query("select count(pcp) from PBFClinicPayee pcp" + + " where pcp.payeeNumber = :payeeNumber" + + " and pcp.archived = false" + + " and pcp.effectiveDate <= CURRENT_DATE" + + " and (pcp.cancelDate IS NULL OR pcp.cancelDate >= CURRENT_DATE)") + public long countActivePayeeEntries(String payeeNumber); } diff --git a/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/PBFClinicPayeeService.java b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/PBFClinicPayeeService.java new file mode 100644 index 00000000..65668491 --- /dev/null +++ b/backend/src/main/java/ca/bc/gov/hlth/hnweb/service/PBFClinicPayeeService.java @@ -0,0 +1,38 @@ +package ca.bc.gov.hlth.hnweb.service; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import ca.bc.gov.hlth.hnweb.persistence.repository.pbf.PBFClinicPayeeRepository; + +/** + * Service for processing PBF clinic payee requests + * + */ +@Service +public class PBFClinicPayeeService extends BaseService { + + private static final Logger logger = LoggerFactory.getLogger(PBFClinicPayeeService.class); + + @Autowired + private PBFClinicPayeeRepository pbfClinicPayeeRepository; + + /** + * Determines the status of the payee by checking if an active record exists in PBFClinicPayee table + * + * @param payeeNumber + * @return returns true if an active record is found otherwise returns false + */ + public boolean getPayeeActiveStatus(String payeeNumber) { + long activeCount = pbfClinicPayeeRepository.countActivePayeeEntries(payeeNumber); + + if (activeCount > 1) { + logger.warn("{} active records found for Payee {}.", activeCount, payeeNumber); + } + + return activeCount > 0; + } + +} diff --git a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/BcscPayeeMappingControllerTest.java b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/BcscPayeeMappingControllerTest.java index 51d342a0..bf1b62c9 100644 --- a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/BcscPayeeMappingControllerTest.java +++ b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/BcscPayeeMappingControllerTest.java @@ -2,6 +2,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.UUID; @@ -24,7 +25,7 @@ */ @SpringBootTest @Transactional -@Sql({ "classpath:scripts/bcsc_payee_mapping.sql" }) +@Sql({ "classpath:scripts/bcsc_payee_mapping.sql", "classpath:scripts/pbf_clinic_payee.sql" }) public class BcscPayeeMappingControllerTest { @Autowired @@ -98,20 +99,51 @@ public void testAddBcscPayeeMapping_fail_bcsc_already_exists() { .withMessage("409 CONFLICT \"Entity already exists.\"; nested exception is ca.bc.gov.hlth.hnweb.exception.BcscPayeeMappingException: Entity already exists."); } + @Test + public void testGetBcscPayeeMapping_success() { + + String bcscGuid = "14100f9b-7daa-4938-a833-c8c56a5988e9"; + final String payeeNumber = "00023"; + + ResponseEntity response = bcscPayeeMappingController.getBcscPayeeMapping(bcscGuid); + assertEquals(HttpStatus.OK, response.getStatusCode()); + BcscPayeeMappingResponse bcscPayeeMappingResponse = response.getBody(); + assertNotNull(bcscPayeeMappingResponse); + assertEquals(bcscGuid, bcscPayeeMappingResponse.getBcscGuid()); + assertEquals(payeeNumber, bcscPayeeMappingResponse.getPayeeNumber()); + assertTrue(bcscPayeeMappingResponse.getPayeeIsActive()); + } + @Test - public void testGetBcscPayeeMapping_success() { + public void testGetBcscPayeeMapping_success_archived_payee() { String bcscGuid = "a9c3b536-4598-411a-bda2-4068d6b5cc20"; - String payeeNumber = "00053"; + final String payeeNumber = "00053"; ResponseEntity response = bcscPayeeMappingController.getBcscPayeeMapping(bcscGuid); assertEquals(HttpStatus.OK, response.getStatusCode()); BcscPayeeMappingResponse bcscPayeeMappingResponse = response.getBody(); assertNotNull(bcscPayeeMappingResponse); assertEquals(bcscGuid, bcscPayeeMappingResponse.getBcscGuid()); - assertEquals(payeeNumber, bcscPayeeMappingResponse.getPayeeNumber()); + assertEquals(payeeNumber, bcscPayeeMappingResponse.getPayeeNumber()); + assertEquals(false, bcscPayeeMappingResponse.getPayeeIsActive()); } + @Test + public void testGetBcscPayeeMapping_success_no_payee_status() { + + String bcscGuid = "f33c9e07-6f49-46c2-90c2-6e0013729c9d"; + final String payeeNumber = "X0054"; + + ResponseEntity response = bcscPayeeMappingController.getBcscPayeeMapping(bcscGuid); + assertEquals(HttpStatus.OK, response.getStatusCode()); + BcscPayeeMappingResponse bcscPayeeMappingResponse = response.getBody(); + assertNotNull(bcscPayeeMappingResponse); + assertEquals(bcscGuid, bcscPayeeMappingResponse.getBcscGuid()); + assertEquals(payeeNumber, bcscPayeeMappingResponse.getPayeeNumber()); + assertEquals(false, bcscPayeeMappingResponse.getPayeeIsActive()); + } + @Test public void testGetBcscPayeeMapping_fail_not_found() { diff --git a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/PatientRegistrationControllerTest.java b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/PatientRegistrationControllerTest.java index dfaffa59..f5638c44 100644 --- a/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/PatientRegistrationControllerTest.java +++ b/backend/src/test/java/ca/bc/gov/hlth/hnweb/controller/PatientRegistrationControllerTest.java @@ -2,7 +2,6 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.springframework.http.HttpHeaders.CONTENT_TYPE; @@ -287,6 +286,25 @@ public void testRegistrationHistory_failure_incorrect_payee_mapping_found() thro .withMessage("400 BAD_REQUEST \"400 BAD_REQUEST \"Payee field value T0053 does not match the Payee Number mapped to this user\"\"; nested exception is org.springframework.web.server.ResponseStatusException: 400 BAD_REQUEST \"Payee field value T0053 does not match the Payee Number mapped to this user\""); } + @Test + public void testRegistrationHistory_failure_inactive_cancelled() throws Exception { + createPBFClinicPayee(); + createPatientRegister(); + + //Note, don't enqueue a response as it is never requested and so will remain queued for next test when they are run together. + + //Override the base setup of the user to ensure we return the User with the User ID mapped to the this Payee Number + mockStatic.when(SecurityUtil::loadUserInfo).thenReturn(new UserInfo("unittest", "a9c3b536-4598-411a-bda2-4068d6b5cc20", "00000010", "Ministry of Health", "hnweb-user", UUID.randomUUID().toString())); + + PatientRegistrationRequest viewPatientRegisterRequest = new PatientRegistrationRequest(); + viewPatientRegisterRequest.setPhn("9879869673"); + viewPatientRegisterRequest.setPayee("00053"); + + assertThatExceptionOfType(ResponseStatusException.class) + .isThrownBy(() -> patientRegistrationController.getPatientRegistration(viewPatientRegisterRequest, createHttpServletRequest())) + .withMessage("400 BAD_REQUEST \"400 BAD_REQUEST \"Payee 00053 is not active\"\"; nested exception is org.springframework.web.server.ResponseStatusException: 400 BAD_REQUEST \"Payee 00053 is not active\""); + } + @Test public void testRegistrationHistory_archived() throws Exception { createPBFClinicPayee(); @@ -456,10 +474,20 @@ private void createPBFClinicPayee() { payee3.setEffectiveDate(effectiveDate3); payee3.setReportGroup("28579"); + PBFClinicPayee payee4 = new PBFClinicPayee(); + payee4.setArchived(Boolean.FALSE); + Date cancelDate4 = new GregorianCalendar(2023, 01, 01).getTime(); + payee4.setCancelDate(cancelDate4); + payee4.setPayeeNumber("00053"); + Date effectiveDate4 = new GregorianCalendar(2021, 7, 5).getTime(); + payee4.setEffectiveDate(effectiveDate4); + payee4.setReportGroup("28579"); + pbfClinicPayeeRepository.save(payee); pbfClinicPayeeRepository.save(payee1); pbfClinicPayeeRepository.save(payee2); pbfClinicPayeeRepository.save(payee3); + pbfClinicPayeeRepository.save(payee4); } /** diff --git a/backend/src/test/java/ca/bc/gov/hlth/hnweb/service/PBFClinicPayeeServiceTest.java b/backend/src/test/java/ca/bc/gov/hlth/hnweb/service/PBFClinicPayeeServiceTest.java new file mode 100644 index 00000000..7f329356 --- /dev/null +++ b/backend/src/test/java/ca/bc/gov/hlth/hnweb/service/PBFClinicPayeeServiceTest.java @@ -0,0 +1,76 @@ +package ca.bc.gov.hlth.hnweb.service; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.transaction.annotation.Transactional; + +@SpringBootTest +@Transactional +@Sql({ "classpath:scripts/bcsc_payee_mapping.sql", "classpath:scripts/pbf_clinic_payee.sql" }) +public class PBFClinicPayeeServiceTest { + + @Autowired + private PBFClinicPayeeService pbfClinicPayeeService; + + @Test + public void testfindActiveStatusByPayeeNumber_payee_not_found() { + + boolean isActive = pbfClinicPayeeService.getPayeeActiveStatus("1234"); + assertFalse(isActive); + } + + @Test + public void testfindActiveStatusByPayeeNumber_payee_archived() { + + boolean isActive = pbfClinicPayeeService.getPayeeActiveStatus("00053"); + assertFalse(isActive); + } + + @Test + public void testfindActiveStatusByPayeeNumber_payee_is_active_no_cancel_date() { + + boolean isActive = pbfClinicPayeeService.getPayeeActiveStatus("00023"); + assertTrue(isActive); + } + + @Test + public void testfindActiveStatusByPayeeNumber_payee_is_active_future_cancel_date() { + + boolean isActive = pbfClinicPayeeService.getPayeeActiveStatus("00033"); + assertTrue(isActive); + } + + @Test + public void testfindActiveStatusByPayeeNumber_payee_is_active_effective_today() { + + boolean isActive = pbfClinicPayeeService.getPayeeActiveStatus("00043"); + assertTrue(isActive); + } + + @Test + public void testfindActiveStatusByPayeeNumber_payee_not_yet_active_effective_tomorrow() { + + boolean isActive = pbfClinicPayeeService.getPayeeActiveStatus("T0055"); + assertFalse(isActive); + } + + @Test + public void testfindActiveStatusByPayeeNumber_payee_is_active_cancelled_today() { + + boolean isActive = pbfClinicPayeeService.getPayeeActiveStatus("T0053"); + assertTrue(isActive); + } + + @Test + public void testfindActiveStatusByPayeeNumber_payee_not_active_cancelled_yesterday() { + + boolean isActive = pbfClinicPayeeService.getPayeeActiveStatus("X0053"); + assertFalse(isActive); + } + +} diff --git a/backend/src/test/resources/scripts/bcsc_payee_mapping.sql b/backend/src/test/resources/scripts/bcsc_payee_mapping.sql index 14eb1bbc..0f90c208 100644 --- a/backend/src/test/resources/scripts/bcsc_payee_mapping.sql +++ b/backend/src/test/resources/scripts/bcsc_payee_mapping.sql @@ -6,4 +6,5 @@ insert into mspdirect.bcsc_payee_mapping values ('eb2d707f-7860-477b-bf7e-191995d2fb8f', '00043'), ('3c0fc3b5-45f8-4745-afa9-b7b04978023d', 'T0055'), ('e4414a89-8974-4cff-9677-d9d2df6f9cfb', 'T0053'), - ('924917e3-970a-482d-88b5-244be4c19d70', 'X0053'); + ('924917e3-970a-482d-88b5-244be4c19d70', 'X0053'), + ('f33c9e07-6f49-46c2-90c2-6e0013729c9d', 'X0054'); diff --git a/backend/src/test/resources/scripts/pbf_clinic_payee.sql b/backend/src/test/resources/scripts/pbf_clinic_payee.sql new file mode 100644 index 00000000..3d6c5d09 --- /dev/null +++ b/backend/src/test/resources/scripts/pbf_clinic_payee.sql @@ -0,0 +1,14 @@ +--Archived +INSERT INTO pbf.pbf_clinic_payee (pbf_clinic_payee_id, archived, cancel_date, effective_date, payee_number, report_group) VALUES (10000, 'true', DATEADD(MONTH, 6, CURRENT_TIMESTAMP), DATEADD(YEAR, -23, CURRENT_TIMESTAMP), '00053', 'AAAA'); +--Effective with no cancel date +INSERT INTO pbf.pbf_clinic_payee (pbf_clinic_payee_id, archived, cancel_date, effective_date, payee_number, report_group) VALUES (10001, 'false', NULL, DATEADD(YEAR, -2, CURRENT_TIMESTAMP) , '00023', 'AAAA'); +--Effective with future cancel date +INSERT INTO pbf.pbf_clinic_payee (pbf_clinic_payee_id, archived, cancel_date, effective_date, payee_number, report_group) VALUES (10002, 'false', DATEADD(YEAR, 2, CURRENT_TIMESTAMP), DATEADD(YEAR, -2, CURRENT_TIMESTAMP) , '00033', 'BBBB'); +--Effective today +INSERT INTO pbf.pbf_clinic_payee (pbf_clinic_payee_id, archived, cancel_date, effective_date, payee_number, report_group) VALUES (10003, 'false', NULL, CURRENT_TIMESTAMP, '00043', 'BBBB'); +--Effective tomorrow +INSERT INTO pbf.pbf_clinic_payee (pbf_clinic_payee_id, archived, cancel_date, effective_date, payee_number, report_group) VALUES (10004, 'false', NULL, DATEADD(DAY, 1, CURRENT_TIMESTAMP), 'T0055', 'CCCC'); +--Cancelled today => still active +INSERT INTO pbf.pbf_clinic_payee (pbf_clinic_payee_id, archived, cancel_date, effective_date, payee_number, report_group) VALUES (10005, 'false', CURRENT_TIMESTAMP, DATEADD(YEAR, -2, CURRENT_TIMESTAMP), 'T0053', 'DDDD'); +--Cancelled yesterday +INSERT INTO pbf.pbf_clinic_payee (pbf_clinic_payee_id, archived, cancel_date, effective_date, payee_number, report_group) VALUES (10006, 'false', DATEADD(DAY, -1, CURRENT_TIMESTAMP), DATEADD(YEAR, -2, CURRENT_TIMESTAMP), 'X0053', 'DDDD'); diff --git a/frontend/env_config/.env.development b/frontend/env_config/.env.development index 96caf1ec..899d03e4 100644 --- a/frontend/env_config/.env.development +++ b/frontend/env_config/.env.development @@ -9,4 +9,5 @@ VITE_SITE_MINDER_LOGOUT_URI=https://logontest7.gov.bc.ca/clp-cgi/logoff.cgi VITE_PHSA_LOGOUT_URI=https://qa-sts.healthbc.org/adfs/ls/?wa=wsignout1.0 VITE_USER_TRANSFER_URL=https://accounttransfer-dev.apps.silver.devops.gov.bc.ca/ VITE_HCIM_WEB_URL=https://hcimweb-cl-hiat2.hlth.gov.bc.ca/ -VITE_HCIM_CONTACT_NO=250-952-9137 \ No newline at end of file +VITE_HCIM_CONTACT_NO=250-952-9137 +VITE_PBF_SUPPORT_CONTACT_NO=test1234@gov.bc.ca \ No newline at end of file diff --git a/frontend/src/views/patientregistration/ViewPatientRegistration.vue b/frontend/src/views/patientregistration/ViewPatientRegistration.vue index 7078fbfd..574ccdf2 100644 --- a/frontend/src/views/patientregistration/ViewPatientRegistration.vue +++ b/frontend/src/views/patientregistration/ViewPatientRegistration.vue @@ -20,7 +20,7 @@ - Submit + Submit Clear @@ -125,14 +125,21 @@ export default { additionalInfoMessage: '', patientRegistrationHistory: [], }, - showModal: false, + payeeInactive: false, } }, async created() { try { + this.alertStore.dismissAlert() const userId = this.$keycloak.tokenParsed?.sub const bcscPayeeMapping = (await PatientRegistrationService.getBcscPayeeMapping(userId)).data + /* If a Payee mapping was found the status will be checked. If there is no active status for a Payee then + an error message should be displayed and the field disabled */ this.payee = bcscPayeeMapping.payeeNumber + if (!bcscPayeeMapping.payeeIsActive) { + this.payeeInactive = true + this.alertStore.setErrorAlert(`Payee ${bcscPayeeMapping.payeeNumber} is not an active PBF clinic.  Please email ${config.VITE_PBF_SUPPORT_CONTACT_NO || import.meta.env.VITE_PBF_SUPPORT_CONTACT_NO} if this is incorrect`) + } } catch (err) { //Check for Not Found error and add a user friendly error message if (typeof err === 'object') {