create Partner-Relation: Erbengemeinschaft with embedded holder and contact data
This commit is contained in:
parent
03f208a27a
commit
fb70e212a6
@ -2,6 +2,7 @@ package net.hostsharing.hsadminng.config;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||
@ -14,6 +15,10 @@ import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
@Configuration
|
||||
public class JsonObjectMapperConfiguration {
|
||||
|
||||
public static ObjectMapper build() {
|
||||
return new JsonObjectMapperConfiguration().customObjectMapper().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public Jackson2ObjectMapperBuilder customObjectMapper() {
|
||||
|
@ -605,10 +605,12 @@ class HsOfficeScenarioTests extends ScenarioTest {
|
||||
.given("partnerNumber", "P-31011")
|
||||
.given("nameOfDeceasedPerson", "Michelle Matthieu") // FIXME: redundant
|
||||
.given("dateOfDeath", "2024-11-15")
|
||||
.given("representativeGivenName", "Lena")
|
||||
.given("representativeFamilyName", "Stadland")
|
||||
.given(
|
||||
// "name": "Erbengemeinschaft Michelle Matthieu", // FIXME: automatic?
|
||||
"communityOfHeirsPostalAddress", """
|
||||
"co": "Lena Stadland",
|
||||
"co": "Lena Stadland", // FIXME: take this form representative...?
|
||||
"street": "Im Wischer 14",
|
||||
"zipcode": "22987",
|
||||
"city": "Hamburg",
|
||||
|
@ -6,6 +6,7 @@ import net.hostsharing.hsadminng.hs.scenarios.UseCase;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import static io.restassured.http.ContentType.JSON;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase<ReplaceDeceasedPartnerWithCommunityOfHeirs> {
|
||||
@ -44,9 +45,36 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase<ReplaceD
|
||||
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON)
|
||||
);
|
||||
|
||||
obtain("Contact: Erbengemeinschaft %{nameOfDeceasedPerson}", () ->
|
||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
{
|
||||
// obtain("Contact: Erbengemeinschaft %{nameOfDeceasedPerson}", () ->
|
||||
// httpPost("/api/hs/office/contacts", usingJsonBody("""
|
||||
// {
|
||||
// "caption": "Erbengemeinschaft %{nameOfDeceasedPerson}",
|
||||
// "postalAddress": {
|
||||
// "name": "Erbengemeinschaft %{nameOfDeceasedPerson}",
|
||||
// %{communityOfHeirsPostalAddress}
|
||||
// },
|
||||
// "phoneNumbers": {
|
||||
// "office": ${communityOfHeirsOfficePhoneNumber}
|
||||
// },
|
||||
// "emailAddresses": {
|
||||
// "main": ${communityOfHeirsEmailAddress}
|
||||
// }
|
||||
// }
|
||||
// """))
|
||||
// .expecting(HttpStatus.CREATED).expecting(ContentType.JSON)
|
||||
// );
|
||||
|
||||
obtain("Partner-Relation: Erbengemeinschaft %{nameOfDeceasedPerson}", () ->
|
||||
httpPost("/api/hs/office/relations", usingJsonBody("""
|
||||
{
|
||||
"type": "PARTNER",
|
||||
"anchor.uuid": ${Person: Hostsharing eG},
|
||||
"holder": {
|
||||
"personType": "NATURAL_PERSON",
|
||||
"givenName": ${representativeGivenName},
|
||||
"familyName": ${representativeFamilyName}
|
||||
},
|
||||
"contact": {
|
||||
"caption": "Erbengemeinschaft %{nameOfDeceasedPerson}",
|
||||
"postalAddress": {
|
||||
"name": "Erbengemeinschaft %{nameOfDeceasedPerson}",
|
||||
@ -59,15 +87,44 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase<ReplaceD
|
||||
"main": ${communityOfHeirsEmailAddress}
|
||||
}
|
||||
}
|
||||
"""))
|
||||
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON)
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON)
|
||||
);
|
||||
|
||||
// Repräsentanten Person für die Erbengemeinschaft anlegen
|
||||
|
||||
// Repräsentanten Relation zur Erbengemeinschaft für die zuvor erzeugte Person zur Erbengemeinschaft anlegen
|
||||
|
||||
|
||||
// obtain("Person: %{representativeGivenName} %{representativeFamilyName}", () ->
|
||||
// httpPost("/api/hs/office/persons", usingJsonBody("""
|
||||
// {
|
||||
// "personType": "NATURAL_PERSON",
|
||||
// "givenName": ${representativeGivenName},
|
||||
// "familyName": ${representativeFamilyName}
|
||||
// }
|
||||
// """))
|
||||
// .expecting(HttpStatus.CREATED).expecting(ContentType.JSON),
|
||||
// "A community of heirs needs at least one representative.",
|
||||
// "If there are more than one, each needs their own contact"
|
||||
// );
|
||||
|
||||
obtain("Representative-Relation: %{subscriberGivenName} %{subscriberFamilyName} for Erbengemeinschaft %{nameOfDeceasedPerson}", () ->
|
||||
httpPost("/api/hs/office/relations", usingJsonBody("""
|
||||
{
|
||||
"type": "REPRESENTATIVE",
|
||||
"anchor.uuid": ${Person: %{partnerPersonTradeName}},
|
||||
"holder.uuid": {
|
||||
"personType": "NATURAL_PERSON",
|
||||
"givenName": ${representativeGivenName},
|
||||
"familyName": ${representativeFamilyName}
|
||||
},
|
||||
"contact.uuid": ${Contact: %{subscriberGivenName} %{subscriberFamilyName}}
|
||||
}
|
||||
"""))
|
||||
.expecting(CREATED).expecting(JSON),
|
||||
""
|
||||
);
|
||||
|
||||
obtain("Partner-Relation: Erbengemeinschaft %{nameOfDeceasedPerson}", () ->
|
||||
httpPost("/api/hs/office/relations", usingJsonBody("""
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ package net.hostsharing.hsadminng.hs.scenarios;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.SneakyThrows;
|
||||
import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration;
|
||||
import net.hostsharing.hsadminng.system.SystemProcess;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.Order;
|
||||
@ -28,7 +29,7 @@ public class TestReport {
|
||||
public static final SimpleDateFormat MM_DD_YYYY_HH_MM_SS = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
|
||||
|
||||
private static final File markdownLogFile = new File(BUILD_DOC_SCENARIOS, ".last-debug-log.md");
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private static final ObjectMapper objectMapper = JsonObjectMapperConfiguration.build();
|
||||
|
||||
private final Map<String, ?> aliases;
|
||||
private final PrintWriter markdownLog; // records everything for debugging purposes
|
||||
|
Loading…
Reference in New Issue
Block a user