diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/ClaimantDefendantAgreedMediationRespondentNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/ClaimantDefendantAgreedMediationRespondentNotificationHandler.java index 0fce6c75e92..403f650a123 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/ClaimantDefendantAgreedMediationRespondentNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/ClaimantDefendantAgreedMediationRespondentNotificationHandler.java @@ -46,11 +46,14 @@ public String camundaActivityId(CallbackParams callbackParams) { private CallbackResponse notifyDefendantMediationAgreement(CallbackParams callbackParams) { CaseData caseData = callbackParams.getCaseData(); - notificationService.sendMail( - addEmail(caseData), - addTemplate(caseData), - addProperties(caseData), - String.format(REFERENCE_TEMPLATE, caseData.getLegacyCaseReference())); + if (caseData.getRespondent1().getPartyEmail() != null || caseData.getRespondentSolicitor1EmailAddress() != null) { + notificationService.sendMail( + addEmail(caseData), + addTemplate(caseData), + addProperties(caseData), + String.format(REFERENCE_TEMPLATE, caseData.getLegacyCaseReference()) + ); + } return AboutToStartOrSubmitCallbackResponse.builder().build(); diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/GenerateCsvAndTransferTaskHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/GenerateCsvAndTransferTaskHandler.java index 2ef6236a61c..e0357a93564 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/GenerateCsvAndTransferTaskHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/GenerateCsvAndTransferTaskHandler.java @@ -52,8 +52,8 @@ public void handleTask(ExternalTask externalTask) { .map(caseDetailsConverter::toCaseData) .toList(); log.info("Job '{}' found {} case(s)", externalTask.getTopicName(), inMediationCases.size()); - String[] headers = {"SITE_ID", "CASE_NUMBER", "CASE_TYPE", "AMOUNT", "PARTY_TYPE", "COMPANY_NAME", - "CONTACT_NAME", "CONTACT_NUMBER", "CHECK_LIST", "PARTY_STATUS", "CONTACT_EMAIL", "PILOT"}; + String[] headers = {"SITE_ID", "CASE_TYPE", "CHECK_LIST", "PARTY_STATUS", "CASE_NUMBER", "AMOUNT", "PARTY_TYPE", + "COMPANY_NAME", "CONTACT_NAME", "CONTACT_NUMBER", "CONTACT_EMAIL", "PILOT"}; StringBuilder csvColContent = new StringBuilder(); try { if (!inMediationCases.isEmpty()) { diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVService.java index b1ee02a108e..b4072a01e11 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVService.java @@ -25,18 +25,18 @@ private String getCSVContent(MediationParams params) { DefendantContactDetails defendantContactDetails = getDefendantContactDetails(); String totalClaimAmount = data.getTotalClaimAmount().toString(); String[] claimantData = { - SITE_ID, data.getLegacyCaseReference(), CASE_TYPE, totalClaimAmount, - CLAIMANT, getCsvCompanyName(data.getApplicant1()), - applicantContactDetails.getApplicantContactName(params), applicantContactDetails.getApplicantContactNumber(params), - CHECK_LIST, PARTY_STATUS, applicantContactDetails.getApplicantContactEmail(params), + SITE_ID, CASE_TYPE, CHECK_LIST, PARTY_STATUS, data.getLegacyCaseReference(), totalClaimAmount, CLAIMANT, + getCsvCompanyName(data.getApplicant1()), applicantContactDetails.getApplicantContactName(params), + applicantContactDetails.getApplicantContactNumber(params), + applicantContactDetails.getApplicantContactEmail(params), isPilot(data.getTotalClaimAmount()) }; String[] respondentData = { - SITE_ID, data.getLegacyCaseReference(), CASE_TYPE, totalClaimAmount, - RESPONDENT, getCsvCompanyName(data.getRespondent1()), - defendantContactDetails.getDefendantContactName(params), defendantContactDetails.getDefendantContactNumber(params), - CHECK_LIST, PARTY_STATUS, defendantContactDetails.getDefendantContactEmail(params), + SITE_ID, CASE_TYPE, CHECK_LIST, PARTY_STATUS, data.getLegacyCaseReference(), totalClaimAmount, RESPONDENT, + getCsvCompanyName(data.getRespondent1()), defendantContactDetails.getDefendantContactName(params), + defendantContactDetails.getDefendantContactNumber(params), + defendantContactDetails.getDefendantContactEmail(params), isPilot(data.getTotalClaimAmount()) };