Skip to content

Commit

Permalink
FINERACT-1981: Remove hardcoded MoneyHelper dependency during progres…
Browse files Browse the repository at this point in the history
…sive loan
  • Loading branch information
kulminsky authored and adamsaghy committed Oct 22, 2024
1 parent 806ee69 commit a9ecdf9
Show file tree
Hide file tree
Showing 31 changed files with 536 additions and 355 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,11 @@ public static Money negativeToZero(Money value) {
return value == null || isGreaterThanZero(value) ? value : Money.zero(value.getCurrency());
}

/** @return parameter value or ZERO if it is negative */
public static Money negativeToZero(Money value, MathContext mc) {
return value == null || isGreaterThanZero(value, mc) ? value : Money.zero(value.getCurrency(), mc);
}

public static boolean isEmpty(Money value) {
return value == null || value.isZero();
}
Expand All @@ -367,6 +372,10 @@ public static boolean isGreaterThanZero(Money value) {
return value != null && value.isGreaterThanZero();
}

public static boolean isGreaterThanZero(Money value, MathContext mc) {
return value != null && value.isGreaterThanZero(mc);
}

public static boolean isLessThanZero(Money value) {
return value != null && value.isLessThanZero();
}
Expand All @@ -387,10 +396,18 @@ public static Money plus(Money first, Money second) {
return first == null ? second : second == null ? first : first.plus(second);
}

public static Money plus(Money first, Money second, MathContext mc) {
return first == null ? second : second == null ? first : first.plus(second, mc);
}

public static Money plus(Money first, Money second, Money third) {
return plus(plus(first, second), third);
}

public static Money plus(Money first, Money second, Money third, MathContext mc) {
return plus(plus(first, second), third, mc);
}

public static Money plus(Money first, Money second, Money third, Money fourth) {
return plus(plus(plus(first, second), third), fourth);
}
Expand Down
Loading

0 comments on commit a9ecdf9

Please sign in to comment.