1
0

add advanced scenario-tests for coop-assets (#123)

Co-authored-by: Michael Hoennig <michael@hoennig.de>
Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/123
Reviewed-by: Marc Sandlus <marc.sandlus@hostsharing.net>
This commit is contained in:
Michael Hoennig
2024-11-25 16:06:24 +01:00
parent 7883052864
commit 3532e3a46c
28 changed files with 942 additions and 101 deletions

View File

@ -1,10 +1,15 @@
package net.hostsharing.hsadminng.hs.office.coopassets;
import net.hostsharing.hsadminng.context.Context;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeCoopAssetsApi;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.*;
import net.hostsharing.hsadminng.errors.MultiValidationException;
import net.hostsharing.hsadminng.mapper.StandardMapper;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeCoopAssetsApi;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionInsertResource;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionResource;
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionTypeResource;
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity;
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipRepository;
import net.hostsharing.hsadminng.mapper.StrictMapper;
import net.hostsharing.hsadminng.persistence.EntityManagerWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;
@ -14,13 +19,19 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
import jakarta.persistence.EntityNotFoundException;
import jakarta.validation.ValidationException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.function.BiConsumer;
import static net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionTypeResource.*;
import static java.util.Optional.ofNullable;
import static net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionTypeResource.CLEARING;
import static net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionTypeResource.DEPOSIT;
import static net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionTypeResource.DISBURSAL;
import static net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionTypeResource.LOSS;
import static net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopAssetsTransactionTypeResource.TRANSFER;
@RestController
public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAssetsApi {
@ -29,11 +40,17 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse
private Context context;
@Autowired
private StandardMapper mapper;
private StrictMapper mapper;
@Autowired
private EntityManagerWrapper emw;
@Autowired
private HsOfficeCoopAssetsTransactionRepository coopAssetsTransactionRepo;
@Autowired
private HsOfficeMembershipRepository membershipRepo;
@Override
@Transactional(readOnly = true)
public ResponseEntity<List<HsOfficeCoopAssetsTransactionResource>> getListOfCoopAssets(
@ -49,7 +66,7 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse
fromValueDate,
toValueDate);
final var resources = mapper.mapList(entities, HsOfficeCoopAssetsTransactionResource.class);
final var resources = mapper.mapList(entities, HsOfficeCoopAssetsTransactionResource.class, ENTITY_TO_RESOURCE_POSTMAPPER);
return ResponseEntity.ok(resources);
}
@ -63,7 +80,10 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse
context.define(currentSubject, assumedRoles);
validate(requestBody);
final var entityToSave = mapper.map(requestBody, HsOfficeCoopAssetsTransactionEntity.class, RESOURCE_TO_ENTITY_POSTMAPPER);
final var entityToSave = mapper.map(
requestBody,
HsOfficeCoopAssetsTransactionEntity.class,
RESOURCE_TO_ENTITY_POSTMAPPER);
final var saved = coopAssetsTransactionRepo.save(entityToSave);
final var uri =
@ -71,14 +91,14 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse
.path("/api/hs/office/coopassetstransactions/{id}")
.buildAndExpand(saved.getUuid())
.toUri();
final var mapped = mapper.map(saved, HsOfficeCoopAssetsTransactionResource.class);
final var mapped = mapper.map(saved, HsOfficeCoopAssetsTransactionResource.class, ENTITY_TO_RESOURCE_POSTMAPPER);
return ResponseEntity.created(uri).body(mapped);
}
@Override
@Transactional(readOnly = true)
public ResponseEntity<HsOfficeCoopAssetsTransactionResource> getSingleCoopAssetTransactionByUuid(
final String currentSubject, final String assumedRoles, final UUID assetTransactionUuid) {
final String currentSubject, final String assumedRoles, final UUID assetTransactionUuid) {
context.define(currentSubject, assumedRoles);
@ -101,7 +121,7 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse
private static void validateDebitTransaction(
final HsOfficeCoopAssetsTransactionInsertResource requestBody,
final ArrayList<String> violations) {
if (List.of(DEPOSIT, ADOPTION).contains(requestBody.getTransactionType())
if (List.of(DEPOSIT, HsOfficeCoopAssetsTransactionTypeResource.ADOPTION).contains(requestBody.getTransactionType())
&& requestBody.getAssetValue().signum() < 0) {
violations.add("for %s, assetValue must be positive but is \"%.2f\"".formatted(
requestBody.getTransactionType(), requestBody.getAssetValue()));
@ -127,10 +147,111 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse
}
}
final BiConsumer<HsOfficeCoopAssetsTransactionInsertResource, HsOfficeCoopAssetsTransactionEntity> RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> {
if ( resource.getRevertedAssetTxUuid() != null ) {
entity.setRevertedAssetTx(coopAssetsTransactionRepo.findByUuid(resource.getRevertedAssetTxUuid())
.orElseThrow(() -> new EntityNotFoundException("ERROR: [400] reverseEntityUuid %s not found".formatted(resource.getRevertedAssetTxUuid()))));
final BiConsumer<HsOfficeCoopAssetsTransactionEntity, HsOfficeCoopAssetsTransactionResource> ENTITY_TO_RESOURCE_POSTMAPPER = (entity, resource) -> {
resource.setMembershipUuid(entity.getMembership().getUuid());
resource.setMembershipMemberNumber(entity.getMembership().getTaggedMemberNumber());
if (entity.getReversalAssetTx() != null) {
resource.getReversalAssetTx().setRevertedAssetTxUuid(entity.getUuid());
resource.getReversalAssetTx().setMembershipUuid(entity.getMembership().getUuid());
resource.getReversalAssetTx().setMembershipMemberNumber(entity.getTaggedMemberNumber());
}
if (entity.getRevertedAssetTx() != null) {
resource.getRevertedAssetTx().setReversalAssetTxUuid(entity.getUuid());
resource.getRevertedAssetTx().setMembershipUuid(entity.getMembership().getUuid());
resource.getRevertedAssetTx().setMembershipMemberNumber(entity.getTaggedMemberNumber());
}
if (entity.getAdoptionAssetTx() != null) {
resource.getAdoptionAssetTx().setTransferAssetTxUuid(entity.getUuid());
resource.getAdoptionAssetTx().setMembershipUuid(entity.getAdoptionAssetTx().getMembership().getUuid());
resource.getAdoptionAssetTx().setMembershipMemberNumber(entity.getAdoptionAssetTx().getTaggedMemberNumber());
}
if (entity.getTransferAssetTx() != null) {
resource.getTransferAssetTx().setAdoptionAssetTxUuid(entity.getUuid());
resource.getTransferAssetTx().setMembershipUuid(entity.getTransferAssetTx().getMembership().getUuid());
resource.getTransferAssetTx().setMembershipMemberNumber(entity.getTransferAssetTx().getTaggedMemberNumber());
}
};
};
final BiConsumer<HsOfficeCoopAssetsTransactionInsertResource, HsOfficeCoopAssetsTransactionEntity> RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> {
if (resource.getMembershipUuid() != null) {
final HsOfficeMembershipEntity membership = ofNullable(emw.find(HsOfficeMembershipEntity.class, resource.getMembershipUuid()))
.orElseThrow(() -> new EntityNotFoundException("ERROR: [400] membership.uuid %s not found".formatted(
resource.getMembershipUuid())));
entity.setMembership(membership);
}
if (resource.getRevertedAssetTxUuid() != null) {
final var revertedAssetTx = coopAssetsTransactionRepo.findByUuid(resource.getRevertedAssetTxUuid())
.orElseThrow(() -> new EntityNotFoundException("ERROR: [400] revertedEntityUuid %s not found".formatted(
resource.getRevertedAssetTxUuid())));
entity.setRevertedAssetTx(revertedAssetTx);
if (resource.getAssetValue().negate().compareTo(revertedAssetTx.getAssetValue()) != 0) {
throw new ValidationException("given assetValue=" + resource.getAssetValue() +
" but must be negative value from reverted asset tx: " + revertedAssetTx.getAssetValue());
}
}
final var adoptingMembership = determineAdoptingMembership(resource);
if (adoptingMembership != null) {
final var adoptingAssetTx = coopAssetsTransactionRepo.save(createAdoptingAssetTx(entity, adoptingMembership));
entity.setAdoptionAssetTx(adoptingAssetTx);
}
};
private HsOfficeMembershipEntity determineAdoptingMembership(final HsOfficeCoopAssetsTransactionInsertResource resource) {
final var adoptingMembershipUuid = resource.getAdoptingMembershipUuid();
final var adoptingMembershipMemberNumber = resource.getAdoptingMembershipMemberNumber();
if (adoptingMembershipUuid != null && adoptingMembershipMemberNumber != null) {
throw new IllegalArgumentException(
// @formatter:off
resource.getTransactionType() == TRANSFER
? "[400] either adoptingMembership.uuid or adoptingMembership.memberNumber can be given, not both"
: "[400] adoptingMembership.uuid and adoptingMembership.memberNumber must not be given for transactionType="
+ resource.getTransactionType());
// @formatter:on
}
if (adoptingMembershipUuid != null) {
final var adoptingMembership = membershipRepo.findByUuid(adoptingMembershipUuid);
return adoptingMembership.orElseThrow(() ->
new ValidationException(
"adoptingMembership.uuid='" + adoptingMembershipUuid + "' not found or not accessible"));
}
if (adoptingMembershipMemberNumber != null) {
final var adoptingMemberNumber = Integer.valueOf(adoptingMembershipMemberNumber.substring("M-".length()));
final var adoptingMembership = membershipRepo.findMembershipByMemberNumber(adoptingMemberNumber);
if (adoptingMembership != null) {
return adoptingMembership;
}
throw new ValidationException("adoptingMembership.memberNumber='" + adoptingMembershipMemberNumber
+ "' not found or not accessible");
}
if (resource.getTransactionType() == TRANSFER) {
throw new ValidationException(
"either adoptingMembership.uuid or adoptingMembership.memberNumber must be given for transactionType="
+ TRANSFER);
}
return null;
}
private HsOfficeCoopAssetsTransactionEntity createAdoptingAssetTx(
final HsOfficeCoopAssetsTransactionEntity transferAssetTxEntity,
final HsOfficeMembershipEntity adoptingMembership) {
return HsOfficeCoopAssetsTransactionEntity.builder()
.membership(adoptingMembership)
.transactionType(HsOfficeCoopAssetsTransactionType.ADOPTION)
.transferAssetTx(transferAssetTxEntity)
.assetValue(transferAssetTxEntity.getAssetValue().negate())
.comment(transferAssetTxEntity.getComment())
.reference(transferAssetTxEntity.getReference())
.valueDate(transferAssetTxEntity.getValueDate())
.build();
}
}

View File

@ -50,8 +50,10 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, BaseE
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue)
.withProp(HsOfficeCoopAssetsTransactionEntity::getReference)
.withProp(HsOfficeCoopAssetsTransactionEntity::getComment)
.withProp(at -> ofNullable(at.getRevertedAssetTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null))
.withProp(at -> ofNullable(at.getReversalAssetTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null))
.withProp(HsOfficeCoopAssetsTransactionEntity::getRevertedAssetTx)
.withProp(HsOfficeCoopAssetsTransactionEntity::getReversalAssetTx)
.withProp(HsOfficeCoopAssetsTransactionEntity::getAdoptionAssetTx)
.withProp(HsOfficeCoopAssetsTransactionEntity::getTransferAssetTx)
.quotedValues(false);
@Id
@ -95,16 +97,24 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, BaseE
@Column(name = "comment")
private String comment;
/**
* Optionally, the UUID of the corresponding transaction for an reversal transaction.
*/
@OneToOne
// Optionally, the UUID of the corresponding transaction for a reversal transaction.
@OneToOne(cascade = CascadeType.PERSIST) // TODO.impl: can probably be removed after office data migration
@JoinColumn(name = "revertedassettxuuid")
private HsOfficeCoopAssetsTransactionEntity revertedAssetTx;
// and the other way around
@OneToOne(mappedBy = "revertedAssetTx")
private HsOfficeCoopAssetsTransactionEntity reversalAssetTx;
// Optionally, the UUID of the corresponding transaction for a transfer transaction.
@OneToOne(cascade = CascadeType.PERSIST) // TODO.impl: can probably be removed after office data migration
@JoinColumn(name = "assetadoptiontxuuid")
private HsOfficeCoopAssetsTransactionEntity adoptionAssetTx;
// and the other way around
@OneToOne(mappedBy = "adoptionAssetTx")
private HsOfficeCoopAssetsTransactionEntity transferAssetTx;
@Override
public HsOfficeCoopAssetsTransactionEntity load() {
BaseEntity.super.load();

View File

@ -80,12 +80,6 @@ public final class Stringify<B> {
.map(prop -> PropertyValue.of(prop, prop.getter.apply(object)))
.filter(Objects::nonNull)
.filter(PropertyValue::nonEmpty)
.map(propVal -> {
if (propVal.rawValue instanceof Stringifyable stringifyable) {
return new PropertyValue<>(propVal.prop, propVal.rawValue, stringifyable.toShortString());
}
return propVal;
})
.map(propVal -> propName(propVal, "=") + optionallyQuoted(propVal))
.collect(Collectors.joining(separator));
return idProp != null
@ -131,7 +125,11 @@ public final class Stringify<B> {
private record PropertyValue<B>(Property<B> prop, Object rawValue, String value) {
static <B> PropertyValue<B> of(Property<B> prop, Object rawValue) {
return rawValue != null ? new PropertyValue<>(prop, rawValue, rawValue.toString()) : null;
return rawValue != null ? new PropertyValue<>(prop, rawValue, toStringOrShortString(rawValue)) : null;
}
private static String toStringOrShortString(final Object rawValue) {
return rawValue instanceof Stringifyable stringifyable ? stringifyable.toShortString() : rawValue.toString();
}
boolean nonEmpty() {

View File

@ -20,6 +20,15 @@ components:
uuid:
type: string
format: uuid
membership.uuid:
type: string
format: uuid
nullable: false
membership.memberNumber:
type: string
minLength: 9
maxLength: 9
pattern: 'M-[0-9]{7}'
transactionType:
$ref: '#/components/schemas/HsOfficeCoopAssetsTransactionType'
assetValue:
@ -32,20 +41,36 @@ components:
type: string
comment:
type: string
adoptionAssetTx:
# a TRANSFER tx must refer to the related ADOPTION tx
$ref: '#/components/schemas/HsOfficeRelatedCoopAssetsTransaction'
transferAssetTx:
# an ADOPTION tx must refer to the related TRANSFER tx
$ref: '#/components/schemas/HsOfficeRelatedCoopAssetsTransaction'
revertedAssetTx:
$ref: '#/components/schemas/HsOfficeReferencedCoopAssetsTransaction'
# a REVERSAL tx must refer to the related tx, which can be of any type but REVERSAL
$ref: '#/components/schemas/HsOfficeRelatedCoopAssetsTransaction'
reversalAssetTx:
$ref: '#/components/schemas/HsOfficeReferencedCoopAssetsTransaction'
# a reverted tx, which can be any but REVERSAL, must refer to the related REVERSAL tx
$ref: '#/components/schemas/HsOfficeRelatedCoopAssetsTransaction'
HsOfficeReferencedCoopAssetsTransaction:
HsOfficeRelatedCoopAssetsTransaction:
description:
Similar to `HsOfficeCoopAssetsTransaction` but without the self-referencing properties
(`revertedAssetTx` and `reversalAssetTx`), to avoid recursive JSON.
Similar to `HsOfficeCoopAssetsTransaction` but just the UUID of the related property, to avoid recursive JSON.
type: object
properties:
uuid:
type: string
format: uuid
membership.uuid:
type: string
format: uuid
nullable: false
membership.memberNumber:
type: string
minLength: 9
maxLength: 9
pattern: 'M-[0-9]{7}'
transactionType:
$ref: '#/components/schemas/HsOfficeCoopAssetsTransactionType'
assetValue:
@ -58,6 +83,22 @@ components:
type: string
comment:
type: string
adoptionAssetTx.uuid:
description: a TRANSFER tx must refer to the related ADOPTION tx
type: string
format: uuid
transferAssetTx.uuid:
description: an ADOPTION tx must refer to the related TRANSFER tx
type: string
format: uuid
revertedAssetTx.uuid:
description: a REVERSAL tx must refer to the related tx, which can be of any type but REVERSAL
type: string
format: uuid
reversalAssetTx.uuid:
description: a reverted tx, which can be any but REVERSAL, must refer to the related REVERSAL tx
type: string
format: uuid
HsOfficeCoopAssetsTransactionInsert:
type: object
@ -83,6 +124,14 @@ components:
revertedAssetTx.uuid:
type: string
format: uuid
adoptingMembership.uuid:
type: string
format: uuid
adoptingMembership.memberNumber:
type: string
minLength: 9
maxLength: 9
pattern: 'M-[0-9]{7}'
required:
- membership.uuid
- transactionType

View File

@ -16,6 +16,10 @@ components:
uuid:
type: string
format: uuid
membership.uuid:
type: string
format: uuid
nullable: false
transactionType:
$ref: '#/components/schemas/HsOfficeCoopSharesTransactionType'
shareCount:
@ -41,6 +45,10 @@ components:
uuid:
type: string
format: uuid
membership.uuid:
type: string
format: uuid
nullable: false
transactionType:
$ref: '#/components/schemas/HsOfficeCoopSharesTransactionType'
shareCount:

View File

@ -25,6 +25,7 @@ create table if not exists hs_office.coopassettx
assetValue numeric(12,2) not null, -- https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_money
reference varchar(48) not null,
revertedAssetTxUuid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED,
assetAdoptionTxUuid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED,
comment varchar(512)
);
--//
@ -35,9 +36,20 @@ create table if not exists hs_office.coopassettx
-- ----------------------------------------------------------------------------
alter table hs_office.coopassettx
add constraint reverse_entry_missing
check ( transactionType = 'REVERSAL' and revertedAssetTxUuid is not null
or transactionType <> 'REVERSAL' and revertedAssetTxUuid is null);
add constraint reversal_asset_tx_must_have_reverted_asset_tx
check (transactionType <> 'REVERSAL' or revertedAssetTxUuid is not null);
alter table hs_office.coopassettx
add constraint non_reversal_asset_tx_must_not_have_reverted_asset_tx
check (transactionType = 'REVERSAL' or revertedAssetTxUuid is null or transactionType = 'REVERSAL');
alter table hs_office.coopassettx
add constraint transfer_asset_tx_must_have_adopted_asset_tx
check (transactionType <> 'TRANSFER' or assetAdoptionTxUuid is not null);
alter table hs_office.coopassettx
add constraint non_transfer_asset_tx_must_not_have_adopted_asset_tx
check (transactionType = 'TRANSFER' or assetAdoptionTxUuid is null);
--//
-- ============================================================================

View File

@ -15,7 +15,9 @@ create or replace procedure hs_office.coopassettx_create_test_data(
language plpgsql as $$
declare
membership hs_office.membership;
lossEntryUuid uuid;
invalidLossTx uuid;
transferTx uuid;
adoptionTx uuid;
begin
select m.uuid
from hs_office.membership m
@ -25,14 +27,18 @@ begin
into membership;
raise notice 'creating test coopAssetsTransaction: %', givenPartnerNumber || givenMemberNumberSuffix;
lossEntryUuid := uuid_generate_v4();
invalidLossTx := uuid_generate_v4();
transferTx := uuid_generate_v4();
adoptionTx := uuid_generate_v4();
insert
into hs_office.coopassettx(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment, revertedAssetTxUuid)
into hs_office.coopassettx(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment, revertedAssetTxUuid, assetAdoptionTxUuid)
values
(uuid_generate_v4(), membership.uuid, 'DEPOSIT', '2010-03-15', 320.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-1', 'initial deposit', null),
(uuid_generate_v4(), membership.uuid, 'DISBURSAL', '2021-09-01', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-2', 'partial disbursal', null),
(lossEntryUuid, membership.uuid, 'DEPOSIT', '2022-10-20', 128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some loss', null),
(uuid_generate_v4(), membership.uuid, 'REVERSAL', '2022-10-21', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some reversal', lossEntryUuid);
(uuid_generate_v4(), membership.uuid, 'DEPOSIT', '2010-03-15', 320.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-1', 'initial deposit', null, null),
(uuid_generate_v4(), membership.uuid, 'DISBURSAL', '2021-09-01', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-2', 'partial disbursal', null, null),
(invalidLossTx, membership.uuid, 'DEPOSIT', '2022-10-20', 128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some loss', null, null),
(uuid_generate_v4(), membership.uuid, 'REVERSAL', '2022-10-21', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some reversal', invalidLossTx, null),
(transferTx, membership.uuid, 'TRANSFER', '2023-12-31', -192.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some reversal', null, adoptionTx),
(adoptionTx, membership.uuid, 'ADOPTION', '2023-12-31', 192.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some reversal', null, null);
end; $$;
--//