coop-shares-transaction-reverse-entry #40

Merged
hsh-marcsandlus merged 3 commits from coop-shares-transaction-reverse-entry into master 2024-04-12 11:29:27 +02:00
4 changed files with 9 additions and 9 deletions
Showing only changes of commit 0fda68e01b - Show all commits

View File

@ -136,9 +136,9 @@ public class HsOfficeCoopSharesTransactionController implements HsOfficeCoopShar
}
final BiConsumer<HsOfficeCoopSharesTransactionInsertResource, HsOfficeCoopSharesTransactionEntity> RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> {
if ( resource.getReverseEntryUuid() != null ) {
entity.setAdjustedShareTx(coopSharesTransactionRepo.findByUuid(resource.getReverseEntryUuid())
.orElseThrow(() -> new EntityNotFoundException("ERROR: [400] reverseEntityUuid %s not found".formatted(resource.getReverseEntryUuid()))));
if ( resource.getAdjustedShareTxUuid() != null ) {
entity.setAdjustedShareTx(coopSharesTransactionRepo.findByUuid(resource.getAdjustedShareTxUuid())
.orElseThrow(() -> new EntityNotFoundException("ERROR: [400] adjustedShareTxUuid %s not found".formatted(resource.getAdjustedShareTxUuid()))));
}
};
}

View File

@ -73,7 +73,7 @@ components:
maxLength: 48
comment:
type: string
reverseEntryUuid:
adjustedShareTxUuid:

adjustedShareTxUuid
auch bei Asset schauen

adjustedShareTxUuid auch bei Asset schauen
type: string
format: uuid
required:

View File

@ -227,7 +227,7 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest extends ContextBased
"valueDate": "2022-10-30",
"reference": "test ref adjustment",
"comment": "some coop shares adjustment transaction",
"reverseEntryUuid": "%s"
"adjustedShareTxUuid": "%s"
}
""".formatted(
givenMembership.getUuid(),

View File

@ -51,23 +51,23 @@ class HsOfficeCoopSharesTransactionEntityUnitTest {
}
@Test
void toShortStringContainsOnlyMemberNumberAndShareCountOnly() {
void toShortStringContainsOnlyAbbreviatedString() {
final var result = givenCoopSharesTransaction.toShortString();
assertThat(result).isEqualTo("M-1000101+4");
assertThat(result).isEqualTo("M-1000101:SUB:+4");
}
@Test
void toStringEmptyTransactionDoesNotThrowException() {
final var result = givenEmptyCoopSharesTransaction.toString();
assertThat(result).isEqualTo("CoopShareTransaction(0)");
assertThat(result).isEqualTo("CoopShareTransaction(null: 0)");
}
@Test
void toShortStringEmptyTransactionDoesNotThrowException() {
final var result = givenEmptyCoopSharesTransaction.toShortString();
assertThat(result).isEqualTo("null+0");
assertThat(result).isEqualTo("null:nul:+0");
}
}