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.core.JsonParser;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||||
@ -14,6 +15,10 @@ import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class JsonObjectMapperConfiguration {
|
public class JsonObjectMapperConfiguration {
|
||||||
|
|
||||||
|
public static ObjectMapper build() {
|
||||||
|
return new JsonObjectMapperConfiguration().customObjectMapper().build();
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
public Jackson2ObjectMapperBuilder customObjectMapper() {
|
public Jackson2ObjectMapperBuilder customObjectMapper() {
|
||||||
|
@ -605,10 +605,12 @@ class HsOfficeScenarioTests extends ScenarioTest {
|
|||||||
.given("partnerNumber", "P-31011")
|
.given("partnerNumber", "P-31011")
|
||||||
.given("nameOfDeceasedPerson", "Michelle Matthieu") // FIXME: redundant
|
.given("nameOfDeceasedPerson", "Michelle Matthieu") // FIXME: redundant
|
||||||
.given("dateOfDeath", "2024-11-15")
|
.given("dateOfDeath", "2024-11-15")
|
||||||
|
.given("representativeGivenName", "Lena")
|
||||||
|
.given("representativeFamilyName", "Stadland")
|
||||||
.given(
|
.given(
|
||||||
// "name": "Erbengemeinschaft Michelle Matthieu", // FIXME: automatic?
|
// "name": "Erbengemeinschaft Michelle Matthieu", // FIXME: automatic?
|
||||||
"communityOfHeirsPostalAddress", """
|
"communityOfHeirsPostalAddress", """
|
||||||
"co": "Lena Stadland",
|
"co": "Lena Stadland", // FIXME: take this form representative...?
|
||||||
"street": "Im Wischer 14",
|
"street": "Im Wischer 14",
|
||||||
"zipcode": "22987",
|
"zipcode": "22987",
|
||||||
"city": "Hamburg",
|
"city": "Hamburg",
|
||||||
|
@ -6,6 +6,7 @@ import net.hostsharing.hsadminng.hs.scenarios.UseCase;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
import static io.restassured.http.ContentType.JSON;
|
import static io.restassured.http.ContentType.JSON;
|
||||||
|
import static org.springframework.http.HttpStatus.CREATED;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase<ReplaceDeceasedPartnerWithCommunityOfHeirs> {
|
public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase<ReplaceDeceasedPartnerWithCommunityOfHeirs> {
|
||||||
@ -44,9 +45,36 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase<ReplaceD
|
|||||||
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON)
|
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON)
|
||||||
);
|
);
|
||||||
|
|
||||||
obtain("Contact: Erbengemeinschaft %{nameOfDeceasedPerson}", () ->
|
// obtain("Contact: Erbengemeinschaft %{nameOfDeceasedPerson}", () ->
|
||||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
// 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}",
|
"caption": "Erbengemeinschaft %{nameOfDeceasedPerson}",
|
||||||
"postalAddress": {
|
"postalAddress": {
|
||||||
"name": "Erbengemeinschaft %{nameOfDeceasedPerson}",
|
"name": "Erbengemeinschaft %{nameOfDeceasedPerson}",
|
||||||
@ -59,15 +87,44 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase<ReplaceD
|
|||||||
"main": ${communityOfHeirsEmailAddress}
|
"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
|
// 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}", () ->
|
obtain("Partner-Relation: Erbengemeinschaft %{nameOfDeceasedPerson}", () ->
|
||||||
httpPost("/api/hs/office/relations", usingJsonBody("""
|
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.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration;
|
||||||
import net.hostsharing.hsadminng.system.SystemProcess;
|
import net.hostsharing.hsadminng.system.SystemProcess;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.junit.jupiter.api.Order;
|
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");
|
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 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 Map<String, ?> aliases;
|
||||||
private final PrintWriter markdownLog; // records everything for debugging purposes
|
private final PrintWriter markdownLog; // records everything for debugging purposes
|
||||||
|
Loading…
Reference in New Issue
Block a user