memberNumber as partnerNumber+memberNumberSuffix #13
@ -29,11 +29,12 @@ 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 -> ofNullable(e.getMembership()).map(HsOfficeMembershipEntity::getMemberNumberSuffix).orElse(null))
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getMemberNumber)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getValueDate)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getValueDate)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getTransactionType)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getTransactionType)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getReference)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getReference)
|
||||||
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getComment)
|
||||||
.withSeparator(", ")
|
.withSeparator(", ")
|
||||||
.quotedValues(false);
|
.quotedValues(false);
|
||||||
|
|
||||||
@ -62,6 +63,11 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, HasUu
|
|||||||
@Column(name = "comment")
|
@Column(name = "comment")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getMemberNumber() {
|
||||||
|
return ofNullable(membership).map(HsOfficeMembershipEntity::getMemberNumber).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return stringify.apply(this);
|
return stringify.apply(this);
|
||||||
@ -69,6 +75,6 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, HasUu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toShortString() {
|
public String toShortString() {
|
||||||
return membership.getMemberNumberSuffix() + new DecimalFormat("+0.00").format(assetValue);
|
return "%s%+1.2f".formatted(getMemberNumber(), assetValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import jakarta.persistence.*;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static java.util.Optional.ofNullable;
|
||||||
import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@ -24,11 +25,12 @@ 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().getMemberNumberSuffix())
|
.withProp(HsOfficeCoopSharesTransactionEntity::getMemberNumber)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getValueDate)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getValueDate)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getTransactionType)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getTransactionType)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getShareCount)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getShareCount)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getReference)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getReference)
|
||||||
|
.withProp(HsOfficeCoopSharesTransactionEntity::getComment)
|
||||||
.withSeparator(", ")
|
.withSeparator(", ")
|
||||||
.quotedValues(false);
|
.quotedValues(false);
|
||||||
|
|
||||||
@ -61,8 +63,12 @@ public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUu
|
|||||||
return stringify.apply(this);
|
return stringify.apply(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getMemberNumber() {
|
||||||
|
return ofNullable(membership).map(HsOfficeMembershipEntity::getMemberNumber).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toShortString() {
|
public String toShortString() {
|
||||||
return "%s%+d".formatted(membership.getMemberNumberSuffix(), shareCount);
|
return "%s%+d".formatted(getMemberNumber(), shareCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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(e -> e.getPartner().getPartnerNumber() + e.memberNumberSuffix)
|
.withProp(HsOfficeMembershipEntity::getMemberNumber)
|
||||||
.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())
|
||||||
|
@ -16,7 +16,7 @@ create table hs_office_debitor
|
|||||||
vatBusiness boolean not null,
|
vatBusiness boolean not null,
|
||||||
vatReverseCharge boolean not null,
|
vatReverseCharge boolean not null,
|
||||||
refundBankAccountUuid uuid references hs_office_bankaccount(uuid),
|
refundBankAccountUuid uuid references hs_office_bankaccount(uuid),
|
||||||
defaultPrefix char(3) not null
|
defaultPrefix char(3) not null unique
|
||||||
constraint check_default_prefix check (
|
constraint check_default_prefix check (
|
||||||
defaultPrefix::text ~ '^([a-z]{3}|al0|bh1|c4s|f3k|k8i|l3d|mh1|o13|p2m|s80|t4w)$'
|
defaultPrefix::text ~ '^([a-z]{3}|al0|bh1|c4s|f3k|k8i|l3d|mh1|o13|p2m|s80|t4w)$'
|
||||||
)
|
)
|
||||||
|
@ -185,16 +185,16 @@ call generateRbacIdentityView('hs_office_debitor', $idName$
|
|||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
call generateRbacRestrictedView('hs_office_debitor', 'target.debitorNumberSuffix',
|
call generateRbacRestrictedView('hs_office_debitor', 'target.debitorNumberSuffix',
|
||||||
$updates$
|
$updates$
|
||||||
partnerUuid = new.partnerUuid,
|
partnerUuid = new.partnerUuid, -- TODO: remove? should never do anything
|
||||||
billable = new.billable,
|
billable = new.billable,
|
||||||
billingContactUuid = new.billingContactUuid,
|
billingContactUuid = new.billingContactUuid,
|
||||||
debitorNumberSuffix = new.debitorNumberSuffix,
|
debitorNumberSuffix = new.debitorNumberSuffix, -- TODO: Should it be allowed to updated this value?
|
||||||
refundBankAccountUuid = new.refundBankAccountUuid,
|
refundBankAccountUuid = new.refundBankAccountUuid,
|
||||||
vatId = new.vatId,
|
vatId = new.vatId,
|
||||||
vatCountryCode = new.vatCountryCode,
|
vatCountryCode = new.vatCountryCode,
|
||||||
vatBusiness = new.vatBusiness,
|
vatBusiness = new.vatBusiness,
|
||||||
vatreversecharge = new.vatreversecharge,
|
vatreversecharge = new.vatreversecharge,
|
||||||
defaultPrefix = new.defaultPrefix
|
defaultPrefix = new.defaultPrefix -- TODO: Should it be allowed to updated this value?
|
||||||
$updates$);
|
$updates$);
|
||||||
--//
|
--//
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ execute procedure hsOfficeMembershipRbacRolesTrigger();
|
|||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
call generateRbacIdentityView('hs_office_membership', idNameExpression => $idName$
|
call generateRbacIdentityView('hs_office_membership', idNameExpression => $idName$
|
||||||
target.memberNumberSuffix ||
|
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$);
|
||||||
--//
|
--//
|
||||||
|
@ -17,6 +17,7 @@ class HsOfficeCoopAssetsTransactionEntityUnitTest {
|
|||||||
.transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT)
|
.transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT)
|
||||||
.assetValue(new BigDecimal("128.00"))
|
.assetValue(new BigDecimal("128.00"))
|
||||||
.build();
|
.build();
|
||||||
|
final HsOfficeCoopAssetsTransactionEntity givenEmptyCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder().build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toStringContainsAlmostAllPropertiesAccount() {
|
void toStringContainsAlmostAllPropertiesAccount() {
|
||||||
@ -31,4 +32,18 @@ class HsOfficeCoopAssetsTransactionEntityUnitTest {
|
|||||||
|
|
||||||
assertThat(result).isEqualTo("300001+128.00");
|
assertThat(result).isEqualTo("300001+128.00");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void toStringWithEmptyTransactionDoesNotThrowException() {
|
||||||
|
final var result = givenEmptyCoopAssetsTransaction.toString();
|
||||||
|
|
||||||
|
assertThat(result).isEqualTo("CoopAssetsTransaction()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void toShortStringEmptyTransactionDoesNotThrowException() {
|
||||||
|
final var result = givenEmptyCoopAssetsTransaction.toShortString();
|
||||||
|
|
||||||
|
assertThat(result).isEqualTo("nullnu");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,17 +142,17 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then
|
// then
|
||||||
allTheseCoopAssetsTransactionsAreReturned(
|
allTheseCoopAssetsTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopAssetsTransaction(10001, 2010-03-15, DEPOSIT, 320.00, ref 10001-1)",
|
"CoopAssetsTransaction(10001, 2010-03-15, DEPOSIT, 320.00, ref 10001-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10001, 2021-09-01, DISBURSAL, -128.00, ref 10001-2)",
|
"CoopAssetsTransaction(10001, 2021-09-01, DISBURSAL, -128.00, ref 10001-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10001, 2022-10-20, ADJUSTMENT, 128.00, ref 10001-3)",
|
"CoopAssetsTransaction(10001, 2022-10-20, ADJUSTMENT, 128.00, ref 10001-3, some adjustment)",
|
||||||
|
|
||||||
"CoopAssetsTransaction(10002, 2010-03-15, DEPOSIT, 320.00, ref 10002-1)",
|
"CoopAssetsTransaction(10002, 2010-03-15, DEPOSIT, 320.00, ref 10002-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2)",
|
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10002, 2022-10-20, ADJUSTMENT, 128.00, ref 10002-3)",
|
"CoopAssetsTransaction(10002, 2022-10-20, ADJUSTMENT, 128.00, ref 10002-3, some adjustment)",
|
||||||
|
|
||||||
"CoopAssetsTransaction(10003, 2010-03-15, DEPOSIT, 320.00, ref 10003-1)",
|
"CoopAssetsTransaction(10003, 2010-03-15, DEPOSIT, 320.00, ref 10003-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10003, 2021-09-01, DISBURSAL, -128.00, ref 10003-2)",
|
"CoopAssetsTransaction(10003, 2021-09-01, DISBURSAL, -128.00, ref 10003-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10003, 2022-10-20, ADJUSTMENT, 128.00, ref 10003-3)");
|
"CoopAssetsTransaction(10003, 2022-10-20, ADJUSTMENT, 128.00, ref 10003-3, some adjustment)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -170,9 +170,9 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then
|
// then
|
||||||
allTheseCoopAssetsTransactionsAreReturned(
|
allTheseCoopAssetsTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopAssetsTransaction(10002, 2010-03-15, DEPOSIT, 320.00, ref 10002-1)",
|
"CoopAssetsTransaction(10002, 2010-03-15, DEPOSIT, 320.00, ref 10002-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2)",
|
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10002, 2022-10-20, ADJUSTMENT, 128.00, ref 10002-3)");
|
"CoopAssetsTransaction(10002, 2022-10-20, ADJUSTMENT, 128.00, ref 10002-3, some adjustment)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -191,7 +191,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then
|
// then
|
||||||
allTheseCoopAssetsTransactionsAreReturned(
|
allTheseCoopAssetsTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2)");
|
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2, partial disbursal)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -208,9 +208,9 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then:
|
// then:
|
||||||
exactlyTheseCoopAssetsTransactionsAreReturned(
|
exactlyTheseCoopAssetsTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopAssetsTransaction(10001, 2010-03-15, DEPOSIT, 320.00, ref 10001-1)",
|
"CoopAssetsTransaction(10001, 2010-03-15, DEPOSIT, 320.00, ref 10001-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10001, 2021-09-01, DISBURSAL, -128.00, ref 10001-2)",
|
"CoopAssetsTransaction(10001, 2021-09-01, DISBURSAL, -128.00, ref 10001-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10001, 2022-10-20, ADJUSTMENT, 128.00, ref 10001-3)");
|
"CoopAssetsTransaction(10001, 2022-10-20, ADJUSTMENT, 128.00, ref 10001-3, some adjustment)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ class HsOfficeCoopSharesTransactionEntityUnitTest {
|
|||||||
.transactionType(HsOfficeCoopSharesTransactionType.SUBSCRIPTION)
|
.transactionType(HsOfficeCoopSharesTransactionType.SUBSCRIPTION)
|
||||||
.shareCount(4)
|
.shareCount(4)
|
||||||
.build();
|
.build();
|
||||||
|
final HsOfficeCoopSharesTransactionEntity givenEmptyCoopSharesTransaction = HsOfficeCoopSharesTransactionEntity.builder().build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toStringContainsAlmostAllPropertiesAccount() {
|
void toStringContainsAlmostAllPropertiesAccount() {
|
||||||
@ -25,9 +26,23 @@ class HsOfficeCoopSharesTransactionEntityUnitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toShortStringContainsOnlyMemberNumberSuffixAndshareCountOnly() {
|
void toShortStringContainsOnlyMemberNumberAndShareCountOnly() {
|
||||||
final var result = givenCoopSharesTransaction.toShortString();
|
final var result = givenCoopSharesTransaction.toShortString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("300001+4");
|
assertThat(result).isEqualTo("300001+4");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void toStringEmptyTransactionDoesNotThrowException() {
|
||||||
|
final var result = givenEmptyCoopSharesTransaction.toString();
|
||||||
|
|
||||||
|
assertThat(result).isEqualTo("CoopShareTransaction(0)");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void toShortStringEmptyTransactionDoesNotThrowException() {
|
||||||
|
final var result = givenEmptyCoopSharesTransaction.toShortString();
|
||||||
|
|
||||||
|
assertThat(result).isEqualTo("null+0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,17 +142,17 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then
|
// then
|
||||||
allTheseCoopSharesTransactionsAreReturned(
|
allTheseCoopSharesTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopShareTransaction(10001, 2010-03-15, SUBSCRIPTION, 4, ref 10001-1)",
|
"CoopShareTransaction(10001, 2010-03-15, SUBSCRIPTION, 4, ref 10001-1, initial subscription)",
|
||||||
"CoopShareTransaction(10001, 2021-09-01, CANCELLATION, -2, ref 10001-2)",
|
"CoopShareTransaction(10001, 2021-09-01, CANCELLATION, -2, ref 10001-2, cancelling some)",
|
||||||
"CoopShareTransaction(10001, 2022-10-20, ADJUSTMENT, 2, ref 10001-3)",
|
"CoopShareTransaction(10001, 2022-10-20, ADJUSTMENT, 2, ref 10001-3, some adjustment)",
|
||||||
|
|
||||||
"CoopShareTransaction(10002, 2010-03-15, SUBSCRIPTION, 4, ref 10002-1)",
|
"CoopShareTransaction(10002, 2010-03-15, SUBSCRIPTION, 4, ref 10002-1, initial subscription)",
|
||||||
"CoopShareTransaction(10002, 2021-09-01, CANCELLATION, -2, ref 10002-2)",
|
"CoopShareTransaction(10002, 2021-09-01, CANCELLATION, -2, ref 10002-2, cancelling some)",
|
||||||
"CoopShareTransaction(10002, 2022-10-20, ADJUSTMENT, 2, ref 10002-3)",
|
"CoopShareTransaction(10002, 2022-10-20, ADJUSTMENT, 2, ref 10002-3, some adjustment)",
|
||||||
|
|
||||||
"CoopShareTransaction(10003, 2010-03-15, SUBSCRIPTION, 4, ref 10003-1)",
|
"CoopShareTransaction(10003, 2010-03-15, SUBSCRIPTION, 4, ref 10003-1, initial subscription)",
|
||||||
"CoopShareTransaction(10003, 2021-09-01, CANCELLATION, -2, ref 10003-2)",
|
"CoopShareTransaction(10003, 2021-09-01, CANCELLATION, -2, ref 10003-2, cancelling some)",
|
||||||
"CoopShareTransaction(10003, 2022-10-20, ADJUSTMENT, 2, ref 10003-3)");
|
"CoopShareTransaction(10003, 2022-10-20, ADJUSTMENT, 2, ref 10003-3, some adjustment)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -171,9 +171,9 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then
|
// then
|
||||||
allTheseCoopSharesTransactionsAreReturned(
|
allTheseCoopSharesTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopShareTransaction(10002, 2010-03-15, SUBSCRIPTION, 4, ref 10002-1)",
|
"CoopShareTransaction(10002, 2010-03-15, SUBSCRIPTION, 4, ref 10002-1, initial subscription)",
|
||||||
"CoopShareTransaction(10002, 2021-09-01, CANCELLATION, -2, ref 10002-2)",
|
"CoopShareTransaction(10002, 2021-09-01, CANCELLATION, -2, ref 10002-2, cancelling some)",
|
||||||
"CoopShareTransaction(10002, 2022-10-20, ADJUSTMENT, 2, ref 10002-3)");
|
"CoopShareTransaction(10002, 2022-10-20, ADJUSTMENT, 2, ref 10002-3, some adjustment)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -192,7 +192,7 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then
|
// then
|
||||||
allTheseCoopSharesTransactionsAreReturned(
|
allTheseCoopSharesTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopShareTransaction(10002, 2021-09-01, CANCELLATION, -2, ref 10002-2)");
|
"CoopShareTransaction(10002, 2021-09-01, CANCELLATION, -2, ref 10002-2, cancelling some)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -209,9 +209,9 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then:
|
// then:
|
||||||
exactlyTheseCoopSharesTransactionsAreReturned(
|
exactlyTheseCoopSharesTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopShareTransaction(10001, 2010-03-15, SUBSCRIPTION, 4, ref 10001-1)",
|
"CoopShareTransaction(10001, 2010-03-15, SUBSCRIPTION, 4, ref 10001-1, initial subscription)",
|
||||||
"CoopShareTransaction(10001, 2021-09-01, CANCELLATION, -2, ref 10001-2)",
|
"CoopShareTransaction(10001, 2021-09-01, CANCELLATION, -2, ref 10001-2, cancelling some)",
|
||||||
"CoopShareTransaction(10001, 2022-10-20, ADJUSTMENT, 2, ref 10001-3)");
|
"CoopShareTransaction(10001, 2022-10-20, ADJUSTMENT, 2, ref 10001-3, some adjustment)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,12 @@ class HsOfficeDebitorEntityPatcherUnitTest extends PatchUnitTestBase<
|
|||||||
PATCHED_BILLABLE,
|
PATCHED_BILLABLE,
|
||||||
HsOfficeDebitorEntity::setBillable)
|
HsOfficeDebitorEntity::setBillable)
|
||||||
.notNullable(),
|
.notNullable(),
|
||||||
|
new SimpleProperty<>(
|
||||||
|
"billable",
|
||||||
|
HsOfficeDebitorPatchResource::setBillable,
|
||||||
|
PATCHED_BILLABLE,
|
||||||
|
HsOfficeDebitorEntity::setBillable)
|
||||||
|
.notNullable(),
|
||||||
new JsonNullableProperty<>(
|
new JsonNullableProperty<>(
|
||||||
"vatId",
|
"vatId",
|
||||||
HsOfficeDebitorPatchResource::setVatId,
|
HsOfficeDebitorPatchResource::setVatId,
|
||||||
@ -121,19 +127,13 @@ class HsOfficeDebitorEntityPatcherUnitTest extends PatchUnitTestBase<
|
|||||||
PATCHED_VAT_COUNTRY_CODE,
|
PATCHED_VAT_COUNTRY_CODE,
|
||||||
HsOfficeDebitorEntity::setVatCountryCode),
|
HsOfficeDebitorEntity::setVatCountryCode),
|
||||||
new SimpleProperty<>(
|
new SimpleProperty<>(
|
||||||
"vatReverseCharge",
|
"vatBusiness",
|
||||||
HsOfficeDebitorPatchResource::setVatReverseCharge,
|
|
||||||
PATCHED_VAT_REVERSE_CHARGE,
|
|
||||||
HsOfficeDebitorEntity::setVatReverseCharge)
|
|
||||||
.notNullable(),
|
|
||||||
new SimpleProperty<>(
|
|
||||||
"personType",
|
|
||||||
HsOfficeDebitorPatchResource::setVatBusiness,
|
HsOfficeDebitorPatchResource::setVatBusiness,
|
||||||
PATCHED_VAT_BUSINESS,
|
PATCHED_VAT_BUSINESS,
|
||||||
HsOfficeDebitorEntity::setVatBusiness)
|
HsOfficeDebitorEntity::setVatBusiness)
|
||||||
.notNullable(),
|
.notNullable(),
|
||||||
new SimpleProperty<>(
|
new SimpleProperty<>(
|
||||||
"personType",
|
"vatReverseCharge",
|
||||||
HsOfficeDebitorPatchResource::setVatReverseCharge,
|
HsOfficeDebitorPatchResource::setVatReverseCharge,
|
||||||
PATCHED_BILLABLE,
|
PATCHED_BILLABLE,
|
||||||
HsOfficeDebitorEntity::setVatReverseCharge)
|
HsOfficeDebitorEntity::setVatReverseCharge)
|
||||||
|
@ -346,7 +346,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
public void globalAdmin_canUpdateNullRefundBankAccountToNotNullBankAccountForArbitraryDebitor() {
|
public void globalAdmin_canUpdateNullRefundBankAccountToNotNullBankAccountForArbitraryDebitor() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", null, "fif");
|
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", null, "fig");
|
||||||
assertThatDebitorIsVisibleForUserWithRole(
|
assertThatDebitorIsVisibleForUserWithRole(
|
||||||
givenDebitor,
|
givenDebitor,
|
||||||
"hs_office_partner#10004:Fourthe.G.-forthcontact.admin");
|
"hs_office_partner#10004:Fourthe.G.-forthcontact.admin");
|
||||||
@ -376,7 +376,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
public void globalAdmin_canUpdateRefundBankAccountToNullForArbitraryDebitor() {
|
public void globalAdmin_canUpdateRefundBankAccountToNullForArbitraryDebitor() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", "Fourth", "fif");
|
final var givenDebitor = givenSomeTemporaryDebitor("Fourth", "fifth contact", "Fourth", "fih");
|
||||||
assertThatDebitorIsVisibleForUserWithRole(
|
assertThatDebitorIsVisibleForUserWithRole(
|
||||||
givenDebitor,
|
givenDebitor,
|
||||||
"hs_office_partner#10004:Fourthe.G.-forthcontact.admin");
|
"hs_office_partner#10004:Fourthe.G.-forthcontact.admin");
|
||||||
|
@ -273,6 +273,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("mainDebitor.debitorNumberSuffix", is((int) givenMembership.getMainDebitor().getDebitorNumberSuffix()))
|
||||||
.body("memberNumberSuffix", is(givenMembership.getMemberNumberSuffix()))
|
.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"))
|
||||||
|
@ -297,8 +297,6 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
@Test
|
@Test
|
||||||
@Order(1040)
|
@Order(1040)
|
||||||
void importCoopShares() {
|
void importCoopShares() {
|
||||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
|
||||||
|
|
||||||
try (Reader reader = resourceReader("migration/share-transactions.csv")) {
|
try (Reader reader = resourceReader("migration/share-transactions.csv")) {
|
||||||
final var lines = readAllLines(reader);
|
final var lines = readAllLines(reader);
|
||||||
importCoopShares(justHeader(lines), withoutHeader(lines));
|
importCoopShares(justHeader(lines), withoutHeader(lines));
|
||||||
@ -312,7 +310,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
void verifyCoopShares() {
|
void verifyCoopShares() {
|
||||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
assumeThat(postgresAdminUser).isEqualTo("admin");
|
||||||
|
|
||||||
assertThat(coopShares.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(coopShares)).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
33443=CoopShareTransaction(10017, 2000-12-06, SUBSCRIPTION, 20, initial share subscription),
|
33443=CoopShareTransaction(10017, 2000-12-06, SUBSCRIPTION, 20, initial share subscription),
|
||||||
33451=CoopShareTransaction(10020, 2000-12-06, SUBSCRIPTION, 2, initial share subscription),
|
33451=CoopShareTransaction(10020, 2000-12-06, SUBSCRIPTION, 2, initial share subscription),
|
||||||
@ -339,7 +337,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
void verifyCoopAssets() {
|
void verifyCoopAssets() {
|
||||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
assumeThat(postgresAdminUser).isEqualTo("admin");
|
||||||
|
|
||||||
assertThat(coopAssets.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(coopAssets)).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
30000=CoopAssetsTransaction(10017, 2000-12-06, DEPOSIT, 1280.00, for subscription A),
|
30000=CoopAssetsTransaction(10017, 2000-12-06, DEPOSIT, 1280.00, for subscription A),
|
||||||
31000=CoopAssetsTransaction(10020, 2000-12-06, DEPOSIT, 128.00, for subscription B),
|
31000=CoopAssetsTransaction(10020, 2000-12-06, DEPOSIT, 128.00, for subscription B),
|
||||||
|
@ -7,14 +7,9 @@ import net.hostsharing.hsadminng.rbac.rbacuser.RbacUserRepository;
|
|||||||
import net.hostsharing.test.Accepts;
|
import net.hostsharing.test.Accepts;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.web.server.LocalServerPort;
|
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||||
|
|
||||||
import jakarta.persistence.EntityManager;
|
|
||||||
import jakarta.persistence.PersistenceContext;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
|
|
||||||
@SpringBootTest(
|
@SpringBootTest(
|
||||||
@ -27,9 +22,6 @@ class RbacRoleControllerAcceptanceTest {
|
|||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
private Integer port;
|
private Integer port;
|
||||||
|
|
||||||
@PersistenceContext
|
|
||||||
EntityManager em;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
Context context;
|
Context context;
|
||||||
|
|
||||||
@ -39,14 +31,6 @@ class RbacRoleControllerAcceptanceTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
RbacRoleRepository rbacRoleRepository;
|
RbacRoleRepository rbacRoleRepository;
|
||||||
|
|
||||||
@Value("${HSADMINNG_POSTGRES_RESTRICTED_USERNAME}")
|
|
||||||
String restrictedUser;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testEnv() {
|
|
||||||
assertThat(restrictedUser).isEqualTo("restricted");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Accepts({ "ROL:L(List)" })
|
@Accepts({ "ROL:L(List)" })
|
||||||
void globalAdmin_withoutAssumedRole_canViewAllRoles() {
|
void globalAdmin_withoutAssumedRole_canViewAllRoles() {
|
||||||
|
@ -32,10 +32,12 @@ dump "select sepa_mandat_id, bp_id, bank_customer, bank_name, bank_iban, bank_bi
|
|||||||
|
|
||||||
dump "select member_asset_id, bp_id, date, action, amount, comment
|
dump "select member_asset_id, bp_id, date, action, amount, comment
|
||||||
from member_asset
|
from member_asset
|
||||||
|
WHERE bp_id NOT IN (511912)
|
||||||
order by member_asset_id" \
|
order by member_asset_id" \
|
||||||
"asset-transactions.csv"
|
"asset-transactions.csv"
|
||||||
|
|
||||||
dump "select member_share_id, bp_id, date, action, quantity, comment
|
dump "select member_share_id, bp_id, date, action, quantity, comment
|
||||||
from member_share
|
from member_share
|
||||||
|
WHERE bp_id NOT IN (511912)
|
||||||
order by member_share_id" \
|
order by member_share_id" \
|
||||||
"share-transactions.csv"
|
"share-transactions.csv"
|
||||||
|
Loading…
Reference in New Issue
Block a user