Skip to content

Commit

Permalink
Revert "FINERACT-1905: Same day repayment + charge handling improvement"
Browse files Browse the repository at this point in the history
This reverts commit c50fc83.
  • Loading branch information
adamsaghy committed Aug 1, 2023
1 parent c50fc83 commit 3869c19
Show file tree
Hide file tree
Showing 12 changed files with 1,136 additions and 1,185 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5741,7 +5741,7 @@ public void processPostDisbursementTransactions() {
final List<LoanTransaction> copyTransactions = new ArrayList<>();
if (!allNonContraTransactionsPostDisbursement.isEmpty()) {
for (LoanTransaction loanTransaction : allNonContraTransactionsPostDisbursement) {
copyTransactions.add(LoanTransaction.copyTransactionPropertiesForReprocessing(loanTransaction));
copyTransactions.add(LoanTransaction.copyTransactionProperties(loanTransaction));
}
loanRepaymentScheduleTransactionProcessor.handleTransaction(getDisbursementDate(), copyTransactions, getCurrency(),
getRepaymentScheduleInstallments(), getActiveCharges());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import java.util.stream.Collectors;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
import org.apache.fineract.infrastructure.core.domain.ExternalId;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
Expand All @@ -61,7 +61,7 @@

@Entity
@Table(name = "m_loan_charge", uniqueConstraints = { @UniqueConstraint(columnNames = { "external_id" }, name = "external_id") })
public class LoanCharge extends AbstractAuditableWithUTCDateTimeCustom {
public class LoanCharge extends AbstractPersistableCustom {

@ManyToOne(optional = false)
@JoinColumn(name = "loan_id", referencedColumnName = "id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,11 @@ public static LoanTransaction refund(final Office office, final Money amount, fi
return new LoanTransaction(null, office, LoanTransactionType.REFUND, paymentDetail, amount.getAmount(), paymentDate, externalId);
}

public static LoanTransaction copyTransactionPropertiesForReprocessing(final LoanTransaction loanTransaction) {
LoanTransaction loanTransactionCopy = new LoanTransaction(loanTransaction.loan, loanTransaction.office, loanTransaction.typeOf,
loanTransaction.dateOf, loanTransaction.amount, loanTransaction.principalPortion, loanTransaction.interestPortion,
public static LoanTransaction copyTransactionProperties(final LoanTransaction loanTransaction) {
return new LoanTransaction(loanTransaction.loan, loanTransaction.office, loanTransaction.typeOf, loanTransaction.dateOf,
loanTransaction.amount, loanTransaction.principalPortion, loanTransaction.interestPortion,
loanTransaction.feeChargesPortion, loanTransaction.penaltyChargesPortion, loanTransaction.overPaymentPortion,
loanTransaction.reversed, loanTransaction.paymentDetail, loanTransaction.externalId);
loanTransactionCopy.setCreatedDate(loanTransaction.getCreatedDateTime());
return loanTransactionCopy;
}

public static LoanTransaction accrueLoanCharge(final Loan loan, final Office office, final Money amount, final LocalDate applyDate,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public int compare(LoanRepaymentScheduleInstallment ord1, LoanRepaymentScheduleI
* For existing transactions, check if the re-payment breakup (principal, interest, fees, penalties)
* has changed.<br>
**/
final LoanTransaction newLoanTransaction = LoanTransaction.copyTransactionPropertiesForReprocessing(loanTransaction);
final LoanTransaction newLoanTransaction = LoanTransaction.copyTransactionProperties(loanTransaction);

// Reset derived component of new loan transaction and
// re-process transaction
Expand Down Expand Up @@ -214,7 +214,7 @@ public int compare(LoanRepaymentScheduleInstallment ord1, LoanRepaymentScheduleI

private void recalculateChargeOffTransaction(ChangedTransactionDetail changedTransactionDetail, LoanTransaction loanTransaction,
MonetaryCurrency currency, List<LoanRepaymentScheduleInstallment> installments) {
final LoanTransaction newLoanTransaction = LoanTransaction.copyTransactionPropertiesForReprocessing(loanTransaction);
final LoanTransaction newLoanTransaction = LoanTransaction.copyTransactionProperties(loanTransaction);
newLoanTransaction.resetDerivedComponents();
// determine how much is outstanding total and breakdown for principal, interest and charges
Money principalPortion = Money.zero(currency);
Expand Down Expand Up @@ -280,7 +280,7 @@ private void recalculateCreditTransaction(ChangedTransactionDetail changedTransa
if (loanTransaction.getId() == null) {
return;
}
final LoanTransaction newLoanTransaction = LoanTransaction.copyTransactionPropertiesForReprocessing(loanTransaction);
final LoanTransaction newLoanTransaction = LoanTransaction.copyTransactionProperties(loanTransaction);

List<LoanTransaction> mergedList = getMergedTransactionList(transactionsToBeProcessed, changedTransactionDetail);
Money overpaidAmount = calculateOverpaidAmount(loanTransaction, mergedList, installments, currency);
Expand Down
Loading

0 comments on commit 3869c19

Please sign in to comment.