FINERACT-1429:FD Interest Transfer on a backdated account (#1956)
This commit is contained in:
+2
@@ -102,4 +102,6 @@ public interface ConfigurationDomainService {
|
||||
String getAccountMappingForPaymentType();
|
||||
|
||||
String getAccountMappingForCharge();
|
||||
|
||||
boolean isNextDayFixedDepositInterestTransferEnabledForPeriodEnd();
|
||||
}
|
||||
|
||||
+7
@@ -393,4 +393,11 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNextDayFixedDepositInterestTransferEnabledForPeriodEnd() {
|
||||
final String propertyName = "fixed-deposit-transfer-interest-next-day-for-period-end-posting";
|
||||
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
|
||||
return property.isEnabled();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+13
-3
@@ -31,6 +31,7 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
@@ -80,6 +81,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
private final AccountTransferDetailRepository accountTransferDetailRepository;
|
||||
private final LoanReadPlatformService loanReadPlatformService;
|
||||
private final GSIMRepositoy gsimRepository;
|
||||
private final ConfigurationDomainService configurationDomainService;
|
||||
|
||||
@Autowired
|
||||
public AccountTransfersWritePlatformServiceImpl(final AccountTransfersDataValidator accountTransfersDataValidator,
|
||||
@@ -88,7 +90,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
final LoanAssembler loanAssembler, final LoanAccountDomainService loanAccountDomainService,
|
||||
final SavingsAccountWritePlatformService savingsAccountWritePlatformService,
|
||||
final AccountTransferDetailRepository accountTransferDetailRepository, final LoanReadPlatformService loanReadPlatformService,
|
||||
final GSIMRepositoy gsimRepository) {
|
||||
final GSIMRepositoy gsimRepository, ConfigurationDomainService configurationDomainService) {
|
||||
this.accountTransfersDataValidator = accountTransfersDataValidator;
|
||||
this.accountTransferAssembler = accountTransferAssembler;
|
||||
this.accountTransferRepository = accountTransferRepository;
|
||||
@@ -100,6 +102,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
this.accountTransferDetailRepository = accountTransferDetailRepository;
|
||||
this.loanReadPlatformService = loanReadPlatformService;
|
||||
this.gsimRepository = gsimRepository;
|
||||
this.configurationDomainService = configurationDomainService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -371,12 +374,19 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
AccountTransferType.fromInt(accountTransferDTO.getTransferType()).isInterestTransfer(),
|
||||
accountTransferDTO.isExceptionForBalanceCheck());
|
||||
|
||||
LocalDate transactionDate = accountTransferDTO.getTransactionDate();
|
||||
if (configurationDomainService.isSavingsInterestPostingAtCurrentPeriodEnd()
|
||||
&& configurationDomainService.isNextDayFixedDepositInterestTransferEnabledForPeriodEnd()
|
||||
&& AccountTransferType.fromInt(accountTransferDTO.getTransferType()).isInterestTransfer()) {
|
||||
transactionDate = transactionDate.plusDays(1);
|
||||
}
|
||||
|
||||
final SavingsAccountTransaction withdrawal = this.savingsAccountDomainService.handleWithdrawal(fromSavingsAccount,
|
||||
accountTransferDTO.getFmt(), accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
||||
accountTransferDTO.getFmt(), transactionDate, accountTransferDTO.getTransactionAmount(),
|
||||
accountTransferDTO.getPaymentDetail(), transactionBooleanValues);
|
||||
|
||||
final SavingsAccountTransaction deposit = this.savingsAccountDomainService.handleDeposit(toSavingsAccount,
|
||||
accountTransferDTO.getFmt(), accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
||||
accountTransferDTO.getFmt(), transactionDate, accountTransferDTO.getTransactionAmount(),
|
||||
accountTransferDTO.getPaymentDetail(), isAccountTransfer, isRegularTransaction);
|
||||
|
||||
accountTransferDetails = this.accountTransferAssembler.assembleSavingsToSavingsTransfer(accountTransferDTO, fromSavingsAccount,
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
--
|
||||
-- Licensed to the Apache Software Foundation (ASF) under one
|
||||
-- or more contributor license agreements. See the NOTICE file
|
||||
-- distributed with this work for additional information
|
||||
-- regarding copyright ownership. The ASF licenses this file
|
||||
-- to you under the Apache License, Version 2.0 (the
|
||||
-- "License"); you may not use this file except in compliance
|
||||
-- with the License. You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing,
|
||||
-- software distributed under the License is distributed on an
|
||||
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
-- KIND, either express or implied. See the License for the
|
||||
-- specific language governing permissions and limitations
|
||||
-- under the License.
|
||||
--
|
||||
|
||||
|
||||
INSERT INTO `c_configuration` (`id`, `name`, `enabled`, `description`)
|
||||
VALUES (NULL, 'fixed-deposit-transfer-interest-next-day-for-period-end-posting', '0', "Transfer fixed transfer interest next day(t+1) for period end posting");
|
||||
+11
-2
@@ -89,8 +89,8 @@ public class GlobalConfigurationHelper {
|
||||
ArrayList<HashMap> actualGlobalConfigurations = getAllGlobalConfigurations(requestSpec, responseSpec);
|
||||
|
||||
// There are currently 32 global configurations.
|
||||
Assertions.assertEquals(32, expectedGlobalConfigurations.size());
|
||||
Assertions.assertEquals(32, actualGlobalConfigurations.size());
|
||||
Assertions.assertEquals(33, expectedGlobalConfigurations.size());
|
||||
Assertions.assertEquals(33, actualGlobalConfigurations.size());
|
||||
|
||||
for (int i = 0; i < expectedGlobalConfigurations.size(); i++) {
|
||||
|
||||
@@ -380,6 +380,15 @@ public class GlobalConfigurationHelper {
|
||||
isAccountMappedForCharge.put("string_value", "Income");
|
||||
defaults.add(isAccountMappedForCharge);
|
||||
|
||||
HashMap<String, Object> isNextDayFixedDepositInterestTransferEnabledForPeriodEnd = new HashMap<>();
|
||||
isNextDayFixedDepositInterestTransferEnabledForPeriodEnd.put("id", 37);
|
||||
isNextDayFixedDepositInterestTransferEnabledForPeriodEnd.put("name",
|
||||
"fixed-deposit-transfer-interest-next-day-for-period-end-posting");
|
||||
isNextDayFixedDepositInterestTransferEnabledForPeriodEnd.put("value", 0);
|
||||
isNextDayFixedDepositInterestTransferEnabledForPeriodEnd.put("enabled", false);
|
||||
isNextDayFixedDepositInterestTransferEnabledForPeriodEnd.put("trapDoor", false);
|
||||
defaults.add(isNextDayFixedDepositInterestTransferEnabledForPeriodEnd);
|
||||
|
||||
return defaults;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user