Skip to content

Commit

Permalink
CIV-15934 unable to open document from claimant collection (#1619)
Browse files Browse the repository at this point in the history
* uploaded document not visible to the user issue fixed

CIV-15935
CIV-15934
CIV-16215

* CIV-15934 judicial notififcation for request more info refactored code to avoid dupicates
  • Loading branch information
deepthidoppalapudihmcts authored Dec 18, 2024
1 parent 7c90701 commit ca20cbb
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,7 @@ private CaseData applicationRequestForInformation(CaseData caseData, String soli
}
customProps.remove(GA_NOTIFICATION_DEADLINE);

}

if ((isSendUncloakAdditionalFeeEmailForWithoutNotice(caseData)
} else if ((isSendUncloakAdditionalFeeEmailForWithoutNotice(caseData)
|| isSendUncloakAdditionalFeeEmailConsentOrder(caseData))) {
// Send notification to applicant only if it's without notice application
if (solicitorType.equals(APPLICANT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ public class ParentCaseUpdateHelper {
private static final String[] DOCUMENT_TYPES = {
"generalOrder", "dismissalOrder",
"directionOrder", "hearingNotice",
"gaResp", GA_DRAFT_FORM
"gaResp", GA_DRAFT_FORM, "gaAddl"
};
private static final String CLAIMANT_ROLE = "Claimant";
private static final String RESPONDENTSOL_ROLE = "RespondentSol";
private static final String RESPONDENTSOL_TWO_ROLE = "RespondentSolTwo";
private String[] roles = {CLAIMANT_ROLE, RESPONDENTSOL_ROLE, RESPONDENTSOL_TWO_ROLE};
private static final String GA_EVIDENCE = "gaEvidence";
private static final String GA_ADDL = "gaAddl";
private static final String CIVIL_GA_EVIDENCE = "generalAppEvidence";
private static final String FREE_KEYWORD = "FREE";

Expand Down Expand Up @@ -747,6 +748,9 @@ protected void updateCaseDocumentByType(Map<String, Object> updateMap, String ty
if (type.equals(GA_EVIDENCE)) {
gaCollectionName = CIVIL_GA_EVIDENCE + "Document";
}
if (type.equals(GA_ADDL)) {
gaCollectionName = type + "Doc";
}

String civilCollectionName = type + "Doc" + role;
Method gaGetter = ReflectionUtils.findMethod(CaseData.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class JudicialApplicantNotificationServiceTest {
private JudicialDecisionHelper judicialDecisionHelper;
@MockBean
private FeatureToggleService featureToggleService;
@MockBean
private GaForLipService gaForLipService;

private static final String APPLICANT = "applicant";
private static final String RESPONDENT = "respondent";
Expand Down Expand Up @@ -170,6 +172,7 @@ void sendNotificationApplicantConcurrentWrittenRep() {
when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseDataForConcurrentWrittenOption(YES, NO));
when(caseDetailsConverter.toCaseData(any())).thenReturn(CaseData.builder().build());
when(gaForLipService.isLipApp(any())).thenReturn(true);
judicialNotificationService.sendNotification(caseDataForConcurrentWrittenOption(YES, NO), APPLICANT);
verify(notificationService, times(1)).sendMail(
DUMMY_EMAIL,
Expand All @@ -184,6 +187,7 @@ void sendNotificationApplicantSequentialWrittenRep() {
when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseDataForSequentialWrittenOption(YES, NO));
when(caseDetailsConverter.toCaseData(any())).thenReturn(CaseData.builder().build());
when(gaForLipService.isLipApp(any())).thenReturn(true);
CaseData caseData = caseDataForSequentialWrittenOption(YES, NO);

judicialNotificationService.sendNotification(caseData.toBuilder().applicantBilingualLanguagePreference(YES)
Expand All @@ -204,6 +208,7 @@ void sendNotificationInWelshApplicantSequentialWrittenRep() {
CaseData claimRespondentResponseLan = CaseData.builder().claimantBilingualLanguagePreference("WELSH")
.applicantBilingualLanguagePreference(YES).build();
when(caseDetailsConverter.toCaseData(any())).thenReturn(claimRespondentResponseLan);
when(gaForLipService.isLipApp(any())).thenReturn(true);
CaseData caseData = caseDataForSequentialWrittenOption(YES, NO);
CaseData updatedCasedata = caseData.toBuilder().applicantBilingualLanguagePreference(YES)
.build();
Expand All @@ -221,6 +226,7 @@ void notificationUncloakShouldSendForDismissal_ApplicantLIP() {

when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseDataForJudgeDismissal(NO, NO, NO, YES, NO));
when(gaForLipService.isLipApp(any())).thenReturn(true);

judicialNotificationService.sendNotification(caseDataForJudgeDismissal(NO, NO, NO, YES, NO), APPLICANT);

Expand All @@ -237,6 +243,7 @@ void notificationCloakShouldSendForDismissal_ApplicantLIP() {

when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseDataForJudgeDismissal(NO, NO, YES, YES, NO));
when(gaForLipService.isLipApp(any())).thenReturn(true);

judicialNotificationService.sendNotification(caseDataForJudgeDismissal(NO, NO, NO, YES, NO), APPLICANT);

Expand All @@ -258,7 +265,7 @@ void notificationShouldSend_LipRespondent_When_JudicialDirectionOrderRep_unCloak
when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseData);
when(caseDetailsConverter.toCaseData(any())).thenReturn(CaseData.builder().build());

when(gaForLipService.isLipApp(any())).thenReturn(true);
judicialNotificationService.sendNotification(caseData, APPLICANT);

verify(notificationService, times(1)).sendMail(
Expand All @@ -273,7 +280,7 @@ void notificationShouldSend_LipRespondent_When_JudicialDirectionOrderRep() {
CaseData caseData
= caseDataForJudicialDirectionOrderOfApplicationWhenRespondentsArePresentInList(NO,
NO, YES, YES, YES, NO);

when(gaForLipService.isLipApp(any())).thenReturn(true);
when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseData);

Expand All @@ -291,7 +298,7 @@ void notificationShouldSendSendToLipRespondent_IfApplicationUncloakedForApproveO
when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseDataWithSolicitorDataOnlyForApplicationUncloakedJudgeApproveOrEdit(
YES, NO, NO));

when(gaForLipService.isLipApp(any())).thenReturn(true);
judicialNotificationService.sendNotification(
caseDataWithSolicitorDataOnlyForApplicationUncloakedJudgeApproveOrEdit(
YES, NO, NO), APPLICANT);
Expand All @@ -310,7 +317,7 @@ void notificationShouldSendSendToLipRespondent_IfApplicationForApproveOrEdit() {
when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseDataWithSolicitorDataOnlyForApplicationUncloakedJudgeApproveOrEdit(
YES, NO, YES));

when(gaForLipService.isLipApp(any())).thenReturn(true);
judicialNotificationService.sendNotification(
caseDataWithSolicitorDataOnlyForApplicationUncloakedJudgeApproveOrEdit(
YES, NO, YES), APPLICANT);
Expand All @@ -334,6 +341,7 @@ void shouldSendNotification_LipRespondent_UncloakedApplication() {

when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseData);
when(gaForLipService.isLipApp(any())).thenReturn(true);
when(caseDetailsConverter.toCaseData(any())).thenReturn(CaseData.builder().build());

judicialNotificationService.sendNotification(caseData, APPLICANT);
Expand All @@ -358,7 +366,7 @@ void shouldSendNotification_LipRespondent_Application() {
when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseData);
when(caseDetailsConverter.toCaseData(any())).thenReturn(CaseData.builder().build());

when(gaForLipService.isLipApp(any())).thenReturn(true);
judicialNotificationService.sendNotification(caseData, APPLICANT);

verify(notificationService, times(1)).sendMail(
Expand All @@ -369,13 +377,67 @@ void shouldSendNotification_LipRespondent_Application() {
);
}

@Test
void shouldSendNotification_LipRespondent_Application_WhenRequestMoreInfo() {

CaseData caseData
= caseDataForJudicialRequestForInformationOfApplication(YES, YES, YES,
REQUEST_MORE_INFORMATION)
.toBuilder()
.generalAppConsentOrder(NO)
.ccdState(CaseState.APPLICATION_ADD_PAYMENT).generalAppType(GAApplicationType.builder()
.types(applicationTypeVaryOrder()).build()).build();

when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseData);
when(caseDetailsConverter.toCaseData(any())).thenReturn(caseData);
when(gaForLipService.isLipResp(any())).thenReturn(true);

judicialNotificationService.sendNotification(caseData, RESPONDENT);

verify(notificationService, times(1)).sendMail(
DUMMY_EMAIL,

"general-application-apps-judicial-notification-template-lip-id",
notificationPropertiesVaryOrder(),
"general-apps-judicial-notification-make-decision-" + CASE_REFERENCE
);
}

@Test
void shouldSendNotification_LipRespondent_Application_WhenRequestMoreInfo_WhenNoLIpInvolved() {

CaseData caseData
= caseDataForJudicialRequestForInformationOfApplication(YES, YES, YES,
REQUEST_MORE_INFORMATION)
.toBuilder()
.generalAppConsentOrder(NO)
.ccdState(CaseState.APPLICATION_ADD_PAYMENT).generalAppType(GAApplicationType.builder()
.types(applicationTypeVaryOrder()).build()).build();

when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseData);
when(caseDetailsConverter.toCaseData(any())).thenReturn(caseData);
when(gaForLipService.isLipResp(any())).thenReturn(false);

judicialNotificationService.sendNotification(caseData, RESPONDENT);

verify(notificationService, times(1)).sendMail(
DUMMY_EMAIL,

"general-application-apps-judicial-notification-template-id",
notificationPropertiesVaryOrder(),
"general-apps-judicial-notification-make-decision-" + CASE_REFERENCE
);
}

@Test
void notificationShouldSendListForHearing() {

when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseDataListForHearing());
when(caseDetailsConverter.toCaseData(any())).thenReturn(CaseData.builder().build());

when(gaForLipService.isLipApp(any())).thenReturn(true);
judicialNotificationService.sendNotification(caseDataListForHearing(), APPLICANT);
verify(notificationService).sendMail(
DUMMY_EMAIL,
Expand Down Expand Up @@ -534,10 +596,17 @@ private CaseData caseDataForJudgeDismissal(YesOrNo orderAgreement, YesOrNo isWit
private Map<String, String> notificationPropertiesSummeryJudgement() {

customProp.put(NotificationData.CASE_REFERENCE, CASE_REFERENCE.toString());
customProp.put(NotificationData.CASE_TITLE, "CL v DEF");
customProp.put(NotificationData.GA_APPLICATION_TYPE,
GeneralApplicationTypes.SUMMARY_JUDGEMENT.getDisplayedValue());
customProp.put(NotificationData.GA_LIP_APPLICANT_NAME, "App");

return customProp;
}

private Map<String, String> notificationPropertiesVaryOrder() {

customProp.put(NotificationData.CASE_REFERENCE, CASE_REFERENCE.toString());
customProp.put(NotificationData.GA_APPLICATION_TYPE,
GeneralApplicationTypes.VARY_ORDER.getDisplayedValue());

return customProp;
}
Expand Down Expand Up @@ -1991,7 +2060,7 @@ void shouldSendAdditionalPaymentNotification_Lip_UncloakedApplication_BeforeAddi
when(solicitorEmailValidation.validateSolicitorEmail(any(), any()))
.thenReturn(caseData);
when(caseDetailsConverter.toCaseData(any())).thenReturn(CaseData.builder().build());

when(gaForLipService.isLipApp(any())).thenReturn(true);
judicialNotificationService.sendNotification(caseData, APPLICANT);

verify(notificationService, times(1)).sendMail(
Expand Down Expand Up @@ -2096,9 +2165,7 @@ public Map<String, String> notificationPropertiesToStayTheClaimLip() {
return Map.of(
NotificationData.CASE_REFERENCE, CASE_REFERENCE.toString(),
NotificationData.GA_APPLICATION_TYPE,
GeneralApplicationTypes.STAY_THE_CLAIM.getDisplayedValue(),
NotificationData.GA_LIP_APPLICANT_NAME, "App",
NotificationData.CASE_TITLE, "CL v DEF"
GeneralApplicationTypes.STAY_THE_CLAIM.getDisplayedValue()
);
}

Expand Down Expand Up @@ -2140,4 +2207,10 @@ public List<GeneralApplicationTypes> applicationTypeSummeryJudgement() {
GeneralApplicationTypes.SUMMARY_JUDGEMENT
);
}

public List<GeneralApplicationTypes> applicationTypeVaryOrder() {
return List.of(
GeneralApplicationTypes.VARY_ORDER
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,14 @@ void updateParentWithGAState_with_n245_after_payment() {

@Test
void updateParentWithGAState_with_n245_before_payment() {
CaseData gaCase = getGaVaryCaseData("RespondentSolTwo", PENDING_APPLICATION_ISSUED, YES);
CaseData civilCase = getVaryMainCaseData("RespondentSolTwo");
CaseData gaCase = getGaVaryCaseDataForAddlDoc("RespondentSol", PENDING_APPLICATION_ISSUED, YES);
CaseData civilCase = getVaryMainCaseData("RespondentSol");
when(coreCaseDataService.startUpdate(any(), any())).thenReturn(getStartEventResponse(YES, NO));
when(caseDetailsConverter.toCaseData(any())).thenReturn(civilCase);
parentCaseUpdateHelper.updateParentWithGAState(gaCase, AWAITING_APPLICATION_PAYMENT.toString());
verify(coreCaseDataService, times(1))
.caseDataContentFromStartEventResponse(any(), mapCaptor.capture());
assertThat(mapCaptor.getValue().get("gaEvidenceDocRespondentSolTwo")).isNotNull();
assertThat(mapCaptor.getValue().get("gaEvidenceDocStaff")).isNull();
assertThat(mapCaptor.getValue().get("gaEvidenceDocRespondentSol")).isNull();
assertThat(mapCaptor.getValue().get("gaEvidenceDocClaimant")).isNull();
assertThat(mapCaptor.getValue().get("gaAddlDocRespondentSol")).isNotNull();
}

@Test
Expand Down Expand Up @@ -701,6 +698,61 @@ private CaseData getGaVaryCaseData(String role, CaseState state, YesOrNo isMulti
return builder.build();
}

private CaseData getGaVaryCaseDataForAddlDoc(String role, CaseState state, YesOrNo isMultiparty) {
CaseData.CaseDataBuilder builder = CaseData.builder();
builder.generalAppType(GAApplicationType.builder()
.types(List.of(GeneralApplicationTypes.VARY_PAYMENT_TERMS_OF_JUDGMENT)).build())
.ccdCaseReference(CaseDataBuilder.CASE_ID)
.generalAppParentCaseLink(GeneralAppParentCaseLink
.builder().caseReference(CaseDataBuilder.CASE_ID.toString()).build())
.ccdState(state);
CaseDocument pdfDocument = CaseDocument.builder()
.createdBy("John")
.documentName("documentName")
.documentSize(0L)
.createdDatetime(now())
.documentLink(Document.builder()
.documentUrl("fake-url")
.documentFileName("file-name")
.documentBinaryUrl("binary-url")
.build())
.build();
String uid = "f000aa01-0451-4000-b000-000000000000";
builder.gaAddlDoc(singletonList(Element.<CaseDocument>builder()
.id(UUID.fromString(uid))
.value(pdfDocument).build()));
switch (role) {
case "Claimant":
builder.parentClaimantIsApplicant(YES)
.isMultiParty(isMultiparty)
.generalAppRespondentAgreement(GARespondentOrderAgreement.builder().hasAgreed(YES).build());
break;
case "RespondentSol":
builder.parentClaimantIsApplicant(NO)
.isMultiParty(isMultiparty).generalAppApplnSolicitor(
GASolicitorDetailsGAspec.builder()
.organisationIdentifier("RespondentSol").build())
.generalAppRespondentAgreement(GARespondentOrderAgreement.builder().hasAgreed(YES).build());
break;
case "RespondentSolTwo":
builder.parentClaimantIsApplicant(NO)
.generalAppRespondentAgreement(GARespondentOrderAgreement.builder().hasAgreed(YES).build())
.isMultiParty(isMultiparty).generalAppApplnSolicitor(
GASolicitorDetailsGAspec.builder()
.organisationIdentifier("RespondentSolTwo").build());
break;
case "RespondentLip":
builder.parentClaimantIsApplicant(NO)
.isGaApplicantLip(YES)
.isMultiParty(isMultiparty)
.generalAppApplnSolicitor(GASolicitorDetailsGAspec.builder().build());
break;
default:
break;
}
return builder.build();
}

private CaseData getGaVaryCaseDataForCollection(String role, CaseState state, YesOrNo isMultiparty,
YesOrNo hasAgreed, YesOrNo isWithNotice) {
CaseData.CaseDataBuilder builder = CaseData.builder();
Expand Down

0 comments on commit ca20cbb

Please sign in to comment.