coop-shares-transaction-reverse-entry
This commit is contained in:
parent
3d4e853c56
commit
0fda68e01b
@ -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()))));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ components:
|
||||
maxLength: 48
|
||||
comment:
|
||||
type: string
|
||||
reverseEntryUuid:
|
||||
adjustedShareTxUuid:
|
||||
type: string
|
||||
format: uuid
|
||||
required:
|
||||
|
@ -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(),
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user