FINERACT-1939: Hold Amount - should be debit
This commit is contained in:
+1
-1
@@ -101,7 +101,7 @@ public class InteropTransactionData extends CommandProcessingResult {
|
||||
SavingsAccount savingsAccount = transaction.getSavingsAccount();
|
||||
|
||||
String transactionId = transaction.getId().toString();
|
||||
SavingsAccountTransactionType transactionType = SavingsAccountTransactionType.fromInt(transaction.getTypeOf());
|
||||
SavingsAccountTransactionType transactionType = transaction.getTransactionType();
|
||||
BigDecimal amount = transaction.getAmount();
|
||||
|
||||
BigDecimal chargeAmount = null;
|
||||
|
||||
+1
-1
@@ -233,7 +233,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
SavingsAccount savingsAccount = validateAndGetSavingAccount(accountId);
|
||||
|
||||
Predicate<SavingsAccountTransaction> transFilter = t -> {
|
||||
SavingsAccountTransactionType transactionType = SavingsAccountTransactionType.fromInt(t.getTypeOf());
|
||||
SavingsAccountTransactionType transactionType = t.getTransactionType();
|
||||
if (debit != transactionType.isDebit() && credit != transactionType.isCredit()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+3
@@ -23,6 +23,7 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.apache.fineract.portfolio.TransactionEntryType;
|
||||
|
||||
final class SavingsAccountTransactionsApiResourceSwagger {
|
||||
|
||||
@@ -147,6 +148,8 @@ final class SavingsAccountTransactionsApiResourceSwagger {
|
||||
@Schema(example = "1")
|
||||
public Long id;
|
||||
public GetTranscationEnumData transactionType;
|
||||
@Schema(example = "CREDIT")
|
||||
public TransactionEntryType entryType;
|
||||
@Schema(example = "1")
|
||||
public Long accountId;
|
||||
@Schema(example = "000000001")
|
||||
|
||||
-1
@@ -405,7 +405,6 @@ public class RecurringDepositAccount extends SavingsAccount {
|
||||
if (transaction.isReversed()) {
|
||||
transaction.zeroBalanceFields();
|
||||
} else {
|
||||
|
||||
Money transactionAmount = Money.zero(this.currency);
|
||||
if (transaction.isCredit()) {
|
||||
transactionAmount = transactionAmount.plus(transaction.getAmount(this.currency));
|
||||
|
||||
+2
-4
@@ -28,7 +28,6 @@ import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
import org.apache.fineract.portfolio.savings.SavingsAccountTransactionType;
|
||||
import org.apache.fineract.portfolio.savings.domain.interest.PostingPeriod;
|
||||
|
||||
/**
|
||||
@@ -106,7 +105,6 @@ public final class SavingsAccountSummary {
|
||||
this.totalOverdraftInterestDerived = wrapper.calculateTotalOverdraftInterest(currency, transactions);
|
||||
this.totalWithholdTax = wrapper.calculateTotalWithholdTaxWithdrawal(currency, transactions);
|
||||
|
||||
// boolean isUpdated = false;
|
||||
updateRunningBalanceAndPivotDate(false, transactions, null, null, null, currency);
|
||||
|
||||
this.accountBalance = Money.of(currency, this.totalDeposits).plus(this.totalInterestPosted).minus(this.totalWithdrawals)
|
||||
@@ -122,7 +120,7 @@ public final class SavingsAccountSummary {
|
||||
return;
|
||||
}
|
||||
Money transactionAmount = Money.of(currency, transaction.getAmount());
|
||||
switch (SavingsAccountTransactionType.fromInt(transaction.getTypeOf())) {
|
||||
switch (transaction.getTransactionType()) {
|
||||
case DEPOSIT:
|
||||
if (transaction.isDepositAndNotReversed() || transaction.isDividendPayoutAndNotReversed()) {
|
||||
this.totalDeposits = Money.of(currency, this.totalDeposits).plus(transactionAmount).getAmount();
|
||||
@@ -185,7 +183,7 @@ public final class SavingsAccountSummary {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// boolean isUpdated = false;
|
||||
// INTEREST_POSTING
|
||||
Money interestTotal = Money.zero(currency);
|
||||
Money withHoldTaxTotal = Money.zero(currency);
|
||||
Money overdraftInterestTotal = Money.zero(currency);
|
||||
|
||||
+42
-42
@@ -418,23 +418,23 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public boolean isDeposit() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isDeposit();
|
||||
return getTransactionType().isDeposit();
|
||||
}
|
||||
|
||||
public boolean isDepositAndNotReversed() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isDeposit() && isNotReversed();
|
||||
return getTransactionType().isDeposit() && isNotReversed();
|
||||
}
|
||||
|
||||
public boolean isDividendPayout() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isDividendPayout();
|
||||
return getTransactionType().isDividendPayout();
|
||||
}
|
||||
|
||||
public boolean isDividendPayoutAndNotReversed() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isDividendPayout() && isNotReversed();
|
||||
return getTransactionType().isDividendPayout() && isNotReversed();
|
||||
}
|
||||
|
||||
public boolean isWithdrawal() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isWithdrawal();
|
||||
return getTransactionType().isWithdrawal();
|
||||
}
|
||||
|
||||
public boolean isPostInterestCalculationRequired() {
|
||||
@@ -442,20 +442,19 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public boolean isInterestPostingAndNotReversed() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isInterestPosting() && isNotReversed();
|
||||
return getTransactionType().isInterestPosting() && isNotReversed();
|
||||
}
|
||||
|
||||
public boolean isInterestPosting() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isInterestPosting()
|
||||
|| SavingsAccountTransactionType.fromInt(this.typeOf).isOverDraftInterestPosting();
|
||||
return getTransactionType().isInterestPosting() || getTransactionType().isOverDraftInterestPosting();
|
||||
}
|
||||
|
||||
public boolean isWithdrawalFeeAndNotReversed() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isWithdrawalFee() && isNotReversed();
|
||||
return getTransactionType().isWithdrawalFee() && isNotReversed();
|
||||
}
|
||||
|
||||
public boolean isWithdrawalFee() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isWithdrawalFee();
|
||||
return getTransactionType().isWithdrawalFee();
|
||||
}
|
||||
|
||||
public boolean isAnnualFeeAndNotReversed() {
|
||||
@@ -463,7 +462,7 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public boolean isAnnualFee() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isAnnualFee();
|
||||
return getTransactionType().isAnnualFee();
|
||||
}
|
||||
|
||||
public boolean isNotReversed() {
|
||||
@@ -475,19 +474,19 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public boolean isTransferInitiation() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isTransferInitiation();
|
||||
return getTransactionType().isTransferInitiation();
|
||||
}
|
||||
|
||||
public boolean isTransferApproval() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isTransferApproval();
|
||||
return getTransactionType().isTransferApproval();
|
||||
}
|
||||
|
||||
public boolean isTransferRejection() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isTransferRejection();
|
||||
return getTransactionType().isTransferRejection();
|
||||
}
|
||||
|
||||
public boolean isTransferWithdrawal() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isTransferWithdrawal();
|
||||
return getTransactionType().isTransferWithdrawal();
|
||||
}
|
||||
|
||||
public boolean isTransferRelatedTransaction() {
|
||||
@@ -722,49 +721,56 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public boolean isCredit() {
|
||||
return isDeposit() || isInterestPostingAndNotReversed() || isDividendPayoutAndNotReversed();
|
||||
return isCreditType() && !isReversed() && !isReversalTransaction();
|
||||
}
|
||||
|
||||
public boolean isCreditType() {
|
||||
return getTransactionType().isCredit();
|
||||
}
|
||||
|
||||
public boolean isDebit() {
|
||||
return isWithdrawal() || isWithdrawalFeeAndNotReversed() || isAnnualFeeAndNotReversed() || isPayCharge()
|
||||
|| isOverdraftInterestAndNotReversed() || isWithHoldTaxAndNotReversed();
|
||||
return isDebitType() && !isReversed() && !isReversalTransaction();
|
||||
}
|
||||
|
||||
public boolean isDebitType() {
|
||||
return getTransactionType().isDebit();
|
||||
}
|
||||
|
||||
public boolean isWithHoldTaxAndNotReversed() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isWithHoldTax() && isNotReversed();
|
||||
return getTransactionType().isWithHoldTax() && isNotReversed();
|
||||
}
|
||||
|
||||
public boolean isOverdraftInterestAndNotReversed() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isIncomeFromInterest() && isNotReversed();
|
||||
return getTransactionType().isIncomeFromInterest() && isNotReversed();
|
||||
}
|
||||
|
||||
public boolean isPayCharge() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isPayCharge();
|
||||
return getTransactionType().isPayCharge();
|
||||
}
|
||||
|
||||
public boolean isChargeTransaction() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isChargeTransaction();
|
||||
return getTransactionType().isChargeTransaction();
|
||||
}
|
||||
|
||||
public boolean isChargeTransactionAndNotReversed() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isChargeTransaction() && isNotReversed();
|
||||
return getTransactionType().isChargeTransaction() && isNotReversed();
|
||||
}
|
||||
|
||||
public boolean isWaiveCharge() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isWaiveCharge();
|
||||
return getTransactionType().isWaiveCharge();
|
||||
}
|
||||
|
||||
public boolean isAmountOnHold() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isAmountOnHold();
|
||||
return getTransactionType().isAmountOnHold();
|
||||
}
|
||||
|
||||
public boolean isAmountRelease() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf).isAmountRelease();
|
||||
return getTransactionType().isAmountRelease();
|
||||
}
|
||||
|
||||
private boolean canOverriteSavingAccountRules() {
|
||||
final SavingsAccountChargePaidBy chargePaidBy = getSavingsAccountChargePaidBy();
|
||||
return (isChargeTransaction() && chargePaidBy != null) ? chargePaidBy.canOverriteSavingAccountRules() : false;
|
||||
return isChargeTransaction() && chargePaidBy != null && chargePaidBy.canOverriteSavingAccountRules();
|
||||
}
|
||||
|
||||
public boolean canProcessBalanceCheck() {
|
||||
@@ -773,12 +779,12 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
|
||||
|
||||
public boolean isFeeCharge() {
|
||||
final SavingsAccountChargePaidBy chargePaidBy = getSavingsAccountChargePaidBy();
|
||||
return (isPayCharge() && chargePaidBy != null) ? chargePaidBy.isFeeCharge() : false;
|
||||
return isPayCharge() && chargePaidBy != null && chargePaidBy.isFeeCharge();
|
||||
}
|
||||
|
||||
public boolean isPenaltyCharge() {
|
||||
final SavingsAccountChargePaidBy chargePaidBy = getSavingsAccountChargePaidBy();
|
||||
return (isPayCharge() && chargePaidBy != null) ? chargePaidBy.isPenaltyCharge() : false;
|
||||
return isPayCharge() && chargePaidBy != null && chargePaidBy.isPenaltyCharge();
|
||||
}
|
||||
|
||||
public boolean isFeeChargeAndNotReversed() {
|
||||
@@ -791,12 +797,12 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
|
||||
|
||||
public boolean isWaiveFeeCharge() {
|
||||
final SavingsAccountChargePaidBy chargePaidBy = getSavingsAccountChargePaidBy();
|
||||
return (isWaiveCharge() && chargePaidBy != null) ? chargePaidBy.isFeeCharge() : false;
|
||||
return isWaiveCharge() && chargePaidBy != null && chargePaidBy.isFeeCharge();
|
||||
}
|
||||
|
||||
public boolean isWaivePenaltyCharge() {
|
||||
final SavingsAccountChargePaidBy chargePaidBy = getSavingsAccountChargePaidBy();
|
||||
return (isWaiveCharge() && chargePaidBy != null) ? chargePaidBy.isPenaltyCharge() : false;
|
||||
return isWaiveCharge() && chargePaidBy != null && chargePaidBy.isPenaltyCharge();
|
||||
}
|
||||
|
||||
public boolean isWaiveFeeChargeAndNotReversed() {
|
||||
@@ -827,18 +833,8 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public boolean isPaymentForCurrentCharge(final SavingsAccountCharge savingsAccountCharge) {
|
||||
|
||||
final SavingsAccountChargePaidBy chargePaidBy = getSavingsAccountChargePaidBy();
|
||||
final boolean isChargePaidForCurrentCharge;
|
||||
if (chargePaidBy == null) {
|
||||
isChargePaidForCurrentCharge = false;
|
||||
} else if (chargePaidBy.getSavingsAccountCharge().equals(savingsAccountCharge)) {
|
||||
isChargePaidForCurrentCharge = true;
|
||||
} else {
|
||||
isChargePaidForCurrentCharge = false;
|
||||
}
|
||||
|
||||
return isChargePaidForCurrentCharge;
|
||||
return chargePaidBy != null && chargePaidBy.getSavingsAccountCharge().equals(savingsAccountCharge);
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
@@ -861,6 +857,10 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom {
|
||||
return this.typeOf;
|
||||
}
|
||||
|
||||
public SavingsAccountTransactionType getTransactionType() {
|
||||
return SavingsAccountTransactionType.fromInt(this.typeOf);
|
||||
}
|
||||
|
||||
public SavingsAccount getSavingsAccount() {
|
||||
return this.savingsAccount;
|
||||
}
|
||||
|
||||
+1
-1
@@ -434,7 +434,7 @@ public class SavingsAccountInterestPostingServiceImpl implements SavingsAccountI
|
||||
}
|
||||
|
||||
runningBalance = runningBalance.plus(transactionAmount);
|
||||
if (!transaction.getRunningBalance(transactionAmount.getCurrency()).isEqualTo(transactionAmount)) {
|
||||
if (!transaction.getRunningBalance(transactionAmount.getCurrency()).isEqualTo(runningBalance)) {
|
||||
transaction.updateRunningBalance(runningBalance);
|
||||
}
|
||||
// transaction.updateRunningBalance(runningBalance);
|
||||
|
||||
Reference in New Issue
Block a user