Skip to content

Conversation

@francisguchie
Copy link
Contributor

Description

#1186

Addressing the following comments from @ptuomola

Addressing these comments below
The current behaviour should be kept as the default - i.e. without a configuration present in the database, the same behaviour should remain (overpayments allowed)
The default configuration added to this should also keep the current behaviour as-is - i.e. the default Flyway script should create the configuration in such way that it allows overpayments
The existing integration tests should be kept-as is and they should continue to be used to test the current behaviour (i.e. overpayment allowed)

but Not able to answer this
We should create a new integration test (or multiple tests) to test the scenario where overpayments are not allowed. These tests should first set the flag to disable overpayments, then carry out the tests to confirm that overpayments fail in different scenarios, and then reset the flag back to enabling overpayments

Checklist

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

Our guidelines for code reviews is at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide

@vorburger
Copy link
Member

Copy link
Contributor

@ptuomola ptuomola left a comment

Choose a reason for hiding this comment

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

Some review comments - please have a look at let me know your thoughts. Also would be good to have some tests for this before merging - maybe you could add a few?

openapi: 3.0.3
info:
version: release-1.4.0-561-g9bad487-dirty
title: Apache Fineract
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not check in this file as it is autogenerated

// customization configure ability to overpay loan
final Money outstandingBalance = Money.of(loan.getCurrency(), loan.getSummary().getTotalOutstanding());
if (outstandingBalance.minus(repaymentAmount).isLessThanZero() && !isLoanOverpaymentEnabled) {
baseDataValidator.reset().failWithCode("Repayment exceeding outstanding balance");
Copy link
Contributor

Choose a reason for hiding this comment

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

failWithCode should take as parameter the error code property, not freetext - you can take a look at the other calls to it in this file

baseDataValidator.reset().failWithCode("Repayment exceeding outstanding balance");
if (!dataValidationErrors.isEmpty()) {
throw new PlatformApiDataValidationException(dataValidationErrors);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

To be consistent with the other exceptions thrown in this class, there are a couple of other parameters that should be passed to PlatformApiDataValidationException - take a look at the other throws

final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction");
final GlobalConfigurationPropertyData configuration = this.configurationReadPlatformService
.retrieveGlobalConfiguration("Enable-Loan-Overpayment");
Copy link
Contributor

Choose a reason for hiding this comment

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

To make the current behaviour default, would it not make sense to have a configuration value that works the other way around - i.e. call it "block-loan-overpayment", and if it is present & enabled then overpayments are blocked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @ptuomola i did not think of this suggested approach. let me try just that

@github-actions
Copy link

github-actions bot commented Oct 3, 2020

This pull request seems to be stale. Are you still planning to work on it? We will automatically close it in 30 days.

@github-actions github-actions bot added the stale label Oct 3, 2020
@vorburger
Copy link
Member

@francisguchie will you update this PR based on @ptuomola code review feedback? If you don't, it will auto-close soon.

@francisguchie
Copy link
Contributor Author

@francisguchie will you update this PR based on @ptuomola code review feedback? If you don't, it will auto-close soon.

Yes @vorburger, will do this weekend

@github-actions github-actions bot removed the stale label Nov 2, 2020
@github-actions
Copy link

github-actions bot commented Dec 2, 2020

This pull request seems to be stale. Are you still planning to work on it? We will automatically close it in 30 days.

@github-actions github-actions bot added the stale label Dec 2, 2020
@francisguchie
Copy link
Contributor Author

@awasum, @vorburger , @ptuomola

I am going to make sure this will be done asap.

@francisguchie
Copy link
Contributor Author

new pull request made

#1536

@francisguchie francisguchie deleted the FINERACT-1052loanOverPaytConf branch December 12, 2020 20:25
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