Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FINERACT-1960: GL account mappings to use Savings product with Accrua… #3752

Conversation

alberto-art3ch
Copy link
Contributor

…l accounting

Description

Financial institutions will want to recognize expenses/incomes accrued on deposit product accounts too similar to the Loan products.

Today, In Fineract deposit products do not support accrual accounting. This spec is to enhance the accrual accounting in Fineract to support periodic accrual of expenses/incomes on deposit accounts too.

Deposit Products refers to the Savings products, Fixed Deposit Products, and Recurring Deposit Products of Fineract Application, and accrual accounting option should be available for all three types.

Deposit product expenses: Interest to be paid on deposit accounts

Deposit product incomes: fees, interest on overdrafts

FINERACT-1960

Checklist
[+] Include the three new parameters in the Deposit product creation and edition
[+] Add the support for Accrual accounting in the Deposit product and GL account mappings

Screenshot 2024-02-17 at 8 59 39 p m

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per https://github.com/apache/fineract/#pull-requests

  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.

  • Create/update unit or integration tests for verifying the changes made.

  • Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.

  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes

  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

@bharathcgowda
Copy link

@adamsaghy could you please in reviewing this PR when ever you are available?

@alberto-art3ch alberto-art3ch force-pushed the enhancements/savings_product_accrual_gl_account_mappings branch from 150105f to 79a4f01 Compare February 21, 2024 05:35
@alberto-art3ch
Copy link
Contributor Author

@adamsaghy could you please in reviewing this PR when ever you are available?

@adamsaghy PR reviewed and updated, Thanks!

final ProductToGLAccountMappingMapper rm = new ProductToGLAccountMappingMapper();
final String sql = "select " + rm.schema() + " and product_id = ? and payment_type is null and mapping.charge_id is null ";

final List<Map<String, Object>> listOfProductToGLAccountMaps = this.jdbcTemplate.query(sql, rm, // NOSONAR
new Object[] { PortfolioProductType.SAVING.getValue(), savingsProductId });

if (AccountingRuleType.CASH_BASED.getValue().equals(accountingType)) {
Map<String, Object> accountMappingDetails = setBaseSavingsProductToGLAccountMaps(listOfProductToGLAccountMaps);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not reuse cash based accounting settings.

Define the mapping for Cash based and for Accrual based separately. Even if there are common rules and accounts, still it is better to handle them and define them differently!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

for (TaxPaymentDTO taxPaymentDTO : taxDetails) {
if (taxPaymentDTO.getAmount() != null) {
if (taxPaymentDTO.getCreditAccountId() == null) {
createCashBasedCreditJournalEntriesAndReversalsForSavings(office, currencyCode, accountTypeToBeCredited.getValue(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An accrual based journal entry should not call cashbased once... Please extract the logic into a common place if needed, but Cash based accounting and Accrual based accounting should not be mixed together!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


static final class GetFixedDepositProductsProductIdTransfersInSuspenseAccount {
@Schema(example = "12")
public Integer id;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GL account id is long!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


static final class GetRecurringDepositProductsProductIdTransfersInSuspenseAccount {
@Schema(example = "12")
public Integer id;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id is Long!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@@ -115,7 +113,7 @@ public void validateForFixedDepositCreate(final String json) {

final JsonElement element = this.fromApiJsonHelper.parse(json);

validateDepositDetailForCreate(element, this.fromApiJsonHelper, baseDataValidator);
validateDepositDetailForCreate(element, this.fromApiJsonHelper, baseDataValidator, DepositAccountType.RECURRING_DEPOSIT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation of Fixed deposit is the method name but here you are providing Recurring deposit. Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@@ -479,6 +480,7 @@ public Collection<AccountTransferDTO> retrieveDataForInterestTransfer() {
sqlBuilder.append(
"and st.transaction_type_enum = ? and sa.status_enum = ? and st.is_reversed=false and st.transaction_date > coalesce(sa.lockedin_until_date_derived,sa.activatedon_date)");

log.info("SQL {}", sqlBuilder.toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to log at info level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments!

Also there are a lot of changes, so my confidence in my review is not 100%!

It would be nice to see a summary of changes!

@alberto-art3ch alberto-art3ch force-pushed the enhancements/savings_product_accrual_gl_account_mappings branch from 79a4f01 to fe2d8a6 Compare February 21, 2024 22:03
Copy link
Contributor Author

@alberto-art3ch alberto-art3ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Comments attended, Thanks

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alberto-art3ch alberto-art3ch force-pushed the enhancements/savings_product_accrual_gl_account_mappings branch from fe2d8a6 to 3420436 Compare February 23, 2024 15:09
@alberto-art3ch alberto-art3ch force-pushed the enhancements/savings_product_accrual_gl_account_mappings branch from 3420436 to 67fa9f9 Compare February 25, 2024 23:30
@adamsaghy adamsaghy merged commit 6ee881b into apache:develop Feb 26, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants