diff --git a/service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendController.java b/service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendController.java index b2d27662d..49cd51600 100644 --- a/service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendController.java +++ b/service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendController.java @@ -30,7 +30,7 @@ public class EhrResendController { private static final String OPERATION_OUTCOME_URL = "https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-OperationOutcome-1"; - private static final String CONFLICT = "CONFLICT"; + private static final String PRECONDITION_FAILED = "PRECONDITION_FAILED"; private static final String INVALID_IDENTIFIER_VALUE = "INVALID_IDENTIFIER_VALUE"; private EhrExtractStatusRepository ehrExtractStatusRepository; @@ -58,7 +58,7 @@ public ResponseEntity scheduleEhrExtractResend(@PathVariable String conv if (hasNoErrorsInEhrReceivedAcknowledgement(ehrExtractStatus) && ehrExtractStatus.getError() == null) { - var details = getCodeableConcept(CONFLICT); + var details = getCodeableConcept(PRECONDITION_FAILED); var diagnostics = "The current resend operation is still in progress. Please wait for it to complete before retrying"; var operationOutcome = createOperationOutcome(OperationOutcome.IssueType.BUSINESSRULE, OperationOutcome.IssueSeverity.ERROR, @@ -78,7 +78,7 @@ public ResponseEntity scheduleEhrExtractResend(@PathVariable String conv private static CodeableConcept getCodeableConcept(String codeableConceptCode) { return new CodeableConcept().addCoding( - new Coding("http://fhir.nhs.net/ValueSet/gpconnect-error-or-warning-code-1", codeableConceptCode, null)); + new Coding("https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", codeableConceptCode, null)); } private static boolean hasNoErrorsInEhrReceivedAcknowledgement(EhrExtractStatus ehrExtractStatus) { diff --git a/service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendControllerTest.java b/service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendControllerTest.java index a93b5f65b..d4cd3bd32 100644 --- a/service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendControllerTest.java +++ b/service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/EhrResendControllerTest.java @@ -46,8 +46,8 @@ class EhrResendControllerTest { private static final String FROM_ASID_CODE = "test-from-asid"; private static final String INCUMBENT_NACK_CODE = "99"; private static final String INCUMBENT_NACK_DISPLAY = "Unexpected condition."; - private static final String CONFLICT = "CONFLICT"; - private static final String GPCONNECT_ERROR_OR_WARNING_CODE = "http://fhir.nhs.net/ValueSet/gpconnect-error-or-warning-code-1"; + private static final String PRECONDITION_FAILED = "PRECONDITION_FAILED"; + private static final String GPCONNECT_ERROR_OR_WARNING_CODE = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1"; private static final String INVALID_IDENTIFIER_VALUE = "INVALID_IDENTIFIER_VALUE"; public static final String ISSUE_CODE_VALUE = "value"; public static final String ISSUE_CODE_BUSINESS_RULE = "business-rule"; @@ -129,7 +129,7 @@ void When_AnEhrExtractHasFailed_Expect_GetGpcStructuredTaskScheduledAndEhrExtrac } @Test - void When_AnEhrExtractHasNotFailedAndAnotherResendRequestArrives_Expect_FailedOperationOutcome() throws JsonProcessingException { + void When_AnEhrExtractIsStillInProgress_Expect_FailedOperationOutcome() throws JsonProcessingException { final EhrExtractStatus IN_PROGRESS_EXTRACT_STATUS = EhrExtractStatus.builder() .conversationId(CONVERSATION_ID) @@ -145,7 +145,7 @@ void When_AnEhrExtractHasNotFailedAndAnotherResendRequestArrives_Expect_FailedOp JsonNode rootNode = objectMapper.readTree(response.getBody()); assertAll( - () -> assertResponseHasExpectedOperationOutcome(rootNode, CONFLICT, DIAGNOSTICS_MSG, ISSUE_CODE_BUSINESS_RULE), + () -> assertResponseHasExpectedOperationOutcome(rootNode, PRECONDITION_FAILED, DIAGNOSTICS_MSG, ISSUE_CODE_BUSINESS_RULE), () -> assertEquals(HttpStatus.CONFLICT, response.getStatusCode()) ); } @@ -181,7 +181,7 @@ void When_AnEhrExtractHasFailed_Expect_RespondsWith202() { } @Test - void When_AnEhrExtractHasNotFailed_Expect_RespondsWith403() throws JsonProcessingException { + void When_AnEhrExtractHasAPositiveAcknowledgement_Expect_FailedOperationOutcome() throws JsonProcessingException { String ehrMessageRef = generateRandomUppercaseUUID(); var ehrExtractStatus = new EhrExtractStatus(); @@ -202,7 +202,7 @@ void When_AnEhrExtractHasNotFailed_Expect_RespondsWith403() throws JsonProcessin JsonNode rootNode = objectMapper.readTree(response.getBody()); assertAll( - () -> assertResponseHasExpectedOperationOutcome(rootNode, CONFLICT, DIAGNOSTICS_MSG, ISSUE_CODE_BUSINESS_RULE), + () -> assertResponseHasExpectedOperationOutcome(rootNode, PRECONDITION_FAILED, DIAGNOSTICS_MSG, ISSUE_CODE_BUSINESS_RULE), () -> assertEquals(HttpStatus.CONFLICT, response.getStatusCode()) ); }