Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def versions = [
mapStruct : '1.3.0.Final',
pact_version : '4.1.34',
piTest : '1.21.0',
probateCommonsVersion : '2.2.12',
probateCommonsVersion : '2.2.12-DTSPB-4689-v4',
restAssured : '5.5.6',
serenity : '4.2.34',
serviceAuthProviderClient : '5.3.3',
Expand Down
2 changes: 1 addition & 1 deletion charts/probate-orchestrator-service/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: probate-orchestrator-service
home: https://github.com/hmcts/probate-orchestrator-service
version: 1.0.51
version: 1.0.52
description: HMCTS Probate Orchestrator Service
maintainers:
- name: HMCTS Probate Team
Expand Down
6 changes: 3 additions & 3 deletions charts/probate-orchestrator-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ java:
DEPLOYMENT_ENV: "{{ .Values.global.environment }}"
SERVICES_PERSISTENCE_BASEURL: "http://probate-persistence-service-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal"
AUTH_PROVIDER_SERVICE_CLIENT_BASEURL: "http://rpe-service-auth-provider-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal"
SERVICES_CORECASEDATA_BASEURL: "http://ccd-data-store-api-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal"
SERVICES_CORECASEDATA_BASEURL: "http://probate-back-office-pr-3376-ccd-data-store-api"
SERVICES_AUTH_PROVIDER_BASEURL: "http://rpe-service-auth-provider-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal"
AUTH_IDAM_CLIENT_BASEURL: "https://idam-api.{{ .Values.global.environment }}.platform.hmcts.net"
SUBMIT_SERVICE_API_URL: "http://probate-submit-service-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal"
SUBMIT_SERVICE_API_URL: "http://probate-submit-service-pr-1215-java"
BUSINESS_SERVICE_API_URL: "http://probate-business-service-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal"
BACK_OFFICE_API_URL: "http://probate-back-office-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal"
BACK_OFFICE_API_URL: "http://probate-back-office-pr-3376-java"
MAIL_JAVAMAILPROPERTIES_MAIL_SMTP_SSL_ENABLE: false
MAIL_JAVAMAILPROPERTIES_MAIL_SMTP_AUTH: false
SERVICES_CORECASEDATA_ENABLED: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package uk.gov.hmcts.probate.core.service.mapper;

import org.springframework.stereotype.Component;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.FromApplicantFamilyDetails;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.ToApplicantFamilyDetails;
import uk.gov.hmcts.reform.probate.model.Relationship;
import uk.gov.hmcts.reform.probate.model.cases.ApplicantFamilyDetails;
import uk.gov.hmcts.reform.probate.model.forms.intestacy.FamilyDetails;

@Component
public class ApplicantFamilyDetailsMapper {
@ToApplicantFamilyDetails
public ApplicantFamilyDetails toApplicantDetails(FamilyDetails details) {
if (details == null) {
return null;
}
return ApplicantFamilyDetails.builder()
.relationshipToDeceased(Relationship.fromString(details.getRelationshipToDeceased()))
.childAdoptedIn(details.getChildAdoptedIn())
.childAdoptionInEnglandOrWales(details.getChildAdoptionInEnglandOrWales())
.childAdoptedOut(details.getChildAdoptedOut())
.grandchildAdoptedIn(details.getGrandchildAdoptedIn())
.grandchildAdoptionInEnglandOrWales(details.getGrandchildAdoptionInEnglandOrWales())
.grandchildAdoptedOut(details.getGrandchildAdoptedOut())
.build();
}

@FromApplicantFamilyDetails
public FamilyDetails fromApplicantDetails(ApplicantFamilyDetails details) {
if (details == null) {
return null;
}
return FamilyDetails.builder()
.relationshipToDeceased(details.getRelationshipToDeceased().getDescription())
.childAdoptedIn(details.getChildAdoptedIn())
.childAdoptionInEnglandOrWales(details.getChildAdoptionInEnglandOrWales())
.childAdoptedOut(details.getChildAdoptedOut())
.grandchildAdoptedIn(details.getGrandchildAdoptedIn())
.grandchildAdoptionInEnglandOrWales(details.getGrandchildAdoptionInEnglandOrWales())
.grandchildAdoptedOut(details.getGrandchildAdoptedOut())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.ReportingPolicy;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.FromApplicantFamilyDetails;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.FromCollectionMember;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.FromDocumentLink;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.FromIhtMethod;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.FromLocalDate;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.FromMap;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.FromRegistryLocation;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.FromUploadDocs;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.ToApplicantFamilyDetails;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.ToCaseAddress;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.ToCollectionMember;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.ToDocumentLink;
Expand All @@ -25,6 +27,7 @@
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.ToRegistryLocation;
import uk.gov.hmcts.probate.core.service.mapper.qualifiers.ToUploadDocs;
import uk.gov.hmcts.reform.probate.model.IhtFormType;
import uk.gov.hmcts.reform.probate.model.Predeceased;
import uk.gov.hmcts.reform.probate.model.ProbateType;
import uk.gov.hmcts.reform.probate.model.Relationship;
import uk.gov.hmcts.reform.probate.model.cases.ApplicationType;
Expand All @@ -42,10 +45,10 @@
@Mapper(componentModel = "spring", uses = {PaPaymentMapper.class, PaymentsMapper.class, AliasNameMapper.class,
RegistryLocationMapper.class, PoundsConverter.class,
IhtMethodConverter.class, MapConverter.class, LegalStatementMapper.class, LocalDateTimeMapper.class,
DocumentsMapper.class, StatementOfTruthMapper.class, AddressMapper.class},
DocumentsMapper.class, StatementOfTruthMapper.class, AddressMapper.class, ApplicantFamilyDetailsMapper.class},
imports = {ApplicationType.class, GrantType.class, LocalDate.class, ProbateType.class, IhtMethod.class,
MaritalStatus.class, DeathCertificate.class, Relationship.class, SpouseNotApplyingReason.class,
AddressMapper.class, IhtFormType.class},
AddressMapper.class, IhtFormType.class, Predeceased.class},
unmappedTargetPolicy = ReportingPolicy.IGNORE, nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface IntestacyMapper extends FormMapper<GrantOfRepresentationData, IntestacyForm> {

Expand Down Expand Up @@ -78,11 +81,16 @@ public interface IntestacyMapper extends FormMapper<GrantOfRepresentationData, I
@Mapping(target = "deceasedMaritalStatus", expression = "java(form.getDeceased()!= null ? "
+ "MaritalStatus.fromString(form.getDeceased().getMaritalStatus()) : null)")
@Mapping(target = "deceasedDivorcedInEnglandOrWales", source = "deceased.divorcedInEnglandOrWales")
@Mapping(target = "deceasedDivorcedDateKnown", source = "deceased.divorcedDateKnown")
@Mapping(target = "dateOfDivorcedCPJudicially", source = "deceased.divorcedDate")
@Mapping(target = "deceasedOtherChildren", source = "deceased.otherChildren")
@Mapping(target = "declarationCheckbox", source = "declaration.declarationCheckbox")
@Mapping(target = "legalStatement", source = "declaration.legalStatement")
@Mapping(target = "allDeceasedChildrenOverEighteen", source = "deceased.allDeceasedChildrenOverEighteen")
@Mapping(target = "childrenDied", source = "deceased.anyDeceasedChildrenDieBeforeDeceased")
@Mapping(target = "childrenDiedBeforeDeceased", expression = "java(form.getDeceased()!= null ? "
+ "Predeceased.fromString(form.getDeceased().getChildrenDiedBeforeDeceased()) : null)")
@Mapping(target = "grandChildrenSurvived", source = "deceased.grandChildrenSurvived")
@Mapping(target = "anyDeceasedGrandChildrenUnderEighteen",
source = "deceased.anyDeceasedGrandchildrenUnderEighteen")
@Mapping(target = "deceasedSpouseNotApplyingReason", expression = "java(form.getApplicant()!= null && "
Expand Down Expand Up @@ -142,6 +150,8 @@ public interface IntestacyMapper extends FormMapper<GrantOfRepresentationData, I
@Mapping(target = "isSaveAndClose", source = "provideinformation.isSaveAndClose")
@Mapping(target = "citizenResponseCheckbox", source = "reviewresponse.citizenResponseCheckbox")
@Mapping(target = "expectedResponseDate", source = "expectedResponseDate")
@Mapping(target = "applicantFamilyDetails", source = "details",
qualifiedBy = {ToApplicantFamilyDetails.class})
GrantOfRepresentationData toCaseData(IntestacyForm form);

@Mapping(target = "type", expression = "java(ProbateType.INTESTACY)")
Expand All @@ -163,6 +173,9 @@ public interface IntestacyMapper extends FormMapper<GrantOfRepresentationData, I
@Mapping(target = "applicant.spouseNotApplyingReason",
expression = "java(grantOfRepresentationData.getDeceasedSpouseNotApplyingReason()!=null ? "
+ "grantOfRepresentationData.getDeceasedSpouseNotApplyingReason().getDescription() : null)")
@Mapping(target = "deceased.childrenDiedBeforeDeceased", expression =
"java(grantOfRepresentationData.getChildrenDiedBeforeDeceased()!=null ? "
+ "grantOfRepresentationData.getChildrenDiedBeforeDeceased().getDescription() : null)")
@Mapping(target = "registry.name", source = "registryLocation", qualifiedBy = {FromRegistryLocation.class})
@Mapping(target = "registry.address", source = "registryAddress")
@Mapping(target = "registry.email", source = "registryEmailAddress")
Expand Down Expand Up @@ -231,6 +244,8 @@ public interface IntestacyMapper extends FormMapper<GrantOfRepresentationData, I
@Mapping(target = "assets.assetsoverseas",
expression = "java(grantOfRepresentationData.getOutsideUkGrantCopies() == null ? "
+ "null : grantOfRepresentationData.getOutsideUkGrantCopies() > 0L)")
@Mapping(target = "details", source = "applicantFamilyDetails",
qualifiedBy = {FromApplicantFamilyDetails.class})
@InheritInverseConfiguration
IntestacyForm fromCaseData(GrantOfRepresentationData grantOfRepresentation);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package uk.gov.hmcts.probate.core.service.mapper.qualifiers;

import org.mapstruct.Qualifier;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Qualifier
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface FromApplicantFamilyDetails {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package uk.gov.hmcts.probate.core.service.mapper.qualifiers;

import org.mapstruct.Qualifier;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Qualifier
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface ToApplicantFamilyDetails {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package uk.gov.hmcts.probate.core.service.mapper;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import uk.gov.hmcts.reform.probate.model.Relationship;
import uk.gov.hmcts.reform.probate.model.cases.ApplicantFamilyDetails;
import uk.gov.hmcts.reform.probate.model.forms.intestacy.FamilyDetails;

class ApplicantFamilyDetailsMapperTest {
@Mock
private ApplicantFamilyDetailsMapper mapper;

@BeforeEach
void setUp() {
mapper = new ApplicantFamilyDetailsMapper();
}

@Test
void toApplicantDetailsReturnsNullWhenInputIsNull() {
ApplicantFamilyDetails result = mapper.toApplicantDetails(null);
Assertions.assertThat(result).isNull();
}

@Test
void fromApplicantDetailsReturnsNullWhenInputIsNull() {
FamilyDetails result = mapper.fromApplicantDetails(null);
Assertions.assertThat(result).isNull();
}

@Test
void toApplicantDetailsMapsAllFieldsCorrectly() {
FamilyDetails details = FamilyDetails.builder()
.relationshipToDeceased("optionSpousePartner")
.childAdoptedIn(true)
.childAdoptionInEnglandOrWales(false)
.childAdoptedOut(true)
.grandchildAdoptedIn(false)
.grandchildAdoptionInEnglandOrWales(true)
.grandchildAdoptedOut(false)
.build();

ApplicantFamilyDetails result = mapper.toApplicantDetails(details);

Assertions.assertThat(result.getRelationshipToDeceased()).isEqualTo(Relationship.PARTNER);
Assertions.assertThat(result.getChildAdoptedIn()).isTrue();
Assertions.assertThat(result.getChildAdoptionInEnglandOrWales()).isFalse();
Assertions.assertThat(result.getChildAdoptedOut()).isTrue();
Assertions.assertThat(result.getGrandchildAdoptedIn()).isFalse();
Assertions.assertThat(result.getGrandchildAdoptionInEnglandOrWales()).isTrue();
Assertions.assertThat(result.getGrandchildAdoptedOut()).isFalse();
}

@Test
void fromApplicantDetailsMapsAllFieldsCorrectly() {
ApplicantFamilyDetails details = ApplicantFamilyDetails.builder()
.relationshipToDeceased(Relationship.PARTNER)
.childAdoptedIn(true)
.childAdoptionInEnglandOrWales(false)
.childAdoptedOut(true)
.grandchildAdoptedIn(false)
.grandchildAdoptionInEnglandOrWales(true)
.grandchildAdoptedOut(false)
.build();

FamilyDetails result = mapper.fromApplicantDetails(details);

Assertions.assertThat(result.getRelationshipToDeceased()).isEqualTo("optionSpousePartner");
Assertions.assertThat(result.getChildAdoptedIn()).isTrue();
Assertions.assertThat(result.getChildAdoptionInEnglandOrWales()).isFalse();
Assertions.assertThat(result.getChildAdoptedOut()).isTrue();
Assertions.assertThat(result.getGrandchildAdoptedIn()).isFalse();
Assertions.assertThat(result.getGrandchildAdoptionInEnglandOrWales()).isTrue();
Assertions.assertThat(result.getGrandchildAdoptedOut()).isFalse();
}
}