Skip to content

Commit

Permalink
Merge branch 'master' into feat/CIV-10907
Browse files Browse the repository at this point in the history
  • Loading branch information
m-meulendijks-v1 authored Nov 14, 2023
2 parents 36305ea + ef0198c commit a5b3924
Show file tree
Hide file tree
Showing 99 changed files with 6,139 additions and 975 deletions.
3 changes: 3 additions & 0 deletions Jenkinsfile_nightly
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ properties([
description: 'The URL of service auth provider'),
string(name: 'CCD_DATA_STORE_URL', defaultValue: 'http://ccd-data-store-api-aat.service.core-compute-aat.internal',
description: 'The URL of ccd data store'),
string(name: 'AAC_API_URL', defaultValue: 'http://aac-manage-case-assignment-aat.service.core-compute-aat.internal',
description: 'The URL of AAC service'),
string(name: 'CIVIL_SERVICE_URL', defaultValue: 'http://civil-service-aat.service.core-compute-aat.internal',
description: 'The URL of civil service'),
string(name: 'WAIT_FOR_TIMEOUT_MS',
Expand Down Expand Up @@ -60,6 +62,7 @@ withNightlyPipeline(type, product, component) {
env.URL_FOR_SECURITY_SCAN = params.CIVIL_SERVICE_URL
env.TESTS_FOR_ACCESSIBILITY = true
env.NIGHTLY_RUN = true
env.AAC_API_URL = params.AAC_API_URL
overrideVaultEnvironments([
'aat': params.ENVIRONMENT
])
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ configurations.all {
}

dependencies {
implementation 'com.github.hmcts:civil-commons:1.0.31'
implementation 'com.github.hmcts:civil-commons:1.0.33'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
Expand Down
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01067.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01068.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01069.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01070.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01071.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01072.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01073.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01074.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01075.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01076.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01077.docx
Binary file not shown.
Binary file modified docker/docmosis/templates/CV-UNS-GAP-ENG-01078.docx
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
import uk.gov.hmcts.reform.civil.exceptions.CaseDataInvalidException;
import uk.gov.hmcts.reform.civil.exceptions.CaseNotFoundException;
import uk.gov.hmcts.reform.civil.exceptions.UserNotFoundOnCaseException;
import uk.gov.hmcts.reform.civil.exceptions.CaseNotFoundException;
import uk.gov.hmcts.reform.civil.exceptions.UserNotFoundOnCaseException;
import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.bulkclaims.CaseworkerSubmitEventDTo;
import uk.gov.hmcts.reform.civil.model.citizenui.DashboardClaimInfo;
import uk.gov.hmcts.reform.civil.model.citizenui.DashboardResponse;
import uk.gov.hmcts.reform.civil.model.citizenui.dto.ExtendedDeadlineDto;
import uk.gov.hmcts.reform.civil.model.citizenui.dto.EventDto;
import uk.gov.hmcts.reform.civil.model.repaymentplan.ClaimantProposedPlan;
import uk.gov.hmcts.reform.civil.service.CoreCaseDataService;
Expand All @@ -42,6 +41,7 @@
import java.util.Map;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
Expand Down Expand Up @@ -228,10 +228,10 @@ void shouldSubmitEventSuccessfully() {
@SneakyThrows
void shouldCalculateDeadlineSuccessfully() {
LocalDate extensionDate = LocalDate.of(2022, 6, 6);
when(deadlineExtensionCalculatorService.calculateExtendedDeadline(any())).thenReturn(extensionDate);
when(deadlineExtensionCalculatorService.calculateExtendedDeadline(any(), anyInt())).thenReturn(extensionDate);
doPost(
BEARER_TOKEN,
extensionDate,
ExtendedDeadlineDto.builder().responseDate(extensionDate).plusDays(5).build(),
CALCULATE_DEADLINE_URL
)
.andExpect(content().json(toJson(extensionDate)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import uk.gov.hmcts.reform.civil.exceptions.CaseDataInvalidException;
import uk.gov.hmcts.reform.civil.model.bulkclaims.CaseworkerSubmitEventDTo;
import uk.gov.hmcts.reform.civil.model.citizenui.DashboardResponse;
import uk.gov.hmcts.reform.civil.model.citizenui.dto.ExtendedDeadlineDto;
import uk.gov.hmcts.reform.civil.model.citizenui.dto.EventDto;
import uk.gov.hmcts.reform.civil.model.citizenui.dto.RepaymentDecisionType;
import uk.gov.hmcts.reform.civil.model.repaymentplan.ClaimantProposedPlan;
Expand Down Expand Up @@ -174,8 +175,9 @@ public ResponseEntity<CaseDetails> submitEvent(
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "401", description = "Not Authorized")})
public ResponseEntity<LocalDate> calculateNewResponseDeadline(@RequestBody LocalDate extendedDeadline) {
LocalDate calculatedDeadline = deadlineExtensionCalculatorService.calculateExtendedDeadline(extendedDeadline);
public ResponseEntity<LocalDate> calculateNewResponseDeadline(@RequestBody ExtendedDeadlineDto deadlineDateDetails) {
LocalDate calculatedDeadline = deadlineExtensionCalculatorService.calculateExtendedDeadline(
deadlineDateDetails.getResponseDate(), deadlineDateDetails.getPlusDays());
return new ResponseEntity<>(calculatedDeadline, HttpStatus.OK);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public enum BundleFileNameList {
QUESTIONS_TO("Questions to %s %s"),
REPLIES_FROM("Replies from %s %s"),
JOINT_STATEMENTS_OF_EXPERTS("Joint statement of experts %s %s %s"),
SKELETON_ARGUMENT("%s Skeleton argument %s");
SKELETON_ARGUMENT("%s Skeleton argument %s"),
PARTICULARS_OF_CLAIM("Particulars Of Claim %s");
String displayName;

public String getDisplayName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.List;
import java.util.Map;

import static uk.gov.hmcts.reform.civil.callback.CallbackParams.Params.BEARER_TOKEN;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_LOCATION_UPDATE;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_UPDATE_GA_LOCATION;
Expand Down Expand Up @@ -44,9 +45,10 @@ public List<CaseEvent> handledEvents() {

private CallbackResponse triggerGaEvent(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
String authToken = callbackParams.getParams().get(BEARER_TOKEN).toString();
try {
if (caseData.getGeneralApplications() != null && !caseData.getGeneralApplications().isEmpty()) {
caseData = helperService.updateApplicationLocationDetailsInClaim(caseData);
caseData = helperService.updateApplicationLocationDetailsInClaim(caseData, authToken);
helperService.triggerEvent(caseData, TRIGGER_LOCATION_UPDATE);
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@
import uk.gov.hmcts.reform.civil.callback.CallbackParams;
import uk.gov.hmcts.reform.civil.callback.CaseEvent;
import uk.gov.hmcts.reform.civil.notify.NotificationsProperties;
import uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.SmallClaimMedicalLRspec;
import uk.gov.hmcts.reform.civil.notify.NotificationService;
import uk.gov.hmcts.reform.civil.service.OrganisationService;
import uk.gov.hmcts.reform.civil.notify.NotificationsProperties;
import uk.gov.hmcts.reform.civil.prd.model.Organisation;
import uk.gov.hmcts.reform.civil.service.OrganisationService;

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;

import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.NOTIFY_RESPONDENT_SOLICITOR1_FOR_CLAIMANT_CONFIRMS_TO_PROCEED;
Expand Down Expand Up @@ -70,7 +76,7 @@ public List<CaseEvent> handledEvents() {

private CallbackResponse notifyRespondentSolicitorForClaimantConfirmsToProceed(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
String template = null;
String template;
var recipient = isCcNotification(callbackParams)
? caseData.getApplicantSolicitor1UserDetails().getEmail()
: caseData.getRespondentSolicitor1EmailAddress();
Expand Down Expand Up @@ -103,9 +109,7 @@ private CallbackResponse notifyRespondentSolicitorForClaimantConfirmsToProceed(C
return AboutToStartOrSubmitCallbackResponse.builder().build();
}
if (SPEC_CLAIM.equals(caseData.getCaseAccessCategory())) {
template = isCcNotification(callbackParams)
? notificationsProperties.getClaimantSolicitorConfirmsToProceedSpec()
: notificationsProperties.getRespondentSolicitorNotifyToProceedSpec();
template = getSpecTemplate(callbackParams, caseData);
} else {
template = notificationsProperties.getClaimantSolicitorConfirmsToProceed();
}
Expand All @@ -123,6 +127,50 @@ private CallbackResponse notifyRespondentSolicitorForClaimantConfirmsToProceed(C
return AboutToStartOrSubmitCallbackResponse.builder().build();
}

private String getSpecTemplate(CallbackParams callbackParams, CaseData caseData) {
String template;
if (isCcNotification(callbackParams)) {
if (rejectedAll(caseData) && mediationRejected(caseData)) {
template = notificationsProperties.getClaimantSolicitorConfirmsToProceedSpecWithAction();
} else {
template = notificationsProperties.getClaimantSolicitorConfirmsToProceedSpec();
}
} else {
if (rejectedAll(caseData) && mediationRejected(caseData)) {
template = notificationsProperties.getRespondentSolicitorNotifyToProceedSpecWithAction();
} else {
template = notificationsProperties.getRespondentSolicitorNotifyToProceedSpec();
}
}
return template;
}

/**
* Consider that reject all is true if any respondent rejected all the claim.
*
* @param caseData the case data of a spec claim
* @return true if and only if at least one respondent rejected all the claim
*/
private boolean rejectedAll(CaseData caseData) {
return caseData.getRespondent1ClaimResponseTypeForSpec() == RespondentResponseTypeSpec.FULL_DEFENCE
|| caseData.getRespondent2ClaimResponseTypeForSpec() == RespondentResponseTypeSpec.FULL_DEFENCE;
}

/**
* Mediation is applicable only when all parties are willing to try it.
*
* @param caseData a spec claim
* @return true if and only if at least one party did not agree to mediation
*/
private boolean mediationRejected(CaseData caseData) {
return Stream.of(
caseData.getResponseClaimMediationSpecRequired(),
caseData.getResponseClaimMediationSpec2Required(),
Optional.ofNullable(caseData.getApplicant1ClaimMediationSpecRequired())
.map(SmallClaimMedicalLRspec::getHasAgreedFreeMediation).orElse(null)
).filter(Objects::nonNull).anyMatch(YesOrNo.NO::equals);
}

@Override
public Map<String, String> addProperties(CaseData caseData) {
return Map.of(
Expand Down Expand Up @@ -158,12 +206,12 @@ private boolean isRespondentSolicitor2Notification(CallbackParams callbackParams
}

//finding legal org name
private String getLegalOrganisationName(CaseData caseData, CaseEvent caseEvent) {
private String getLegalOrganisationName(CaseData caseData, CaseEvent caseEvent) {
String organisationID;
if (caseEvent.equals(NOTIFY_RESPONDENT_SOLICITOR1_FOR_CLAIMANT_CONFIRMS_TO_PROCEED_CC)) {
organisationID = caseData.getApplicant1OrganisationPolicy().getOrganisation().getOrganisationID();
} else {
organisationID = caseEvent.equals(NOTIFY_RESPONDENT_SOLICITOR1_FOR_CLAIMANT_CONFIRMS_TO_PROCEED)
organisationID = caseEvent.equals(NOTIFY_RESPONDENT_SOLICITOR1_FOR_CLAIMANT_CONFIRMS_TO_PROCEED)
? caseData.getRespondent1OrganisationPolicy().getOrganisation().getOrganisationID()
: caseData.getRespondent2OrganisationPolicy().getOrganisation().getOrganisationID();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.ONE_V_TWO_TWO_LEGAL_REP;
import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.TWO_V_ONE;
import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.getMultiPartyScenario;
import static uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec.BY_SET_DATE;
import static uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec.IMMEDIATELY;
import static uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec.SUGGESTION_OF_REPAYMENT_PLAN;
import static uk.gov.hmcts.reform.civil.utils.PartyUtils.buildPartiesReferences;
import static uk.gov.hmcts.reform.civil.utils.PartyUtils.getPartyNameBasedOnType;

Expand Down Expand Up @@ -159,7 +161,11 @@ private void sendNotificationToSolicitorSpec(CaseData caseData, String recipient
String.format(REFERENCE_TEMPLATE, caseData.getLegacyCaseReference())
);
} else if (caseEvent.equals(NOTIFY_APPLICANT_SOLICITOR1_FOR_DEFENDANT_RESPONSE_CC)) {
emailTemplate = notificationsProperties.getRespondentSolicitorDefendantResponseForSpec();
if (MultiPartyScenario.getMultiPartyScenario(caseData).equals(ONE_V_TWO_TWO_LEGAL_REP)) {
emailTemplate = notificationsProperties.getRespondentSolicitorDefendantResponseForSpec();
} else {
emailTemplate = getTemplateForSpecOtherThan1v2DS(caseData);
}
if (caseData.getRespondent1ResponseDate() == null || !MultiPartyScenario.getMultiPartyScenario(caseData)
.equals(ONE_V_TWO_TWO_LEGAL_REP)) {
notificationService.sendMail(
Expand All @@ -171,7 +177,11 @@ private void sendNotificationToSolicitorSpec(CaseData caseData, String recipient
}

} else {
emailTemplate = notificationsProperties.getRespondentSolicitorDefendantResponseForSpec();
if (MultiPartyScenario.getMultiPartyScenario(caseData).equals(ONE_V_TWO_TWO_LEGAL_REP)) {
emailTemplate = notificationsProperties.getRespondentSolicitorDefendantResponseForSpec();
} else {
emailTemplate = getTemplateForSpecOtherThan1v2DS(caseData);
}
notificationService.sendMail(
recipient,
emailTemplate,
Expand All @@ -181,6 +191,23 @@ private void sendNotificationToSolicitorSpec(CaseData caseData, String recipient
}
}

private String getTemplateForSpecOtherThan1v2DS(CaseData caseData) {

String emailTemplate;
if ((caseData.getDefenceAdmitPartPaymentTimeRouteRequired() == IMMEDIATELY
|| caseData.getDefenceAdmitPartPaymentTimeRouteRequired() == BY_SET_DATE
|| caseData.getDefenceAdmitPartPaymentTimeRouteRequired() == SUGGESTION_OF_REPAYMENT_PLAN)
&&
(RespondentResponseTypeSpec.PART_ADMISSION.equals(caseData.getRespondent1ClaimResponseTypeForSpec()))
) {
emailTemplate = notificationsProperties.getRespondentSolicitorDefResponseSpecWithClaimantAction();
} else {
emailTemplate = notificationsProperties.getRespondentSolicitorDefendantResponseForSpec();
}

return emailTemplate;
}

@Override
public Map<String, String> addProperties(CaseData caseData) {
if (getMultiPartyScenario(caseData).equals(ONE_V_ONE) || getMultiPartyScenario(caseData).equals(TWO_V_ONE)) {
Expand Down Expand Up @@ -216,10 +243,10 @@ public Map<String, String> addPropertiesSpec(CaseData caseData, CaseEvent caseEv
+ " " + caseData.getRespondToClaimAdmitPartLRspec().getWhenWillThisAmountBePaid().getMonth()
+ " " + caseData.getRespondToClaimAdmitPartLRspec().getWhenWillThisAmountBePaid().getYear();
return Map.of(
CLAIM_LEGAL_ORG_NAME_SPEC, getLegalOrganisationName(caseData, caseEvent),
CLAIM_REFERENCE_NUMBER, caseData.getLegacyCaseReference(),
RESPONDENT_NAME, getPartyNameBasedOnType(caseData.getApplicant1()),
WHEN_WILL_BE_PAID_IMMEDIATELY, shouldBePaidBy
CLAIM_LEGAL_ORG_NAME_SPEC, getLegalOrganisationName(caseData, caseEvent),
CLAIM_REFERENCE_NUMBER, caseData.getLegacyCaseReference(),
RESPONDENT_NAME, getPartyNameBasedOnType(caseData.getApplicant1()),
WHEN_WILL_BE_PAID_IMMEDIATELY, shouldBePaidBy
);
} else {
return Map.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public interface NotificationData {
String OTHER_SOL_NAME = "other solicitor name";
String EXTERNAL_ID = "externalId";

// evidence upload
String UPLOADED_DOCUMENTS = "uploaded documents";

Map<String, String> addProperties(CaseData caseData);

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import uk.gov.hmcts.reform.civil.enums.CaseState;
import uk.gov.hmcts.reform.civil.model.BusinessProcess;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.service.citizenui.ResponseOneVOneShowTagService;
import uk.gov.hmcts.reform.civil.service.citizen.UpdateCaseManagementDetailsService;

import java.time.LocalDateTime;
import java.util.Collections;
Expand All @@ -31,12 +33,15 @@ public class ClaimantResponseCuiCallbackHandler extends CallbackHandler {

private static final List<CaseEvent> EVENTS = Collections.singletonList(CLAIMANT_RESPONSE_CUI);

private final ResponseOneVOneShowTagService responseOneVOneService;

private final ObjectMapper objectMapper;
private final UpdateCaseManagementDetailsService updateCaseManagementLocationDetailsService;

@Override
protected Map<String, Callback> callbacks() {
return Map.of(
callbackKey(ABOUT_TO_START), this::emptyCallbackResponse,
callbackKey(ABOUT_TO_START), this::populateCaseData,
callbackKey(ABOUT_TO_SUBMIT), this::aboutToSubmit,
callbackKey(SUBMITTED), this::emptySubmittedCallbackResponse
);
Expand All @@ -47,28 +52,42 @@ public List<CaseEvent> handledEvents() {
return EVENTS;
}

private CallbackResponse populateCaseData(CallbackParams callbackParams) {
var caseData = callbackParams.getCaseData();
CaseData.CaseDataBuilder<?, ?> updatedCaseData = caseData.toBuilder();
updatedCaseData.showResponseOneVOneFlag(responseOneVOneService.setUpOneVOneFlow(caseData));

return AboutToStartOrSubmitCallbackResponse.builder()
.data(updatedCaseData.build().toMap(objectMapper))
.build();
}

private CallbackResponse aboutToSubmit(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
CaseData updatedData = caseData.toBuilder()
.applicant1ResponseDate(LocalDateTime.now())
.businessProcess(BusinessProcess.ready(CLAIMANT_RESPONSE_CUI))
.build();
CaseData.CaseDataBuilder<?, ?> builder = caseData.toBuilder()
.applicant1ResponseDate(LocalDateTime.now())
.businessProcess(BusinessProcess.ready(CLAIMANT_RESPONSE_CUI));

updateCaseManagementLocationDetailsService.updateCaseManagementDetails(builder, callbackParams);

CaseData updatedData = builder.build();
AboutToStartOrSubmitCallbackResponse.AboutToStartOrSubmitCallbackResponseBuilder response =
AboutToStartOrSubmitCallbackResponse.builder()
.data(updatedData.toMap(objectMapper));
AboutToStartOrSubmitCallbackResponse.builder()
.data(updatedData.toMap(objectMapper));

updateClaimEndState(response, updatedData);

return response.build();
}

private void updateClaimEndState(AboutToStartOrSubmitCallbackResponse.AboutToStartOrSubmitCallbackResponseBuilder response, CaseData updatedData) {

if (updatedData.hasClaimantAgreedToFreeMediation()) {
response.state(CaseState.IN_MEDIATION.name());
} else if (updatedData.hasApplicantRejectedRepaymentPlan() && updatedData.getRespondent1().isCompanyOROrganisation()) {
response.state(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM.name());
} else {
response.state(CaseState.JUDICIAL_REFERRAL.name());
}
}

}
Loading

0 comments on commit a5b3924

Please sign in to comment.