FINERACT-1706-Allow-Chargeback-on-payment-type-transactions

This commit is contained in:
Ruchi Dhamankar
2023-05-03 13:41:44 +02:00
committed by Adam Saghy
parent 5238e29449
commit c7e777c37c
3 changed files with 280 additions and 4 deletions
@@ -567,6 +567,10 @@ public class LoanTransaction extends AbstractAuditableWithUTCDateTimeCustom {
|| isChargeAdjustment();
}
public boolean isTypeAllowedForChargeback() {
return isRepayment() || isMerchantIssuedRefund() || isPayoutRefund() || isGoodwillCredit();
}
public boolean isRepayment() {
return LoanTransactionType.REPAYMENT.equals(getTypeOf()) && isNotReversed();
}
@@ -1235,10 +1235,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
transactionId);
}
if (!loanTransaction.isRepaymentLikeType()) {
throw new PlatformServiceUnavailableException("error.msg.loan.chargeback.operation.not.allowed",
"Loan transaction:" + transactionId + " chargeback not allowed as loan transaction is not repayment type, its type is "
+ loanTransaction.getTypeOf().getCode(),
if (!loanTransaction.isTypeAllowedForChargeback()) {
throw new PlatformServiceUnavailableException(
"error.msg.loan.chargeback.operation.not.allowed", "Loan transaction:" + transactionId
+ " chargeback not allowed for loan transaction type, its type is " + loanTransaction.getTypeOf().getCode(),
transactionId);
}