adamsaghy commented on code in PR #3269:
URL: https://github.com/apache/fineract/pull/3269#discussion_r1238593625
##########
fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnersWriteServiceImpl.java:
##########
@@ -150,6 +170,27 @@ private ExternalAssetOwnerTransfer
fetchAndValidateEffectiveTransferForBuyback(f
return effectiveTransfers.get(0);
}
+ private ExternalAssetOwnerTransfer
fetchAndValidateEffectiveTransferForCancel(final Long transferId) {
+ ExternalAssetOwnerTransfer selectedTransfer =
externalAssetOwnerTransferRepository.findById(transferId)
+ .orElseThrow(() -> new
ExternalAssetOwnerInitiateTransferException(
+ String.format("This loan cannot be cancel, transfer
with id %s does not exist", transferId)));
+
+ List<ExternalAssetOwnerTransfer> effective =
externalAssetOwnerTransferRepository
+ .findEffectiveTransfers(selectedTransfer.getLoanId(),
selectedTransfer.getSettlementDate());
+ if (effective.size() == 0) {
+ throw new ExternalAssetOwnerInitiateTransferException(
+ String.format("This loan cannot be cancel, there is no
effective transfer for this loan"));
+ } else if (!effective.get(0).getId().equals(selectedTransfer.getId()))
{
+ throw new ExternalAssetOwnerInitiateTransferException(
+ String.format("This loan cannot be cancel, selected
transfer is not effective or not the latest"));
+ } else if (selectedTransfer.getStatus() !=
ExternalTransferStatus.PENDING
+ && selectedTransfer.getStatus() !=
ExternalTransferStatus.BUYBACK) {
+ throw new ExternalAssetOwnerInitiateTransferException(
+ "This loan cannot be cancel, the selected transfer status
is not pending or buyback");
Review Comment:
This loan cannot be cancel -> This loan cannot be cancelled
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]