FINERACT-2114: Fix EMI adjustment when Interest Rate change has with Early Repayment Adjust Last case

This commit is contained in:
Janos Meszaros
2024-11-21 12:46:42 +01:00
committed by Adam Saghy
parent 425085f4eb
commit 75fa740ff6
4 changed files with 143 additions and 35 deletions
@@ -198,6 +198,14 @@ public class Money implements Comparable<Money> {
return new Money(this.currencyCode, this.currencyDigitsAfterDecimal, this.amount.stripTrailingZeros(), this.inMultiplesOf, this.mc);
}
public Money copy(final BigDecimal amount) {
return new Money(this.currencyCode, this.currencyDigitsAfterDecimal, amount.stripTrailingZeros(), this.inMultiplesOf, this.mc);
}
public Money copy(final double amount) {
return copy(BigDecimal.valueOf(amount));
}
public Money plus(final Iterable<? extends Money> moniesToAdd) {
BigDecimal total = this.amount;
for (final Money moneyProvider : moniesToAdd) {
@@ -313,6 +321,14 @@ public class Money implements Comparable<Money> {
return Money.of(monetaryCurrency(), newAmount, mc);
}
public Money dividedBy(final long valueToDivideBy) {
if (valueToDivideBy == 1) {
return this;
}
final BigDecimal newAmount = this.amount.divide(BigDecimal.valueOf(valueToDivideBy), getMc());
return Money.of(monetaryCurrency(), newAmount, getMc());
}
public Money multipliedBy(final BigDecimal valueToMultiplyBy) {
return multipliedBy(valueToMultiplyBy, getMc());
}