memberNumber as partnerNumber+memberNumberSuffix #13
@ -27,7 +27,7 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
|||||||
public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, HasUuid {
|
public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, HasUuid {
|
||||||
|
|
||||||
private static Stringify<HsOfficeCoopAssetsTransactionEntity> stringify = stringify(HsOfficeCoopAssetsTransactionEntity.class)
|
private static Stringify<HsOfficeCoopAssetsTransactionEntity> stringify = stringify(HsOfficeCoopAssetsTransactionEntity.class)
|
||||||
.withProp(e -> e.getMembership().getMemberNumber())
|
.withProp(e -> e.getMembership().getMemberNumberSuffix())
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getValueDate)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getValueDate)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getTransactionType)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getTransactionType)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue)
|
||||||
@ -67,6 +67,6 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, HasUu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toShortString() {
|
public String toShortString() {
|
||||||
return membership.getMemberNumber() + new DecimalFormat("+0.00").format(assetValue);
|
return membership.getMemberNumberSuffix() + new DecimalFormat("+0.00").format(assetValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public interface HsOfficeCoopAssetsTransactionRepository extends Repository<HsOf
|
|||||||
WHERE ( CAST(:membershipUuid AS org.hibernate.type.UUIDCharType) IS NULL OR at.membership.uuid = :membershipUuid)
|
WHERE ( CAST(:membershipUuid AS org.hibernate.type.UUIDCharType) IS NULL OR at.membership.uuid = :membershipUuid)
|
||||||
AND ( CAST(:fromValueDate AS java.time.LocalDate) IS NULL OR (at.valueDate >= :fromValueDate))
|
AND ( CAST(:fromValueDate AS java.time.LocalDate) IS NULL OR (at.valueDate >= :fromValueDate))
|
||||||
AND ( CAST(:toValueDate AS java.time.LocalDate)IS NULL OR (at.valueDate <= :toValueDate))
|
AND ( CAST(:toValueDate AS java.time.LocalDate)IS NULL OR (at.valueDate <= :toValueDate))
|
||||||
ORDER BY at.membership.memberNumber, at.valueDate
|
ORDER BY at.membership.memberNumberSuffix, at.valueDate
|
||||||
""")
|
""")
|
||||||
List<HsOfficeCoopAssetsTransactionEntity> findCoopAssetsTransactionByOptionalMembershipUuidAndDateRange(
|
List<HsOfficeCoopAssetsTransactionEntity> findCoopAssetsTransactionByOptionalMembershipUuidAndDateRange(
|
||||||
UUID membershipUuid, LocalDate fromValueDate, LocalDate toValueDate);
|
UUID membershipUuid, LocalDate fromValueDate, LocalDate toValueDate);
|
||||||
|
@ -24,7 +24,7 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
|||||||
public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUuid {
|
public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUuid {
|
||||||
|
|
||||||
private static Stringify<HsOfficeCoopSharesTransactionEntity> stringify = stringify(HsOfficeCoopSharesTransactionEntity.class)
|
private static Stringify<HsOfficeCoopSharesTransactionEntity> stringify = stringify(HsOfficeCoopSharesTransactionEntity.class)
|
||||||
.withProp(e -> e.getMembership().getMemberNumber())
|
.withProp(e -> e.getMembership().getMemberNumberSuffix())
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getValueDate)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getValueDate)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getTransactionType)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getTransactionType)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getShareCount)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getShareCount)
|
||||||
@ -63,6 +63,6 @@ public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toShortString() {
|
public String toShortString() {
|
||||||
return "%s%+d".formatted(membership.getMemberNumber(), shareCount);
|
return "%s%+d".formatted(membership.getMemberNumberSuffix(), shareCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public interface HsOfficeCoopSharesTransactionRepository extends Repository<HsOf
|
|||||||
WHERE ( CAST(:membershipUuid AS org.hibernate.type.UUIDCharType) IS NULL OR st.membership.uuid = :membershipUuid)
|
WHERE ( CAST(:membershipUuid AS org.hibernate.type.UUIDCharType) IS NULL OR st.membership.uuid = :membershipUuid)
|
||||||
AND ( CAST(:fromValueDate AS java.time.LocalDate) IS NULL OR (st.valueDate >= :fromValueDate))
|
AND ( CAST(:fromValueDate AS java.time.LocalDate) IS NULL OR (st.valueDate >= :fromValueDate))
|
||||||
AND ( CAST(:toValueDate AS java.time.LocalDate)IS NULL OR (st.valueDate <= :toValueDate))
|
AND ( CAST(:toValueDate AS java.time.LocalDate)IS NULL OR (st.valueDate <= :toValueDate))
|
||||||
ORDER BY st.membership.memberNumber, st.valueDate
|
ORDER BY st.membership.memberNumberSuffix, st.valueDate
|
||||||
""")
|
""")
|
||||||
List<HsOfficeCoopSharesTransactionEntity> findCoopSharesTransactionByOptionalMembershipUuidAndDateRange(
|
List<HsOfficeCoopSharesTransactionEntity> findCoopSharesTransactionByOptionalMembershipUuidAndDateRange(
|
||||||
UUID membershipUuid, LocalDate fromValueDate, LocalDate toValueDate);
|
UUID membershipUuid, LocalDate fromValueDate, LocalDate toValueDate);
|
||||||
|
@ -41,11 +41,11 @@ public class HsOfficeMembershipController implements HsOfficeMembershipsApi {
|
|||||||
final String currentUser,
|
final String currentUser,
|
||||||
final String assumedRoles,
|
final String assumedRoles,
|
||||||
UUID partnerUuid,
|
UUID partnerUuid,
|
||||||
Integer memberNumber) {
|
Integer memberNumberSuffix) {
|
||||||
context.define(currentUser, assumedRoles);
|
context.define(currentUser, assumedRoles);
|
||||||
|
|
||||||
final var entities =
|
final var entities =
|
||||||
membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(partnerUuid, memberNumber);
|
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::getMemberNumber)
|
.withProp(HsOfficeMembershipEntity::getMemberNumberSuffix)
|
||||||
.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 = "membernumber")
|
@Column(name = "membernumbersuffix")
|
||||||
private int memberNumber; // TODO: migrate to suffix, like debitorNumberSuffix
|
private int 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(memberNumber);
|
return String.valueOf(memberNumberSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PrePersist
|
@PrePersist
|
||||||
|
@ -13,12 +13,12 @@ public interface HsOfficeMembershipRepository extends Repository<HsOfficeMembers
|
|||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT membership FROM HsOfficeMembershipEntity membership
|
SELECT membership FROM HsOfficeMembershipEntity membership
|
||||||
WHERE (:memberNumber is null OR membership.memberNumber = :memberNumber)
|
WHERE (:memberNumberSuffix is null OR membership.memberNumberSuffix = :memberNumberSuffix)
|
||||||
AND ( 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.memberNumber
|
ORDER BY membership.memberNumberSuffix
|
||||||
""")
|
""")
|
||||||
List<HsOfficeMembershipEntity> findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(UUID partnerUuid, Integer memberNumber);
|
List<HsOfficeMembershipEntity> findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(UUID partnerUuid, Integer memberNumberSuffix);
|
||||||
|
|
||||||
HsOfficeMembershipEntity save(final HsOfficeMembershipEntity entity);
|
HsOfficeMembershipEntity save(final HsOfficeMembershipEntity entity);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ components:
|
|||||||
$ref: './hs-office-partner-schemas.yaml#/components/schemas/HsOfficePartner'
|
$ref: './hs-office-partner-schemas.yaml#/components/schemas/HsOfficePartner'
|
||||||
mainDebitor:
|
mainDebitor:
|
||||||
$ref: './hs-office-debitor-schemas.yaml#/components/schemas/HsOfficeDebitor'
|
$ref: './hs-office-debitor-schemas.yaml#/components/schemas/HsOfficeDebitor'
|
||||||
memberNumber:
|
memberNumberSuffix:
|
||||||
type: integer
|
type: integer
|
||||||
validFrom:
|
validFrom:
|
||||||
type: string
|
type: string
|
||||||
@ -66,7 +66,7 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
nullable: false
|
nullable: false
|
||||||
memberNumber:
|
memberNumberSuffix:
|
||||||
type: integer
|
type: integer
|
||||||
nullable: false
|
nullable: false
|
||||||
validFrom:
|
validFrom:
|
||||||
|
@ -14,7 +14,7 @@ get:
|
|||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
description: UUID of the business partner.
|
description: UUID of the business partner.
|
||||||
- name: memberNumber
|
- name: memberNumberSuffix
|
||||||
in: query
|
in: query
|
||||||
required: false
|
required: false
|
||||||
schema:
|
schema:
|
||||||
|
@ -13,7 +13,7 @@ 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),
|
||||||
memberNumber numeric(5) not null unique,
|
memberNumberSuffix numeric(5) not null unique,
|
||||||
hsh-michaelhoennig marked this conversation as resolved
|
|||||||
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
|
||||||
|
@ -92,7 +92,7 @@ execute procedure hsOfficeMembershipRbacRolesTrigger();
|
|||||||
--changeset hs-office-membership-rbac-IDENTITY-VIEW:1 endDelimiter:--//
|
--changeset hs-office-membership-rbac-IDENTITY-VIEW:1 endDelimiter:--//
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
call generateRbacIdentityView('hs_office_membership', idNameExpression => $idName$
|
call generateRbacIdentityView('hs_office_membership', idNameExpression => $idName$
|
||||||
target.memberNumber ||
|
target.memberNumberSuffix ||
|
||||||
':' || (select split_part(idName, ':', 2) from hs_office_partner_iv p where p.uuid = target.partnerUuid)
|
':' || (select split_part(idName, ':', 2) from hs_office_partner_iv p where p.uuid = target.partnerUuid)
|
||||||
$idName$);
|
$idName$);
|
||||||
--//
|
--//
|
||||||
@ -102,7 +102,7 @@ call generateRbacIdentityView('hs_office_membership', idNameExpression => $idNam
|
|||||||
--changeset hs-office-membership-rbac-RESTRICTED-VIEW:1 endDelimiter:--//
|
--changeset hs-office-membership-rbac-RESTRICTED-VIEW:1 endDelimiter:--//
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
call generateRbacRestrictedView('hs_office_membership',
|
call generateRbacRestrictedView('hs_office_membership',
|
||||||
orderby => 'target.memberNumber',
|
orderby => 'target.memberNumberSuffix',
|
||||||
columnUpdates => $updates$
|
columnUpdates => $updates$
|
||||||
validity = new.validity,
|
validity = new.validity,
|
||||||
reasonForTermination = new.reasonForTermination,
|
reasonForTermination = new.reasonForTermination,
|
||||||
|
@ -15,7 +15,7 @@ declare
|
|||||||
idName varchar;
|
idName varchar;
|
||||||
relatedPartner hs_office_partner;
|
relatedPartner hs_office_partner;
|
||||||
relatedDebitor hs_office_debitor;
|
relatedDebitor hs_office_debitor;
|
||||||
newMemberNumber numeric;
|
newMemberNumberSuffix numeric;
|
||||||
begin
|
begin
|
||||||
idName := cleanIdentifier( forPartnerTradeName || '#' || forMainDebitorNumber);
|
idName := cleanIdentifier( forPartnerTradeName || '#' || forMainDebitorNumber);
|
||||||
currentTask := 'creating Membership test-data ' || idName;
|
currentTask := 'creating Membership test-data ' || idName;
|
||||||
@ -26,14 +26,14 @@ begin
|
|||||||
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 where d.debitorNumberSuffix = forMainDebitorNumber into relatedDebitor;
|
||||||
select coalesce(max(memberNumber)+1, 10001) from hs_office_membership into newMemberNumber;
|
select coalesce(max(memberNumberSuffix)+1, 10001) from hs_office_membership into newMemberNumberSuffix;
|
||||||
|
|
||||||
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;
|
||||||
raise notice '- using debitor (%): %', relatedDebitor.uuid, relatedDebitor;
|
raise notice '- using debitor (%): %', relatedDebitor.uuid, relatedDebitor;
|
||||||
insert
|
insert
|
||||||
into hs_office_membership (uuid, partneruuid, maindebitoruuid, membernumber, validity, reasonfortermination)
|
into hs_office_membership (uuid, partneruuid, maindebitoruuid, memberNumberSuffix, validity, reasonfortermination)
|
||||||
values (uuid_generate_v4(), relatedPartner.uuid, relatedDebitor.uuid, newMemberNumber, daterange('20221001' , null, '[]'), 'NONE');
|
values (uuid_generate_v4(), relatedPartner.uuid, relatedDebitor.uuid, newMemberNumberSuffix, daterange('20221001' , null, '[]'), 'NONE');
|
||||||
end; $$;
|
end; $$;
|
||||||
--//
|
--//
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ begin
|
|||||||
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.memberNumber = givenMembershipNumber into membership;
|
select m.uuid from hs_office_membership m where m.memberNumberSuffix = givenMembershipNumber into membership;
|
||||||
|
|
||||||
raise notice 'creating test coopSharesTransaction: %', givenMembershipNumber;
|
raise notice 'creating test coopSharesTransaction: %', givenMembershipNumber;
|
||||||
insert
|
insert
|
||||||
|
@ -18,7 +18,7 @@ begin
|
|||||||
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.memberNumber = givenMembershipNumber into membership;
|
select m.uuid from hs_office_membership m where m.memberNumberSuffix = givenMembershipNumber into membership;
|
||||||
|
|
||||||
raise notice 'creating test coopAssetsTransaction: %', givenMembershipNumber;
|
raise notice 'creating test coopAssetsTransaction: %', givenMembershipNumber;
|
||||||
insert
|
insert
|
||||||
|
@ -72,10 +72,10 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumber() {
|
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumberSuffix() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
@ -115,10 +115,10 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumberAndDateRange() {
|
void globalAdmin_canFindCoopAssetsTransactionsByMemberNumberSuffixAndDateRange() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
||||||
.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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10001)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001)
|
||||||
.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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10001)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
final var location = RestAssured // @formatter:off
|
final var location = RestAssured // @formatter:off
|
||||||
|
@ -26,7 +26,7 @@ class HsOfficeCoopAssetsTransactionEntityUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toShortStringContainsOnlyMemberNumberAndSharesCountOnly() {
|
void toShortStringContainsOnlyMemberNumberSuffixAndSharesCountOnly() {
|
||||||
final var result = givenCoopAssetTransaction.toShortString();
|
final var result = givenCoopAssetTransaction.toShortString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("300001+128.00");
|
assertThat(result).isEqualTo("300001+128.00");
|
||||||
|
@ -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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10001)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
@ -96,7 +96,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
|
|
||||||
// when
|
// when
|
||||||
attempt(em, () -> {
|
attempt(em, () -> {
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
||||||
null,
|
null,
|
||||||
10001).get(0);
|
10001).get(0);
|
||||||
final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
|
final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
|
||||||
@ -161,7 +161,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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
@ -182,7 +182,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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
@ -72,10 +72,10 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void globalAdmin_canFindCoopSharesTransactionsByMemberNumber() {
|
void globalAdmin_canFindCoopSharesTransactionsByMemberNumberSuffix() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10002).get(0);
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002).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("""
|
||||||
@ -106,10 +106,10 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void globalAdmin_canFindCoopSharesTransactionsByMemberNumberAndDateRange() {
|
void globalAdmin_canFindCoopSharesTransactionsByMemberNumberSuffixAndDateRange() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10002).get(0);
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002).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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10001).get(0);
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001).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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10001).get(0);
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001).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("""
|
||||||
|
@ -25,7 +25,7 @@ class HsOfficeCoopSharesTransactionEntityUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toShortStringContainsOnlyMemberNumberAndshareCountOnly() {
|
void toShortStringContainsOnlyMemberNumberSuffixAndshareCountOnly() {
|
||||||
final var result = givenCoopSharesTransaction.toShortString();
|
final var result = givenCoopSharesTransaction.toShortString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("300001+4");
|
assertThat(result).isEqualTo("300001+4");
|
||||||
|
@ -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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10001)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10001)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
@ -95,7 +95,7 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
|
|
||||||
// when
|
// when
|
||||||
attempt(em, () -> {
|
attempt(em, () -> {
|
||||||
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
||||||
null,
|
null,
|
||||||
10001).get(0);
|
10001).get(0);
|
||||||
final var newCoopSharesTransaction = HsOfficeCoopSharesTransactionEntity.builder()
|
final var newCoopSharesTransaction = HsOfficeCoopSharesTransactionEntity.builder()
|
||||||
@ -160,7 +160,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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
@ -181,7 +181,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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10002)
|
final var givenMembership = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
@ -61,7 +61,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
EntityManager em;
|
EntityManager em;
|
||||||
|
|
||||||
private static int tempMemberNumber = 20010;
|
private static int tempMemberNumberSuffix = 20010;
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@Accepts({ "Membership:F(Find)" })
|
@Accepts({ "Membership:F(Find)" })
|
||||||
@ -84,7 +84,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
{
|
{
|
||||||
"partner": { "person": { "tradeName": "First GmbH" } },
|
"partner": { "person": { "tradeName": "First GmbH" } },
|
||||||
"mainDebitor": { "debitorNumber": 1000111 },
|
"mainDebitor": { "debitorNumber": 1000111 },
|
||||||
"memberNumber": 10001,
|
"memberNumberSuffix": 10001,
|
||||||
"validFrom": "2022-10-01",
|
"validFrom": "2022-10-01",
|
||||||
"validTo": null,
|
"validTo": null,
|
||||||
"reasonForTermination": "NONE"
|
"reasonForTermination": "NONE"
|
||||||
@ -92,7 +92,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
{
|
{
|
||||||
"partner": { "person": { "tradeName": "Second e.K." } },
|
"partner": { "person": { "tradeName": "Second e.K." } },
|
||||||
"mainDebitor": { "debitorNumber": 1000212 },
|
"mainDebitor": { "debitorNumber": 1000212 },
|
||||||
"memberNumber": 10002,
|
"memberNumberSuffix": 10002,
|
||||||
"validFrom": "2022-10-01",
|
"validFrom": "2022-10-01",
|
||||||
"validTo": null,
|
"validTo": null,
|
||||||
"reasonForTermination": "NONE"
|
"reasonForTermination": "NONE"
|
||||||
@ -100,7 +100,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
{
|
{
|
||||||
"partner": { "person": { "tradeName": "Third OHG" } },
|
"partner": { "person": { "tradeName": "Third OHG" } },
|
||||||
"mainDebitor": { "debitorNumber": 1000313 },
|
"mainDebitor": { "debitorNumber": 1000313 },
|
||||||
"memberNumber": 10003,
|
"memberNumberSuffix": 10003,
|
||||||
"validFrom": "2022-10-01",
|
"validFrom": "2022-10-01",
|
||||||
"validTo": null,
|
"validTo": null,
|
||||||
"reasonForTermination": "NONE"
|
"reasonForTermination": "NONE"
|
||||||
@ -130,7 +130,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
{
|
{
|
||||||
"partnerUuid": "%s",
|
"partnerUuid": "%s",
|
||||||
"mainDebitorUuid": "%s",
|
"mainDebitorUuid": "%s",
|
||||||
"memberNumber": 20001,
|
"memberNumberSuffix": 20001,
|
||||||
"validFrom": "2022-10-13",
|
"validFrom": "2022-10-13",
|
||||||
"membershipFeeBillable": "true"
|
"membershipFeeBillable": "true"
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
.body("mainDebitor.debitorNumber", is(givenDebitor.getDebitorNumber()))
|
.body("mainDebitor.debitorNumber", is(givenDebitor.getDebitorNumber()))
|
||||||
.body("mainDebitor.debitorNumberSuffix", is((int) givenDebitor.getDebitorNumberSuffix()))
|
.body("mainDebitor.debitorNumberSuffix", is((int) givenDebitor.getDebitorNumberSuffix()))
|
||||||
.body("partner.person.tradeName", is("Third OHG"))
|
.body("partner.person.tradeName", is("Third OHG"))
|
||||||
.body("memberNumber", is(20001))
|
.body("memberNumberSuffix", is(20001))
|
||||||
.body("validFrom", is("2022-10-13"))
|
.body("validFrom", is("2022-10-13"))
|
||||||
.body("validTo", equalTo(null))
|
.body("validTo", equalTo(null))
|
||||||
.header("Location", startsWith("http://localhost"))
|
.header("Location", startsWith("http://localhost"))
|
||||||
@ -166,7 +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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(
|
final var givenMembershipUuid = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
||||||
null,
|
null,
|
||||||
10001)
|
10001)
|
||||||
.get(0)
|
.get(0)
|
||||||
@ -185,7 +185,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
{
|
{
|
||||||
"partner": { "person": { "tradeName": "First GmbH" } },
|
"partner": { "person": { "tradeName": "First GmbH" } },
|
||||||
"mainDebitor": { "debitorNumber": 1000111 },
|
"mainDebitor": { "debitorNumber": 1000111 },
|
||||||
"memberNumber": 10001,
|
"memberNumberSuffix": 10001,
|
||||||
"validFrom": "2022-10-01",
|
"validFrom": "2022-10-01",
|
||||||
"validTo": null,
|
"validTo": null,
|
||||||
"reasonForTermination": "NONE"
|
"reasonForTermination": "NONE"
|
||||||
@ -197,7 +197,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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(
|
final var givenMembershipUuid = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
||||||
null,
|
null,
|
||||||
10001)
|
10001)
|
||||||
.get(0)
|
.get(0)
|
||||||
@ -217,7 +217,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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(
|
final var givenMembershipUuid = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
||||||
null,
|
null,
|
||||||
10003)
|
10003)
|
||||||
.get(0)
|
.get(0)
|
||||||
@ -240,7 +240,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
"debitorNumber": 1000313,
|
"debitorNumber": 1000313,
|
||||||
"billingContact": { "label": "third contact" }
|
"billingContact": { "label": "third contact" }
|
||||||
},
|
},
|
||||||
"memberNumber": 10003,
|
"memberNumberSuffix": 10003,
|
||||||
"validFrom": "2022-10-01",
|
"validFrom": "2022-10-01",
|
||||||
"validTo": null,
|
"validTo": null,
|
||||||
"reasonForTermination": "NONE"
|
"reasonForTermination": "NONE"
|
||||||
@ -279,7 +279,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
.body("partner.person.tradeName", is(givenMembership.getPartner().getPerson().getTradeName()))
|
.body("partner.person.tradeName", is(givenMembership.getPartner().getPerson().getTradeName()))
|
||||||
.body("mainDebitor.debitorNumber", is(givenMembership.getMainDebitor().getDebitorNumber()))
|
.body("mainDebitor.debitorNumber", is(givenMembership.getMainDebitor().getDebitorNumber()))
|
||||||
.body("mainDebitor.debitorNumberSuffix", is((int) givenMembership.getMainDebitor().getDebitorNumberSuffix()))
|
.body("mainDebitor.debitorNumberSuffix", is((int) givenMembership.getMainDebitor().getDebitorNumberSuffix()))
|
||||||
.body("memberNumber", is(givenMembership.getMemberNumber()))
|
.body("memberNumberSuffix", is(givenMembership.getMemberNumberSuffix()))
|
||||||
.body("validFrom", is("2022-11-01"))
|
.body("validFrom", is("2022-11-01"))
|
||||||
.body("validTo", is("2023-12-31"))
|
.body("validTo", is("2023-12-31"))
|
||||||
.body("reasonForTermination", is("CANCELLATION"));
|
.body("reasonForTermination", is("CANCELLATION"));
|
||||||
@ -290,7 +290,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
.matches(mandate -> {
|
.matches(mandate -> {
|
||||||
assertThat(mandate.getPartner().toShortString()).isEqualTo("LEGAL First GmbH");
|
assertThat(mandate.getPartner().toShortString()).isEqualTo("LEGAL First GmbH");
|
||||||
assertThat(mandate.getMainDebitor().toString()).isEqualTo(givenMembership.getMainDebitor().toString());
|
assertThat(mandate.getMainDebitor().toString()).isEqualTo(givenMembership.getMainDebitor().toString());
|
||||||
assertThat(mandate.getMemberNumber()).isEqualTo(givenMembership.getMemberNumber());
|
assertThat(mandate.getMemberNumberSuffix()).isEqualTo(givenMembership.getMemberNumberSuffix());
|
||||||
assertThat(mandate.getValidity().asString()).isEqualTo("[2022-11-01,2024-01-01)");
|
assertThat(mandate.getValidity().asString()).isEqualTo("[2022-11-01,2024-01-01)");
|
||||||
assertThat(mandate.getReasonForTermination()).isEqualTo(HsOfficeReasonForTermination.CANCELLATION);
|
assertThat(mandate.getReasonForTermination()).isEqualTo(HsOfficeReasonForTermination.CANCELLATION);
|
||||||
return true;
|
return true;
|
||||||
@ -322,7 +322,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
.body("uuid", isUuidValid())
|
.body("uuid", isUuidValid())
|
||||||
.body("partner.person.tradeName", is(givenMembership.getPartner().getPerson().getTradeName()))
|
.body("partner.person.tradeName", is(givenMembership.getPartner().getPerson().getTradeName()))
|
||||||
.body("mainDebitor.debitorNumber", is(1000313))
|
.body("mainDebitor.debitorNumber", is(1000313))
|
||||||
.body("memberNumber", is(givenMembership.getMemberNumber()))
|
.body("memberNumberSuffix", is(givenMembership.getMemberNumberSuffix()))
|
||||||
.body("validFrom", is("2022-11-01"))
|
.body("validFrom", is("2022-11-01"))
|
||||||
.body("validTo", nullValue())
|
.body("validTo", nullValue())
|
||||||
.body("reasonForTermination", is("NONE"));
|
.body("reasonForTermination", is("NONE"));
|
||||||
@ -333,7 +333,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
.matches(mandate -> {
|
.matches(mandate -> {
|
||||||
assertThat(mandate.getPartner().toShortString()).isEqualTo("LEGAL First GmbH");
|
assertThat(mandate.getPartner().toShortString()).isEqualTo("LEGAL First GmbH");
|
||||||
assertThat(mandate.getMainDebitor().toString()).isEqualTo(givenMembership.getMainDebitor().toString());
|
assertThat(mandate.getMainDebitor().toString()).isEqualTo(givenMembership.getMainDebitor().toString());
|
||||||
assertThat(mandate.getMemberNumber()).isEqualTo(givenMembership.getMemberNumber());
|
assertThat(mandate.getMemberNumberSuffix()).isEqualTo(givenMembership.getMemberNumberSuffix());
|
||||||
assertThat(mandate.getValidity().asString()).isEqualTo("[2022-11-01,)");
|
assertThat(mandate.getValidity().asString()).isEqualTo("[2022-11-01,)");
|
||||||
assertThat(mandate.getReasonForTermination()).isEqualTo(NONE);
|
assertThat(mandate.getReasonForTermination()).isEqualTo(NONE);
|
||||||
return true;
|
return true;
|
||||||
@ -444,7 +444,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
.uuid(UUID.randomUUID())
|
.uuid(UUID.randomUUID())
|
||||||
.partner(givenPartner)
|
.partner(givenPartner)
|
||||||
.mainDebitor(givenDebitor)
|
.mainDebitor(givenDebitor)
|
||||||
.memberNumber(++tempMemberNumber)
|
.memberNumberSuffix(++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)
|
||||||
@ -459,7 +459,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
|
|||||||
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.memberNumber >= 20000");
|
final var query = em.createQuery("DELETE FROM HsOfficeMembershipEntity m WHERE m.memberNumberSuffix >= 20000");
|
||||||
query.executeUpdate();
|
query.executeUpdate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class HsOfficeMembershipControllerRestTest {
|
|||||||
{
|
{
|
||||||
"partnerUuid": null,
|
"partnerUuid": null,
|
||||||
"mainDebitorUuid": "%s",
|
"mainDebitorUuid": "%s",
|
||||||
"memberNumber": 20001,
|
"memberNumberSuffix": 20001,
|
||||||
"validFrom": "2022-10-13",
|
"validFrom": "2022-10-13",
|
||||||
"membershipFeeBillable": "true"
|
"membershipFeeBillable": "true"
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ public class HsOfficeMembershipControllerRestTest {
|
|||||||
{
|
{
|
||||||
"partnerUuid": "%s",
|
"partnerUuid": "%s",
|
||||||
"mainDebitorUuid": null,
|
"mainDebitorUuid": null,
|
||||||
"memberNumber": 20001,
|
"memberNumberSuffix": 20001,
|
||||||
"validFrom": "2022-10-13",
|
"validFrom": "2022-10-13",
|
||||||
"membershipFeeBillable": "true"
|
"membershipFeeBillable": "true"
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ public class HsOfficeMembershipControllerRestTest {
|
|||||||
{
|
{
|
||||||
"partnerUuid": "%s",
|
"partnerUuid": "%s",
|
||||||
"mainDebitorUuid": "%s",
|
"mainDebitorUuid": "%s",
|
||||||
"memberNumber": 20001,
|
"memberNumberSuffix": 20001,
|
||||||
"validFrom": "2022-10-13",
|
"validFrom": "2022-10-13",
|
||||||
"membershipFeeBillable": "true"
|
"membershipFeeBillable": "true"
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ public class HsOfficeMembershipControllerRestTest {
|
|||||||
{
|
{
|
||||||
"partnerUuid": "%s",
|
"partnerUuid": "%s",
|
||||||
"mainDebitorUuid": "%s",
|
"mainDebitorUuid": "%s",
|
||||||
"memberNumber": 20001,
|
"memberNumberSuffix": 20001,
|
||||||
"validFrom": "2022-10-13",
|
"validFrom": "2022-10-13",
|
||||||
"membershipFeeBillable": "true"
|
"membershipFeeBillable": "true"
|
||||||
}
|
}
|
||||||
|
@ -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()
|
||||||
.memberNumber(10001)
|
.memberNumberSuffix(10001)
|
||||||
.partner(TEST_PARTNER)
|
.partner(TEST_PARTNER)
|
||||||
.mainDebitor(TEST_DEBITOR)
|
.mainDebitor(TEST_DEBITOR)
|
||||||
.validity(Range.closedInfinite(GIVEN_VALID_FROM))
|
.validity(Range.closedInfinite(GIVEN_VALID_FROM))
|
||||||
@ -31,7 +31,7 @@ class HsOfficeMembershipEntityUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toShortStringContainsMemberNumberOnly() {
|
void toShortStringContainsMemberNumberSuffixOnly() {
|
||||||
final var result = givenMembership.toShortString();
|
final var result = givenMembership.toShortString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("10001");
|
assertThat(result).isEqualTo("10001");
|
||||||
|
@ -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()
|
||||||
.memberNumber(20001)
|
.memberNumberSuffix(20001)
|
||||||
.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()
|
||||||
.memberNumber(20002)
|
.memberNumberSuffix(20002)
|
||||||
.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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, null);
|
final var result = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, null);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
exactlyTheseMembershipsAreReturned(
|
exactlyTheseMembershipsAreReturned(
|
||||||
@ -196,7 +196,7 @@ 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.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(
|
final var result = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(
|
||||||
givenPartner.getUuid(),
|
givenPartner.getUuid(),
|
||||||
null);
|
null);
|
||||||
|
|
||||||
@ -205,12 +205,12 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void globalAdmin_withoutAssumedRole_canFindAllMembershipByMemberNumber() {
|
public void globalAdmin_withoutAssumedRole_canFindAllMembershipByMemberNumberSuffix() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
|
|
||||||
// when
|
// when
|
||||||
final var result = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumber(null, 10002);
|
final var result = membershipRepo.findMembershipsByOptionalPartnerUuidAndOptionalMemberNumberSuffix(null, 10002);
|
||||||
|
|
||||||
// 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 +401,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 memberNumber >= 20000");
|
em.createQuery("DELETE FROM HsOfficeMembershipEntity WHERE memberNumberSuffix >= 20000");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +411,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()
|
||||||
.memberNumber(20002)
|
.memberNumberSuffix(20002)
|
||||||
.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)
|
||||||
.memberNumber(300001)
|
.memberNumberSuffix(300001)
|
||||||
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -575,7 +575,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
if (isNotBlank(rec.getString("member_since"))) {
|
if (isNotBlank(rec.getString("member_since"))) {
|
||||||
final var membership = HsOfficeMembershipEntity.builder()
|
final var membership = HsOfficeMembershipEntity.builder()
|
||||||
.partner(partner)
|
.partner(partner)
|
||||||
.memberNumber(rec.getInteger("member_id"))
|
.memberNumberSuffix(rec.getInteger("member_id"))
|
||||||
.validity(toPostgresDateRange(
|
.validity(toPostgresDateRange(
|
||||||
rec.getLocalDate("member_since"),
|
rec.getLocalDate("member_since"),
|
||||||
rec.getLocalDate("member_until")))
|
rec.getLocalDate("member_until")))
|
||||||
|
Loading…
Reference in New Issue
Block a user
add unique constraint mit partnerNumber