office-related spec-clarifications and -amendmends (contact.emailaddresses+.phonenumbers JSON) (#50)
Co-authored-by: Michael Hoennig <michael@hoennig.de> Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/50 Reviewed-by: Marc Sandlus <marc.sandlus@hostsharing.net>
This commit is contained in:
@@ -19,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static net.hostsharing.hsadminng.rbac.test.IsValidUuidMatcher.isUuidValid;
|
||||
@@ -103,7 +104,9 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
.body("""
|
||||
{
|
||||
"label": "Temp Contact",
|
||||
"emailAddresses": "test@example.org"
|
||||
"emailAddresses": {
|
||||
"main": "test@example.org"
|
||||
}
|
||||
}
|
||||
""")
|
||||
.port(port)
|
||||
@@ -114,7 +117,7 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
.contentType(ContentType.JSON)
|
||||
.body("uuid", isUuidValid())
|
||||
.body("label", is("Temp Contact"))
|
||||
.body("emailAddresses", is("test@example.org"))
|
||||
.body("emailAddresses", is(Map.of("main", "test@example.org")))
|
||||
.header("Location", startsWith("http://localhost"))
|
||||
.extract().header("Location"); // @formatter:on
|
||||
|
||||
@@ -180,9 +183,13 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
.contentType("application/json")
|
||||
.body("", lenientlyEquals("""
|
||||
{
|
||||
"label": "first contact",
|
||||
"emailAddresses": "contact-admin@firstcontact.example.com",
|
||||
"phoneNumbers": "+49 123 1234567"
|
||||
"label": "first contact",
|
||||
"emailAddresses": {
|
||||
"main": "contact-admin@firstcontact.example.com"
|
||||
},
|
||||
"phoneNumbers": {
|
||||
"phone_office": "+49 123 1234567"
|
||||
}
|
||||
}
|
||||
""")); // @formatter:on
|
||||
}
|
||||
@@ -204,9 +211,13 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
.body("""
|
||||
{
|
||||
"label": "Temp patched contact",
|
||||
"emailAddresses": "patched@example.org",
|
||||
"emailAddresses": {
|
||||
"main": "patched@example.org"
|
||||
},
|
||||
"postalAddress": "Patched Address",
|
||||
"phoneNumbers": "+01 100 123456"
|
||||
"phoneNumbers": {
|
||||
"phone_office": "+01 100 123456"
|
||||
}
|
||||
}
|
||||
""")
|
||||
.port(port)
|
||||
@@ -217,9 +228,9 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
.contentType(ContentType.JSON)
|
||||
.body("uuid", isUuidValid())
|
||||
.body("label", is("Temp patched contact"))
|
||||
.body("emailAddresses", is("patched@example.org"))
|
||||
.body("emailAddresses", is(Map.of("main", "patched@example.org")))
|
||||
.body("postalAddress", is("Patched Address"))
|
||||
.body("phoneNumbers", is("+01 100 123456"));
|
||||
.body("phoneNumbers", is(Map.of("phone_office", "+01 100 123456")));
|
||||
// @formatter:on
|
||||
|
||||
// finally, the contact is actually updated
|
||||
@@ -227,9 +238,9 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
assertThat(contactRepo.findByUuid(givenContact.getUuid())).isPresent().get()
|
||||
.matches(person -> {
|
||||
assertThat(person.getLabel()).isEqualTo("Temp patched contact");
|
||||
assertThat(person.getEmailAddresses()).isEqualTo("patched@example.org");
|
||||
assertThat(person.getEmailAddresses()).containsExactlyEntriesOf(Map.of("main", "patched@example.org"));
|
||||
assertThat(person.getPostalAddress()).isEqualTo("Patched Address");
|
||||
assertThat(person.getPhoneNumbers()).isEqualTo("+01 100 123456");
|
||||
assertThat(person.getPhoneNumbers()).containsExactlyEntriesOf(Map.of("phone_office", "+01 100 123456"));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -246,8 +257,12 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
.contentType(ContentType.JSON)
|
||||
.body("""
|
||||
{
|
||||
"emailAddresses": "patched@example.org",
|
||||
"phoneNumbers": "+01 100 123456"
|
||||
"emailAddresses": {
|
||||
"main": "patched@example.org"
|
||||
},
|
||||
"phoneNumbers": {
|
||||
"phone_office": "+01 100 123456"
|
||||
}
|
||||
}
|
||||
""")
|
||||
.port(port)
|
||||
@@ -258,18 +273,18 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
.contentType(ContentType.JSON)
|
||||
.body("uuid", isUuidValid())
|
||||
.body("label", is(givenContact.getLabel()))
|
||||
.body("emailAddresses", is("patched@example.org"))
|
||||
.body("emailAddresses", is(Map.of("main", "patched@example.org")))
|
||||
.body("postalAddress", is(givenContact.getPostalAddress()))
|
||||
.body("phoneNumbers", is("+01 100 123456"));
|
||||
.body("phoneNumbers", is(Map.of("phone_office", "+01 100 123456")));
|
||||
// @formatter:on
|
||||
|
||||
// finally, the contact is actually updated
|
||||
assertThat(contactRepo.findByUuid(givenContact.getUuid())).isPresent().get()
|
||||
.matches(person -> {
|
||||
assertThat(person.getLabel()).isEqualTo(givenContact.getLabel());
|
||||
assertThat(person.getEmailAddresses()).isEqualTo("patched@example.org");
|
||||
assertThat(person.getEmailAddresses()).containsExactlyEntriesOf(Map.of("main", "patched@example.org"));
|
||||
assertThat(person.getPostalAddress()).isEqualTo(givenContact.getPostalAddress());
|
||||
assertThat(person.getPhoneNumbers()).isEqualTo("+01 100 123456");
|
||||
assertThat(person.getPhoneNumbers()).containsExactlyEntriesOf(Map.of("phone_office", "+01 100 123456"));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -340,9 +355,9 @@ class HsOfficeContactControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
final var newContact = HsOfficeContactEntity.builder()
|
||||
.uuid(UUID.randomUUID())
|
||||
.label("Temp from " + Context.getCallerMethodNameFromStackFrame(1) )
|
||||
.emailAddresses(RandomStringUtils.randomAlphabetic(10) + "@example.org")
|
||||
.emailAddresses(Map.of("main", RandomStringUtils.randomAlphabetic(10) + "@example.org"))
|
||||
.postalAddress("Postal Address " + RandomStringUtils.randomAlphabetic(10))
|
||||
.phoneNumbers("+01 200 " + RandomStringUtils.randomNumeric(8))
|
||||
.phoneNumbers(Map.of("phone_office", "+01 200 " + RandomStringUtils.randomNumeric(8)))
|
||||
.build();
|
||||
|
||||
return contactRepo.save(newContact);
|
||||
|
@@ -4,9 +4,12 @@ import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase;
|
||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeContactPatchResource;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static net.hostsharing.hsadminng.mapper.PatchMap.entry;
|
||||
import static net.hostsharing.hsadminng.mapper.PatchMap.patchMap;
|
||||
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
|
||||
|
||||
@TestInstance(PER_CLASS)
|
||||
@@ -16,15 +19,42 @@ class HsOfficeContactEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||
> {
|
||||
|
||||
private static final UUID INITIAL_CONTACT_UUID = UUID.randomUUID();
|
||||
private static final Map<String, String> PATCH_EMAIL_ADDRESSES = patchMap(
|
||||
entry("main", "patched@example.com"),
|
||||
entry("paul", null),
|
||||
entry("suse", "suse@example.com")
|
||||
);
|
||||
private static final Map<String, String> PATCHED_EMAIL_ADDRESSES = patchMap(
|
||||
entry("main", "patched@example.com"),
|
||||
entry("suse", "suse@example.com"),
|
||||
entry("mila", "mila@example.com")
|
||||
);
|
||||
|
||||
private static final Map<String, String> PATCH_PHONE_NUMBERS = patchMap(
|
||||
entry("phone_mobile", null),
|
||||
entry("phone_private", "+49 40 987654321"),
|
||||
entry("fax", "+49 40 12345-99")
|
||||
);
|
||||
private static final Map<String, String> PATCHED_PHONE_NUMBERS = patchMap(
|
||||
entry("phone_office", "+49 40 12345-00"),
|
||||
entry("phone_private", "+49 40 987654321"),
|
||||
entry("fax", "+49 40 12345-99")
|
||||
);
|
||||
|
||||
@Override
|
||||
protected HsOfficeContactEntity newInitialEntity() {
|
||||
final var entity = new HsOfficeContactEntity();
|
||||
entity.setUuid(INITIAL_CONTACT_UUID);
|
||||
entity.setLabel("initial label");
|
||||
entity.setEmailAddresses("initial@example.org");
|
||||
entity.setPhoneNumbers("initial postal address");
|
||||
entity.setPostalAddress("+01 100 123456789");
|
||||
entity.putEmailAddresses(Map.ofEntries(
|
||||
entry("main", "initial@example.org"),
|
||||
entry("paul", "paul@example.com"),
|
||||
entry("mila", "mila@example.com")));
|
||||
entity.putPhoneNumbers(Map.ofEntries(
|
||||
entry("phone_office", "+49 40 12345-00"),
|
||||
entry("phone_mobile", "+49 1555 1234567"),
|
||||
entry("fax", "+49 40 12345-90")));
|
||||
entity.setPostalAddress("Initialstraße 50\n20000 Hamburg");
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -34,8 +64,8 @@ class HsOfficeContactEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HsOfficeContactEntityPatch createPatcher(final HsOfficeContactEntity entity) {
|
||||
return new HsOfficeContactEntityPatch(entity);
|
||||
protected HsOfficeContactEntityPatcher createPatcher(final HsOfficeContactEntity entity) {
|
||||
return new HsOfficeContactEntityPatcher(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,16 +76,20 @@ class HsOfficeContactEntityPatcherUnitTest extends PatchUnitTestBase<
|
||||
HsOfficeContactPatchResource::setLabel,
|
||||
"patched label",
|
||||
HsOfficeContactEntity::setLabel),
|
||||
new JsonNullableProperty<>(
|
||||
"emailAddresses",
|
||||
new SimpleProperty<>(
|
||||
"resources",
|
||||
HsOfficeContactPatchResource::setEmailAddresses,
|
||||
"patched trade name",
|
||||
HsOfficeContactEntity::setEmailAddresses),
|
||||
new JsonNullableProperty<>(
|
||||
"phoneNumbers",
|
||||
PATCH_EMAIL_ADDRESSES,
|
||||
HsOfficeContactEntity::putEmailAddresses,
|
||||
PATCHED_EMAIL_ADDRESSES)
|
||||
.notNullable(),
|
||||
new SimpleProperty<>(
|
||||
"resources",
|
||||
HsOfficeContactPatchResource::setPhoneNumbers,
|
||||
"patched family name",
|
||||
HsOfficeContactEntity::setPhoneNumbers),
|
||||
PATCH_PHONE_NUMBERS,
|
||||
HsOfficeContactEntity::putPhoneNumbers,
|
||||
PATCHED_PHONE_NUMBERS)
|
||||
.notNullable(),
|
||||
new JsonNullableProperty<>(
|
||||
"patched given name",
|
||||
HsOfficeContactPatchResource::setPostalAddress,
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package net.hostsharing.hsadminng.hs.office.contact;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class TestHsOfficeContact {
|
||||
|
||||
@@ -9,7 +10,7 @@ public class TestHsOfficeContact {
|
||||
return HsOfficeContactEntity.builder()
|
||||
.label(label)
|
||||
.postalAddress("address of " + label)
|
||||
.emailAddresses(emailAddr)
|
||||
.emailAddresses(Map.of("main", emailAddr))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@@ -107,8 +107,8 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
"mark": null,
|
||||
"contact": {
|
||||
"label": "first contact",
|
||||
"emailAddresses": "contact-admin@firstcontact.example.com",
|
||||
"phoneNumbers": "+49 123 1234567"
|
||||
"emailAddresses": { "main": "contact-admin@firstcontact.example.com" },
|
||||
"phoneNumbers": { "phone_office": "+49 123 1234567" }
|
||||
}
|
||||
},
|
||||
"debitorNumber": 1000111,
|
||||
@@ -132,8 +132,8 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
"mark": null,
|
||||
"contact": {
|
||||
"label": "first contact",
|
||||
"emailAddresses": "contact-admin@firstcontact.example.com",
|
||||
"phoneNumbers": "+49 123 1234567"
|
||||
"emailAddresses": { "main": "contact-admin@firstcontact.example.com" },
|
||||
"phoneNumbers": { "phone_office": "+49 123 1234567" }
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
@@ -162,7 +162,9 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
"anchor": {"tradeName": "Second e.K."},
|
||||
"holder": {"tradeName": "Second e.K."},
|
||||
"type": "DEBITOR",
|
||||
"contact": {"emailAddresses": "contact-admin@secondcontact.example.com"}
|
||||
"contact": {
|
||||
"emailAddresses": { "main": "contact-admin@secondcontact.example.com" }
|
||||
}
|
||||
},
|
||||
"debitorNumber": 1000212,
|
||||
"debitorNumberSuffix": 12,
|
||||
@@ -172,7 +174,9 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
"anchor": {"tradeName": "Hostsharing eG"},
|
||||
"holder": {"tradeName": "Second e.K."},
|
||||
"type": "PARTNER",
|
||||
"contact": {"emailAddresses": "contact-admin@secondcontact.example.com"}
|
||||
"contact": {
|
||||
"emailAddresses": { "main": "contact-admin@secondcontact.example.com" }
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"registrationOffice": "Hamburg",
|
||||
@@ -192,7 +196,9 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
"anchor": {"tradeName": "Third OHG"},
|
||||
"holder": {"tradeName": "Third OHG"},
|
||||
"type": "DEBITOR",
|
||||
"contact": {"emailAddresses": "contact-admin@thirdcontact.example.com"}
|
||||
"contact": {
|
||||
"emailAddresses": { "main": "contact-admin@thirdcontact.example.com" }
|
||||
}
|
||||
},
|
||||
"debitorNumber": 1000313,
|
||||
"debitorNumberSuffix": 13,
|
||||
@@ -202,7 +208,9 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
"anchor": {"tradeName": "Hostsharing eG"},
|
||||
"holder": {"tradeName": "Third OHG"},
|
||||
"type": "PARTNER",
|
||||
"contact": {"emailAddresses": "contact-admin@thirdcontact.example.com"}
|
||||
"contact": {
|
||||
"emailAddresses": { "main": "contact-admin@thirdcontact.example.com" }
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"registrationOffice": "Hamburg",
|
||||
@@ -223,7 +231,7 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
}
|
||||
|
||||
@Test
|
||||
void globalAdmin_withoutAssumedRoles_canFindDebitorDebitorByDebitorNumber() throws JSONException {
|
||||
void globalAdmin_withoutAssumedRoles_canFindDebitorDebitorByDebitorNumber() {
|
||||
|
||||
RestAssured // @formatter:off
|
||||
.given()
|
||||
@@ -456,9 +464,9 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
"type": "DEBITOR",
|
||||
"contact": {
|
||||
"label": "first contact",
|
||||
"postalAddress": "\\nVorname Nachname\\nStraße Hnr\\nPLZ Stadt\\n",
|
||||
"emailAddresses": "contact-admin@firstcontact.example.com",
|
||||
"phoneNumbers": "+49 123 1234567"
|
||||
"postalAddress": "Vorname Nachname\\nStraße Hnr\\nPLZ Stadt",
|
||||
"emailAddresses": { "main": "contact-admin@firstcontact.example.com" },
|
||||
"phoneNumbers": { "phone_office": "+49 123 1234567" }
|
||||
}
|
||||
},
|
||||
"debitorNumber": 1000111,
|
||||
@@ -472,9 +480,9 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
||||
"mark": null,
|
||||
"contact": {
|
||||
"label": "first contact",
|
||||
"postalAddress": "\\nVorname Nachname\\nStraße Hnr\\nPLZ Stadt\\n",
|
||||
"emailAddresses": "contact-admin@firstcontact.example.com",
|
||||
"phoneNumbers": "+49 123 1234567"
|
||||
"postalAddress": "Vorname Nachname\\nStraße Hnr\\nPLZ Stadt",
|
||||
"emailAddresses": { "main": "contact-admin@firstcontact.example.com" },
|
||||
"phoneNumbers": { "phone_office": "+49 123 1234567" }
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
|
@@ -240,30 +240,30 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
""");
|
||||
assertThat(toFormattedString(contacts)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
1101=contact(label='Herr Michael Mellies ', emailAddresses='mih@example.org'),
|
||||
1200=contact(label='JM e.K.', emailAddresses='jm-ex-partner@example.org'),
|
||||
1201=contact(label='Frau Dr. Jenny Meyer-Billing , JM GmbH', emailAddresses='jm-billing@example.org'),
|
||||
1202=contact(label='Herr Andrew Meyer-Operation , JM GmbH', emailAddresses='am-operation@example.org'),
|
||||
1203=contact(label='Herr Philip Meyer-Contract , JM GmbH', emailAddresses='pm-partner@example.org'),
|
||||
1204=contact(label='Frau Tammy Meyer-VIP , JM GmbH', emailAddresses='tm-vip@example.org'),
|
||||
1301=contact(label='Petra Schmidt , Test PS', emailAddresses='ps@example.com'),
|
||||
1401=contact(label='Frau Frauke Fanninga ', emailAddresses='ff@example.org'),
|
||||
1501=contact(label='Frau Cecilia Camus ', emailAddresses='cc@example.org')
|
||||
1101=contact(label='Herr Michael Mellies ', emailAddresses='{ main: mih@example.org }'),
|
||||
1200=contact(label='JM e.K.', emailAddresses='{ main: jm-ex-partner@example.org }'),
|
||||
1201=contact(label='Frau Dr. Jenny Meyer-Billing , JM GmbH', emailAddresses='{ main: jm-billing@example.org }'),
|
||||
1202=contact(label='Herr Andrew Meyer-Operation , JM GmbH', emailAddresses='{ main: am-operation@example.org }'),
|
||||
1203=contact(label='Herr Philip Meyer-Contract , JM GmbH', emailAddresses='{ main: pm-partner@example.org }'),
|
||||
1204=contact(label='Frau Tammy Meyer-VIP , JM GmbH', emailAddresses='{ main: tm-vip@example.org }'),
|
||||
1301=contact(label='Petra Schmidt , Test PS', emailAddresses='{ main: ps@example.com }'),
|
||||
1401=contact(label='Frau Frauke Fanninga ', emailAddresses='{ main: ff@example.org }'),
|
||||
1501=contact(label='Frau Cecilia Camus ', emailAddresses='{ main: cc@example.org }')
|
||||
}
|
||||
""");
|
||||
assertThat(toFormattedString(persons)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
1=person(personType='LP', tradeName='Hostsharing eG'),
|
||||
1101=person(personType='NP', tradeName='', familyName='Mellies', givenName='Michael'),
|
||||
1200=person(personType='LP', tradeName='JM e.K.', familyName='', givenName=''),
|
||||
1101=person(personType='NP', familyName='Mellies', givenName='Michael'),
|
||||
1200=person(personType='LP', tradeName='JM e.K.'),
|
||||
1201=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-Billing', givenName='Jenny'),
|
||||
1202=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-Operation', givenName='Andrew'),
|
||||
1203=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-Contract', givenName='Philip'),
|
||||
1204=person(personType='LP', tradeName='JM GmbH', familyName='Meyer-VIP', givenName='Tammy'),
|
||||
1301=person(personType='??', tradeName='Test PS', familyName='Schmidt', givenName='Petra'),
|
||||
1401=person(personType='NP', tradeName='', familyName='Fanninga', givenName='Frauke'),
|
||||
1501=person(personType='NP', tradeName='', familyName='Camus', givenName='Cecilia')
|
||||
}
|
||||
1401=person(personType='NP', familyName='Fanninga', givenName='Frauke'),
|
||||
1501=person(personType='NP', familyName='Camus', givenName='Cecilia')
|
||||
}
|
||||
""");
|
||||
assertThat(toFormattedString(debitors)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
@@ -363,11 +363,11 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
|
||||
assertThat(toFormattedString(coopShares)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
33443=CoopShareTransaction(M-1001700: 2000-12-06, SUBSCRIPTION, 20, legacy data import, initial share subscription),
|
||||
33451=CoopShareTransaction(M-1002000: 2000-12-06, SUBSCRIPTION, 2, legacy data import, initial share subscription),
|
||||
33701=CoopShareTransaction(M-1001700: 2005-01-10, SUBSCRIPTION, 40, legacy data import, increase),
|
||||
33810=CoopShareTransaction(M-1002000: 2016-12-31, CANCELLATION, 22, legacy data import, membership ended)
|
||||
}
|
||||
33443=CoopShareTransaction(M-1001700: 2000-12-06, SUBSCRIPTION, 20, 1001700, initial share subscription),
|
||||
33451=CoopShareTransaction(M-1002000: 2000-12-06, SUBSCRIPTION, 2, 1002000, initial share subscription),
|
||||
33701=CoopShareTransaction(M-1001700: 2005-01-10, SUBSCRIPTION, 40, 1001700, increase),
|
||||
33810=CoopShareTransaction(M-1002000: 2016-12-31, CANCELLATION, 22, 1002000, membership ended)
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@@ -390,16 +390,16 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
|
||||
assertThat(toFormattedString(coopAssets)).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
30000=CoopAssetsTransaction(M-1001700: 2000-12-06, DEPOSIT, 1280.00, legacy data import, for subscription A),
|
||||
31000=CoopAssetsTransaction(M-1002000: 2000-12-06, DEPOSIT, 128.00, legacy data import, for subscription B),
|
||||
32000=CoopAssetsTransaction(M-1001700: 2005-01-10, DEPOSIT, 2560.00, legacy data import, for subscription C),
|
||||
33001=CoopAssetsTransaction(M-1001700: 2005-01-10, TRANSFER, -512.00, legacy data import, for transfer to 10),
|
||||
33002=CoopAssetsTransaction(M-1002000: 2005-01-10, ADOPTION, 512.00, legacy data import, for transfer from 7),
|
||||
34001=CoopAssetsTransaction(M-1002000: 2016-12-31, CLEARING, -8.00, legacy data import, for cancellation D),
|
||||
34002=CoopAssetsTransaction(M-1002000: 2016-12-31, DISBURSAL, -100.00, legacy data import, for cancellation D),
|
||||
34003=CoopAssetsTransaction(M-1002000: 2016-12-31, LOSS, -20.00, legacy data import, for cancellation D),
|
||||
35001=CoopAssetsTransaction(M-1909000: 2024-01-15, DEPOSIT, 128.00, legacy data import, for subscription E),
|
||||
35002=CoopAssetsTransaction(M-1909000: 2024-01-20, ADJUSTMENT, -128.00, legacy data import, chargeback for subscription E, M-1909000:DEP:+128.00)
|
||||
30000=CoopAssetsTransaction(M-1001700: 2000-12-06, DEPOSIT, 1280.00, 1001700, for subscription A),
|
||||
31000=CoopAssetsTransaction(M-1002000: 2000-12-06, DEPOSIT, 128.00, 1002000, for subscription B),
|
||||
32000=CoopAssetsTransaction(M-1001700: 2005-01-10, DEPOSIT, 2560.00, 1001700, for subscription C),
|
||||
33001=CoopAssetsTransaction(M-1001700: 2005-01-10, TRANSFER, -512.00, 1001700, for transfer to 10),
|
||||
33002=CoopAssetsTransaction(M-1002000: 2005-01-10, ADOPTION, 512.00, 1002000, for transfer from 7),
|
||||
34001=CoopAssetsTransaction(M-1002000: 2016-12-31, CLEARING, -8.00, 1002000, for cancellation D),
|
||||
34002=CoopAssetsTransaction(M-1002000: 2016-12-31, DISBURSAL, -100.00, 1002000, for cancellation D),
|
||||
34003=CoopAssetsTransaction(M-1002000: 2016-12-31, LOSS, -20.00, 1002000, for cancellation D),
|
||||
35001=CoopAssetsTransaction(M-1909000: 2024-01-15, DEPOSIT, 128.00, 1909000, for subscription E),
|
||||
35002=CoopAssetsTransaction(M-1909000: 2024-01-20, ADJUSTMENT, -128.00, 1909000, chargeback for subscription E, M-1909000:DEP:+128.00)
|
||||
}
|
||||
""");
|
||||
}
|
||||
@@ -810,7 +810,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
)
|
||||
.shareCount(rec.getInteger("quantity"))
|
||||
.comment( rec.getString("comment"))
|
||||
.reference("legacy data import") // TODO.spec: or use value from comment column?
|
||||
.reference(member.getMemberNumber().toString())
|
||||
.build();
|
||||
|
||||
if (shareTransaction.getTransactionType() == HsOfficeCoopSharesTransactionType.ADJUSTMENT) {
|
||||
@@ -867,7 +867,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
.transactionType(assetTypeMapping.get(rec.getString("action")))
|
||||
.assetValue(rec.getBigDecimal("amount"))
|
||||
.comment(rec.getString("comment"))
|
||||
.reference("legacy data import") // TODO.spec: or use value from comment column?
|
||||
.reference(member.getMemberNumber().toString())
|
||||
.build();
|
||||
|
||||
if (assetTransaction.getTransactionType() == HsOfficeCoopAssetsTransactionType.ADJUSTMENT) {
|
||||
@@ -1092,9 +1092,9 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
contactRecord.getString("first_name"),
|
||||
contactRecord.getString("last_name"),
|
||||
contactRecord.getString("firma")));
|
||||
contact.setEmailAddresses(contactRecord.getString("email"));
|
||||
contact.putEmailAddresses( Map.of("main", contactRecord.getString("email")));
|
||||
contact.setPostalAddress(toAddress(contactRecord));
|
||||
contact.setPhoneNumbers(toPhoneNumbers(contactRecord));
|
||||
contact.putPhoneNumbers(toPhoneNumbers(contactRecord));
|
||||
|
||||
contacts.put(contactRecord.getInteger("contact_id"), contact);
|
||||
return contact;
|
||||
@@ -1120,17 +1120,17 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
return record;
|
||||
}
|
||||
|
||||
private String toPhoneNumbers(final Record rec) {
|
||||
final var result = new StringBuilder("{\n");
|
||||
private Map<String, String> toPhoneNumbers(final Record rec) {
|
||||
final var phoneNumbers = new LinkedHashMap<String, String>();
|
||||
if (isNotBlank(rec.getString("phone_private")))
|
||||
result.append(" \"private\": " + "\"" + rec.getString("phone_private") + "\",\n");
|
||||
phoneNumbers.put("phone_private", rec.getString("phone_private"));
|
||||
if (isNotBlank(rec.getString("phone_office")))
|
||||
result.append(" \"office\": " + "\"" + rec.getString("phone_office") + "\",\n");
|
||||
phoneNumbers.put("phone_office", rec.getString("phone_office"));
|
||||
if (isNotBlank(rec.getString("phone_mobile")))
|
||||
result.append(" \"mobile\": " + "\"" + rec.getString("phone_mobile") + "\",\n");
|
||||
phoneNumbers.put("phone_mobile", rec.getString("phone_mobile"));
|
||||
if (isNotBlank(rec.getString("fax")))
|
||||
result.append(" \"fax\": " + "\"" + rec.getString("fax") + "\",\n");
|
||||
return (result + "}").replace("\",\n}", "\"\n}");
|
||||
phoneNumbers.put("fax", rec.getString("fax"));
|
||||
return phoneNumbers;
|
||||
}
|
||||
|
||||
private String toAddress(final Record rec) {
|
||||
|
@@ -13,6 +13,19 @@ class TestPackageEntityUnitTest {
|
||||
assertThat(rbacFlowchart).isEqualTo("""
|
||||
%%{init:{'flowchart':{'htmlLabels':false}}}%%
|
||||
flowchart TB
|
||||
|
||||
subgraph customer["`**customer**`"]
|
||||
direction TB
|
||||
style customer fill:#99bcdb,stroke:#274d6e,stroke-width:8px
|
||||
|
||||
subgraph customer:roles[ ]
|
||||
style customer:roles fill:#99bcdb,stroke:white
|
||||
|
||||
role:customer:OWNER[[customer:OWNER]]
|
||||
role:customer:ADMIN[[customer:ADMIN]]
|
||||
role:customer:TENANT[[customer:TENANT]]
|
||||
end
|
||||
end
|
||||
|
||||
subgraph package["`**package**`"]
|
||||
direction TB
|
||||
@@ -36,19 +49,6 @@ class TestPackageEntityUnitTest {
|
||||
end
|
||||
end
|
||||
|
||||
subgraph customer["`**customer**`"]
|
||||
direction TB
|
||||
style customer fill:#99bcdb,stroke:#274d6e,stroke-width:8px
|
||||
|
||||
subgraph customer:roles[ ]
|
||||
style customer:roles fill:#99bcdb,stroke:white
|
||||
|
||||
role:customer:OWNER[[customer:OWNER]]
|
||||
role:customer:ADMIN[[customer:ADMIN]]
|
||||
role:customer:TENANT[[customer:TENANT]]
|
||||
end
|
||||
end
|
||||
|
||||
%% granting roles to roles
|
||||
role:global:ADMIN -.->|XX| role:customer:OWNER
|
||||
role:customer:OWNER -.-> role:customer:ADMIN
|
||||
|
Reference in New Issue
Block a user