You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/12/28 12:39:59 UTC
[GitHub] [fineract] galovics commented on a diff in pull request #2845: FINERACT-1841 Fix Duplicated journal entries when a chargeback happens
galovics commented on code in PR #2845:
URL: https://github.com/apache/fineract/pull/2845#discussion_r1058306504
##########
fineract-provider/src/main/java/org/apache/fineract/interoperation/service/InteropServiceImpl.java:
##########
@@ -354,7 +354,7 @@ public InteropQuoteResponseData createQuote(@NotNull JsonCommand command) {
final BigDecimal fee;
if (transactionType.isDebit()) {
- fee = savingsAccount.calculateWithdrawalFee(request.getAmount().getAmount());
+ fee = savingsAccount.calculateTransactionFee(request.getAmount().getAmount());
Review Comment:
This must be an unrelated change, isn't it? If so, let's get rid of it.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/ChargeTimeType.java:
##########
@@ -37,7 +37,8 @@ public enum ChargeTimeType {
SHAREACCOUNT_ACTIVATION(13, "chargeTimeType.activation"), // only for loan
SHARE_PURCHASE(14, "chargeTimeType.sharespurchase"), SHARE_REDEEM(15, "chargeTimeType.sharesredeem"),
- SAVINGS_NOACTIVITY_FEE(16, "chargeTimeType.savingsNoActivityFee");
+ SAVINGS_NOACTIVITY_FEE(16, "chargeTimeType.savingsNoActivityFee"), // only for savings
Review Comment:
This is also unrelated.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -6215,7 +6215,8 @@ private ChangedTransactionDetail handleRefundTransaction(final LoanTransaction l
}
public void handleChargebackTransaction(final LoanTransaction chargebackTransaction,
- final LoanLifecycleStateMachine loanLifecycleStateMachine) {
+ final LoanLifecycleStateMachine loanLifecycleStateMachine, final List<Long> existingTransactionIds,
Review Comment:
I don't really like this change because it'll bring side-effects to an already complex codebase.
Why can't we just do the findExistingTransactionIds and findExistingReversedTransactionIds where this is being called?
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/Charge.java:
##########
@@ -223,12 +223,12 @@ private Charge(final String name, final BigDecimal amount, final String currency
.failWithCodeNoParameterAddedToErrorCode("not.allowed.charge.calculation.type.for.savings");
}
- if (!(ChargeTimeType.fromInt(getChargeTimeType()).isWithdrawalFee()
- || ChargeTimeType.fromInt(getChargeTimeType()).isSavingsNoActivityFee())
+ final ChargeTimeType chargeTimeType = ChargeTimeType.fromInt(getChargeTimeType());
Review Comment:
This is also unrelated.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java:
##########
@@ -1150,6 +1150,9 @@ public SavingsAccountTransaction deposit(final SavingsAccountTransactionDTO tran
addTransaction(transaction);
}
+ payDepositFee(transactionDTO.getTransactionAmount(), transactionDTO.getTransactionDate(), transactionDTO.getAppUser(),
Review Comment:
This is also unrelated.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountData.java:
##########
@@ -901,7 +901,7 @@ private SavingsAccountData(final Long id, final String accountNo, final EnumOpti
this.savingsAmountOnHold = savingsAmountOnHold;
}
- private SavingsAccountChargeData calculateWithdrawalFee() {
+ private SavingsAccountChargeData calculateTransactionFee() {
Review Comment:
This is also unrelated.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeEnumerations.java:
##########
@@ -58,6 +58,10 @@ public static EnumOptionData chargeTimeType(final ChargeTimeType type) {
optionData = new EnumOptionData(ChargeTimeType.WITHDRAWAL_FEE.getValue().longValue(),
ChargeTimeType.WITHDRAWAL_FEE.getCode(), "Withdrawal Fee");
break;
+ case DEPOSIT_FEE:
Review Comment:
This is also unrelated.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java:
##########
@@ -1347,6 +1350,41 @@ private void payWithdrawalFee(final BigDecimal transactionAmount, final LocalDat
}
}
+ private void payDepositFee(final BigDecimal transactionAmount, final LocalDate transactionDate, final AppUser user,
Review Comment:
This is also unrelated.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeDropdownReadPlatformServiceImpl.java:
##########
@@ -102,7 +102,8 @@ public List<EnumOptionData> retrieveSavingsCollectionTimeTypes() {
// chargeTimeType(ChargeTimeType.SAVINGS_CLOSURE),
chargeTimeType(ChargeTimeType.WITHDRAWAL_FEE), chargeTimeType(ChargeTimeType.ANNUAL_FEE),
chargeTimeType(ChargeTimeType.MONTHLY_FEE), chargeTimeType(ChargeTimeType.WEEKLY_FEE),
- chargeTimeType(ChargeTimeType.OVERDRAFT_FEE), chargeTimeType(ChargeTimeType.SAVINGS_NOACTIVITY_FEE));
+ chargeTimeType(ChargeTimeType.OVERDRAFT_FEE), chargeTimeType(ChargeTimeType.SAVINGS_NOACTIVITY_FEE),
Review Comment:
This is also unrelated.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java:
##########
@@ -720,6 +720,10 @@ public boolean isWithdrawalFee() {
return ChargeTimeType.fromInt(this.chargeTime).isWithdrawalFee();
}
+ public boolean isDepositFee() {
Review Comment:
This is also unrelated.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -287,7 +287,7 @@ private boolean isAnyLoanProductsAssociateWithThisCharge(final Long chargeId) {
}
private boolean isAnySavingsProductsAssociateWithThisCharge(final Long chargeId) {
- final String sql = "select (CASE WHEN (exists (select 1 from m_savings_product_charge sc where sc.charge_id = ?)) = 1 THEN 'true' ELSE 'false' END)";
+ final String sql = "select (CASE WHEN exists (select 1 from m_savings_product_charge sc where sc.charge_id = ?) THEN 'true' ELSE 'false' END)";
Review Comment:
This is also unrelated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org