MIFOSX-1788:Waive interest is not working as expected

This commit is contained in:
sachinkulkarni12
2015-08-30 16:27:09 +05:30
parent 1e00782c91
commit befd953fcf
2 changed files with 16 additions and 6 deletions
@@ -640,6 +640,10 @@ public final class LoanTransaction extends AbstractPersistable<Long> {
private LocalDate getCreatedDate() {
return new LocalDate(this.createdDate);
}
public LocalDateTime getCreatedDateTime() {
return new LocalDateTime(this.createdDate);
}
public boolean isLastTransaction(final LoanTransaction loanTransaction) {
boolean isLatest = false;
@@ -17,13 +17,19 @@ public class LoanTransactionComparator implements Comparator<LoanTransaction> {
int compareResult = 0;
final int comparsion = o1.getTransactionDate().compareTo(o2.getTransactionDate());
if (comparsion == 0) {
int comparsionCreate = 0;
if (o1.getCreatedDateTime() != null && o2.getCreatedDateTime() != null){
comparsionCreate = o1.getCreatedDateTime().compareTo(o2.getCreatedDateTime());
}
// equal transaction dates
if (o1.isWaiver() && o2.isNotWaiver()) {
compareResult = -1;
} else if (o1.isNotWaiver() && o2.isWaiver()) {
compareResult = 1;
} else {
compareResult = 0;
if (comparsionCreate == 0) {
if (o1.isWaiver() && o2.isNotWaiver()) {
compareResult = -1;
} else if (o1.isNotWaiver() && o2.isWaiver()) {
compareResult = 1;
} else {
compareResult = 0;
}
}
} else {
compareResult = comparsion;