FINERACT-1411 Allow charges type saving to map to all types of Ledgers (#1935)
This commit is contained in:
+4
@@ -43,4 +43,8 @@ public interface AccountingDropdownReadPlatformService {
|
||||
|
||||
Map<String, List<GLAccountData>> retrieveAccountMappingOptionsForShareProducts();
|
||||
|
||||
List<GLAccountData> retrieveExpenseAccountOptions();
|
||||
|
||||
List<GLAccountData> retrieveAssetAccountOptions();
|
||||
|
||||
}
|
||||
|
||||
+10
@@ -95,6 +95,16 @@ public class AccountingDropdownReadPlatformServiceImpl implements AccountingDrop
|
||||
includeEquityAccounts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GLAccountData> retrieveExpenseAccountOptions() {
|
||||
return accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.EXPENSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GLAccountData> retrieveAssetAccountOptions() {
|
||||
return accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.ASSET);
|
||||
}
|
||||
|
||||
private Map<String, List<GLAccountData>> retrieveAccountMappingOptions(boolean includeAssetAccounts, boolean includeIncomeAccounts,
|
||||
boolean includeExpenseAccounts, boolean includeLiabilityAccounts, boolean includeEquityAccounts) {
|
||||
final Map<String, List<GLAccountData>> accountOptions = new HashMap<>();
|
||||
|
||||
+1
@@ -30,6 +30,7 @@ public class ChargePaymentDTO {
|
||||
this.chargeId = chargeId;
|
||||
this.amount = amount;
|
||||
this.loanChargeId = loanChargeId;
|
||||
|
||||
}
|
||||
|
||||
public Long getChargeId() {
|
||||
|
||||
+16
-4
@@ -64,6 +64,7 @@ import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.account.PortfolioAccountType;
|
||||
import org.apache.fineract.portfolio.account.service.AccountTransfersReadPlatformService;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientTransaction;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientTransactionRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionEnumData;
|
||||
@@ -95,6 +96,7 @@ public class AccountingProcessorHelper {
|
||||
private final ClientTransactionRepositoryWrapper clientTransactionRepository;
|
||||
private final SavingsAccountTransactionRepository savingsAccountTransactionRepository;
|
||||
private final AccountTransfersReadPlatformService accountTransfersReadPlatformService;
|
||||
private final ChargeRepositoryWrapper chargeRepositoryWrapper;
|
||||
|
||||
@Autowired
|
||||
public AccountingProcessorHelper(final JournalEntryRepository glJournalEntryRepository,
|
||||
@@ -104,7 +106,8 @@ public class AccountingProcessorHelper {
|
||||
final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository,
|
||||
final AccountTransfersReadPlatformService accountTransfersReadPlatformService,
|
||||
final GLAccountRepositoryWrapper accountRepositoryWrapper,
|
||||
final ClientTransactionRepositoryWrapper clientTransactionRepositoryWrapper) {
|
||||
final ClientTransactionRepositoryWrapper clientTransactionRepositoryWrapper,
|
||||
final ChargeRepositoryWrapper chargeRepositoryWrapper) {
|
||||
this.glJournalEntryRepository = glJournalEntryRepository;
|
||||
this.accountMappingRepository = accountMappingRepository;
|
||||
this.closureRepository = closureRepository;
|
||||
@@ -115,6 +118,7 @@ public class AccountingProcessorHelper {
|
||||
this.accountTransfersReadPlatformService = accountTransfersReadPlatformService;
|
||||
this.accountRepositoryWrapper = accountRepositoryWrapper;
|
||||
this.clientTransactionRepository = clientTransactionRepositoryWrapper;
|
||||
this.chargeRepositoryWrapper = chargeRepositoryWrapper;
|
||||
}
|
||||
|
||||
public LoanDTO populateLoanDtoFromMap(final Map<String, Object> accountingBridgeData, final boolean cashBasedAccountingEnabled,
|
||||
@@ -758,7 +762,7 @@ public class AccountingProcessorHelper {
|
||||
* chargePaymentDTOs
|
||||
*/
|
||||
public void createCashBasedJournalEntriesAndReversalsForSavingsCharges(final Office office, final String currencyCode,
|
||||
final CashAccountsForSavings accountTypeToBeDebited, final CashAccountsForSavings accountTypeToBeCredited,
|
||||
final CashAccountsForSavings accountTypeToBeDebited, CashAccountsForSavings accountTypeToBeCredited,
|
||||
final Long savingsProductId, final Long paymentTypeId, final Long loanId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
|
||||
final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
@@ -774,9 +778,9 @@ public class AccountingProcessorHelper {
|
||||
"Recent Portfolio changes w.r.t Charges for Savings have Broken the accounting code");
|
||||
}
|
||||
ChargePaymentDTO chargePaymentDTO = chargePaymentDTOs.get(0);
|
||||
|
||||
final GLAccount chargeSpecificAccount = getLinkedGLAccountForSavingsCharges(savingsProductId, accountTypeToBeCredited.getValue(),
|
||||
GLAccount chargeSpecificAccount = getLinkedGLAccountForSavingsCharges(savingsProductId, accountTypeToBeCredited.getValue(),
|
||||
chargePaymentDTO.getChargeId());
|
||||
|
||||
final GLAccount savingsControlAccount = getLinkedGLAccountForSavingsProduct(savingsProductId, accountTypeToBeDebited.getValue(),
|
||||
paymentTypeId);
|
||||
if (isReversal) {
|
||||
@@ -1158,6 +1162,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
private GLAccount getLinkedGLAccountForSavingsCharges(final Long savingsProductId, final int accountMappingTypeId,
|
||||
final Long chargeId) {
|
||||
|
||||
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(savingsProductId,
|
||||
PortfolioProductType.SAVING.getValue(), accountMappingTypeId);
|
||||
/*****
|
||||
@@ -1167,15 +1172,22 @@ public class AccountingProcessorHelper {
|
||||
*****/
|
||||
|
||||
// Vishwas TODO: remove this condition as it should always be true
|
||||
|
||||
if (accountMappingTypeId == CashAccountsForSavings.INCOME_FROM_FEES.getValue()
|
||||
|| accountMappingTypeId == CashAccountsForLoan.INCOME_FROM_PENALTIES.getValue()) {
|
||||
GLAccount glAccount = chargeRepositoryWrapper.findOneWithNotFoundDetection(chargeId).getAccount();
|
||||
if (glAccount != null) {
|
||||
return glAccount;
|
||||
}
|
||||
final ProductToGLAccountMapping chargeSpecificIncomeAccountMapping = this.accountMappingRepository
|
||||
.findProductIdAndProductTypeAndFinancialAccountTypeAndChargeId(savingsProductId, PortfolioProductType.SAVING.getValue(),
|
||||
accountMappingTypeId, chargeId);
|
||||
if (chargeSpecificIncomeAccountMapping != null) {
|
||||
|
||||
accountMapping = chargeSpecificIncomeAccountMapping;
|
||||
}
|
||||
}
|
||||
|
||||
return accountMapping.getGlAccount();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -115,8 +115,8 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
|
||||
public void saveChargesToIncomeAccountMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||
final Map<String, Object> changes) {
|
||||
// save both fee and penalty charges
|
||||
saveChargesToIncomeOrLiabilityAccountMappings(command, element, productId, changes, PortfolioProductType.LOAN, true);
|
||||
saveChargesToIncomeOrLiabilityAccountMappings(command, element, productId, changes, PortfolioProductType.LOAN, false);
|
||||
saveChargesToGLAccountMappings(command, element, productId, changes, PortfolioProductType.LOAN, true);
|
||||
saveChargesToGLAccountMappings(command, element, productId, changes, PortfolioProductType.LOAN, false);
|
||||
}
|
||||
|
||||
public void updateChargesToIncomeAccountMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||
|
||||
+2
-3
@@ -162,7 +162,7 @@ public class ProductToGLAccountMappingHelper {
|
||||
* @param productId
|
||||
* @param changes
|
||||
*/
|
||||
public void saveChargesToIncomeOrLiabilityAccountMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||
public void saveChargesToGLAccountMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||
final Map<String, Object> changes, final PortfolioProductType portfolioProductType, final boolean isPenalty) {
|
||||
String arrayName;
|
||||
if (isPenalty) {
|
||||
@@ -332,8 +332,7 @@ public class ProductToGLAccountMappingHelper {
|
||||
if (inputPaymentChannelFundSourceMap.containsKey(currentPaymentChannelId)) {
|
||||
final Long newGLAccountId = inputPaymentChannelFundSourceMap.get(currentPaymentChannelId);
|
||||
if (!newGLAccountId.equals(existingPaymentChannelToFundSourceMapping.getGlAccount().getId())) {
|
||||
final GLAccount glAccount = getAccountByIdAndType(LoanProductAccountingParams.FUND_SOURCE.getValue(),
|
||||
GLAccountType.ASSET, newGLAccountId);
|
||||
final GLAccount glAccount = getAccountById(LoanProductAccountingParams.FUND_SOURCE.getValue(), newGLAccountId);
|
||||
existingPaymentChannelToFundSourceMapping.setGlAccount(glAccount);
|
||||
this.accountMappingRepository.save(existingPaymentChannelToFundSourceMapping);
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public interface ProductToGLAccountMappingReadPlatformService {
|
||||
|
||||
List<PaymentTypeToGLAccountMapper> fetchPaymentTypeToFundSourceMappingsForLoanProduct(Long loanProductId);
|
||||
|
||||
List<ChargeToGLAccountMapper> fetchFeeToIncomeOrLiabilityAccountMappingsForLoanProduct(Long loanProductId);
|
||||
List<ChargeToGLAccountMapper> fetchFeeToGLAccountMappingsForLoanProduct(Long loanProductId);
|
||||
|
||||
List<ChargeToGLAccountMapper> fetchPenaltyToIncomeAccountMappingsForLoanProduct(Long loanProductId);
|
||||
|
||||
|
||||
+1
-1
@@ -279,7 +279,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChargeToGLAccountMapper> fetchFeeToIncomeOrLiabilityAccountMappingsForLoanProduct(final Long loanProductId) {
|
||||
public List<ChargeToGLAccountMapper> fetchFeeToGLAccountMappingsForLoanProduct(final Long loanProductId) {
|
||||
return fetchChargeToIncomeAccountMappings(PortfolioProductType.LOAN, loanProductId, false);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -121,8 +121,8 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
|
||||
public void saveChargesToIncomeAccountMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||
final Map<String, Object> changes) {
|
||||
// save both fee and penalty charges
|
||||
saveChargesToIncomeOrLiabilityAccountMappings(command, element, productId, changes, PortfolioProductType.SAVING, true);
|
||||
saveChargesToIncomeOrLiabilityAccountMappings(command, element, productId, changes, PortfolioProductType.SAVING, false);
|
||||
saveChargesToGLAccountMappings(command, element, productId, changes, PortfolioProductType.SAVING, true);
|
||||
saveChargesToGLAccountMappings(command, element, productId, changes, PortfolioProductType.SAVING, false);
|
||||
}
|
||||
|
||||
public void updateChargesToIncomeAccountMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||
|
||||
+2
-2
@@ -114,8 +114,8 @@ public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMapp
|
||||
|
||||
public void saveChargesToIncomeAccountMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||
final Map<String, Object> changes) {
|
||||
saveChargesToIncomeOrLiabilityAccountMappings(command, element, productId, changes, PortfolioProductType.SHARES, true);
|
||||
saveChargesToIncomeOrLiabilityAccountMappings(command, element, productId, changes, PortfolioProductType.SHARES, false);
|
||||
saveChargesToGLAccountMappings(command, element, productId, changes, PortfolioProductType.SHARES, true);
|
||||
saveChargesToGLAccountMappings(command, element, productId, changes, PortfolioProductType.SHARES, false);
|
||||
}
|
||||
|
||||
public void updateChargesToIncomeAccountMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||
|
||||
+3
-3
@@ -370,7 +370,7 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
|
||||
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
|
||||
if (property.isEnabled()) {
|
||||
String value = property.getStringValue();
|
||||
if (value == null) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return value;
|
||||
@@ -384,8 +384,8 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
|
||||
String defaultValue = "Income"; // 1 Stands for Account mapped from income only
|
||||
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
|
||||
if (property.isEnabled()) {
|
||||
String value = property.getValue().toString();
|
||||
if (value == null) {
|
||||
String value = property.getStringValue();
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return defaultValue;
|
||||
}
|
||||
return value;
|
||||
|
||||
-1
@@ -184,7 +184,6 @@ public class ChargesApiResource {
|
||||
|
||||
@DELETE
|
||||
@Path("{chargeId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
@Operation(summary = "Delete a Charge", description = "Deletes a Charge.")
|
||||
@ApiResponses({
|
||||
|
||||
+26
-6
@@ -77,6 +77,10 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
|
||||
private final Map<String, List<GLAccountData>> incomeOrLiabilityAccountOptions;
|
||||
private final Collection<TaxGroupData> taxGroupOptions;
|
||||
|
||||
private final String accountMappingForChargeConfig;
|
||||
private final List<GLAccountData> expenseAccountOptions;
|
||||
private final List<GLAccountData> assetAccountOptions;
|
||||
|
||||
public static ChargeData template(final Collection<CurrencyData> currencyOptions,
|
||||
final List<EnumOptionData> chargeCalculationTypeOptions, final List<EnumOptionData> chargeAppliesToOptions,
|
||||
final List<EnumOptionData> chargeTimeTypeOptions, final List<EnumOptionData> chargePaymentModeOptions,
|
||||
@@ -85,7 +89,8 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
|
||||
final List<EnumOptionData> clientChargeCalculationTypeOptions, final List<EnumOptionData> clientChargeTimeTypeOptions,
|
||||
final List<EnumOptionData> feeFrequencyOptions, final Map<String, List<GLAccountData>> incomeOrLiabilityAccountOptions,
|
||||
final Collection<TaxGroupData> taxGroupOptions, final List<EnumOptionData> shareChargeCalculationTypeOptions,
|
||||
final List<EnumOptionData> shareChargeTimeTypeOptions) {
|
||||
final List<EnumOptionData> shareChargeTimeTypeOptions, String accountMappingForChargeConfig,
|
||||
List<GLAccountData> expenseAccountOptions, List<GLAccountData> assetAccountOptions) {
|
||||
final GLAccountData account = null;
|
||||
final TaxGroupData taxGroupData = null;
|
||||
|
||||
@@ -94,7 +99,7 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
|
||||
loansChargeCalculationTypeOptions, loansChargeTimeTypeOptions, savingsChargeCalculationTypeOptions,
|
||||
savingsChargeTimeTypeOptions, clientChargeCalculationTypeOptions, clientChargeTimeTypeOptions, null, null, null, null, null,
|
||||
feeFrequencyOptions, account, incomeOrLiabilityAccountOptions, taxGroupOptions, shareChargeCalculationTypeOptions,
|
||||
shareChargeTimeTypeOptions);
|
||||
shareChargeTimeTypeOptions, accountMappingForChargeConfig, expenseAccountOptions, assetAccountOptions);
|
||||
}
|
||||
|
||||
public static ChargeData withTemplate(final ChargeData charge, final ChargeData template) {
|
||||
@@ -106,7 +111,8 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
|
||||
template.clientChargeCalculationTypeOptions, template.clientChargeTimeTypeOptions, charge.feeOnMonthDay, charge.feeInterval,
|
||||
charge.minCap, charge.maxCap, charge.feeFrequency, template.feeFrequencyOptions, charge.incomeOrLiabilityAccount,
|
||||
template.incomeOrLiabilityAccountOptions, template.taxGroupOptions, template.shareChargeCalculationTypeOptions,
|
||||
template.shareChargeTimeTypeOptions);
|
||||
template.shareChargeTimeTypeOptions, template.accountMappingForChargeConfig, template.expenseAccountOptions,
|
||||
template.assetAccountOptions);
|
||||
}
|
||||
|
||||
public static ChargeData instance(final Long id, final String name, final BigDecimal amount, final CurrencyData currency,
|
||||
@@ -131,12 +137,16 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
|
||||
final List<EnumOptionData> shareChargeCalculationTypeOptions = null;
|
||||
final List<EnumOptionData> shareChargeTimeTypeOptions = null;
|
||||
final Collection<TaxGroupData> taxGroupOptions = null;
|
||||
final String accountMappingForChargeConfig = null;
|
||||
final List<GLAccountData> expenseAccountOptions = null;
|
||||
final List<GLAccountData> assetAccountOptions = null;
|
||||
return new ChargeData(id, name, amount, currency, chargeTimeType, chargeAppliesTo, chargeCalculationType, chargePaymentMode,
|
||||
penalty, active, taxGroupData, currencyOptions, chargeCalculationTypeOptions, chargeAppliesToOptions, chargeTimeTypeOptions,
|
||||
chargePaymentModeOptions, loansChargeCalculationTypeOptions, loansChargeTimeTypeOptions,
|
||||
savingsChargeCalculationTypeOptions, savingsChargeTimeTypeOptions, clientChargeCalculationTypeOptions,
|
||||
clientChargeTimeTypeOptions, feeOnMonthDay, feeInterval, minCap, maxCap, feeFrequency, feeFrequencyOptions, accountData,
|
||||
incomeOrLiabilityAccountOptions, taxGroupOptions, shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions);
|
||||
incomeOrLiabilityAccountOptions, taxGroupOptions, shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions,
|
||||
accountMappingForChargeConfig, expenseAccountOptions, assetAccountOptions);
|
||||
}
|
||||
|
||||
public static ChargeData lookup(final Long id, final String name, final boolean isPenalty) {
|
||||
@@ -171,12 +181,17 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
|
||||
final List<EnumOptionData> shareChargeTimeTypeOptions = null;
|
||||
final TaxGroupData taxGroupData = null;
|
||||
final Collection<TaxGroupData> taxGroupOptions = null;
|
||||
final String accountMappingForChargeConfig = null;
|
||||
final List<GLAccountData> expenseAccountOptions = null;
|
||||
final List<GLAccountData> assetAccountOptions = null;
|
||||
|
||||
return new ChargeData(id, name, amount, currency, chargeTimeType, chargeAppliesTo, chargeCalculationType, chargePaymentMode,
|
||||
penalty, active, taxGroupData, currencyOptions, chargeCalculationTypeOptions, chargeAppliesToOptions, chargeTimeTypeOptions,
|
||||
chargePaymentModeOptions, loansChargeCalculationTypeOptions, loansChargeTimeTypeOptions,
|
||||
savingsChargeCalculationTypeOptions, savingsChargeTimeTypeOptions, clientChargeCalculationTypeOptions,
|
||||
clientChargeTimeTypeOptions, feeOnMonthDay, feeInterval, minCap, maxCap, feeFrequency, feeFrequencyOptions, account,
|
||||
incomeOrLiabilityAccountOptions, taxGroupOptions, shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions);
|
||||
incomeOrLiabilityAccountOptions, taxGroupOptions, shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions,
|
||||
accountMappingForChargeConfig, expenseAccountOptions, assetAccountOptions);
|
||||
}
|
||||
|
||||
private ChargeData(final Long id, final String name, final BigDecimal amount, final CurrencyData currency,
|
||||
@@ -191,7 +206,9 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
|
||||
final BigDecimal minCap, final BigDecimal maxCap, final EnumOptionData feeFrequency,
|
||||
final List<EnumOptionData> feeFrequencyOptions, final GLAccountData account,
|
||||
final Map<String, List<GLAccountData>> incomeOrLiabilityAccountOptions, final Collection<TaxGroupData> taxGroupOptions,
|
||||
final List<EnumOptionData> shareChargeCalculationTypeOptions, final List<EnumOptionData> shareChargeTimeTypeOptions) {
|
||||
final List<EnumOptionData> shareChargeCalculationTypeOptions, final List<EnumOptionData> shareChargeTimeTypeOptions,
|
||||
final String accountMappingForChargeConfig, final List<GLAccountData> expenseAccountOptions,
|
||||
final List<GLAccountData> assetAccountOptions) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.amount = amount;
|
||||
@@ -225,6 +242,9 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
|
||||
this.taxGroupOptions = taxGroupOptions;
|
||||
this.shareChargeCalculationTypeOptions = shareChargeCalculationTypeOptions;
|
||||
this.shareChargeTimeTypeOptions = shareChargeTimeTypeOptions;
|
||||
this.accountMappingForChargeConfig = accountMappingForChargeConfig;
|
||||
this.assetAccountOptions = assetAccountOptions;
|
||||
this.expenseAccountOptions = expenseAccountOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -579,7 +579,7 @@ public class Charge extends AbstractPersistableCustom {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
private Long getIncomeAccountId() {
|
||||
public Long getIncomeAccountId() {
|
||||
Long incomeAccountId = null;
|
||||
if (this.account != null) {
|
||||
incomeAccountId = this.account.getId();
|
||||
|
||||
+10
-2
@@ -28,6 +28,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainServiceJpa;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
@@ -67,13 +68,14 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService;
|
||||
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
||||
private final TaxReadPlatformService taxReadPlatformService;
|
||||
private final ConfigurationDomainServiceJpa configurationDomainServiceJpa;
|
||||
|
||||
@Autowired
|
||||
public ChargeReadPlatformServiceImpl(final CurrencyReadPlatformService currencyReadPlatformService,
|
||||
final ChargeDropdownReadPlatformService chargeDropdownReadPlatformService, final RoutingDataSource dataSource,
|
||||
final DropdownReadPlatformService dropdownReadPlatformService, final FineractEntityAccessUtil fineractEntityAccessUtil,
|
||||
final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService,
|
||||
final TaxReadPlatformService taxReadPlatformService) {
|
||||
final TaxReadPlatformService taxReadPlatformService, final ConfigurationDomainServiceJpa configurationDomainServiceJpa) {
|
||||
this.chargeDropdownReadPlatformService = chargeDropdownReadPlatformService;
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.currencyReadPlatformService = currencyReadPlatformService;
|
||||
@@ -82,6 +84,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService;
|
||||
this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
|
||||
this.taxReadPlatformService = taxReadPlatformService;
|
||||
this.configurationDomainServiceJpa = configurationDomainServiceJpa;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,11 +155,16 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
.retrieveSharesCalculationTypes();
|
||||
final List<EnumOptionData> shareChargeTimeTypeOptions = this.chargeDropdownReadPlatformService.retrieveSharesCollectionTimeTypes();
|
||||
final Collection<TaxGroupData> taxGroupOptions = this.taxReadPlatformService.retrieveTaxGroupsForLookUp();
|
||||
final String accountMappingForChargeConfig = this.configurationDomainServiceJpa.getAccountMappingForCharge();
|
||||
final List<GLAccountData> expenseAccountOptions = this.accountingDropdownReadPlatformService.retrieveExpenseAccountOptions();
|
||||
final List<GLAccountData> assetAccountOptions = this.accountingDropdownReadPlatformService.retrieveAssetAccountOptions();
|
||||
|
||||
return ChargeData.template(currencyOptions, allowedChargeCalculationTypeOptions, allowedChargeAppliesToOptions,
|
||||
allowedChargeTimeOptions, chargePaymentOptions, loansChargeCalculationTypeOptions, loansChargeTimeTypeOptions,
|
||||
savingsChargeCalculationTypeOptions, savingsChargeTimeTypeOptions, clientChargeCalculationTypeOptions,
|
||||
clientChargeTimeTypeOptions, feeFrequencyOptions, incomeOrLiabilityAccountOptions, taxGroupOptions,
|
||||
shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions);
|
||||
shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions, accountMappingForChargeConfig, expenseAccountOptions,
|
||||
assetAccountOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-1
@@ -159,10 +159,16 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
|
||||
final List<EnumOptionData> shareChargeCalculationTypeOptions = null;
|
||||
final List<EnumOptionData> shareChargeTimeTypeOptions = null;
|
||||
final Collection<TaxGroupData> taxGroupOptions = null;
|
||||
|
||||
final String accountMappingForChargeConfig = null;
|
||||
final List<GLAccountData> expenseAccountOptions = null;
|
||||
final List<GLAccountData> assetAccountOptions = null;
|
||||
|
||||
return ChargeData.template(null, allowedChargeCalculationTypeOptions, null, allowedChargeTimeOptions, null,
|
||||
loansChargeCalculationTypeOptions, loansChargeTimeTypeOptions, savingsChargeCalculationTypeOptions,
|
||||
savingsChargeTimeTypeOptions, clientChargeCalculationTypeOptions, clientChargeTimeTypeOptions, feeFrequencyOptions,
|
||||
incomeOrLiabilityAccountOptions, taxGroupOptions, shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions);
|
||||
incomeOrLiabilityAccountOptions, taxGroupOptions, shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions,
|
||||
accountMappingForChargeConfig, expenseAccountOptions, assetAccountOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-2
@@ -275,8 +275,7 @@ public class LoanProductsApiResource {
|
||||
loanProduct.accountingRuleType().getId().intValue());
|
||||
paymentChannelToFundSourceMappings = this.accountMappingReadPlatformService
|
||||
.fetchPaymentTypeToFundSourceMappingsForLoanProduct(productId);
|
||||
feeToGLAccountMappings = this.accountMappingReadPlatformService
|
||||
.fetchFeeToIncomeOrLiabilityAccountMappingsForLoanProduct(productId);
|
||||
feeToGLAccountMappings = this.accountMappingReadPlatformService.fetchFeeToGLAccountMappingsForLoanProduct(productId);
|
||||
penaltyToGLAccountMappings = this.accountMappingReadPlatformService
|
||||
.fetchPenaltyToIncomeAccountMappingsForLoanProduct(productId);
|
||||
loanProduct = LoanProductData.withAccountingDetails(loanProduct, accountingMappings, paymentChannelToFundSourceMappings,
|
||||
|
||||
+4
@@ -192,4 +192,8 @@ public class SavingsAccountChargeData implements Serializable {
|
||||
return this.amountOutstanding;
|
||||
}
|
||||
|
||||
public long getAccountId() {
|
||||
return this.accountId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-1
@@ -163,11 +163,17 @@ public class SavingsAccountChargeReadPlatformServiceImpl implements SavingsAccou
|
||||
final List<EnumOptionData> shareChargeCalculationTypeOptions = null;
|
||||
final List<EnumOptionData> shareChargeTimeTypeOptions = null;
|
||||
final Collection<TaxGroupData> taxGroupOptions = null;
|
||||
|
||||
final String accountMappingForChargeConfig = null;
|
||||
final List<GLAccountData> expenseAccountOptions = null;
|
||||
final List<GLAccountData> assetAccountOptions = null;
|
||||
|
||||
// TODO AA : revisit for merge conflict - Not sure method signature
|
||||
return ChargeData.template(null, allowedChargeCalculationTypeOptions, null, allowedChargeTimeOptions, null,
|
||||
loansChargeCalculationTypeOptions, loansChargeTimeTypeOptions, savingsChargeCalculationTypeOptions,
|
||||
savingsChargeTimeTypeOptions, clientChargeCalculationTypeOptions, clientChargeTimeTypeOptions, feeFrequencyOptions,
|
||||
incomeOrLiabilityAccountOptions, taxGroupOptions, shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions);
|
||||
incomeOrLiabilityAccountOptions, taxGroupOptions, shareChargeCalculationTypeOptions, shareChargeTimeTypeOptions,
|
||||
accountMappingForChargeConfig, expenseAccountOptions, assetAccountOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user