Skip to content

FINERACT-2455: WC - Transaction - Prepay Loan - #6385

Draft
somasorosdpc wants to merge 1 commit into
apache:developfrom
openMF:FINERACT-2455/wc-transaction-prepay-loan
Draft

FINERACT-2455: WC - Transaction - Prepay Loan#6385
somasorosdpc wants to merge 1 commit into
apache:developfrom
openMF:FINERACT-2455/wc-transaction-prepay-loan

Conversation

@somasorosdpc

Copy link
Copy Markdown
Contributor

Description

Describe the changes made and why they were made. (Ignore if these details are present on the associated Apache Fineract JIRA ticket.)

Checklist

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

  • Write the commit message as per our guidelines
  • 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 our 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
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.

Your assigned reviewer(s) will follow our guidelines for code reviews.

@somasorosdpc
somasorosdpc marked this pull request as draft September 3, 2026 12:44
@somasorosdpc
somasorosdpc force-pushed the FINERACT-2455/wc-transaction-prepay-loan branch from 160ef6a to 2e88f6c Compare September 4, 2026 13:53

@galovics galovics left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The transactionDate parameter is accepted, validated, parsed, and echoed back in the response - but never actually used to compute anything. The template amount is just balance.getTotalOutstanding() as it stands right now, so for a WC loan where penalties and discount fee accrue daily and backdated transactions are allowed, a payoff quote for any date other than today is going to be wrong with no way for the caller to tell. Either the payoff needs to be computed as of transactionDate (which is what I'd expect from something called "prepay" - including whatever the intended treatment of unearned discount fee is on an early settlement), or the parameter should be dropped until it does something.

Two more concrete issues:

  • repository.getReferenceById(loanId) returns a lazy proxy - an unknown loanId won't fail here, it'll throw EntityNotFoundException on first property access (getCurrency()), which has no exception mapper and surfaces as a 500 instead of a 404. retrieveOne in the same class does this correctly via findByIdWithFullDetails(...).orElseThrow(...) - worth reusing that pattern here, especially since getCurrency() and the balance can both be null in general.
  • The new Swagger response DTO (WorkingCapitalLoanTransactionTemplateResponse) doesn't match what the endpoint actually returns - it declares id (which the data class doesn't have) and omits currency (which it does). The generated client will always get null for a field that never exists and won't expose the one that does.

Smaller things: the permission check happens after loan resolution rather than before (every other endpoint in this resource does it the other way), and this also introduces a second, parallel "template" mechanism on the same resource ({loanId}/transactions/template?command=X vs. the existing {loanId}/template?templateType=X) with different query param names and different backing services for the same concept - worth confirming that's intentional rather than folding prepayLoan into the existing one.

Recommendation: CHANGES_REQUESTED

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.

2 participants