memberNumber as partnerNumber+memberNumberSuffix #13
@ -41,11 +41,10 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi {
|
|||||||
final String currentUser,
|
final String currentUser,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
UUID partnerUuid,
|
UUID partnerUuid,
|
||||||
Integer memberNumberSuffix) {
|
Integer memberNumber) {
|
||||||
context.define(currentUser, assumedRoles);
|
context.define(currentUser, assumedRoles);
|
||||||
|
|
||||||
final var entities =
|
final var entities = membershipRepo.findMembershipsByOptionalPartherNumber(partnerUuid);
|
||||||
membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(partnerUuid, memberNumberSuffix);
|
|
||||||
|
|
||||||
final var resources = mapper.mapList(entities, HsOfficeMembershipResource.class,
|
final var resources = mapper.mapList(entities, HsOfficeMembershipResource.class,
|
||||||
SEPA_MANDATE_ENTITY_TO_RESOURCE_POSTMAPPER);
|
SEPA_MANDATE_ENTITY_TO_RESOURCE_POSTMAPPER);
|
||||||
|
@ -31,7 +31,7 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
|||||||
public class HsOfficeMembershipEntity implements HasUuid, Stringifyable {
|
public class HsOfficeMembershipEntity implements HasUuid, Stringifyable {
|
||||||
|
|
||||||
private static Stringify<HsOfficeMembershipEntity> stringify = stringify(HsOfficeMembershipEntity.class)
|
private static Stringify<HsOfficeMembershipEntity> stringify = stringify(HsOfficeMembershipEntity.class)
|
||||||
.withProp(HsOfficeMembershipEntity::getMemberNumberSuffix)
|
.withProp(e -> e.getPartner().getPartnerNumber() + e.memberNumberSuffix)
|
||||||
.withProp(e -> e.getPartner().toShortString())
|
.withProp(e -> e.getPartner().toShortString())
|
||||||
.withProp(e -> e.getMainDebitor().toShortString())
|
.withProp(e -> e.getMainDebitor().toShortString())
|
||||||
.withProp(e -> e.getValidity().asString())
|
.withProp(e -> e.getValidity().asString())
|
||||||
@ -52,8 +52,8 @@ public class HsOfficeMembershipEntity implements HasUuid, Stringifyable {
|
|||||||
@JoinColumn(name = "maindebitoruuid")
|
@JoinColumn(name = "maindebitoruuid")
|
||||||
private HsOfficeDebitorEntity mainDebitor;
|
private HsOfficeDebitorEntity mainDebitor;
|
||||||
|
|
||||||
@Column(name = "membernumbersuffix")
|
@Column(name = "membernumbersuffix", length = 2)
|
||||||
private int memberNumberSuffix;
|
private String memberNumberSuffix;
|
||||||
|
|
||||||
@Column(name = "validity", columnDefinition = "daterange")
|
@Column(name = "validity", columnDefinition = "daterange")
|
||||||
@Type(PostgreSQLRangeType.class)
|
@Type(PostgreSQLRangeType.class)
|
||||||
@ -98,7 +98,7 @@ public class HsOfficeMembershipEntity implements HasUuid, Stringifyable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toShortString() {
|
public String toShortString() {
|
||||||
return String.valueOf(memberNumberSuffix);
|
return partner.getPartnerNumber() + String.valueOf(memberNumberSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PrePersist
|
@PrePersist
|
||||||
|
@ -3,6 +3,7 @@ package net.hostsharing.hsadminng.hs.office.membership;
|
|||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.Repository;
|
import org.springframework.data.repository.Repository;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -11,16 +12,30 @@ public interface HsOfficeMembershipRepository extends Repository<HsOfficeMembers
|
|||||||
|
|
||||||
Optional<HsOfficeMembershipEntity> findByUuid(UUID id);
|
Optional<HsOfficeMembershipEntity> findByUuid(UUID id);
|
||||||
|
|
||||||
|
HsOfficeMembershipEntity save(final HsOfficeMembershipEntity entity);
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT membership FROM HsOfficeMembershipEntity membership
|
SELECT membership FROM HsOfficeMembershipEntity membership
|
||||||
WHERE (:memberNumberSuffix is null OR membership.memberNumberSuffix = :memberNumberSuffix)
|
WHERE ( CAST(:partnerUuid as org.hibernate.type.UUIDCharType) IS NULL
|
||||||
AND ( CAST(:partnerUuid as org.hibernate.type.UUIDCharType) IS NULL
|
OR membership.partner.uuid = :partnerUuid )
|
||||||
OR membership.partner.uuid = :partnerUuid )
|
ORDER BY membership.partner.partnerNumber, membership.memberNumberSuffix
|
||||||
|
""")
|
||||||
|
List<HsOfficeMembershipEntity> findMembershipsByOptionalPartherNumber(UUID partnerUuid);
|
||||||
|
@Query("""
|
||||||
|
SELECT membership FROM HsOfficeMembershipEntity membership
|
||||||
|
WHERE (:partnerNumber = membership.partner.partnerNumber)
|
||||||
|
AND (membership.memberNumberSuffix = :suffix)
|
||||||
ORDER BY membership.memberNumberSuffix
|
ORDER BY membership.memberNumberSuffix
|
||||||
""")
|
""")
|
||||||
List<HsOfficeMembershipEntity> findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(UUID partnerUuid, Integer memberNumberSuffix);
|
List<HsOfficeMembershipEntity> findMembershipsByPartnerNumberAndSuffix(
|
||||||
|
@NotNull Integer partnerNumber,
|
||||||
HsOfficeMembershipEntity save(final HsOfficeMembershipEntity entity);
|
@NotNull String suffix);
|
||||||
|
default List<HsOfficeMembershipEntity> findMembershipsByMemberNumber(Integer memberNumber) {
|
||||||
|
final var partnerNumber = memberNumber / 100;
|
||||||
|
final var suffix = memberNumber % 100;
|
||||||
|
return findMembershipsByPartnerNumberAndSuffix(partnerNumber, String.format("%02d", suffix));
|
||||||
|
}
|
||||||
|
|
||||||
long count();
|
long count();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ call create_journal('hs_office_partner_details');
|
|||||||
create table hs_office_partner
|
create table hs_office_partner
|
||||||
(
|
(
|
||||||
uuid uuid unique references RbacObject (uuid) initially deferred,
|
uuid uuid unique references RbacObject (uuid) initially deferred,
|
||||||
partnerNumber varchar(5),
|
partnerNumber numeric(5),
|
||||||
personUuid uuid not null references hs_office_person(uuid),
|
personUuid uuid not null references hs_office_person(uuid),
|
||||||
contactUuid uuid not null references hs_office_contact(uuid),
|
contactUuid uuid not null references hs_office_contact(uuid),
|
||||||
detailsUuid uuid not null references hs_office_partner_details(uuid) on delete cascade
|
detailsUuid uuid not null references hs_office_partner_details(uuid) on delete cascade
|
||||||
|
@ -13,7 +13,8 @@ create table if not exists hs_office_membership
|
|||||||
uuid uuid unique references RbacObject (uuid) initially deferred,
|
uuid uuid unique references RbacObject (uuid) initially deferred,
|
||||||
partnerUuid uuid not null references hs_office_partner(uuid),
|
partnerUuid uuid not null references hs_office_partner(uuid),
|
||||||
mainDebitorUuid uuid not null references hs_office_debitor(uuid),
|
mainDebitorUuid uuid not null references hs_office_debitor(uuid),
|
||||||
memberNumberSuffix numeric(5) not null unique,
|
memberNumberSuffix char(2) not null check (
|
||||||
hsh-michaelhoennig marked this conversation as resolved
|
|||||||
|
memberNumberSuffix::text ~ '^[0-9][0-9]$'),
|
||||||
validity daterange not null,
|
validity daterange not null,
|
||||||
reasonForTermination HsOfficeReasonForTermination not null default 'NONE',
|
reasonForTermination HsOfficeReasonForTermination not null default 'NONE',
|
||||||
membershipFeeBillable boolean not null default true
|
membershipFeeBillable boolean not null default true
|
||||||
|
@ -8,16 +8,18 @@
|
|||||||
/*
|
/*
|
||||||
Creates a single membership test record.
|
Creates a single membership test record.
|
||||||
*/
|
*/
|
||||||
create or replace procedure createHsOfficeMembershipTestData( forPartnerTradeName varchar, forMainDebitorNumber numeric )
|
create or replace procedure createHsOfficeMembershipTestData(
|
||||||
|
forPartnerTradeName varchar,
|
||||||
|
forMainDebitorNumberSuffix numeric,
|
||||||
|
newMemberNumberSuffix char(2) )
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
currentTask varchar;
|
currentTask varchar;
|
||||||
idName varchar;
|
idName varchar;
|
||||||
relatedPartner hs_office_partner;
|
relatedPartner hs_office_partner;
|
||||||
relatedDebitor hs_office_debitor;
|
relatedDebitor hs_office_debitor;
|
||||||
newMemberNumberSuffix numeric;
|
|
||||||
begin
|
begin
|
||||||
idName := cleanIdentifier( forPartnerTradeName || '#' || forMainDebitorNumber);
|
idName := cleanIdentifier( forPartnerTradeName || '#' || forMainDebitorNumberSuffix);
|
||||||
currentTask := 'creating Membership test-data ' || idName;
|
currentTask := 'creating Membership test-data ' || idName;
|
||||||
call defineContext(currentTask, null, 'superuser-alex@hostsharing.net', 'global#global.admin');
|
call defineContext(currentTask, null, 'superuser-alex@hostsharing.net', 'global#global.admin');
|
||||||
execute format('set local hsadminng.currentTask to %L', currentTask);
|
execute format('set local hsadminng.currentTask to %L', currentTask);
|
||||||
@ -25,8 +27,10 @@ begin
|
|||||||
select partner.* from hs_office_partner partner
|
select partner.* from hs_office_partner partner
|
||||||
join hs_office_person person on person.uuid = partner.personUuid
|
join hs_office_person person on person.uuid = partner.personUuid
|
||||||
where person.tradeName = forPartnerTradeName into relatedPartner;
|
where person.tradeName = forPartnerTradeName into relatedPartner;
|
||||||
select d.* from hs_office_debitor d where d.debitorNumberSuffix = forMainDebitorNumber into relatedDebitor;
|
select d.* from hs_office_debitor d
|
||||||
select coalesce(max(memberNumberSuffix)+1, 10001) from hs_office_membership into newMemberNumberSuffix;
|
where d.partneruuid = relatedPartner.uuid
|
||||||
|
and d.debitorNumberSuffix = forMainDebitorNumberSuffix
|
||||||
|
into relatedDebitor;
|
||||||
|
|
||||||
raise notice 'creating test Membership: %', idName;
|
raise notice 'creating test Membership: %', idName;
|
||||||
raise notice '- using partner (%): %', relatedPartner.uuid, relatedPartner;
|
raise notice '- using partner (%): %', relatedPartner.uuid, relatedPartner;
|
||||||
@ -44,9 +48,9 @@ end; $$;
|
|||||||
|
|
||||||
do language plpgsql $$
|
do language plpgsql $$
|
||||||
begin
|
begin
|
||||||
call createHsOfficeMembershipTestData('First GmbH', 11);
|
call createHsOfficeMembershipTestData('First GmbH', 11, '01');
|
||||||
call createHsOfficeMembershipTestData('Second e.K.', 12);
|
call createHsOfficeMembershipTestData('Second e.K.', 12, '02');
|
||||||
call createHsOfficeMembershipTestData('Third OHG', 13);
|
call createHsOfficeMembershipTestData('Third OHG', 13, '03');
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
--//
|
--//
|
||||||
|
@ -8,25 +8,33 @@
|
|||||||
/*
|
/*
|
||||||
Creates a single coopSharesTransaction test record.
|
Creates a single coopSharesTransaction test record.
|
||||||
*/
|
*/
|
||||||
create or replace procedure createHsOfficeCoopSharesTransactionTestData(givenMembershipNumber numeric)
|
create or replace procedure createHsOfficeCoopSharesTransactionTestData(
|
||||||
|
givenPartnerNumber numeric,
|
||||||
|
givenMemberNumberSuffix varchar -- TODO char(2)?
|
||||||
|
)
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
currentTask varchar;
|
currentTask varchar;
|
||||||
membership hs_office_membership;
|
membership hs_office_membership;
|
||||||
begin
|
begin
|
||||||
currentTask = 'creating coopSharesTransaction test-data ' || givenMembershipNumber;
|
currentTask = 'creating coopSharesTransaction test-data ' || givenPartnerNumber::text || givenMemberNumberSuffix;
|
||||||
execute format('set local hsadminng.currentTask to %L', currentTask);
|
execute format('set local hsadminng.currentTask to %L', currentTask);
|
||||||
|
|
||||||
call defineContext(currentTask);
|
call defineContext(currentTask);
|
||||||
select m.uuid from hs_office_membership m where m.memberNumberSuffix = givenMembershipNumber into membership;
|
select m.uuid
|
||||||
|
from hs_office_membership m
|
||||||
|
join hs_office_partner p on p.uuid = m.partneruuid
|
||||||
|
where p.partnerNumber = givenPartnerNumber
|
||||||
|
and m.memberNumberSuffix = givenMemberNumberSuffix
|
||||||
|
into membership;
|
||||||
|
|
||||||
raise notice 'creating test coopSharesTransaction: %', givenMembershipNumber;
|
raise notice 'creating test coopSharesTransaction: %', givenPartnerNumber::text || givenMemberNumberSuffix;
|
||||||
insert
|
insert
|
||||||
into hs_office_coopsharestransaction(uuid, membershipuuid, transactiontype, valuedate, sharecount, reference, comment)
|
into hs_office_coopsharestransaction(uuid, membershipuuid, transactiontype, valuedate, sharecount, reference, comment)
|
||||||
values
|
values
|
||||||
(uuid_generate_v4(), membership.uuid, 'SUBSCRIPTION', '2010-03-15', 4, 'ref '||givenMembershipNumber||'-1', 'initial subscription'),
|
(uuid_generate_v4(), membership.uuid, 'SUBSCRIPTION', '2010-03-15', 4, 'ref '||givenPartnerNumber::text || givenMemberNumberSuffix||'-1', 'initial subscription'),
|
||||||
(uuid_generate_v4(), membership.uuid, 'CANCELLATION', '2021-09-01', -2, 'ref '||givenMembershipNumber||'-2', 'cancelling some'),
|
(uuid_generate_v4(), membership.uuid, 'CANCELLATION', '2021-09-01', -2, 'ref '||givenPartnerNumber::text || givenMemberNumberSuffix||'-2', 'cancelling some'),
|
||||||
(uuid_generate_v4(), membership.uuid, 'ADJUSTMENT', '2022-10-20', 2, 'ref '||givenMembershipNumber||'-3', 'some adjustment');
|
(uuid_generate_v4(), membership.uuid, 'ADJUSTMENT', '2022-10-20', 2, 'ref '||givenPartnerNumber::text || givenMemberNumberSuffix||'-3', 'some adjustment');
|
||||||
end; $$;
|
end; $$;
|
||||||
--//
|
--//
|
||||||
|
|
||||||
@ -37,8 +45,8 @@ end; $$;
|
|||||||
|
|
||||||
do language plpgsql $$
|
do language plpgsql $$
|
||||||
begin
|
begin
|
||||||
call createHsOfficeCoopSharesTransactionTestData(10001);
|
call createHsOfficeCoopSharesTransactionTestData(10001, '01');
|
||||||
call createHsOfficeCoopSharesTransactionTestData(10002);
|
call createHsOfficeCoopSharesTransactionTestData(10002, '02');
|
||||||
call createHsOfficeCoopSharesTransactionTestData(10003);
|
call createHsOfficeCoopSharesTransactionTestData(10003, '03');
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
|
@ -8,25 +8,33 @@
|
|||||||
/*
|
/*
|
||||||
Creates a single coopAssetsTransaction test record.
|
Creates a single coopAssetsTransaction test record.
|
||||||
*/
|
*/
|
||||||
create or replace procedure createHsOfficeCoopAssetsTransactionTestData(givenMembershipNumber numeric)
|
create or replace procedure createHsOfficeCoopAssetsTransactionTestData(
|
||||||
|
givenPartnerNumber numeric,
|
||||||
|
givenMemberNumberSuffix char(2)
|
||||||
|
)
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
currentTask varchar;
|
currentTask varchar;
|
||||||
membership hs_office_membership;
|
membership hs_office_membership;
|
||||||
begin
|
begin
|
||||||
currentTask = 'creating coopAssetsTransaction test-data ' || givenMembershipNumber;
|
currentTask = 'creating coopAssetsTransaction test-data ' || givenPartnerNumber || givenMemberNumberSuffix;
|
||||||
execute format('set local hsadminng.currentTask to %L', currentTask);
|
execute format('set local hsadminng.currentTask to %L', currentTask);
|
||||||
|
|
||||||
call defineContext(currentTask);
|
call defineContext(currentTask);
|
||||||
select m.uuid from hs_office_membership m where m.memberNumberSuffix = givenMembershipNumber into membership;
|
select m.uuid
|
||||||
|
from hs_office_membership m
|
||||||
|
join hs_office_partner p on p.uuid = m.partneruuid
|
||||||
|
where p.partnerNumber = givenPartnerNumber
|
||||||
|
and m.memberNumberSuffix = givenMemberNumberSuffix
|
||||||
|
into membership;
|
||||||
|
|
||||||
raise notice 'creating test coopAssetsTransaction: %', givenMembershipNumber;
|
raise notice 'creating test coopAssetsTransaction: %', givenPartnerNumber || givenMemberNumberSuffix;
|
||||||
insert
|
insert
|
||||||
into hs_office_coopassetstransaction(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment)
|
into hs_office_coopassetstransaction(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment)
|
||||||
values
|
values
|
||||||
(uuid_generate_v4(), membership.uuid, 'DEPOSIT', '2010-03-15', 320.00, 'ref '||givenMembershipNumber||'-1', 'initial deposit'),
|
(uuid_generate_v4(), membership.uuid, 'DEPOSIT', '2010-03-15', 320.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-1', 'initial deposit'),
|
||||||
(uuid_generate_v4(), membership.uuid, 'DISBURSAL', '2021-09-01', -128.00, 'ref '||givenMembershipNumber||'-2', 'partial disbursal'),
|
(uuid_generate_v4(), membership.uuid, 'DISBURSAL', '2021-09-01', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-2', 'partial disbursal'),
|
||||||
(uuid_generate_v4(), membership.uuid, 'ADJUSTMENT', '2022-10-20', 128.00, 'ref '||givenMembershipNumber||'-3', 'some adjustment');
|
(uuid_generate_v4(), membership.uuid, 'ADJUSTMENT', '2022-10-20', 128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some adjustment');
|
||||||
end; $$;
|
end; $$;
|
||||||
--//
|
--//
|
||||||
|
|
||||||
@ -37,8 +45,8 @@ end; $$;
|
|||||||
|
|
||||||
do language plpgsql $$
|
do language plpgsql $$
|
||||||
begin
|
begin
|
||||||
call createHsOfficeCoopAssetsTransactionTestData(10001);
|
call createHsOfficeCoopAssetsTransactionTestData(10001, '01');
|
||||||
call createHsOfficeCoopAssetsTransactionTestData(10002);
|
call createHsOfficeCoopAssetsTransactionTestData(10002, '02');
|
||||||
call createHsOfficeCoopAssetsTransactionTestData(10003);
|
call createHsOfficeCoopAssetsTransactionTestData(10003, '03');
|
||||||
end;
|
end;
|
||||||
$$;
|
$$;
|
||||||
|
@ -75,7 +75,7 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest {
|
|||||||
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumberSuffix() {
|
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumberSuffix() {
|
||||||
hsh-michaelhoennig marked this conversation as resolved
Outdated
hsh-michaelhoennig
commented
ohne "Suffix" im Namen ohne "Suffix" im Namen
|
|||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000202)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
@ -118,7 +118,7 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest {
|
|||||||
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumberSuffixAndDateRange() {
|
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumberSuffixAndDateRange() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000202)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
@ -153,7 +153,7 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest {
|
|||||||
void globalAdmin_canAddCoopAssetsTransaction() {
|
void globalAdmin_canAddCoopAssetsTransaction() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000101)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
final var location = RestAssured // @formatter:off
|
final var location = RestAssured // @formatter:off
|
||||||
@ -199,7 +199,7 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest {
|
|||||||
void globalAdmin_canNotCancelMoreAssetsThanCurrentlySubscribed() {
|
void globalAdmin_canNotCancelMoreAssetsThanCurrentlySubscribed() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000101)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
final var location = RestAssured // @formatter:off
|
final var location = RestAssured // @formatter:off
|
||||||
|
@ -62,7 +62,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
final var count = coopAssetsTransactionRepo.count();
|
final var count = coopAssetsTransactionRepo.count();
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000101)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
@ -96,9 +96,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
|
|
||||||
// when
|
// when
|
||||||
attempt(em, () -> {
|
attempt(em, () -> {
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000101).get(0);
|
||||||
null,
|
|
||||||
10001).get(0);
|
|
||||||
final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
|
final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
|
||||||
.membership(givenMembership)
|
.membership(givenMembership)
|
||||||
.transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT)
|
.transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT)
|
||||||
@ -161,8 +159,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
public void globalAdmin_canViewCoopAssetsTransactions_filteredByMembershipUuid() {
|
public void globalAdmin_canViewCoopAssetsTransactions_filteredByMembershipUuid() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(null).get(1000202);
|
||||||
.get(0);
|
|
||||||
|
|
||||||
// when
|
// when
|
||||||
final var result = coopAssetsTransactionRepo.findCoopAssetsTransactionByOptionalMembershipUuidAndDateRange(
|
final var result = coopAssetsTransactionRepo.findCoopAssetsTransactionByOptionalMembershipUuidAndDateRange(
|
||||||
@ -182,7 +179,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
public void globalAdmin_canViewCoopAssetsTransactions_filteredByMembershipUuidAndValueDateRange() {
|
public void globalAdmin_canViewCoopAssetsTransactions_filteredByMembershipUuidAndValueDateRange() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000202)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
@ -75,7 +75,7 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest {
|
|||||||
void globalAdmin_canFindCoopSharesTransactionsByMemberNumberSuffix() {
|
void globalAdmin_canFindCoopSharesTransactionsByMemberNumberSuffix() {
|
||||||
hsh-michaelhoennig marked this conversation as resolved
Outdated
hsh-michaelhoennig
commented
ohne "Suffix" im Namen ohne "Suffix" im Namen
|
|||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002).get(0);
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000202).get(0);
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
.given().header("current-user", "superuser-alex@hostsharing.net").port(port).when().get("http://localhost/api/hs/office/coopsharestransactions?membershipUuid=" + givenMembership.getUuid()).then().log().all().assertThat().statusCode(200).contentType("application/json").body("", lenientlyEquals("""
|
.given().header("current-user", "superuser-alex@hostsharing.net").port(port).when().get("http://localhost/api/hs/office/coopsharestransactions?membershipUuid=" + givenMembership.getUuid()).then().log().all().assertThat().statusCode(200).contentType("application/json").body("", lenientlyEquals("""
|
||||||
@ -109,7 +109,7 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest {
|
|||||||
void globalAdmin_canFindCoopSharesTransactionsByMemberNumberSuffixAndDateRange() {
|
void globalAdmin_canFindCoopSharesTransactionsByMemberNumberSuffixAndDateRange() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002).get(0);
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000202).get(0);
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
.given().header("current-user", "superuser-alex@hostsharing.net").port(port).when().get("http://localhost/api/hs/office/coopsharestransactions?membershipUuid=" + givenMembership.getUuid() + "&fromValueDate=2020-01-01&toValueDate=2021-12-31").then().log().all().assertThat().statusCode(200).contentType("application/json").body("", lenientlyEquals("""
|
.given().header("current-user", "superuser-alex@hostsharing.net").port(port).when().get("http://localhost/api/hs/office/coopsharestransactions?membershipUuid=" + givenMembership.getUuid() + "&fromValueDate=2020-01-01&toValueDate=2021-12-31").then().log().all().assertThat().statusCode(200).contentType("application/json").body("", lenientlyEquals("""
|
||||||
@ -134,7 +134,7 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest {
|
|||||||
void globalAdmin_canAddCoopSharesTransaction() {
|
void globalAdmin_canAddCoopSharesTransaction() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001).get(0);
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000101).get(0);
|
||||||
|
|
||||||
final var location = RestAssured // @formatter:off
|
final var location = RestAssured // @formatter:off
|
||||||
.given().header("current-user", "superuser-alex@hostsharing.net").contentType(ContentType.JSON).body("""
|
.given().header("current-user", "superuser-alex@hostsharing.net").contentType(ContentType.JSON).body("""
|
||||||
@ -165,7 +165,7 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest {
|
|||||||
void globalAdmin_canNotCancelMoreSharesThanCurrentlySubscribed() {
|
void globalAdmin_canNotCancelMoreSharesThanCurrentlySubscribed() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001).get(0);
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000101).get(0);
|
||||||
|
|
||||||
final var location = RestAssured // @formatter:off
|
final var location = RestAssured // @formatter:off
|
||||||
.given().header("current-user", "superuser-alex@hostsharing.net").contentType(ContentType.JSON).body("""
|
.given().header("current-user", "superuser-alex@hostsharing.net").contentType(ContentType.JSON).body("""
|
||||||
|
@ -61,7 +61,7 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
final var count = coopSharesTransactionRepo.count();
|
final var count = coopSharesTransactionRepo.count();
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000101)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
@ -95,9 +95,8 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
|
|
||||||
// when
|
// when
|
||||||
attempt(em, () -> {
|
attempt(em, () -> {
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000101)
|
||||||
null,
|
.get(0);
|
||||||
10001).get(0);
|
|
||||||
final var newCoopSharesTransaction = HsOfficeCoopSharesTransactionEntity.builder()
|
final var newCoopSharesTransaction = HsOfficeCoopSharesTransactionEntity.builder()
|
||||||
.membership(givenMembership)
|
.membership(givenMembership)
|
||||||
.transactionType(HsOfficeCoopSharesTransactionType.SUBSCRIPTION)
|
.transactionType(HsOfficeCoopSharesTransactionType.SUBSCRIPTION)
|
||||||
@ -160,7 +159,7 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
public void globalAdmin_canViewCoopSharesTransactions_filteredByMembershipUuid() {
|
public void globalAdmin_canViewCoopSharesTransactions_filteredByMembershipUuid() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000202)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
@ -181,7 +180,7 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
public void globalAdmin_canViewCoopSharesTransactions_filteredByMembershipUuidAndValueDateRange() {
|
public void globalAdmin_canViewCoopSharesTransactions_filteredByMembershipUuidAndValueDateRange() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByMemberNumber(1000202)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
@ -61,7 +61,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
EntityManager em;
|
EntityManager em;
|
||||||
|
|
||||||
private static int tempMemberNumberSuffix = 20010;
|
private static int tempMemberNumberSuffix = 10;
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@Accepts({ "Membership:F(Find)" })
|
@Accepts({ "Membership:F(Find)" })
|
||||||
@ -166,9 +166,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
@Test
|
@Test
|
||||||
void globalAdmin_canGetArbitraryMembership() {
|
void globalAdmin_canGetArbitraryMembership() {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembershipUuid = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
final var givenMembershipUuid = membershipRepo.findMembershipsByMemberNumber(1000101)
|
||||||
null,
|
|
||||||
10001)
|
|
||||||
.get(0)
|
.get(0)
|
||||||
.getUuid();
|
.getUuid();
|
||||||
|
|
||||||
@ -197,9 +195,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
@Accepts({ "Membership:X(Access Control)" })
|
@Accepts({ "Membership:X(Access Control)" })
|
||||||
void normalUser_canNotGetUnrelatedMembership() {
|
void normalUser_canNotGetUnrelatedMembership() {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembershipUuid = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
final var givenMembershipUuid = membershipRepo.findMembershipsByMemberNumber(1000101)
|
||||||
null,
|
|
||||||
10001)
|
|
||||||
.get(0)
|
.get(0)
|
||||||
.getUuid();
|
.getUuid();
|
||||||
|
|
||||||
@ -217,9 +213,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
@Accepts({ "Membership:X(Access Control)" })
|
@Accepts({ "Membership:X(Access Control)" })
|
||||||
void debitorAgentUser_canGetRelatedMembership() {
|
void debitorAgentUser_canGetRelatedMembership() {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembershipUuid = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
final var givenMembershipUuid = membershipRepo.findMembershipsByMemberNumber(1000303)
|
||||||
null,
|
|
||||||
10003)
|
|
||||||
.get(0)
|
.get(0)
|
||||||
.getUuid();
|
.getUuid();
|
||||||
|
|
||||||
@ -444,7 +438,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
.uuid(UUID.randomUUID())
|
.uuid(UUID.randomUUID())
|
||||||
.partner(givenPartner)
|
.partner(givenPartner)
|
||||||
.mainDebitor(givenDebitor)
|
.mainDebitor(givenDebitor)
|
||||||
.memberNumberSuffix(++tempMemberNumberSuffix)
|
.memberNumberSuffix(toPaddedSuffix(++tempMemberNumberSuffix))
|
||||||
.validity(Range.closedInfinite(LocalDate.parse("2022-11-01")))
|
.validity(Range.closedInfinite(LocalDate.parse("2022-11-01")))
|
||||||
.reasonForTermination(NONE)
|
.reasonForTermination(NONE)
|
||||||
.membershipFeeBillable(true)
|
.membershipFeeBillable(true)
|
||||||
@ -454,12 +448,16 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
}).assertSuccessful().returnedValue();
|
}).assertSuccessful().returnedValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String toPaddedSuffix(final int numericSuffix) {
|
||||||
|
return String.format("%02d", numericSuffix);
|
||||||
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
jpaAttempt.transacted(() -> {
|
jpaAttempt.transacted(() -> {
|
||||||
context.define("superuser-alex@hostsharing.net", null);
|
context.define("superuser-alex@hostsharing.net", null);
|
||||||
final var query = em.createQuery("DELETE FROM HsOfficeMembershipEntity m WHERE m.memberNumberSuffix >= 20000");
|
final var query = em.createQuery("DELETE FROM HsOfficeMembershipEntity m WHERE m.memberNumberSuffix >= '20'");
|
||||||
query.executeUpdate();
|
query.executeUpdate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class HsOfficeMembershipEntityUnitTest {
|
|||||||
public static final LocalDate GIVEN_VALID_FROM = LocalDate.parse("2020-01-01");
|
public static final LocalDate GIVEN_VALID_FROM = LocalDate.parse("2020-01-01");
|
||||||
|
|
||||||
final HsOfficeMembershipEntity givenMembership = HsOfficeMembershipEntity.builder()
|
final HsOfficeMembershipEntity givenMembership = HsOfficeMembershipEntity.builder()
|
||||||
.memberNumberSuffix(10001)
|
.memberNumberSuffix("01")
|
||||||
.partner(TEST_PARTNER)
|
.partner(TEST_PARTNER)
|
||||||
.mainDebitor(TEST_DEBITOR)
|
.mainDebitor(TEST_DEBITOR)
|
||||||
.validity(Range.closedInfinite(GIVEN_VALID_FROM))
|
.validity(Range.closedInfinite(GIVEN_VALID_FROM))
|
||||||
@ -27,14 +27,14 @@ class HsOfficeMembershipEntityUnitTest {
|
|||||||
void toStringContainsAllProps() {
|
void toStringContainsAllProps() {
|
||||||
final var result = givenMembership.toString();
|
final var result = givenMembership.toString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("Membership(10001, LEGAL Test Ltd., 1000100, [2020-01-01,))");
|
assertThat(result).isEqualTo("Membership(1000101, LEGAL Test Ltd., 1000100, [2020-01-01,))");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toShortStringContainsMemberNumberSuffixOnly() {
|
void toShortStringContainsMemberNumberSuffixOnly() {
|
||||||
final var result = givenMembership.toShortString();
|
final var result = givenMembership.toShortString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("10001");
|
assertThat(result).isEqualTo("1000101");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -77,7 +77,7 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
// when
|
// when
|
||||||
final var result = attempt(em, () -> {
|
final var result = attempt(em, () -> {
|
||||||
final var newMembership = toCleanup(HsOfficeMembershipEntity.builder()
|
final var newMembership = toCleanup(HsOfficeMembershipEntity.builder()
|
||||||
.memberNumberSuffix(20001)
|
.memberNumberSuffix("01")
|
||||||
.partner(givenPartner)
|
.partner(givenPartner)
|
||||||
.mainDebitor(givenDebitor)
|
.mainDebitor(givenDebitor)
|
||||||
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
||||||
@ -108,7 +108,7 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("First").get(0);
|
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("First").get(0);
|
||||||
final var givenDebitor = debitorRepo.findDebitorByOptionalNameLike("First").get(0);
|
final var givenDebitor = debitorRepo.findDebitorByOptionalNameLike("First").get(0);
|
||||||
final var newMembership = toCleanup(HsOfficeMembershipEntity.builder()
|
final var newMembership = toCleanup(HsOfficeMembershipEntity.builder()
|
||||||
.memberNumberSuffix(20002)
|
.memberNumberSuffix("02")
|
||||||
.partner(givenPartner)
|
.partner(givenPartner)
|
||||||
.mainDebitor(givenDebitor)
|
.mainDebitor(givenDebitor)
|
||||||
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
||||||
@ -179,7 +179,7 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
|
|
||||||
// when
|
// when
|
||||||
final var result = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, null);
|
final var result = membershipRepo.findMembershipsByOptionalPartherNumber(null);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
exactlyTheseMembershipsAreReturned(
|
exactlyTheseMembershipsAreReturned(
|
||||||
@ -196,21 +196,19 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("First").get(0);
|
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike("First").get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
final var result = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
final var result = membershipRepo.findMembershipsByOptionalPartherNumber(givenPartner.getUuid());
|
||||||
givenPartner.getUuid(),
|
|
||||||
null);
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
exactlyTheseMembershipsAreReturned(result, "Membership(10001, LEGAL First GmbH, 1000111, [2022-10-01,), NONE)");
|
exactlyTheseMembershipsAreReturned(result, "Membership(10001, LEGAL First GmbH, 1000111, [2022-10-01,), NONE)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void globalAdmin_withoutAssumedRole_canFindAllMembershipByMemberNumberSuffix() {
|
public void globalAdmin_withoutAssumedRole_canFindAllMemberships() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
|
|
||||||
// when
|
// when
|
||||||
final var result = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002);
|
final var result = membershipRepo.findMembershipsByOptionalPartherNumber(null);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
exactlyTheseMembershipsAreReturned(result, "Membership(10002, LEGAL Second e.K., 1000212, [2022-10-01,), NONE)");
|
exactlyTheseMembershipsAreReturned(result, "Membership(10002, LEGAL Second e.K., 1000212, [2022-10-01,), NONE)");
|
||||||
@ -401,7 +399,7 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
});
|
});
|
||||||
jpaAttempt.transacted(() -> {
|
jpaAttempt.transacted(() -> {
|
||||||
context("superuser-alex@hostsharing.net", null);
|
context("superuser-alex@hostsharing.net", null);
|
||||||
em.createQuery("DELETE FROM HsOfficeMembershipEntity WHERE memberNumberSuffix >= 20000");
|
em.createQuery("DELETE FROM HsOfficeMembershipEntity WHERE memberNumberSuffix >= '20'");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +409,7 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike(partnerTradeName).get(0);
|
final var givenPartner = partnerRepo.findPartnerByOptionalNameLike(partnerTradeName).get(0);
|
||||||
final var givenDebitor = debitorRepo.findDebitorByOptionalNameLike(debitorName).get(0);
|
final var givenDebitor = debitorRepo.findDebitorByOptionalNameLike(debitorName).get(0);
|
||||||
final var newMembership = HsOfficeMembershipEntity.builder()
|
final var newMembership = HsOfficeMembershipEntity.builder()
|
||||||
.memberNumberSuffix(20002)
|
.memberNumberSuffix("02")
|
||||||
.partner(givenPartner)
|
.partner(givenPartner)
|
||||||
.mainDebitor(givenDebitor)
|
.mainDebitor(givenDebitor)
|
||||||
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
||||||
|
@ -11,7 +11,7 @@ public class TestHsMembership {
|
|||||||
public static final HsOfficeMembershipEntity TEST_MEMBERSHIP =
|
public static final HsOfficeMembershipEntity TEST_MEMBERSHIP =
|
||||||
HsOfficeMembershipEntity.builder()
|
HsOfficeMembershipEntity.builder()
|
||||||
.partner(TEST_PARTNER)
|
.partner(TEST_PARTNER)
|
||||||
.memberNumberSuffix(300001)
|
.memberNumberSuffix("01")
|
||||||
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -573,9 +573,10 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
partners.put(rec.getInteger("bp_id"), partner);
|
partners.put(rec.getInteger("bp_id"), partner);
|
||||||
|
|
||||||
if (isNotBlank(rec.getString("member_since"))) {
|
if (isNotBlank(rec.getString("member_since"))) {
|
||||||
|
assertThat(rec.getInteger("member_id")).isEqualTo(partner.getPartnerNumber());
|
||||||
final var membership = HsOfficeMembershipEntity.builder()
|
final var membership = HsOfficeMembershipEntity.builder()
|
||||||
.partner(partner)
|
.partner(partner)
|
||||||
.memberNumberSuffix(rec.getInteger("member_id"))
|
.memberNumberSuffix("00")
|
||||||
.validity(toPostgresDateRange(
|
.validity(toPostgresDateRange(
|
||||||
rec.getLocalDate("member_since"),
|
rec.getLocalDate("member_since"),
|
||||||
rec.getLocalDate("member_until")))
|
rec.getLocalDate("member_until")))
|
||||||
@ -612,7 +613,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
: HsOfficeCoopSharesTransactionType.ADJUSTMENT
|
: HsOfficeCoopSharesTransactionType.ADJUSTMENT
|
||||||
)
|
)
|
||||||
.shareCount(rec.getInteger("quantity"))
|
.shareCount(rec.getInteger("quantity"))
|
||||||
.reference(rec.getString("comment"))
|
.comment( rec.getString("comment"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
coopShares.put(rec.getInteger("member_share_id"), shareTransaction);
|
coopShares.put(rec.getInteger("member_share_id"), shareTransaction);
|
||||||
@ -655,7 +656,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
.valueDate(rec.getLocalDate("date"))
|
.valueDate(rec.getLocalDate("date"))
|
||||||
.transactionType(assetTypeMapping.get(rec.getString("action")))
|
.transactionType(assetTypeMapping.get(rec.getString("action")))
|
||||||
.assetValue(rec.getBigDecimal("amount"))
|
.assetValue(rec.getBigDecimal("amount"))
|
||||||
.reference(rec.getString("comment"))
|
.comment(rec.getString("comment"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
coopAssets.put(rec.getInteger("member_asset_id"), assetTransaction);
|
coopAssets.put(rec.getInteger("member_asset_id"), assetTransaction);
|
||||||
|
Loading…
Reference in New Issue
Block a user
add unique constraint mit partnerNumber