-
Notifications
You must be signed in to change notification settings - Fork 2.6k
FINERACT-2101: Loan product using global config values #3951
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
Closed
alberto-art3ch
wants to merge
1
commit into
apache:develop
from
alberto-art3ch:enhancement/loan_product_global_configs_01
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,6 +157,8 @@ private PostLoanProductsRequest() {} | |
| public Long delinquencyBucketId; | ||
| @Schema(example = "false") | ||
| public Boolean enableInstallmentLevelDelinquency; | ||
| @Schema(example = "false") | ||
| public Boolean useDueRepaymentGlobalConfigs; | ||
| @Schema(example = "3") | ||
| public Integer dueDaysForRepaymentEvent; | ||
| @Schema(example = "3") | ||
|
|
@@ -1260,6 +1262,8 @@ private GetLoanCharge() {} | |
| public Boolean enableInstallmentLevelDelinquency; | ||
| @Schema(example = "true") | ||
| public Boolean disallowExpectedDisbursements; | ||
| @Schema(example = "false") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this for GetLoanCharge? |
||
| public Boolean useDueRepaymentGlobalConfigs; | ||
| @Schema(example = "3") | ||
| public Integer dueDaysForRepaymentEvent; | ||
| @Schema(example = "3") | ||
|
|
@@ -1402,6 +1406,8 @@ private PutLoanProductsProductIdRequest() {} | |
| public Long delinquencyBucketId; | ||
| @Schema(example = "false") | ||
| public Boolean enableInstallmentLevelDelinquency; | ||
| @Schema(example = "false") | ||
| public Boolean useDueRepaymentGlobalConfigs; | ||
| @Schema(example = "3") | ||
| public Integer dueDaysForRepaymentEvent; | ||
| @Schema(example = "3") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,6 +232,9 @@ public class LoanProduct extends AbstractPersistableCustom<Long> { | |
| @Column(name = "repayment_start_date_type_enum", nullable = false) | ||
| private RepaymentStartDateType repaymentStartDateType; | ||
|
|
||
| @Column(name = "use_due_repayment_global_configs", nullable = false) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was not stored previously? |
||
| private boolean useDueRepaymentGlobalConfigs = false; | ||
|
|
||
| public static LoanProduct assembleFromJson(final Fund fund, final String loanTransactionProcessingStrategy, | ||
| final List<Charge> productCharges, final JsonCommand command, final AprCalculator aprCalculator, FloatingRate floatingRate, | ||
| final List<Rate> productRates, List<LoanProductPaymentAllocationRule> loanProductPaymentAllocationRules, | ||
|
|
@@ -439,6 +442,9 @@ public static LoanProduct assembleFromJson(final Fund fund, final String loanTra | |
|
|
||
| final Integer fixedLength = command.integerValueOfParameterNamed(LoanProductConstants.FIXED_LENGTH); | ||
|
|
||
| final boolean useDueRepaymentGlobalConfigs = command | ||
| .booleanPrimitiveValueOfParameterNamed(LoanProductConstants.USE_DUE_REPAYMENT_GLOBAL_CONFIGS); | ||
|
|
||
| return new LoanProduct(fund, loanTransactionProcessingStrategy, loanProductPaymentAllocationRules, loanProductCreditAllocationRules, | ||
| name, shortName, description, currency, principal, minPrincipal, maxPrincipal, interestRatePerPeriod, | ||
| minInterestRatePerPeriod, maxInterestRatePerPeriod, interestFrequencyType, annualInterestRate, interestMethod, | ||
|
|
@@ -457,7 +463,8 @@ public static LoanProduct assembleFromJson(final Fund fund, final String loanTra | |
| isEqualAmortization, productRates, fixedPrincipalPercentagePerInstallment, disallowExpectedDisbursements, | ||
| allowApprovedDisbursedAmountsOverApplied, overAppliedCalculationType, overAppliedNumber, dueDaysForRepaymentEvent, | ||
| overDueDaysForRepaymentEvent, enableDownPayment, disbursedAmountPercentageDownPayment, enableAutoRepaymentForDownPayment, | ||
| repaymentStartDateType, enableInstallmentLevelDelinquency, loanScheduleType, loanScheduleProcessingType, fixedLength); | ||
| repaymentStartDateType, enableInstallmentLevelDelinquency, loanScheduleType, loanScheduleProcessingType, fixedLength, | ||
| useDueRepaymentGlobalConfigs); | ||
|
|
||
| } | ||
|
|
||
|
|
@@ -674,7 +681,8 @@ public LoanProduct(final Fund fund, final String transactionProcessingStrategyCo | |
| final boolean enableDownPayment, final BigDecimal disbursedAmountPercentageForDownPayment, | ||
| final boolean enableAutoRepaymentForDownPayment, final RepaymentStartDateType repaymentStartDateType, | ||
| final boolean enableInstallmentLevelDelinquency, final LoanScheduleType loanScheduleType, | ||
| final LoanScheduleProcessingType loanScheduleProcessingType, final Integer fixedLength) { | ||
| final LoanScheduleProcessingType loanScheduleProcessingType, final Integer fixedLength, | ||
| final boolean useDueRepaymentGlobalConfigs) { | ||
| this.fund = fund; | ||
| this.transactionProcessingStrategyCode = transactionProcessingStrategyCode; | ||
|
|
||
|
|
@@ -771,6 +779,7 @@ public LoanProduct(final Fund fund, final String transactionProcessingStrategyCo | |
| this.rates = rates; | ||
| } | ||
|
|
||
| this.useDueRepaymentGlobalConfigs = useDueRepaymentGlobalConfigs; | ||
| this.dueDaysForRepaymentEvent = dueDaysForRepaymentEvent; | ||
| this.overDueDaysForRepaymentEvent = overDueDaysForRepaymentEvent; | ||
| this.repaymentStartDateType = repaymentStartDateType; | ||
|
|
@@ -1277,6 +1286,13 @@ public Map<String, Object> update(final JsonCommand command, final AprCalculator | |
| this.overAppliedNumber = newValue; | ||
| } | ||
|
|
||
| if (command.isChangeInBooleanParameterNamed(LoanProductConstants.USE_DUE_REPAYMENT_GLOBAL_CONFIGS, | ||
| this.useDueRepaymentGlobalConfigs)) { | ||
| final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.USE_DUE_REPAYMENT_GLOBAL_CONFIGS); | ||
| actualChanges.put(LoanProductConstants.USE_DUE_REPAYMENT_GLOBAL_CONFIGS, newValue); | ||
| this.useDueRepaymentGlobalConfigs = newValue; | ||
| } | ||
|
|
||
| if (command.isChangeInIntegerParameterNamed(LoanProductConstants.DUE_DAYS_FOR_REPAYMENT_EVENT, this.dueDaysForRepaymentEvent)) { | ||
| final Integer newValue = command.integerValueOfParameterNamed(LoanProductConstants.DUE_DAYS_FOR_REPAYMENT_EVENT); | ||
| actualChanges.put(LoanProductConstants.DUE_DAYS_FOR_REPAYMENT_EVENT, newValue); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...angelog/tenant/module/loan/parts/1022_add_use_due_repayment_global_configs_to_product.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
|
|
||
| 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. | ||
|
|
||
| --> | ||
| <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd"> | ||
| <changeSet author="fineract" id="1"> | ||
| <addColumn tableName="m_product_loan"> | ||
| <column name="use_due_repayment_global_configs" type="boolean" defaultValueBoolean="false"> | ||
| <constraints nullable="false"/> | ||
| </column> | ||
| </addColumn> | ||
| </changeSet> | ||
| </databaseChangeLog> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer the following:
Instead, if we have any settings on the loan product, fetch it, if not, we read from global configuration.
User can decide whether they provide any value for it or not... Basically these field would be optional ones, and what we can do when we fetch the loan product or the loan product template, we can send back the values from the global configuration and as a hint it can be shown on the UI. After that the user can decide whether they are happy with it or wanna override it. What do you think?
@bharathc27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamsaghy / @bharathc27
This boolean attribute is to let the UI know If the products uses or not the global config values. This is because in the UI exists a checkbox to indicate this. When you are creating and select that checkbox the global values are sent to Fineract. Until this, It is ok
The problem exists when you edit a Loan Product, the UI can not to know If the values of these configurations are or not copied from the global config
This issue was reported by Peter. The UI has the logic to read the value, but If Fineract does not return any value for this, then the UI can not indicate if the configurations are or not inherit from the global configurations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still believe we should not have the which indicates whether it is coming from global configuration or not. I would simply leave these fields as optional and if user does not fill them, it is coming from global configurations. If user provide a value then that will be used instead of the one from global configurations. Additionally we can enhance further and return the values from global configurations and we can show it on the UI to inform the user if nothing is sent, those value will be used, but they should be different values and do not send it back to backend!
What are your thoughts?