determine reverse entry for asset transaction adjustment in legacy data import
This commit is contained in:
parent
82cd5a9ac6
commit
abba21688e
@ -395,8 +395,8 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
34001=CoopAssetsTransaction(M-1002000: 2016-12-31, CLEARING, -8.00, legacy data import, for cancellation D),
|
34001=CoopAssetsTransaction(M-1002000: 2016-12-31, CLEARING, -8.00, legacy data import, for cancellation D),
|
||||||
34002=CoopAssetsTransaction(M-1002000: 2016-12-31, DISBURSAL, -100.00, legacy data import, for cancellation D),
|
34002=CoopAssetsTransaction(M-1002000: 2016-12-31, DISBURSAL, -100.00, legacy data import, for cancellation D),
|
||||||
34003=CoopAssetsTransaction(M-1002000: 2016-12-31, LOSS, -20.00, legacy data import, for cancellation D),
|
34003=CoopAssetsTransaction(M-1002000: 2016-12-31, LOSS, -20.00, legacy data import, for cancellation D),
|
||||||
35001=CoopAssetsTransaction(M-1909000: 2024-01-15, DEPOSIT, 128.00, legacy data import, for subscription E),
|
35001=CoopAssetsTransaction(M-1909000: 2024-01-15, DEPOSIT, 128.00, legacy data import, for subscription E, M-1909000:-128.00),
|
||||||
35002=CoopAssetsTransaction(M-1909000: 2024-01-20, ADJUSTMENT, -128.00, legacy data import, chargeback for subscription E)
|
35002=CoopAssetsTransaction(M-1909000: 2024-01-20, ADJUSTMENT, -128.00, legacy data import, chargeback for subscription E, M-1909000:+128.00)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
@ -852,6 +852,18 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
.reference("legacy data import") // TODO.spec: or use value from comment column?
|
.reference("legacy data import") // TODO.spec: or use value from comment column?
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
if (assetTransaction.getTransactionType() == HsOfficeCoopAssetsTransactionType.ADJUSTMENT) {
|
||||||
|
final var negativeValue = assetTransaction.getAssetValue().negate();
|
||||||
|
final var reverseEntry = coopAssets.values().stream().filter(a ->
|
||||||
|
a.getTransactionType() != HsOfficeCoopAssetsTransactionType.ADJUSTMENT &&
|
||||||
|
a.getMembership() == assetTransaction.getMembership() &&
|
||||||
|
a.getAssetValue().equals(negativeValue))
|
||||||
|
.findAny()
|
||||||
|
.orElseThrow(() -> new IllegalStateException("cannot determine asset reverse entry for adjustment " + assetTransaction));
|
||||||
|
reverseEntry.setReverseEntry(assetTransaction);
|
||||||
|
assetTransaction.setReverseEntry(reverseEntry);
|
||||||
|
}
|
||||||
|
|
||||||
coopAssets.put(rec.getInteger("member_asset_id"), assetTransaction);
|
coopAssets.put(rec.getInteger("member_asset_id"), assetTransaction);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user