coop-shares-transaction-reverse-entry

This commit is contained in:
Marc O. Sandlus 2024-04-12 11:27:21 +02:00
parent 3d4e853c56
commit 0fda68e01b
4 changed files with 9 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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