diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/NotificationClaimantOfHearingHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/NotificationClaimantOfHearingHandler.java index e7106d2bf12..64047745922 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/NotificationClaimantOfHearingHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/NotificationClaimantOfHearingHandler.java @@ -164,7 +164,7 @@ private String getEmailTemplate(CaseData caseData, boolean isApplicantLip) { } public Map addPropertiesHMC(final CaseData caseData) { - Fee fee = calculateAndApplyFee(hearingFeesService, caseData, caseData.getAllocatedTrack()); + Fee fee = calculateAndApplyFee(hearingFeesService, caseData, caseData.getAllocatedTrack().name()); LocalDateTime hearingStartDateTime = camundaService .getProcessVariables(caseData.getBusinessProcess().getProcessInstanceId()).getHearingStartDateTime(); diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/payment/ServiceRequestAPIHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/payment/ServiceRequestAPIHandler.java index 2e69bdf6a0c..21ad339e5f1 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/payment/ServiceRequestAPIHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/payment/ServiceRequestAPIHandler.java @@ -76,7 +76,7 @@ private CallbackResponse makePaymentServiceReq(CallbackParams callbackParams) { .fee(calculateAndApplyFee( hearingFeesService, caseData, - caseData.getAllocatedTrack())); + caseData.getAllocatedTrack().name())); caseDataBuilder.hearingFeePBADetails(paymentDetails.build()); } catch (FeignException e) { log.error("Failed creating a payment service request for case {}. Http status: {}. Exception: {}", diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/CreateSDOCallbackHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/CreateSDOCallbackHandler.java index 3607e77cfcc..cf3dc0e9baa 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/CreateSDOCallbackHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/CreateSDOCallbackHandler.java @@ -99,6 +99,8 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED; import static uk.gov.hmcts.reform.civil.callback.CallbackVersion.V_1; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_SDO; +import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.FAST_CLAIM; +import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.SMALL_CLAIM; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; import static uk.gov.hmcts.reform.civil.enums.sdo.OrderDetailsPagesSectionsToggle.SHOW; import static uk.gov.hmcts.reform.civil.enums.sdo.OrderType.DISPOSAL; @@ -883,13 +885,36 @@ private CallbackResponse submitSDO(CallbackParams callbackParams) { dataBuilder.smallClaimsMethodInPerson(deleteLocationList( caseData.getSmallClaimsMethodInPerson())); - System.out.println("before about to submit"); + setClaimsTrackBasedOnJudgeSelection(dataBuilder, caseData); return AboutToStartOrSubmitCallbackResponse.builder() .data(dataBuilder.build().toMap(objectMapper)) .build(); } + // During SDO the claim track can change based on judges selection. In this case we want to update claims track + // to this decision, or maintain it, if it was not changed. + private void setClaimsTrackBasedOnJudgeSelection(CaseData.CaseDataBuilder dataBuilder, CaseData caseData) { + CaseCategory caseAccessCategory = caseData.getCaseAccessCategory(); + switch (caseAccessCategory) { + case UNSPEC_CLAIM:// unspec use allocatedTrack to hold claims track value + if (SdoHelper.isSmallClaimsTrack(caseData)) { + dataBuilder.allocatedTrack(SMALL_CLAIM); + } else if (SdoHelper.isFastTrack(caseData)) { + dataBuilder.allocatedTrack(FAST_CLAIM); + } + break; + case SPEC_CLAIM:// spec claims use responseClaimTrack to hold claims track value + if (SdoHelper.isSmallClaimsTrack(caseData)) { + dataBuilder.responseClaimTrack(SMALL_CLAIM.name()); + } else if (SdoHelper.isFastTrack(caseData)) { + dataBuilder.responseClaimTrack(FAST_CLAIM.name()); + } + break; + default: break; + } + } + private boolean caseContainsLiP(CaseData caseData) { return caseData.isRespondent1LiP() || caseData.isRespondent2LiP() || caseData.isApplicantNotRepresented(); } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadHandlerBase.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadHandlerBase.java index 50548ead6ee..f11cb9addbf 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadHandlerBase.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadHandlerBase.java @@ -54,7 +54,8 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.EVIDENCE_UPLOAD_APPLICANT; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.EVIDENCE_UPLOAD_RESPONDENT; -import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.getAllocatedTrack; +import static uk.gov.hmcts.reform.civil.enums.CaseCategory.SPEC_CLAIM; +import static uk.gov.hmcts.reform.civil.enums.CaseCategory.UNSPEC_CLAIM; import static uk.gov.hmcts.reform.civil.enums.CaseRole.RESPONDENTSOLICITORONE; import static uk.gov.hmcts.reform.civil.enums.CaseRole.RESPONDENTSOLICITORTWO; @@ -218,11 +219,13 @@ CallbackResponse setOptions(CallbackParams callbackParams) { } } CaseData.CaseDataBuilder caseDataBuilder = caseData.toBuilder(); - //determine claim path, and assign to CCD object for show hide functionality - if (caseData.getClaimType() == null) { - caseDataBuilder.caseProgAllocatedTrack(getAllocatedTrack(caseData.getTotalClaimAmount(), null).name()); - } else { - caseDataBuilder.caseProgAllocatedTrack(getAllocatedTrack(caseData.getClaimValue().toPounds(), caseData.getClaimType()).name()); + //Evidence upload will have different screen for Fast claims and Small claims. + // We use show hide in CCD to do this, using utility field caseProgAllocatedTrack to hold the value of the claim track + // for either spec claims (ResponseClaimTrack) or unspec claims (AllocatedTrack) + if (caseData.getCaseAccessCategory().equals(UNSPEC_CLAIM)) { + caseDataBuilder.caseProgAllocatedTrack(caseData.getAllocatedTrack().name()); + } else if (caseData.getCaseAccessCategory().equals(SPEC_CLAIM)) { + caseDataBuilder.caseProgAllocatedTrack(caseData.getResponseClaimTrack()); } caseDataBuilder.evidenceUploadOptions(DynamicList.fromList(dynamicListOptions)); // was unable to null value properly in EvidenceUploadNotificationEventHandler after emails are sent, diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/HearingScheduledHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/HearingScheduledHandler.java index f378b489e01..a6a0e26a3ef 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/HearingScheduledHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/HearingScheduledHandler.java @@ -21,7 +21,6 @@ import uk.gov.hmcts.reform.civil.callback.CallbackHandler; import uk.gov.hmcts.reform.civil.callback.CallbackParams; import uk.gov.hmcts.reform.civil.callback.CaseEvent; -import uk.gov.hmcts.reform.civil.enums.AllocatedTrack; import uk.gov.hmcts.reform.civil.enums.CaseState; import uk.gov.hmcts.reform.civil.enums.hearing.ListingOrRelisting; import uk.gov.hmcts.reform.civil.model.BusinessProcess; @@ -34,7 +33,6 @@ import uk.gov.hmcts.reform.civil.utils.HearingReferenceNumber; import static java.lang.String.format; -import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import static uk.gov.hmcts.reform.civil.callback.CallbackParams.Params.BEARER_TOKEN; import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_START; @@ -42,6 +40,8 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.MID; import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.HEARING_SCHEDULED; +import static uk.gov.hmcts.reform.civil.enums.CaseCategory.SPEC_CLAIM; +import static uk.gov.hmcts.reform.civil.enums.CaseCategory.UNSPEC_CLAIM; import static uk.gov.hmcts.reform.civil.enums.CaseState.HEARING_READINESS; import static uk.gov.hmcts.reform.civil.enums.CaseState.PREPARE_FOR_HEARING_CONDUCT_HEARING; import static uk.gov.hmcts.reform.civil.model.common.DynamicList.fromList; @@ -185,16 +185,20 @@ private CallbackResponse handleAboutToSubmit(CallbackParams callbackParams) { } CaseState caseState = HEARING_READINESS; - var allocatedTrack = caseData.getAllocatedTrack(); - if (isNull(caseData.getAllocatedTrack())) { - allocatedTrack = AllocatedTrack.getAllocatedTrack(caseData.getTotalClaimAmount(), null); - caseDataBuilder.allocatedTrack(allocatedTrack); + // Hearing fee will be different based on claim track. + // for either spec claims (ResponseClaimTrack) or unspec claims (AllocatedTrack) + String claimTrack = null; + + if (caseData.getCaseAccessCategory().equals(UNSPEC_CLAIM)) { + claimTrack = caseData.getAllocatedTrack().name(); + } else if (caseData.getCaseAccessCategory().equals(SPEC_CLAIM)) { + claimTrack = caseData.getResponseClaimTrack(); } if (ListingOrRelisting.LISTING.equals(caseData.getListingOrRelisting())) { caseDataBuilder.hearingDueDate( calculateHearingDueDate(time.now().toLocalDate(), caseData.getHearingDate())); - caseDataBuilder.hearingFee(calculateAndApplyFee(hearingFeesService, caseData, allocatedTrack)); + caseDataBuilder.hearingFee(calculateAndApplyFee(hearingFeesService, caseData, claimTrack)); } else { caseState = PREPARE_FOR_HEARING_CONDUCT_HEARING; } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/PaymentsService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/PaymentsService.java index 72684c3f68e..d4911b40d1a 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/PaymentsService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/PaymentsService.java @@ -178,7 +178,7 @@ private CreateServiceRequestDTO buildServiceRequest(CaseData caseData) { feeResponse = caseData.getHearingFee().toFeeDto(); } else { feeResponse = HearingFeeUtils.calculateAndApplyFee( - hearingFeesService, caseData, caseData.getAllocatedTrack()).toFeeDto(); + hearingFeesService, caseData, caseData.getAllocatedTrack().name()).toFeeDto(); } } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/docmosis/hearing/HearingNoticeHmcGenerator.java b/src/main/java/uk/gov/hmcts/reform/civil/service/docmosis/hearing/HearingNoticeHmcGenerator.java index 80113bc4d14..ff77e8fd322 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/docmosis/hearing/HearingNoticeHmcGenerator.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/docmosis/hearing/HearingNoticeHmcGenerator.java @@ -66,7 +66,7 @@ public HearingNoticeHmc getHearingNoticeTemplateData(CaseData caseData, HearingG var paymentFailed = caseData.getHearingFeePaymentDetails() == null || caseData.getHearingFeePaymentDetails().getStatus().equals(PaymentStatus.FAILED); var feeAmount = paymentFailed - ? HearingUtils.formatHearingFee(HearingFeeUtils.calculateAndApplyFee(hearingFeesService, caseData, caseData.getAllocatedTrack())) : null; + ? HearingUtils.formatHearingFee(HearingFeeUtils.calculateAndApplyFee(hearingFeesService, caseData, caseData.getAllocatedTrack().name())) : null; var hearingDueDate = paymentFailed ? HearingFeeUtils .calculateHearingDueDate(LocalDate.now(), HmcDataUtils.getHearingStartDay(hearing) .getHearingStartDateTime().toLocalDate()) : null; diff --git a/src/main/java/uk/gov/hmcts/reform/civil/utils/HearingFeeUtils.java b/src/main/java/uk/gov/hmcts/reform/civil/utils/HearingFeeUtils.java index 5ca09370140..69d5cf244c7 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/utils/HearingFeeUtils.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/utils/HearingFeeUtils.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.civil.utils; -import uk.gov.hmcts.reform.civil.enums.AllocatedTrack; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.model.Fee; import uk.gov.hmcts.reform.civil.service.hearings.HearingFeesService; @@ -10,8 +9,6 @@ import java.time.LocalDate; import static java.util.Objects.nonNull; -import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.FAST_CLAIM; -import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.SMALL_CLAIM; public class HearingFeeUtils { @@ -35,7 +32,7 @@ public static LocalDate calculateHearingDueDate(LocalDate now, LocalDate hearing } public static Fee calculateAndApplyFee(HearingFeesService hearingFeesService, - CaseData caseData, AllocatedTrack allocatedTrack) { + CaseData caseData, String claimTrack) { BigDecimal claimAmount; if (nonNull(caseData.getClaimValue())) { claimAmount = caseData.getClaimValue().toPounds(); @@ -47,9 +44,9 @@ public static Fee calculateAndApplyFee(HearingFeesService hearingFeesService, claimAmount = caseData.getTotalClaimAmount().setScale(2, RoundingMode.UNNECESSARY); } - if (SMALL_CLAIM.equals(allocatedTrack)) { + if (claimTrack.equals("SMALL_CLAIM")) { return hearingFeesService.getFeeForHearingSmallClaims(claimAmount); - } else if (FAST_CLAIM.equals(allocatedTrack)) { + } else if (claimTrack.equals("FAST_CLAIM")) { return hearingFeesService.getFeeForHearingFastTrackClaims(claimAmount); } else { return hearingFeesService.getFeeForHearingMultiClaims(claimAmount); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/CreateSDOCallbackHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/CreateSDOCallbackHandlerTest.java index 260e56113c6..c94f7ae8b96 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/CreateSDOCallbackHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/CreateSDOCallbackHandlerTest.java @@ -6,7 +6,9 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.MethodSource; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; @@ -22,6 +24,7 @@ import uk.gov.hmcts.reform.civil.config.MockDatabaseConfiguration; import uk.gov.hmcts.reform.civil.crd.model.Category; import uk.gov.hmcts.reform.civil.crd.model.CategorySearchResult; +import uk.gov.hmcts.reform.civil.enums.AllocatedTrack; import uk.gov.hmcts.reform.civil.enums.YesOrNo; import uk.gov.hmcts.reform.civil.enums.sdo.ClaimsTrack; import uk.gov.hmcts.reform.civil.enums.sdo.DisposalHearingMethod; @@ -66,6 +69,8 @@ import java.util.Optional; import java.util.UUID; import java.util.stream.Collectors; +import java.util.stream.Stream; + import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -81,6 +86,7 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_SDO; import static uk.gov.hmcts.reform.civil.enums.CaseCategory.SPEC_CLAIM; +import static uk.gov.hmcts.reform.civil.enums.CaseCategory.UNSPEC_CLAIM; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; import static uk.gov.hmcts.reform.civil.handler.callback.user.CreateSDOCallbackHandler.CONFIRMATION_HEADER; @@ -103,6 +109,11 @@ public class CreateSDOCallbackHandlerTest extends BaseCallbackHandlerTest { public static final String REFERENCE_NUMBER = "000DC001"; + private static final DynamicList options = DynamicList.builder() + .listItems(List.of( + DynamicListElement.builder().code("00001").label("court 1 - 1 address - Y01 7RB").build(), + DynamicListElement.builder().code("00002").label("court 2 - 2 address - Y02 7RB").build(), + DynamicListElement.builder().code("00003").label("court 3 - 3 address - Y03 7RB").build())).build(); @MockBean private Time time; @@ -892,6 +903,172 @@ void shouldPrePopulateDisposalHearingPageSpec3() { } } + @ParameterizedTest + @MethodSource("testDataUnspec") + void whenClaimUnspecAndJudgeSelects_changeTrackOrMaintainAllocatedTrack(CaseData caseData, AllocatedTrack expectedAllocatedTrack) { + // When judge selects a different track to which the claim is currently on, update allocatedTrack to match selection + // or maintain allocatedTrack if selection already corresponds with selection made. + when(featureToggleService.isEarlyAdoptersEnabled()).thenReturn(true); + CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT); + AboutToStartOrSubmitCallbackResponse response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params); + + assertThat(response.getData()).containsEntry("allocatedTrack", expectedAllocatedTrack.name()); + } + + static Stream testDataUnspec() { + DynamicListElement selectedCourt = DynamicListElement.builder() + .code("00002").label("court 2 - 2 address - Y02 7RB").build(); + return Stream.of( + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(UNSPEC_CLAIM) + .allocatedTrack(AllocatedTrack.SMALL_CLAIM) + .fastTrackMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(NO) + .claimsTrack(ClaimsTrack.fastTrack) + .build(), + AllocatedTrack.FAST_CLAIM + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(UNSPEC_CLAIM) + .allocatedTrack(AllocatedTrack.SMALL_CLAIM) + .fastTrackMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(YES) + .drawDirectionsOrderSmallClaims(NO) + .orderType(OrderType.DECIDE_DAMAGES) + .build(), + AllocatedTrack.FAST_CLAIM + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(UNSPEC_CLAIM) + .allocatedTrack(AllocatedTrack.FAST_CLAIM) + .disposalHearingMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(YES) + .drawDirectionsOrderSmallClaims(NO) + .orderType(OrderType.DISPOSAL) + .build(), + AllocatedTrack.FAST_CLAIM + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(UNSPEC_CLAIM) + .allocatedTrack(AllocatedTrack.FAST_CLAIM) + .smallClaimsMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(NO) + .claimsTrack(ClaimsTrack.smallClaimsTrack) + .build(), + AllocatedTrack.SMALL_CLAIM + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(UNSPEC_CLAIM) + .allocatedTrack(AllocatedTrack.FAST_CLAIM) + .smallClaimsMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(YES) + .drawDirectionsOrderSmallClaims(YES) + .orderType(OrderType.DECIDE_DAMAGES) + .build(), + AllocatedTrack.SMALL_CLAIM + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(UNSPEC_CLAIM) + .allocatedTrack(AllocatedTrack.SMALL_CLAIM) + .disposalHearingMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(YES) + .drawDirectionsOrderSmallClaims(NO) + .orderType(OrderType.DISPOSAL) + .build(), + AllocatedTrack.SMALL_CLAIM + ) + ); + } + + @ParameterizedTest + @MethodSource("testDataSpec") + void whenClaimSpecAndJudgeSelects_changeTrackOrMaintainClaimResponseTrack(CaseData caseData, String expectedClaimResponseTrack) { + // When judge selects a different track to which the claim is currently on, update ClaimResponseTrack to match selection + // or maintain ClaimResponseTrack if selection already corresponds with selection made. + when(featureToggleService.isEarlyAdoptersEnabled()).thenReturn(true); + CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT); + AboutToStartOrSubmitCallbackResponse response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params); + + assertThat(response.getData()).containsEntry("responseClaimTrack", expectedClaimResponseTrack); + } + + static Stream testDataSpec() { + DynamicListElement selectedCourt = DynamicListElement.builder() + .code("00002").label("court 2 - 2 address - Y02 7RB").build(); + return Stream.of( + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) + .responseClaimTrack("SMALL_CLAIM") + .fastTrackMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(NO) + .claimsTrack(ClaimsTrack.fastTrack) + .build(), + "FAST_CLAIM" + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) + .responseClaimTrack("SMALL_CLAIM") + .fastTrackMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(YES) + .drawDirectionsOrderSmallClaims(NO) + .orderType(OrderType.DECIDE_DAMAGES) + .build(), + "FAST_CLAIM" + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) + .responseClaimTrack("FAST_CLAIM") + .disposalHearingMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(YES) + .drawDirectionsOrderSmallClaims(NO) + .orderType(OrderType.DISPOSAL) + .build(), + "FAST_CLAIM" + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) + .responseClaimTrack("FAST_CLAIM") + .smallClaimsMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(NO) + .claimsTrack(ClaimsTrack.smallClaimsTrack) + .build(), + "SMALL_CLAIM" + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) + .responseClaimTrack("FAST_CLAIM") + .smallClaimsMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(YES) + .drawDirectionsOrderSmallClaims(YES) + .orderType(OrderType.DECIDE_DAMAGES) + .build(), + "SMALL_CLAIM" + ), + Arguments.of( + CaseDataBuilder.builder().atStateClaimDraft().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) + .responseClaimTrack("SMALL_CLAIM") + .disposalHearingMethodInPerson(options.toBuilder().value(selectedCourt).build()) + .drawDirectionsOrderRequired(YES) + .drawDirectionsOrderSmallClaims(NO) + .orderType(OrderType.DISPOSAL) + .build(), + "SMALL_CLAIM" + ) + ); + } + @Nested class MidEventPrePopulateOrderDetailsPagesCallback extends LocationRefSampleDataBuilder { private LocalDate newDate; diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadApplicantHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadApplicantHandlerTest.java index 6f9138d35d8..5c068030094 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadApplicantHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadApplicantHandlerTest.java @@ -27,12 +27,10 @@ import uk.gov.hmcts.reform.ccd.client.model.SubmittedCallbackResponse; import uk.gov.hmcts.reform.civil.callback.CallbackHandler; import uk.gov.hmcts.reform.civil.callback.CallbackParams; -import uk.gov.hmcts.reform.civil.enums.ClaimType; import uk.gov.hmcts.reform.civil.handler.callback.BaseCallbackHandlerTest; import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter; import uk.gov.hmcts.reform.civil.model.Bundle; import uk.gov.hmcts.reform.civil.model.CaseData; -import uk.gov.hmcts.reform.civil.model.ClaimValue; import uk.gov.hmcts.reform.civil.model.IdValue; import uk.gov.hmcts.reform.civil.model.caseprogression.UploadEvidenceDocumentType; import uk.gov.hmcts.reform.civil.model.caseprogression.UploadEvidenceExpert; @@ -61,6 +59,8 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.MID; import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.EVIDENCE_UPLOAD_APPLICANT; +import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.SMALL_CLAIM; +import static uk.gov.hmcts.reform.civil.enums.CaseCategory.SPEC_CLAIM; import static uk.gov.hmcts.reform.civil.enums.CaseRole.RESPONDENTSOLICITORONE; import static uk.gov.hmcts.reform.civil.enums.CaseRole.RESPONDENTSOLICITORTWO; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; @@ -134,10 +134,8 @@ void givenAboutToStart_assignCaseProgAllocatedTrackUnSpec() { // Given CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified().build().toBuilder() .notificationText(null) - .claimType(ClaimType.CLINICAL_NEGLIGENCE) - .claimValue(ClaimValue.builder() - .statementOfValueInPennies(BigDecimal.valueOf(5000)) - .build()) + .allocatedTrack(SMALL_CLAIM) + .responseClaimTrack(null) .build(); given(userService.getUserInfo(anyString())).willReturn(UserInfo.builder().uid("uid").build()); given(coreCaseUserService.userHasCaseRole(any(), any(), any())).willReturn(false); @@ -154,9 +152,10 @@ void givenAboutToStart_assignCaseProgAllocatedTrackUnSpec() { void givenAboutToStart_assignCaseProgAllocatedTrackSpec() { // Given CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) .notificationText(null) - .claimType(null) - .totalClaimAmount(BigDecimal.valueOf(12500)) + .allocatedTrack(null) + .responseClaimTrack("FAST_CLAIM") .build(); given(userService.getUserInfo(anyString())).willReturn(UserInfo.builder().uid("uid").build()); given(coreCaseUserService.userHasCaseRole(any(), any(), any())).willReturn(false); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadRespondentHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadRespondentHandlerTest.java index 54d7927b8e7..402c0074ca5 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadRespondentHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/EvidenceUploadRespondentHandlerTest.java @@ -30,7 +30,6 @@ import uk.gov.hmcts.reform.ccd.client.model.SubmittedCallbackResponse; import uk.gov.hmcts.reform.civil.callback.CallbackHandler; import uk.gov.hmcts.reform.civil.callback.CallbackParams; -import uk.gov.hmcts.reform.civil.enums.ClaimType; import uk.gov.hmcts.reform.civil.enums.caseprogression.EvidenceUploadExpert; import uk.gov.hmcts.reform.civil.enums.caseprogression.EvidenceUploadTrial; import uk.gov.hmcts.reform.civil.enums.caseprogression.EvidenceUploadWitness; @@ -38,7 +37,6 @@ import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter; import uk.gov.hmcts.reform.civil.model.Bundle; import uk.gov.hmcts.reform.civil.model.CaseData; -import uk.gov.hmcts.reform.civil.model.ClaimValue; import uk.gov.hmcts.reform.civil.model.IdValue; import uk.gov.hmcts.reform.civil.model.caseprogression.UploadEvidenceDocumentType; import uk.gov.hmcts.reform.civil.model.caseprogression.UploadEvidenceExpert; @@ -68,7 +66,9 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.MID; import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.EVIDENCE_UPLOAD_RESPONDENT; +import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.FAST_CLAIM; import static uk.gov.hmcts.reform.civil.enums.CaseCategory.SPEC_CLAIM; +import static uk.gov.hmcts.reform.civil.enums.CaseCategory.UNSPEC_CLAIM; import static uk.gov.hmcts.reform.civil.enums.CaseRole.RESPONDENTSOLICITORONE; import static uk.gov.hmcts.reform.civil.enums.CaseRole.RESPONDENTSOLICITORTWO; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO; @@ -148,11 +148,10 @@ void setup() { void givenAboutToStart_assignCaseProgAllocatedTrackUnSpec() { // Given CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified().build().toBuilder() + .caseAccessCategory(UNSPEC_CLAIM) .notificationText("NULLED") - .claimType(ClaimType.CLINICAL_NEGLIGENCE) - .claimValue(ClaimValue.builder() - .statementOfValueInPennies(BigDecimal.valueOf(5000)) - .build()) + .allocatedTrack(FAST_CLAIM) + .responseClaimTrack(null) .build(); given(userService.getUserInfo(anyString())).willReturn(UserInfo.builder().uid("uid").build()); given(coreCaseUserService.userHasCaseRole(any(), any(), any())).willReturn(false); @@ -161,7 +160,7 @@ void givenAboutToStart_assignCaseProgAllocatedTrackUnSpec() { AboutToStartOrSubmitCallbackResponse response = (AboutToStartOrSubmitCallbackResponse) handler .handle(params); // Then - assertThat(response.getData()).extracting("caseProgAllocatedTrack").isEqualTo("SMALL_CLAIM"); + assertThat(response.getData()).extracting("caseProgAllocatedTrack").isEqualTo("FAST_CLAIM"); assertThat(response.getData()).extracting("notificationText").isNull(); } @@ -169,9 +168,10 @@ void givenAboutToStart_assignCaseProgAllocatedTrackUnSpec() { void givenAboutToStart_assignCaseProgAllocatedTrackSpec() { // Given CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) .notificationText(null) - .claimType(null) - .totalClaimAmount(BigDecimal.valueOf(12500)) + .allocatedTrack(null) + .responseClaimTrack("SMALL_CLAIM") .build(); given(userService.getUserInfo(anyString())).willReturn(UserInfo.builder().uid("uid").build()); given(coreCaseUserService.userHasCaseRole(any(), any(), any())).willReturn(false); @@ -180,7 +180,7 @@ void givenAboutToStart_assignCaseProgAllocatedTrackSpec() { AboutToStartOrSubmitCallbackResponse response = (AboutToStartOrSubmitCallbackResponse) handler .handle(params); // Then - assertThat(response.getData()).extracting("caseProgAllocatedTrack").isEqualTo("FAST_CLAIM"); + assertThat(response.getData()).extracting("caseProgAllocatedTrack").isEqualTo("SMALL_CLAIM"); assertThat(response.getData()).extracting("notificationText").isNull(); } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/HearingScheduledHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/HearingScheduledHandlerTest.java index 0f8595eb50d..696de8dba5a 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/HearingScheduledHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/HearingScheduledHandlerTest.java @@ -48,6 +48,7 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.MID; import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.HEARING_SCHEDULED; +import static uk.gov.hmcts.reform.civil.enums.CaseCategory.SPEC_CLAIM; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO; @ExtendWith(SpringExtension.class) @@ -311,10 +312,12 @@ void shouldTriggerBusinessProcessHearingScheduledOnRelisting_whenAboutToSubmit() void shouldGetDueDateAndFeeFastAndClaimValueClaim_whenAboutToSubmit() { // Given CaseData caseData = CaseDataBuilder.builder().atStateNotificationAcknowledged().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) .addRespondent2(NO) .listingOrRelisting(ListingOrRelisting.LISTING) .hearingDate(time.now().toLocalDate().plusWeeks(5)) - .allocatedTrack(AllocatedTrack.FAST_CLAIM) + .allocatedTrack(null) + .responseClaimTrack("FAST_CLAIM") .respondent1ResponseDeadline(LocalDateTime.now().minusDays(15)) .build(); CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT); @@ -333,10 +336,12 @@ void shouldGetDueDateAndFeeFastAndClaimValueClaim_whenAboutToSubmit() { void shouldGetDueDateAndFeeFastAndNoClaimValueClaim_whenAboutToSubmit() { // Given CaseData caseData = CaseDataBuilder.builder().atStateNotificationAcknowledged().build().toBuilder() + .caseAccessCategory(SPEC_CLAIM) .addRespondent2(NO) .listingOrRelisting(ListingOrRelisting.LISTING) .hearingDate(time.now().toLocalDate().plusWeeks(5)) - .allocatedTrack(AllocatedTrack.FAST_CLAIM) + .allocatedTrack(null) + .responseClaimTrack("SMALL_CLAIM") .respondent1ResponseDeadline(LocalDateTime.now().minusDays(15)) .claimValue(null) .totalInterest(BigDecimal.TEN) @@ -345,7 +350,7 @@ void shouldGetDueDateAndFeeFastAndNoClaimValueClaim_whenAboutToSubmit() { CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT); Fee expectedFee = Fee.builder() .calculatedAmountInPence(new BigDecimal(54500)).code("FEE0441").version("1").build(); - given(feesService.getFeeForHearingFastTrackClaims(any())).willReturn(expectedFee); + given(feesService.getFeeForHearingSmallClaims(any())).willReturn(expectedFee); // When var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params); @@ -362,7 +367,7 @@ void shouldGetDueDateAndFeeFastClaim_whenAboutToSubmit() { .addRespondent2(NO) .listingOrRelisting(ListingOrRelisting.LISTING) .hearingDate(time.now().toLocalDate().plusWeeks(5)) - .allocatedTrack(null) + .allocatedTrack(AllocatedTrack.SMALL_CLAIM) .claimValue(null) .totalClaimAmount(new BigDecimal(123)) .respondent1ResponseDeadline(LocalDateTime.now().minusDays(15)) diff --git a/src/test/java/uk/gov/hmcts/reform/civil/utils/HearingFeeUtilsTest.java b/src/test/java/uk/gov/hmcts/reform/civil/utils/HearingFeeUtilsTest.java index d3e292534a0..77d7168ee54 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/utils/HearingFeeUtilsTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/utils/HearingFeeUtilsTest.java @@ -79,7 +79,7 @@ void shouldCalculateAndApplyFee_whenClaimTrackIsSet(String track, String expecte when(hearingFeesService.getFeeForHearingFastTrackClaims(any())).thenReturn(expected); when(hearingFeesService.getFeeForHearingMultiClaims(any())).thenReturn(expected); - assertThat(calculateAndApplyFee(hearingFeesService, caseData, allocatedTrack)) + assertThat(calculateAndApplyFee(hearingFeesService, caseData, allocatedTrack.name())) .isEqualTo(expected); }