FINERACT-822 Enable CompareToZero check
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
e295bef743
commit
aed3e41ca4
@@ -309,7 +309,6 @@ tasks.withType(JavaCompile) {
|
||||
"UnnecessaryParentheses",
|
||||
"ClassCanBeStatic",
|
||||
"MissingCasesInEnumSwitch",
|
||||
"CompareToZero",
|
||||
"OperatorPrecedence",
|
||||
"MixedMutabilityReturnType",
|
||||
"SameNameButDifferent",
|
||||
@@ -332,11 +331,13 @@ tasks.withType(JavaCompile) {
|
||||
"UnusedNestedClass",
|
||||
"UndefinedEquals",
|
||||
"JdkObsolete",
|
||||
"OperatorPrecedence",
|
||||
"NarrowingCompoundAssignment"
|
||||
"OperatorPrecedence"
|
||||
)
|
||||
//TODO gradually enable these checks
|
||||
error( "DefaultCharset",
|
||||
"RemoveUnusedImports",
|
||||
"WaitNotInLoop",
|
||||
"ThreeLetterTimeZoneID",
|
||||
// "ReturnMissingNullable",
|
||||
// "InconsistentOverloads",
|
||||
// "MethodCanBeStatic",
|
||||
@@ -348,7 +349,6 @@ tasks.withType(JavaCompile) {
|
||||
// "MultiVariableDeclaration",
|
||||
// "PackageLocation",
|
||||
// "PrivateConstructorForNoninstantiableModule",
|
||||
// "RemoveUnusedImports",
|
||||
// "UnnecessaryStaticImport",
|
||||
// "UseBinds",
|
||||
// "WildcardImport",
|
||||
@@ -357,11 +357,9 @@ tasks.withType(JavaCompile) {
|
||||
// "FloatCast",
|
||||
// "ClassNewInstance",
|
||||
// "ConstructorInvokesOverridable",
|
||||
// "ThreeLetterTimeZoneID",
|
||||
// "UnsafeFinalization",
|
||||
// "MutableMethodReturnType",
|
||||
// "SynchronizeOnNonFinalField",
|
||||
// "WaitNotInLoop",
|
||||
// "SwitchDefault",
|
||||
// "ReachabilityFenceUsage",
|
||||
// "BoxedPrimitiveConstructor",
|
||||
|
||||
+1
-1
@@ -231,7 +231,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
||||
}
|
||||
if (this.status != null) {
|
||||
if ((Double) this.status.get("id") >= 0) {
|
||||
hash += (Double) this.status.get("id");
|
||||
hash = (int) (hash + (Double) this.status.get("id"));
|
||||
}
|
||||
if ((String) this.status.get("code") != null) {
|
||||
hash += this.status.get("code").hashCode();
|
||||
|
||||
+9
-9
@@ -66,7 +66,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
FinancialActivity.LIABILITY_TRANSFER.getValue(), savingsProductId, paymentTypeId, savingsId, transactionId,
|
||||
transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate,
|
||||
@@ -77,7 +77,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
@@ -90,7 +90,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
FinancialActivity.LIABILITY_TRANSFER.getValue(), CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate,
|
||||
@@ -101,7 +101,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(),
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CashAccountsForSavings.SAVINGS_REFERENCE.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
@@ -154,12 +154,12 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
else if (savingsTransactionDTO.getTransactionType().isInterestPosting() && savingsTransactionDTO.isOverdraftTransaction()) {
|
||||
// Post journal entry if earned interest amount is greater than
|
||||
// zero
|
||||
if (savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CashAccountsForSavings.INTEREST_ON_SAVINGS.getValue(),
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
transactionId, transactionDate, overdraftAmount, isReversal);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CashAccountsForSavings.INTEREST_ON_SAVINGS.getValue(),
|
||||
CashAccountsForSavings.SAVINGS_CONTROL.getValue(), savingsProductId, paymentTypeId, savingsId,
|
||||
@@ -171,7 +171,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
else if (savingsTransactionDTO.getTransactionType().isInterestPosting()) {
|
||||
// Post journal entry if earned interest amount is greater than
|
||||
// zero
|
||||
if (savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CashAccountsForSavings.INTEREST_ON_SAVINGS.getValue(), CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
@@ -193,7 +193,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL, CashAccountsForSavings.INCOME_FROM_PENALTIES,
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, overdraftAmount, isReversal,
|
||||
penaltyPayments);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL, CashAccountsForSavings.INCOME_FROM_PENALTIES,
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate,
|
||||
@@ -204,7 +204,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
CashAccountsForSavings.OVERDRAFT_PORTFOLIO_CONTROL, CashAccountsForSavings.INCOME_FROM_FEES,
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, overdraftAmount, isReversal,
|
||||
feePayments);
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount.subtract(overdraftAmount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavingsCharges(office, currencyCode,
|
||||
CashAccountsForSavings.SAVINGS_CONTROL, CashAccountsForSavings.INCOME_FROM_FEES, savingsProductId,
|
||||
paymentTypeId, savingsId, transactionId, transactionDate, amount.subtract(overdraftAmount), isReversal,
|
||||
|
||||
+4
-4
@@ -76,7 +76,7 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
public void createJournalEntriesForRedeem(final Long shareAccountId, final Long shareProductId, final String currencyCode,
|
||||
final Date transactionDate, final String transactionId, final Office office, final Long paymentTypeId, final BigDecimal amount,
|
||||
final BigDecimal chargeAmount, final List<ChargePaymentDTO> feePayments) {
|
||||
if (chargeAmount == null || chargeAmount.compareTo(BigDecimal.ZERO) != 1) {
|
||||
if (chargeAmount == null || chargeAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CashAccountsForShares.SHARES_EQUITY.getValue(),
|
||||
CashAccountsForShares.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
transactionDate, amount);
|
||||
@@ -94,7 +94,7 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
SharesTransactionDTO transactionDTO, final Date transactionDate, final String transactionId, final Office office,
|
||||
final Long paymentTypeId, final BigDecimal amount, final BigDecimal chargeAmount, final List<ChargePaymentDTO> feePayments) {
|
||||
if (transactionDTO.getTransactionStatus().isApplied()) {
|
||||
if (chargeAmount == null || chargeAmount.compareTo(BigDecimal.ZERO) != 1) {
|
||||
if (chargeAmount == null || chargeAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CashAccountsForShares.SHARES_REFERENCE.getValue(),
|
||||
CashAccountsForShares.SHARES_SUSPENSE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
transactionDate, amount);
|
||||
@@ -108,14 +108,14 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
}
|
||||
} else if (transactionDTO.getTransactionStatus().isApproved()) {
|
||||
BigDecimal amountForJE = amount;
|
||||
if (chargeAmount != null && chargeAmount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (chargeAmount != null && chargeAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
amountForJE = amount.subtract(chargeAmount);
|
||||
}
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CashAccountsForShares.SHARES_SUSPENSE.getValue(),
|
||||
CashAccountsForShares.SHARES_EQUITY.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
transactionDate, amountForJE);
|
||||
} else if (transactionDTO.getTransactionStatus().isRejected()) {
|
||||
if (chargeAmount != null && chargeAmount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (chargeAmount != null && chargeAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.helper.revertCashBasedJournalEntryForSharesCharges(office, currencyCode, CashAccountsForShares.INCOME_FROM_FEES,
|
||||
shareProductId, shareAccountId, transactionId, transactionDate, chargeAmount, feePayments);
|
||||
this.helper.createDebitJournalEntryForShares(office, currencyCode, CashAccountsForShares.SHARES_SUSPENSE.getValue(), shareProductId, paymentTypeId, shareAccountId,
|
||||
|
||||
+6
-6
@@ -708,7 +708,7 @@ public class DataValidatorBuilder {
|
||||
|
||||
public DataValidatorBuilder comapareMinimumAndMaximumAmounts(final BigDecimal minimumBalance, final BigDecimal maximumBalance) {
|
||||
if (minimumBalance != null && maximumBalance != null) {
|
||||
if (maximumBalance.compareTo(minimumBalance) == -1) {
|
||||
if (maximumBalance.compareTo(minimumBalance) < 0) {
|
||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
||||
.append(this.parameter).append(".is.not.within.expected.range");
|
||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(" minimum amount ")
|
||||
@@ -725,7 +725,7 @@ public class DataValidatorBuilder {
|
||||
public DataValidatorBuilder inMinAndMaxAmountRange(final BigDecimal minimumAmount, final BigDecimal maximumAmount) {
|
||||
if (minimumAmount != null && maximumAmount != null && this.value != null) {
|
||||
final BigDecimal amount = BigDecimal.valueOf(Double.valueOf(this.value.toString()));
|
||||
if (amount.compareTo(minimumAmount) == -1 || amount.compareTo(maximumAmount) == 1) {
|
||||
if (amount.compareTo(minimumAmount) < 0 || amount.compareTo(maximumAmount) > 0) {
|
||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
||||
.append(this.parameter).append(".amount.is.not.within.min.max.range");
|
||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The ").append(this.parameter).append(" amount ")
|
||||
@@ -743,7 +743,7 @@ public class DataValidatorBuilder {
|
||||
public DataValidatorBuilder notLessThanMin(final BigDecimal min) {
|
||||
if (min != null && this.value != null) {
|
||||
final BigDecimal amount = BigDecimal.valueOf(Double.valueOf(this.value.toString()));
|
||||
if (amount.compareTo(min) == -1) {
|
||||
if (amount.compareTo(min) < 0) {
|
||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
||||
.append(this.parameter).append(".is.less.than.min");
|
||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The ").append(this.parameter).append(" value ")
|
||||
@@ -760,7 +760,7 @@ public class DataValidatorBuilder {
|
||||
public DataValidatorBuilder notGreaterThanMax(final BigDecimal max) {
|
||||
if (max != null && this.value != null) {
|
||||
final BigDecimal amount = BigDecimal.valueOf(Double.valueOf(this.value.toString()));
|
||||
if (amount.compareTo(max) == 1) {
|
||||
if (amount.compareTo(max) > 0) {
|
||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
||||
.append(this.parameter).append(".is.greater.than.max");
|
||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The ").append(this.parameter).append(" value ")
|
||||
@@ -776,7 +776,7 @@ public class DataValidatorBuilder {
|
||||
|
||||
public DataValidatorBuilder comapareMinAndMaxOfTwoBigDecmimalNos(final BigDecimal min, final BigDecimal max) {
|
||||
if (min != null && max != null) {
|
||||
if (max.compareTo(min) == -1) {
|
||||
if (max.compareTo(min) < 0) {
|
||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
||||
.append(this.parameter).append(".is.not.within.expected.range");
|
||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The ").append(" min number ").append(min)
|
||||
@@ -1018,4 +1018,4 @@ public class DataValidatorBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -154,7 +154,7 @@ public class InterestRateChartSlabDataValidator {
|
||||
}
|
||||
|
||||
if (amountRangeFrom != null && amountRangeTo != null) {
|
||||
if (amountRangeFrom.compareTo(amountRangeTo) > 1) {
|
||||
if (amountRangeFrom.compareTo(amountRangeTo) > 0) {
|
||||
baseDataValidator.parameter(amountRangeFromParamName).value(fromPeriod).failWithCode("from.amount.greater.than.to.amount");
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ public class InterestRateChartSlabDataValidator {
|
||||
}
|
||||
|
||||
if (amountRangeFrom != null && amountRangeTo != null) {
|
||||
if (amountRangeFrom.compareTo(amountRangeTo) > 1) {
|
||||
if (amountRangeFrom.compareTo(amountRangeTo) > 0) {
|
||||
baseDataValidator.parameter(fromPeriodParamName).value(fromPeriod).failWithCode("fromperiod.greater.than.toperiod");
|
||||
}
|
||||
}
|
||||
@@ -283,4 +283,4 @@ public class InterestRateChartSlabDataValidator {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -163,7 +163,7 @@ public class InterestRateChartSlabFields {
|
||||
|
||||
public boolean isFromPeriodGreaterThanToPeriod() {
|
||||
boolean isGreater = false;
|
||||
if (this.toPeriod != null && this.fromPeriod.compareTo(this.toPeriod) > 1) {
|
||||
if (this.toPeriod != null && this.fromPeriod.compareTo(this.toPeriod) > 0) {
|
||||
isGreater = true;
|
||||
}
|
||||
return isGreater;
|
||||
@@ -171,7 +171,7 @@ public class InterestRateChartSlabFields {
|
||||
|
||||
public boolean isAmountRangeFromGreaterThanTo() {
|
||||
boolean isGreater = false;
|
||||
if (this.amountRangeFrom != null && this.amountRangeTo != null && this.amountRangeFrom.compareTo(this.amountRangeTo) > 1) {
|
||||
if (this.amountRangeFrom != null && this.amountRangeTo != null && this.amountRangeFrom.compareTo(this.amountRangeTo) > 0) {
|
||||
isGreater = true;
|
||||
}
|
||||
return isGreater;
|
||||
@@ -281,8 +281,8 @@ public class InterestRateChartSlabFields {
|
||||
return true;
|
||||
} else if (this.amountRangeTo == null) {
|
||||
return true;
|
||||
} else if (that.amountRangeTo == null) { return that.amountRangeFrom.compareTo(this.amountRangeTo) < 1; }
|
||||
return this.amountRangeFrom.compareTo(that.amountRangeTo) < 1 && that.amountRangeFrom.compareTo(this.amountRangeTo) < 1;
|
||||
} else if (that.amountRangeTo == null) { return that.amountRangeFrom.compareTo(this.amountRangeTo) <= 0; }
|
||||
return this.amountRangeFrom.compareTo(that.amountRangeTo) <= 0 && that.amountRangeFrom.compareTo(this.amountRangeTo) <= 0;
|
||||
}
|
||||
|
||||
public boolean isAmountSame(final InterestRateChartSlabFields that) {
|
||||
@@ -365,4 +365,4 @@ public class InterestRateChartSlabFields {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -2203,7 +2203,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
// Approved amount has to be less than or equal to principal
|
||||
// amount demanded
|
||||
|
||||
if (approvedLoanAmount.compareTo(this.proposedPrincipal) == -1) {
|
||||
if (approvedLoanAmount.compareTo(this.proposedPrincipal) < 0) {
|
||||
|
||||
this.approvedPrincipal = approvedLoanAmount;
|
||||
|
||||
@@ -2217,7 +2217,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
actualChanges.put(LoanApiConstants.approvedLoanAmountParameterName, approvedLoanAmount);
|
||||
actualChanges.put(LoanApiConstants.disbursementPrincipalParameterName, approvedLoanAmount);
|
||||
} else if (approvedLoanAmount.compareTo(this.proposedPrincipal) == 1) {
|
||||
} else if (approvedLoanAmount.compareTo(this.proposedPrincipal) > 0) {
|
||||
final String errorMessage = "Loan approved amount can't be greater than loan amount demanded.";
|
||||
throw new InvalidLoanStateTransitionException("approval", "amount.can't.be.greater.than.loan.amount.demanded",
|
||||
errorMessage, this.proposedPrincipal, approvedLoanAmount);
|
||||
@@ -2511,7 +2511,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
totalAmount = totalAmount.add(disbursementDetails.principal());
|
||||
}
|
||||
this.loanRepaymentScheduleDetail.setPrincipal(setPrincipalAmount);
|
||||
if (totalAmount.compareTo(this.approvedPrincipal) == 1) {
|
||||
if (totalAmount.compareTo(this.approvedPrincipal) > 0) {
|
||||
final String errorMsg = "Loan can't be disbursed,disburse amount is exceeding approved principal ";
|
||||
throw new LoanDisbursalException(errorMsg, "disburse.amount.must.be.less.than.approved.principal", principalDisbursed,
|
||||
this.approvedPrincipal);
|
||||
@@ -2519,7 +2519,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
} else {
|
||||
this.loanRepaymentScheduleDetail.setPrincipal(this.loanRepaymentScheduleDetail.getPrincipal().minus(diff).getAmount());
|
||||
}
|
||||
if (!(this.loanProduct().isMultiDisburseLoan()) && diff.compareTo(BigDecimal.ZERO) == -1) {
|
||||
if (!(this.loanProduct().isMultiDisburseLoan()) && diff.compareTo(BigDecimal.ZERO) < 0) {
|
||||
final String errorMsg = "Loan can't be disbursed,disburse amount is exceeding approved amount ";
|
||||
throw new LoanDisbursalException(errorMsg, "disburse.amount.must.be.less.than.approved.amount", principalDisbursed,
|
||||
this.loanRepaymentScheduleDetail.getPrincipal().getAmount());
|
||||
@@ -3004,7 +3004,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
existingReversedTransactionIds.addAll(findExistingReversedTransactionIds());
|
||||
|
||||
if (status().isOverpaid()) {
|
||||
if (this.totalOverpaid.compareTo(loanTransaction.getAmount(getCurrency()).getAmount()) == -1) {
|
||||
if (this.totalOverpaid.compareTo(loanTransaction.getAmount(getCurrency()).getAmount()) < 0) {
|
||||
final String errorMessage = "The refund amount must be less than or equal to overpaid amount ";
|
||||
throw new InvalidLoanStateTransitionException("transaction", "is.exceeding.overpaid.amount", errorMessage,
|
||||
this.totalOverpaid, loanTransaction.getAmount(getCurrency()).getAmount());
|
||||
@@ -3258,7 +3258,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
boolean isAllChargesPaid = true;
|
||||
for (final LoanCharge loanCharge : this.charges) {
|
||||
if (loanCharge.isActive() && loanCharge.amount().compareTo(BigDecimal.ZERO) == 1 && !(loanCharge.isPaid() || loanCharge.isWaived())) {
|
||||
if (loanCharge.isActive() && loanCharge.amount().compareTo(BigDecimal.ZERO) > 0 && !(loanCharge.isPaid() || loanCharge.isWaived())) {
|
||||
isAllChargesPaid = false;
|
||||
break;
|
||||
}
|
||||
|
||||
+2
-2
@@ -567,7 +567,7 @@ public class LoanCharge extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
private static boolean isGreaterThanZero(final BigDecimal value) {
|
||||
return value.compareTo(BigDecimal.ZERO) == 1;
|
||||
return value.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
public LoanChargeCommand toCommand() {
|
||||
@@ -1037,4 +1037,4 @@ public class LoanCharge extends AbstractPersistableCustom {
|
||||
public boolean isDueDateCharge() {
|
||||
return this.dueDate != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ public class GuarantorFundingDetails extends AbstractPersistableCustom {
|
||||
public void undoReleaseFunds(final BigDecimal amount) {
|
||||
this.amountReleased = getAmountReleased().subtract(amount);
|
||||
this.amountRemaining = getAmountRemaining().add(amount);
|
||||
if (getStatus().isCompleted() && this.amountRemaining.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (getStatus().isCompleted() && this.amountRemaining.compareTo(BigDecimal.ZERO) > 0) {
|
||||
this.updateStatus(GuarantorFundStatusType.ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -141,17 +141,17 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.guarantor");
|
||||
if (actualSelfAmount.compareTo(minSelfAmount) == -1) {
|
||||
if (actualSelfAmount.compareTo(minSelfAmount) < 0) {
|
||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(GuarantorConstants.GUARANTOR_SELF_GUARANTEE_ERROR,
|
||||
minSelfAmount);
|
||||
}
|
||||
|
||||
if (actualExtGuarantee.compareTo(minExtGuarantee) == -1) {
|
||||
if (actualExtGuarantee.compareTo(minExtGuarantee) < 0) {
|
||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(GuarantorConstants.GUARANTOR_EXTERNAL_GUARANTEE_ERROR,
|
||||
minExtGuarantee);
|
||||
}
|
||||
actualAmount = actualAmount.add(actualExtGuarantee).add(actualSelfAmount);
|
||||
if (actualAmount.compareTo(mandatoryAmount) == -1) {
|
||||
if (actualAmount.compareTo(mandatoryAmount) < 0) {
|
||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(GuarantorConstants.GUARANTOR_MANDATORY_GUARANTEE_ERROR,
|
||||
mandatoryAmount);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
if (guarantorFundingDetails.getStatus().isActive()) {
|
||||
SavingsAccount savingsAccount = guarantorFundingDetails.getLinkedSavingsAccount();
|
||||
savingsAccount.holdFunds(guarantorFundingDetails.getAmount());
|
||||
if (savingsAccount.getWithdrawableBalance().compareTo(BigDecimal.ZERO) == -1) {
|
||||
if (savingsAccount.getWithdrawableBalance().compareTo(BigDecimal.ZERO) < 0) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.guarantor");
|
||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(GuarantorConstants.GUARANTOR_INSUFFICIENT_BALANCE_ERROR,
|
||||
@@ -195,7 +195,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
@Override
|
||||
public void releaseGuarantor(final GuarantorFundingDetails guarantorFundingDetails, final LocalDate transactionDate) {
|
||||
BigDecimal amoutForWithdraw = guarantorFundingDetails.getAmountRemaining();
|
||||
if (amoutForWithdraw.compareTo(BigDecimal.ZERO) == 1 && (guarantorFundingDetails.getStatus().isActive())) {
|
||||
if (amoutForWithdraw.compareTo(BigDecimal.ZERO) > 0 && (guarantorFundingDetails.getStatus().isActive())) {
|
||||
SavingsAccount savingsAccount = guarantorFundingDetails.getLinkedSavingsAccount();
|
||||
savingsAccount.releaseFunds(amoutForWithdraw);
|
||||
DepositAccountOnHoldTransaction onHoldTransaction = DepositAccountOnHoldTransaction.release(savingsAccount, amoutForWithdraw,
|
||||
@@ -218,7 +218,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
*/
|
||||
@Override
|
||||
public void transaferFundsFromGuarantor(final Loan loan) {
|
||||
if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) != 1) { return; }
|
||||
if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) <= 0) { return; }
|
||||
final List<Guarantor> existGuarantorList = this.guarantorRepository.findByLoan(loan);
|
||||
final boolean isRegularTransaction = true;
|
||||
final boolean isExceptionForBalanceCheck = true;
|
||||
@@ -252,7 +252,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
releaseLoanIds.put(loanId, guarantorFundingDetails.getId());
|
||||
try {
|
||||
BigDecimal remainingAmount = guarantorFundingDetails.getAmountRemaining();
|
||||
if (loan.getGuaranteeAmount().compareTo(loan.getPrincpal().getAmount()) == 1) {
|
||||
if (loan.getGuaranteeAmount().compareTo(loan.getPrincpal().getAmount()) > 0) {
|
||||
remainingAmount = remainingAmount.multiply(loan.getPrincpal().getAmount()).divide(loan.getGuaranteeAmount(),
|
||||
MoneyHelper.getRoundingMode());
|
||||
}
|
||||
@@ -295,7 +295,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
*/
|
||||
private void reverseAllFundTransaction(final Loan loan) {
|
||||
|
||||
if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
final List<Guarantor> existGuarantorList = this.guarantorRepository.findByLoan(loan);
|
||||
List<GuarantorFundingDetails> guarantorFundingDetailList = new ArrayList<>();
|
||||
for (Guarantor guarantor : existGuarantorList) {
|
||||
@@ -349,7 +349,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
null, onHoldTransaction);
|
||||
guarantorFundingDetails.addGuarantorFundingTransactions(guarantorFundingTransaction);
|
||||
guarantorFundingDetailList.add(guarantorFundingDetails);
|
||||
if (savingsAccount.getWithdrawableBalance().compareTo(BigDecimal.ZERO) == -1) {
|
||||
if (savingsAccount.getWithdrawableBalance().compareTo(BigDecimal.ZERO) < 0) {
|
||||
insufficientBalanceIds.add(savingsAccount.getId());
|
||||
}
|
||||
savingsAccount.updateSavingsAccountSummary(savingsAccount.getTransactions());
|
||||
@@ -382,7 +382,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
*/
|
||||
private void releaseGuarantorFunds(final LoanTransaction loanTransaction) {
|
||||
final Loan loan = loanTransaction.getLoan();
|
||||
if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
final List<Guarantor> existGuarantorList = this.guarantorRepository.findByLoan(loan);
|
||||
List<GuarantorFundingDetails> externalGuarantorList = new ArrayList<>();
|
||||
List<GuarantorFundingDetails> selfGuarantorList = new ArrayList<>();
|
||||
@@ -413,7 +413,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
BigDecimal amountLeft = calculateAndRelaseGuarantorFunds(externalGuarantorList, guarantorGuarantee, amountForRelease,
|
||||
loanTransaction, accountOnHoldTransactions);
|
||||
|
||||
if (amountLeft.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amountLeft.compareTo(BigDecimal.ZERO) > 0) {
|
||||
calculateAndRelaseGuarantorFunds(selfGuarantorList, selfGuarantee, amountLeft, loanTransaction,
|
||||
accountOnHoldTransactions);
|
||||
externalGuarantorList.addAll(selfGuarantorList);
|
||||
@@ -435,7 +435,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
*/
|
||||
private void releaseAllGuarantors(final LoanTransaction loanTransaction) {
|
||||
Loan loan = loanTransaction.getLoan();
|
||||
if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
final List<Guarantor> existGuarantorList = this.guarantorRepository.findByLoan(loan);
|
||||
List<GuarantorFundingDetails> saveGuarantorFundingDetails = new ArrayList<>();
|
||||
List<DepositAccountOnHoldTransaction> onHoldTransactions = new ArrayList<>();
|
||||
@@ -443,7 +443,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
final List<GuarantorFundingDetails> fundingDetails = guarantor.getGuarantorFundDetails();
|
||||
for (GuarantorFundingDetails guarantorFundingDetails : fundingDetails) {
|
||||
BigDecimal amoutForRelease = guarantorFundingDetails.getAmountRemaining();
|
||||
if (amoutForRelease.compareTo(BigDecimal.ZERO) == 1 && (guarantorFundingDetails.getStatus().isActive())) {
|
||||
if (amoutForRelease.compareTo(BigDecimal.ZERO) > 0 && (guarantorFundingDetails.getStatus().isActive())) {
|
||||
SavingsAccount savingsAccount = guarantorFundingDetails.getLinkedSavingsAccount();
|
||||
savingsAccount.releaseFunds(amoutForRelease);
|
||||
DepositAccountOnHoldTransaction onHoldTransaction = DepositAccountOnHoldTransaction.release(savingsAccount,
|
||||
@@ -495,7 +495,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
for (GuarantorFundingDetails fundingDetails : guarantorList) {
|
||||
BigDecimal guarantorAmount = amountForRelease.multiply(fundingDetails.getAmountRemaining()).divide(totalGuaranteeAmount,
|
||||
MoneyHelper.getRoundingMode());
|
||||
if (fundingDetails.getAmountRemaining().compareTo(guarantorAmount) < 1) {
|
||||
if (fundingDetails.getAmountRemaining().compareTo(guarantorAmount) <= 0) {
|
||||
guarantorAmount = fundingDetails.getAmountRemaining();
|
||||
}
|
||||
fundingDetails.releaseFunds(guarantorAmount);
|
||||
|
||||
+2
-2
@@ -278,7 +278,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
||||
|
||||
// will check for EMI amount greater than interest calculated
|
||||
if (loanApplicationTerms.getFixedEmiAmount() != null
|
||||
&& loanApplicationTerms.getFixedEmiAmount().compareTo(principalInterestForThisPeriod.interest().getAmount()) == -1) {
|
||||
&& loanApplicationTerms.getFixedEmiAmount().compareTo(principalInterestForThisPeriod.interest().getAmount()) < 0) {
|
||||
String errorMsg = "EMI amount must be greater than : " + principalInterestForThisPeriod.interest().getAmount();
|
||||
throw new MultiDisbursementEmiAmountException(errorMsg, principalInterestForThisPeriod.interest().getAmount(),
|
||||
loanApplicationTerms.getFixedEmiAmount());
|
||||
@@ -2797,4 +2797,4 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ public class LoanScheduleCalculationPlatformServiceImpl implements LoanScheduleC
|
||||
BigDecimal disbursedAmount = loan.getDisbursedAmount();
|
||||
BigDecimal principalRepaid = loan.getLoanSummary().getTotalPrincipalRepaid();
|
||||
BigDecimal principalWrittenOff = loan.getLoanSummary().getTotalPrincipalWrittenOff();
|
||||
if (disbursedAmount.subtract(principalWrittenOff).subtract(principalRepaid).compareTo(BigDecimal.ZERO) != 1) { return; }
|
||||
if (disbursedAmount.subtract(principalWrittenOff).subtract(principalRepaid).compareTo(BigDecimal.ZERO) <= 0) { return; }
|
||||
}
|
||||
MonetaryCurrency currency = loan.getCurrency();
|
||||
Money totalPrincipal = Money.zero(currency);
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ public class LoanScheduleHistoryReadPlatformServiceImpl implements LoanScheduleH
|
||||
periods.add(periodData);
|
||||
this.outstandingLoanPrincipalBalance = this.outstandingLoanPrincipalBalance.add(data.amount());
|
||||
} else if (data.isDueForDisbursement(fromDate, dueDate)
|
||||
&& this.outstandingLoanPrincipalBalance.compareTo(BigDecimal.ZERO) == 1) {
|
||||
&& this.outstandingLoanPrincipalBalance.compareTo(BigDecimal.ZERO) > 0) {
|
||||
principal = principal.add(data.amount());
|
||||
final LoanSchedulePeriodData periodData = LoanSchedulePeriodData.disbursementOnlyPeriod(
|
||||
data.disbursementDate(), data.amount(), BigDecimal.ZERO, data.isDisbursed());
|
||||
|
||||
+2
-2
@@ -1144,7 +1144,7 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
i++;
|
||||
} while (i < variationArray.size());
|
||||
|
||||
if (tatalDisbursement.compareTo(totalPrincipal) == 1) {
|
||||
if (tatalDisbursement.compareTo(totalPrincipal) > 0) {
|
||||
baseDataValidator.reset().parameter(LoanApiConstants.disbursementPrincipalParameterName)
|
||||
.failWithCode(LoanApiConstants.APPROVED_AMOUNT_IS_LESS_THAN_SUM_OF_TRANCHES);
|
||||
}
|
||||
@@ -1248,4 +1248,4 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -206,7 +206,7 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat
|
||||
penaltyportion = null;
|
||||
}
|
||||
}
|
||||
if (amount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
addAccrualAccounting(accrualData, amount, interestportion, totalAccInterest, feeportion, totalAccFee, penaltyportion,
|
||||
totalAccPenalty, tilldate);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat
|
||||
penaltyportion = null;
|
||||
}
|
||||
}
|
||||
if (amount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
addAccrualAccounting(scheduleAccrualData, amount, interestportion, totalAccInterest, feeportion, totalAccFee, penaltyportion,
|
||||
totalAccPenalty, scheduleAccrualData.getDueDateAsLocaldate());
|
||||
}
|
||||
@@ -374,7 +374,7 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat
|
||||
accruableForInstallment = accruableForInstallment.subtract(installmentChargeData.getAmountUnrecognized());
|
||||
}
|
||||
chargeAmount = accruableForInstallment;
|
||||
boolean canAddCharge = chargeAmount.compareTo(BigDecimal.ZERO) == 1;
|
||||
boolean canAddCharge = chargeAmount.compareTo(BigDecimal.ZERO) > 0;
|
||||
if (canAddCharge
|
||||
&& (installmentChargeData.getAmountAccrued() == null || chargeAmount.compareTo(installmentChargeData
|
||||
.getAmountAccrued()) != 0)) {
|
||||
@@ -398,7 +398,7 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat
|
||||
if (loanCharge.getAmountUnrecognized() != null) {
|
||||
chargeAmount = chargeAmount.subtract(loanCharge.getAmountUnrecognized());
|
||||
}
|
||||
boolean canAddCharge = chargeAmount.compareTo(BigDecimal.ZERO) == 1;
|
||||
boolean canAddCharge = chargeAmount.compareTo(BigDecimal.ZERO) > 0;
|
||||
if (canAddCharge && (loanCharge.getAmountAccrued() == null || chargeAmount.compareTo(loanCharge.getAmountAccrued()) != 0)) {
|
||||
BigDecimal amountForAccrual = chargeAmount;
|
||||
if (loanCharge.getAmountAccrued() != null) {
|
||||
@@ -451,14 +451,14 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat
|
||||
|
||||
Iterator<LoanTransactionData> iterator = loanTransactionDatas.iterator();
|
||||
for (LoanSchedulePeriodData loanSchedulePeriodData : loanSchedulePeriodDatas) {
|
||||
if (recognized.compareTo(BigDecimal.ZERO) != 1 && unrecognized.compareTo(BigDecimal.ZERO) != 1 && iterator.hasNext()) {
|
||||
if (recognized.compareTo(BigDecimal.ZERO) <= 0 && unrecognized.compareTo(BigDecimal.ZERO) <= 0 && iterator.hasNext()) {
|
||||
LoanTransactionData loanTransactionData = iterator.next();
|
||||
recognized = recognized.add(loanTransactionData.getInterestPortion());
|
||||
unrecognized = unrecognized.add(loanTransactionData.getUnrecognizedIncomePortion());
|
||||
}
|
||||
if (loanSchedulePeriodData.periodDueDate().isBefore(accrualData.getDueDateAsLocaldate())) {
|
||||
remainingAmt = remainingAmt.add(loanSchedulePeriodData.interestWaived());
|
||||
if (recognized.compareTo(remainingAmt) == 1) {
|
||||
if (recognized.compareTo(remainingAmt) > 0) {
|
||||
recognized = recognized.subtract(remainingAmt);
|
||||
remainingAmt = BigDecimal.ZERO;
|
||||
} else {
|
||||
@@ -477,7 +477,7 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat
|
||||
}
|
||||
|
||||
BigDecimal interestWaived = accrualData.getWaivedInterestIncome();
|
||||
if (interestWaived.compareTo(recognized) == 1) {
|
||||
if (interestWaived.compareTo(recognized) > 0) {
|
||||
interestIncome = interestIncome.subtract(interestWaived.subtract(recognized));
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -183,7 +183,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
||||
}
|
||||
|
||||
BigDecimal totalOverDue = principalOverdue.add(interestOverdue).add(feeOverdue).add(penaltyOverdue);
|
||||
if (totalOverDue.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (totalOverDue.compareTo(BigDecimal.ZERO) > 0) {
|
||||
if (isInsertStatement) {
|
||||
updateSql = constructInsertStatement(loan.getId(), principalOverdue, interestOverdue, feeOverdue, penaltyOverdue,
|
||||
overDueSince);
|
||||
@@ -277,12 +277,12 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
||||
loanSchedulePeriodData.penaltyChargesPaid()));
|
||||
if (overDueSince.isAfter(loanSchedulePeriodData.periodDueDate())
|
||||
&& loanSchedulePeriodData.principalDue().subtract(loanSchedulePeriodData.principalPaid())
|
||||
.compareTo(BigDecimal.ZERO) == 1) {
|
||||
.compareTo(BigDecimal.ZERO) > 0) {
|
||||
overDueSince = loanSchedulePeriodData.periodDueDate();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (principalOverdue.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (principalOverdue.compareTo(BigDecimal.ZERO) > 0) {
|
||||
String sqlStatement = null;
|
||||
if (isInsertStatement) {
|
||||
sqlStatement = constructInsertStatement(loanId, principalOverdue, interestOverdue, feeOverdue, penaltyOverdue,
|
||||
@@ -356,7 +356,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
||||
BigDecimal feeChargesPaid = null;
|
||||
BigDecimal penaltyChargesPaid = null;
|
||||
Boolean isComplete = true;
|
||||
if (loanSchedulePeriodData.principalDue().compareTo(principalAmt) == 1) {
|
||||
if (loanSchedulePeriodData.principalDue().compareTo(principalAmt) > 0) {
|
||||
principalPaid = principalAmt;
|
||||
principalAmt = BigDecimal.ZERO;
|
||||
isComplete = false;
|
||||
@@ -365,7 +365,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
||||
principalAmt = principalAmt.subtract(loanSchedulePeriodData.principalDue());
|
||||
}
|
||||
|
||||
if (loanSchedulePeriodData.interestDue().compareTo(interestAmt) == 1) {
|
||||
if (loanSchedulePeriodData.interestDue().compareTo(interestAmt) > 0) {
|
||||
interestPaid = interestAmt;
|
||||
interestAmt = BigDecimal.ZERO;
|
||||
isComplete = false;
|
||||
@@ -373,7 +373,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
||||
interestPaid = loanSchedulePeriodData.interestDue();
|
||||
interestAmt = interestAmt.subtract(loanSchedulePeriodData.interestDue());
|
||||
}
|
||||
if (loanSchedulePeriodData.feeChargesDue().compareTo(feeAmt) == 1) {
|
||||
if (loanSchedulePeriodData.feeChargesDue().compareTo(feeAmt) > 0) {
|
||||
feeChargesPaid = feeAmt;
|
||||
feeAmt = BigDecimal.ZERO;
|
||||
isComplete = false;
|
||||
@@ -381,7 +381,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
|
||||
feeChargesPaid = loanSchedulePeriodData.feeChargesDue();
|
||||
feeAmt = feeAmt.subtract(loanSchedulePeriodData.feeChargesDue());
|
||||
}
|
||||
if (loanSchedulePeriodData.penaltyChargesDue().compareTo(penaltyAmt) == 1) {
|
||||
if (loanSchedulePeriodData.penaltyChargesDue().compareTo(penaltyAmt) > 0) {
|
||||
penaltyChargesPaid = penaltyAmt;
|
||||
penaltyAmt = BigDecimal.ZERO;
|
||||
isComplete = false;
|
||||
|
||||
+40
-40
@@ -193,9 +193,9 @@ public final class LoanProductDataValidator {
|
||||
baseDataValidator.reset().parameter(maxPrincipalParameterName).value(maxPrincipalAmount).ignoreIfNull().positiveAmount();
|
||||
}
|
||||
|
||||
if (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
|
||||
if (minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter(maxPrincipalParameterName).value(maxPrincipalAmount).notLessThanMin(minPrincipalAmount);
|
||||
if (minPrincipalAmount.compareTo(maxPrincipalAmount) <= 0 && principal != null) {
|
||||
baseDataValidator.reset().parameter("principal").value(principal)
|
||||
@@ -204,7 +204,7 @@ public final class LoanProductDataValidator {
|
||||
} else if (principal != null) {
|
||||
baseDataValidator.reset().parameter("principal").value(principal).notGreaterThanMax(maxPrincipalAmount);
|
||||
}
|
||||
} else if (minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) != -1 && principal != null) {
|
||||
} else if (minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) >= 0 && principal != null) {
|
||||
baseDataValidator.reset().parameter("principal").value(principal).notLessThanMin(minPrincipalAmount);
|
||||
}
|
||||
|
||||
@@ -227,8 +227,8 @@ public final class LoanProductDataValidator {
|
||||
.integerGreaterThanZero();
|
||||
}
|
||||
|
||||
if (maxNumberOfRepayments != null && maxNumberOfRepayments.compareTo(0) == 1) {
|
||||
if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) == 1) {
|
||||
if (maxNumberOfRepayments != null && maxNumberOfRepayments.compareTo(0) > 0) {
|
||||
if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) > 0) {
|
||||
baseDataValidator.reset().parameter(maxNumberOfRepaymentsParameterName).value(maxNumberOfRepayments)
|
||||
.notLessThanMin(minNumberOfRepayments);
|
||||
if (minNumberOfRepayments.compareTo(maxNumberOfRepayments) <= 0) {
|
||||
@@ -239,7 +239,7 @@ public final class LoanProductDataValidator {
|
||||
baseDataValidator.reset().parameter("numberOfRepayments").value(numberOfRepayments)
|
||||
.notGreaterThanMax(maxNumberOfRepayments);
|
||||
}
|
||||
} else if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) == 1) {
|
||||
} else if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) > 0) {
|
||||
baseDataValidator.reset().parameter("numberOfRepayments").value(numberOfRepayments).notLessThanMin(minNumberOfRepayments);
|
||||
}
|
||||
|
||||
@@ -397,22 +397,22 @@ public final class LoanProductDataValidator {
|
||||
baseDataValidator.reset().parameter(maxDifferentialLendingRateParameterName).value(maxDifferentialLendingRate).notNull()
|
||||
.zeroOrPositiveAmount();
|
||||
|
||||
if (defaultDifferentialLendingRate != null && defaultDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (minDifferentialLendingRate != null && minDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (defaultDifferentialLendingRate != null && defaultDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
if (minDifferentialLendingRate != null && minDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter("defaultDifferentialLendingRate").value(defaultDifferentialLendingRate)
|
||||
.notLessThanMin(minDifferentialLendingRate);
|
||||
}
|
||||
}
|
||||
|
||||
if (maxDifferentialLendingRate != null && maxDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (minDifferentialLendingRate != null && minDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (maxDifferentialLendingRate != null && maxDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
if (minDifferentialLendingRate != null && minDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter("maxDifferentialLendingRate").value(maxDifferentialLendingRate)
|
||||
.notLessThanMin(minDifferentialLendingRate);
|
||||
}
|
||||
}
|
||||
|
||||
if (maxDifferentialLendingRate != null && maxDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (defaultDifferentialLendingRate != null && defaultDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (maxDifferentialLendingRate != null && maxDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
if (defaultDifferentialLendingRate != null && defaultDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter("maxDifferentialLendingRate").value(maxDifferentialLendingRate)
|
||||
.notLessThanMin(defaultDifferentialLendingRate);
|
||||
}
|
||||
@@ -493,8 +493,8 @@ public final class LoanProductDataValidator {
|
||||
.zeroOrPositiveAmount();
|
||||
}
|
||||
|
||||
if (maxInterestRatePerPeriod != null && maxInterestRatePerPeriod.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (minInterestRatePerPeriod != null && minInterestRatePerPeriod.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (maxInterestRatePerPeriod != null && maxInterestRatePerPeriod.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
if (minInterestRatePerPeriod != null && minInterestRatePerPeriod.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter(maxInterestRatePerPeriodParameterName).value(maxInterestRatePerPeriod)
|
||||
.notLessThanMin(minInterestRatePerPeriod);
|
||||
if (minInterestRatePerPeriod.compareTo(maxInterestRatePerPeriod) <= 0) {
|
||||
@@ -505,7 +505,7 @@ public final class LoanProductDataValidator {
|
||||
baseDataValidator.reset().parameter("interestRatePerPeriod").value(interestRatePerPeriod)
|
||||
.notGreaterThanMax(maxInterestRatePerPeriod);
|
||||
}
|
||||
} else if (minInterestRatePerPeriod != null && minInterestRatePerPeriod.compareTo(BigDecimal.ZERO) != -1) {
|
||||
} else if (minInterestRatePerPeriod != null && minInterestRatePerPeriod.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter("interestRatePerPeriod").value(interestRatePerPeriod)
|
||||
.notLessThanMin(minInterestRatePerPeriod);
|
||||
}
|
||||
@@ -1260,22 +1260,22 @@ public final class LoanProductDataValidator {
|
||||
baseDataValidator.reset().parameter(maxDifferentialLendingRateParameterName).value(maxDifferentialLendingRate).notNull()
|
||||
.zeroOrPositiveAmount();
|
||||
|
||||
if (defaultDifferentialLendingRate != null && defaultDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (minDifferentialLendingRate != null && minDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (defaultDifferentialLendingRate != null && defaultDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
if (minDifferentialLendingRate != null && minDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter("defaultDifferentialLendingRate").value(defaultDifferentialLendingRate)
|
||||
.notLessThanMin(minDifferentialLendingRate);
|
||||
}
|
||||
}
|
||||
|
||||
if (maxDifferentialLendingRate != null && maxDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (minDifferentialLendingRate != null && minDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (maxDifferentialLendingRate != null && maxDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
if (minDifferentialLendingRate != null && minDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter("maxDifferentialLendingRate").value(maxDifferentialLendingRate)
|
||||
.notLessThanMin(minDifferentialLendingRate);
|
||||
}
|
||||
}
|
||||
|
||||
if (maxDifferentialLendingRate != null && maxDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (defaultDifferentialLendingRate != null && defaultDifferentialLendingRate.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (maxDifferentialLendingRate != null && maxDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
if (defaultDifferentialLendingRate != null && defaultDifferentialLendingRate.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter("maxDifferentialLendingRate").value(maxDifferentialLendingRate)
|
||||
.notLessThanMin(defaultDifferentialLendingRate);
|
||||
}
|
||||
@@ -1594,14 +1594,14 @@ public final class LoanProductDataValidator {
|
||||
maxPrincipalAmount = minmaxValues.get(LoanProductConstants.maxPrincipal);
|
||||
}
|
||||
|
||||
if ((minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) == 1)
|
||||
&& (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) == 1)) {
|
||||
if ((minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) > 0)
|
||||
&& (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) > 0)) {
|
||||
baseDataValidator.reset().parameter(principalParameterName).value(principalAmount)
|
||||
.inMinAndMaxAmountRange(minPrincipalAmount, maxPrincipalAmount);
|
||||
} else {
|
||||
if (minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
baseDataValidator.reset().parameter(principalParameterName).value(principalAmount).notLessThanMin(minPrincipalAmount);
|
||||
} else if (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
} else if (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
baseDataValidator.reset().parameter(principalParameterName).value(principalAmount).notGreaterThanMax(maxPrincipalAmount);
|
||||
}
|
||||
}
|
||||
@@ -1620,15 +1620,15 @@ public final class LoanProductDataValidator {
|
||||
}
|
||||
}
|
||||
|
||||
if (maxNumberOfRepayments != null && maxNumberOfRepayments.compareTo(0) == 1) {
|
||||
if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) == 1) {
|
||||
if (maxNumberOfRepayments != null && maxNumberOfRepayments.compareTo(0) > 0) {
|
||||
if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) > 0) {
|
||||
baseDataValidator.reset().parameter(numberOfRepaymentsParameterName).value(numberOfRepayments)
|
||||
.inMinMaxRange(minNumberOfRepayments, maxNumberOfRepayments);
|
||||
} else {
|
||||
baseDataValidator.reset().parameter(numberOfRepaymentsParameterName).value(numberOfRepayments)
|
||||
.notGreaterThanMax(maxNumberOfRepayments);
|
||||
}
|
||||
} else if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) == 1) {
|
||||
} else if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) > 0) {
|
||||
baseDataValidator.reset().parameter(numberOfRepaymentsParameterName).value(numberOfRepayments)
|
||||
.notLessThanMin(minNumberOfRepayments);
|
||||
}
|
||||
@@ -1700,14 +1700,14 @@ public final class LoanProductDataValidator {
|
||||
|
||||
if ((principalUpdated || minPrincipalUpdated || maxPrincipalUpdated)) {
|
||||
|
||||
if ((minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) == 1)
|
||||
&& (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) == 1)) {
|
||||
if ((minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) > 0)
|
||||
&& (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) > 0)) {
|
||||
baseDataValidator.reset().parameter(principalParameterName).value(principalAmount)
|
||||
.inMinAndMaxAmountRange(minPrincipalAmount, maxPrincipalAmount);
|
||||
} else {
|
||||
if (minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (minPrincipalAmount != null && minPrincipalAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
baseDataValidator.reset().parameter(principalParameterName).value(principalAmount).notLessThanMin(minPrincipalAmount);
|
||||
} else if (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
} else if (maxPrincipalAmount != null && maxPrincipalAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
baseDataValidator.reset().parameter(principalParameterName).value(principalAmount)
|
||||
.notGreaterThanMax(maxPrincipalAmount);
|
||||
}
|
||||
@@ -1759,15 +1759,15 @@ public final class LoanProductDataValidator {
|
||||
}
|
||||
|
||||
if (numberOfRepaymentsUpdated || minNumberOfRepaymentsUpdated || maxNumberOfRepaymentsUpdated) {
|
||||
if (maxNumberOfRepayments != null && maxNumberOfRepayments.compareTo(0) == 1) {
|
||||
if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) == 1) {
|
||||
if (maxNumberOfRepayments != null && maxNumberOfRepayments.compareTo(0) > 0) {
|
||||
if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) > 0) {
|
||||
baseDataValidator.reset().parameter(numberOfRepaymentsParameterName).value(numberOfRepayments)
|
||||
.inMinMaxRange(minNumberOfRepayments, maxNumberOfRepayments);
|
||||
} else {
|
||||
baseDataValidator.reset().parameter(numberOfRepaymentsParameterName).value(numberOfRepayments)
|
||||
.notGreaterThanMax(maxNumberOfRepayments);
|
||||
}
|
||||
} else if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) == 1) {
|
||||
} else if (minNumberOfRepayments != null && minNumberOfRepayments.compareTo(0) > 0) {
|
||||
baseDataValidator.reset().parameter(numberOfRepaymentsParameterName).value(numberOfRepayments)
|
||||
.notLessThanMin(minNumberOfRepayments);
|
||||
}
|
||||
@@ -1924,14 +1924,14 @@ public final class LoanProductDataValidator {
|
||||
if (maxValue != null) {
|
||||
baseDataValidator.reset().parameter(maxParameterName).value(maxValue).notLessThanMin(minValue);
|
||||
}
|
||||
if ((minValue != null && minValue.compareTo(BigDecimal.ZERO) == 1)
|
||||
&& (maxValue != null && maxValue.compareTo(BigDecimal.ZERO) == 1)) {
|
||||
if ((minValue != null && minValue.compareTo(BigDecimal.ZERO) > 0)
|
||||
&& (maxValue != null && maxValue.compareTo(BigDecimal.ZERO) > 0)) {
|
||||
baseDataValidator.reset().parameter(defaultParameterName).value(defaultValue)
|
||||
.inMinAndMaxAmountRange(minValue, maxValue);
|
||||
} else {
|
||||
if (minValue != null && minValue.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (minValue != null && minValue.compareTo(BigDecimal.ZERO) > 0) {
|
||||
baseDataValidator.reset().parameter(defaultParameterName).value(defaultValue).notLessThanMin(minValue);
|
||||
} else if (maxValue != null && maxValue.compareTo(BigDecimal.ZERO) == 1) {
|
||||
} else if (maxValue != null && maxValue.compareTo(BigDecimal.ZERO) > 0) {
|
||||
baseDataValidator.reset().parameter(defaultParameterName).value(defaultValue).notGreaterThanMax(maxValue);
|
||||
}
|
||||
}
|
||||
@@ -2019,7 +2019,7 @@ public final class LoanProductDataValidator {
|
||||
}
|
||||
}
|
||||
|
||||
if (mandatoryGuarantee.compareTo(minimumGuaranteeFromOwnFunds.add(minimumGuaranteeFromGuarantor)) == -1) {
|
||||
if (mandatoryGuarantee.compareTo(minimumGuaranteeFromOwnFunds.add(minimumGuaranteeFromGuarantor)) < 0) {
|
||||
baseDataValidator.parameter(LoanProductConstants.mandatoryGuaranteeParamName).failWithCode(
|
||||
"must.be.greter.than.sum.of.min.funds");
|
||||
}
|
||||
|
||||
+7
-7
@@ -730,8 +730,8 @@ public class DepositProductDataValidator {
|
||||
baseDataValidator.reset().parameter(depositMaxAmountParamName).value(depositMaxAmount).notNull().positiveAmount();
|
||||
}
|
||||
|
||||
if (depositMaxAmount != null && depositMaxAmount.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (depositMinAmount != null && depositMinAmount.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (depositMaxAmount != null && depositMaxAmount.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
if (depositMinAmount != null && depositMinAmount.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter(depositMaxAmountParamName).value(depositMaxAmount).notLessThanMin(depositMinAmount);
|
||||
if (depositMinAmount.compareTo(depositMaxAmount) <= 0) {
|
||||
baseDataValidator.reset().parameter(depositAmountParamName).value(depositAmount)
|
||||
@@ -740,7 +740,7 @@ public class DepositProductDataValidator {
|
||||
} else {
|
||||
baseDataValidator.reset().parameter(depositAmountParamName).value(depositAmount).notGreaterThanMax(depositMaxAmount);
|
||||
}
|
||||
} else if (depositMinAmount != null && depositMinAmount.compareTo(BigDecimal.ZERO) != -1) {
|
||||
} else if (depositMinAmount != null && depositMinAmount.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter(depositAmountParamName).value(depositAmount).notLessThanMin(depositMinAmount);
|
||||
}
|
||||
}
|
||||
@@ -766,8 +766,8 @@ public class DepositProductDataValidator {
|
||||
}
|
||||
|
||||
if (depositAmount != null) {
|
||||
if (depositMaxAmount != null && depositMaxAmount.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (depositMinAmount != null && depositMinAmount.compareTo(BigDecimal.ZERO) != -1) {
|
||||
if (depositMaxAmount != null && depositMaxAmount.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
if (depositMinAmount != null && depositMinAmount.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter(depositMaxAmountParamName).value(depositMaxAmount).notLessThanMin(depositMinAmount);
|
||||
if (depositMinAmount.compareTo(depositMaxAmount) <= 0) {
|
||||
baseDataValidator.reset().parameter(depositAmountParamName).value(depositAmount)
|
||||
@@ -776,7 +776,7 @@ public class DepositProductDataValidator {
|
||||
} else {
|
||||
baseDataValidator.reset().parameter(depositAmountParamName).value(depositAmount).notGreaterThanMax(depositMaxAmount);
|
||||
}
|
||||
} else if (depositMinAmount != null && depositMinAmount.compareTo(BigDecimal.ZERO) != -1) {
|
||||
} else if (depositMinAmount != null && depositMinAmount.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
baseDataValidator.reset().parameter(depositAmountParamName).value(depositAmount).notLessThanMin(depositMinAmount);
|
||||
}
|
||||
}
|
||||
@@ -806,4 +806,4 @@ public class DepositProductDataValidator {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -144,7 +144,7 @@ public class SavingsAccountTransactionDataValidator {
|
||||
baseDataValidator.reset().parameter(withdrawBalanceParamName).value(withdrawBalance).isOneOfTheseValues(true, false);
|
||||
}
|
||||
|
||||
if (account.getSavingsHoldAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getSavingsHoldAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(
|
||||
"amount.is.on.hold.release.the.amount.to.continue", account.getId());
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public class SavingsAccountTransactionDataValidator {
|
||||
.failWithCodeNoParameterAddedToErrorCode(SavingsApiConstants.ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE);
|
||||
}
|
||||
account.holdAmount(amount);
|
||||
if (account.getWithdrawableBalance().compareTo(BigDecimal.ZERO)==-1){
|
||||
if (account.getWithdrawableBalance().compareTo(BigDecimal.ZERO) < 0){
|
||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("insufficient balance", account.getId());
|
||||
}
|
||||
LocalDate lastTransactionDate = account.retrieveLastTransactionDate();
|
||||
@@ -253,4 +253,4 @@ public class SavingsAccountTransactionDataValidator {
|
||||
dataValidationErrors);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -177,7 +177,7 @@ public class FixedDepositAccount extends SavingsAccount {
|
||||
|
||||
if (applyPreMaturePenalty) {
|
||||
applicableInterestRate = applicableInterestRate.subtract(penalInterest);
|
||||
applicableInterestRate = applicableInterestRate.compareTo(BigDecimal.ZERO) == -1 ? BigDecimal.ZERO : applicableInterestRate;
|
||||
applicableInterestRate = applicableInterestRate.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : applicableInterestRate;
|
||||
}
|
||||
}
|
||||
this.nominalAnnualInterestRate = applicableInterestRate;
|
||||
@@ -860,4 +860,4 @@ public class FixedDepositAccount extends SavingsAccount {
|
||||
return SavingsAccountStatusType.MATURED.getValue().equals(this.status);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -230,7 +230,7 @@ public class RecurringDepositAccount extends SavingsAccount {
|
||||
|
||||
if (applyPreMaturePenalty) {
|
||||
applicableInterestRate = applicableInterestRate.subtract(penalInterest);
|
||||
applicableInterestRate = applicableInterestRate.compareTo(BigDecimal.ZERO) == -1 ? BigDecimal.ZERO : applicableInterestRate;
|
||||
applicableInterestRate = applicableInterestRate.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : applicableInterestRate;
|
||||
}
|
||||
|
||||
this.nominalAnnualInterestRate = applicableInterestRate;
|
||||
@@ -1240,4 +1240,4 @@ public class RecurringDepositAccount extends SavingsAccount {
|
||||
public BigDecimal getDepositAmount() {
|
||||
return this.accountTermAndPreClosure.depositAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -610,10 +610,10 @@ public class SavingsAccount extends AbstractPersistableCustom {
|
||||
|
||||
protected boolean createWithHoldTransaction(final BigDecimal amount, final LocalDate date) {
|
||||
boolean isTaxAdded = false;
|
||||
if (this.taxGroup != null && amount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (this.taxGroup != null && amount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
Map<TaxComponent, BigDecimal> taxSplit = TaxUtils.splitTax(amount, date, this.taxGroup.getTaxGroupMappings(), amount.scale());
|
||||
BigDecimal totalTax = TaxUtils.totalTaxAmount(taxSplit);
|
||||
if (totalTax.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (totalTax.compareTo(BigDecimal.ZERO) > 0) {
|
||||
SavingsAccountTransaction withholdTransaction = SavingsAccountTransaction.withHoldTax(this, office(), date,
|
||||
Money.of(currency, totalTax), taxSplit);
|
||||
addTransaction(withholdTransaction);
|
||||
@@ -625,11 +625,11 @@ public class SavingsAccount extends AbstractPersistableCustom {
|
||||
|
||||
protected boolean updateWithHoldTransaction(final BigDecimal amount, final SavingsAccountTransaction withholdTransaction) {
|
||||
boolean isTaxAdded = false;
|
||||
if (this.taxGroup != null && amount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (this.taxGroup != null && amount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
Map<TaxComponent, BigDecimal> taxSplit = TaxUtils.splitTax(amount, withholdTransaction.transactionLocalDate(),
|
||||
this.taxGroup.getTaxGroupMappings(), amount.scale());
|
||||
BigDecimal totalTax = TaxUtils.totalTaxAmount(taxSplit);
|
||||
if (totalTax.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (totalTax.compareTo(BigDecimal.ZERO) > 0) {
|
||||
if (withholdTransaction.getId() == null) {
|
||||
withholdTransaction.updateAmount(Money.of(currency, totalTax));
|
||||
withholdTransaction.getTaxDetails().clear();
|
||||
@@ -1143,7 +1143,7 @@ public class SavingsAccount extends AbstractPersistableCustom {
|
||||
"transactionAmount", getAccountBalance(), withdrawalFee, transactionAmount); }
|
||||
}
|
||||
|
||||
if (this.getSavingsHoldAmount().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (this.getSavingsHoldAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
if (runningBalance.minus(this.getSavingsHoldAmount()).isLessThanZero()) {
|
||||
throw new InsufficientAccountBalanceException("transactionAmount", getAccountBalance(), withdrawalFee,
|
||||
transactionAmount);
|
||||
@@ -2690,7 +2690,7 @@ public class SavingsAccount extends AbstractPersistableCustom {
|
||||
.resource(SAVINGS_ACCOUNT_RESOURCE_NAME);
|
||||
|
||||
if (this.overdraftLimit != null && this.product.overdraftLimit() != null
|
||||
&& this.overdraftLimit.compareTo(this.product.overdraftLimit()) == 1) {
|
||||
&& this.overdraftLimit.compareTo(this.product.overdraftLimit()) > 0) {
|
||||
baseDataValidator.reset().parameter(SavingsApiConstants.overdraftLimitParamName).value(this.overdraftLimit)
|
||||
.failWithCode("cannot.exceed.product.value");
|
||||
}
|
||||
|
||||
+3
-3
@@ -501,7 +501,7 @@ public class SavingsAccountCharge extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
private boolean isGreaterThanZero(final BigDecimal value) {
|
||||
return value.compareTo(BigDecimal.ZERO) == 1;
|
||||
return value.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
public LocalDate getDueLocalDate() {
|
||||
@@ -840,7 +840,7 @@ public class SavingsAccountCharge extends AbstractPersistableCustom {
|
||||
|
||||
public boolean isChargeIsOverPaid(final LocalDate nextDueDate) {
|
||||
final BigDecimal amountPaid = this.amountPaid == null ? BigDecimal.ZERO : amountPaid();
|
||||
return this.getDueLocalDate().isAfter(nextDueDate) && amountPaid.compareTo(BigDecimal.ZERO) == 1;
|
||||
return this.getDueLocalDate().isAfter(nextDueDate) && amountPaid.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
private BigDecimal amountPaid() {
|
||||
@@ -873,4 +873,4 @@ public class SavingsAccountCharge extends AbstractPersistableCustom {
|
||||
public boolean canOverriteSavingAccountRules() {
|
||||
return !(this.isSavingsActivation() || this.isWithdrawalFee());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -111,7 +111,7 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
||||
isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -235,4 +235,4 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
||||
map.put(entityEvent, entity);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -262,7 +262,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
account.updateMaturityDateAndAmount(mc, isPreMatureClosure, isSavingsInterestPostingAtCurrentPeriodEnd,
|
||||
financialYearBeginningMonth);
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -379,7 +379,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -645,7 +645,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -748,7 +748,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -1194,7 +1194,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -1329,7 +1329,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
|
||||
+5
-5
@@ -289,7 +289,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
}
|
||||
account.processAccountUponActivation(isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth, user);
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -625,7 +625,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -717,7 +717,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -1122,7 +1122,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
@@ -1255,7 +1255,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
financialYearBeginningMonth, postInterestOnDate);
|
||||
}
|
||||
List<DepositAccountOnHoldTransaction> depositAccountOnHoldTransactions = null;
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (account.getOnHoldFunds().compareTo(BigDecimal.ZERO) > 0) {
|
||||
depositAccountOnHoldTransactions = this.depositAccountOnHoldTransactionRepository
|
||||
.findBySavingsAccountAndReversedFalseOrderByCreatedDateAsc(account);
|
||||
}
|
||||
|
||||
+1
-1
@@ -205,7 +205,7 @@ public class ShareAccountCharge extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
private boolean isGreaterThanZero(final BigDecimal value) {
|
||||
return value.compareTo(BigDecimal.ZERO) == 1;
|
||||
return value.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
private boolean determineIfFullyPaid() {
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public class TaxUtils {
|
||||
public static BigDecimal addTax(final BigDecimal amount, final LocalDate date, final List<TaxGroupMappings> taxGroupMappings,
|
||||
final int scale) {
|
||||
BigDecimal totalAmount = null;
|
||||
if (amount != null && amount.compareTo(BigDecimal.ZERO) == 1) {
|
||||
if (amount != null && amount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
double percentageVal = 0;
|
||||
double amountVal = amount.doubleValue();
|
||||
double cent_percentage = Double.valueOf("100.0");
|
||||
|
||||
Reference in New Issue
Block a user