WEB-657: Working Capital loan - Payout Refund transaction - #3750
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Note
|
| Layer / File(s) | Summary |
|---|---|
Payout refund availability and routing src/app/loans/loans-view/loan-accounts-button-config.ts, src/app/loans/common-resolvers/loan-action-button.resolver.ts, src/app/loans/loans.service.ts, src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts |
Active, Closed, and Overpaid working-capital accounts receive a Payout Refund action. Dedicated templates and permissions handle the action. |
Repayment form and payload handling src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts, src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.html |
Working-capital repayments display classification options, use an expected-amount fallback, and conditionally nest payment details in the submission payload. |
Working-capital transaction undo src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts, src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts |
Working-capital undo operations use the working-capital command and omit loan-specific transaction fields. |
Breach-actions navigation src/app/loans/loans-view/loans-view.component.html |
The working-capital breach-actions tab link was removed. |
Dispute Management Cleanup
| Layer / File(s) | Summary |
|---|---|
Remove unused progress bar registration src/app/clients/clients-view/dispute-management/dispute-management.component.ts |
The unused progress bar import and standalone registration were removed. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Sequence Diagram(s)
sequenceDiagram
participant AccountView
participant LoanActionButtonResolver
participant LoansService
participant WorkingCapitalCommand
AccountView->>LoanActionButtonResolver: open Payout Refund
LoanActionButtonResolver->>LoansService: request working-capital repayment template
LoansService-->>LoanActionButtonResolver: return repayment form template
AccountView->>WorkingCapitalCommand: submit payout refund or undo transaction
WorkingCapitalCommand-->>AccountView: complete action and navigate back
Possibly related PRs
- openMF/web-app#3752: Both PRs update transaction undo behavior for working-capital loans.
Suggested reviewers: adamsaghy
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly identifies the main change: adding Payout Refund transactions for Working Capital loans. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts (1)
375-375: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid introducing an untyped payment-details payload.
anydisables checks while constructing data sent to the working-capital action API. Use a guardedRecord<string, unknown>(or the request DTO) instead.Suggested change
- const paymentDetails: any = 'paymentDetails' in payload ? payload['paymentDetails'] : {}; + const existingPaymentDetails = payload['paymentDetails']; + const paymentDetails: Record<string, unknown> = + existingPaymentDetails !== null && + typeof existingPaymentDetails === 'object' && + !Array.isArray(existingPaymentDetails) + ? { ...existingPaymentDetails } + : {};As per coding guidelines, “Use TypeScript for all application code with strict typing conventions.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts` at line 375, Update the paymentDetails declaration in the repayment payload construction to remove any and use a guarded Record<string, unknown> or the existing request DTO, while preserving the empty-object fallback when paymentDetails is absent. Ensure the resulting value remains compatible with the working-capital action API request.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts`:
- Line 375: Update the paymentDetails declaration in the repayment payload
construction to remove any and use a guarded Record<string, unknown> or the
existing request DTO, while preserving the empty-object fallback when
paymentDetails is absent. Ensure the resulting value remains compatible with the
working-capital action API request.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0869b2a9-5359-4733-8f6d-1cfbdbfe0867
📒 Files selected for processing (5)
src/app/loans/common-resolvers/loan-action-button.resolver.tssrc/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.htmlsrc/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.tssrc/app/loans/loans-view/loan-accounts-button-config.tssrc/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts
|
Just wanted to inform you that I found the WC transaction undo issue too and created a PR for it. It contains the unsupported parameters fix that you also did, but it also contains another fix. If you click on the wc transaction in the table the detail view will show edit, undo and chargeback buttons. WC loans don't support transaction editing and chargeback, and the undo button sends the request to the core undo method, not the WC loan specific one. I have that also fixed in my pr. since you fix the first issue can you also fix the detail view as well? It's the view transaction component changes in this pr |
cf6d96f to
91e2fcc
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/app/loans/loans.service.ts (1)
673-676: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDefine strong Fineract loan request/response types.
Add typed contracts for
getWorkingCapitalLoanTransactionTemplateand the working-capital payment payload instead of passingObservable<any>/anypayloads throughpaymentDetails. This keeps the Fineract API boundary strict and catches template/command field mismatches before runtime.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/app/loans/loans.service.ts` around lines 673 - 676, Define explicit Fineract request/response interfaces for getWorkingCapitalLoanTransactionTemplate and the working-capital payment payload, then replace Observable<any> and paymentDetails: any with those types. Update both src/app/loans/loans.service.ts lines 673-676 and src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts lines 371-393 to use the shared contracts, including correctly typed template and command fields.Sources: Coding guidelines, Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts`:
- Around line 305-307: Update allowUndoTransaction and the undoRequest selection
in the transaction view so Working Capital write-off transactions are not
eligible for undo, and applyWorkingCapitalLoanActionCommand is invoked only for
the supported generic undo command. Keep undowriteoff on the appropriate
non-Working-Capital path or prevent it from being issued entirely for Working
Capital loans.
---
Nitpick comments:
In `@src/app/loans/loans.service.ts`:
- Around line 673-676: Define explicit Fineract request/response interfaces for
getWorkingCapitalLoanTransactionTemplate and the working-capital payment
payload, then replace Observable<any> and paymentDetails: any with those types.
Update both src/app/loans/loans.service.ts lines 673-676 and
src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts
lines 371-393 to use the shared contracts, including correctly typed template
and command fields.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7b2139bd-b402-47ad-990e-2eb0876aedb6
📒 Files selected for processing (6)
src/app/loans/common-resolvers/loan-action-button.resolver.tssrc/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.htmlsrc/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.tssrc/app/loans/loans-view/loan-accounts-button-config.tssrc/app/loans/loans-view/transactions/view-transaction/view-transaction.component.tssrc/app/loans/loans.service.ts
91e2fcc to
e0da54a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/app/loans/loans.service.ts (1)
673-681: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse typed response models for the new template methods.
Both methods return
Observable<any>. Define response interfaces from the Fineract specification and return typed observables so template-field changes fail at compile time.As per coding guidelines, application TypeScript must use strict typing conventions. Based on learnings, avoid
Observable<any>for API responses and track the broader response-layer migration separately.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/app/loans/loans.service.ts` around lines 673 - 681, Replace the Observable<any> return types in getWorkingCapitalLoanPayoutTemplate and getWorkingCapitalLoanTransactionTemplate with interfaces modeled on the Fineract template responses, and apply those types to the corresponding HTTP GET calls. Define or reuse appropriately named response interfaces in the service’s response-model layer so template field changes are checked at compile time.Sources: Coding guidelines, Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/app/loans/loans.service.ts`:
- Around line 673-676: The getWorkingCapitalLoanPayoutTemplate method uses the
inconsistent non-hyphenated resource path. Update its HTTP request to use the
established hyphenated Working Capital template endpoint, or use the Working
Capital transaction-template endpoint if this method serves payout/transaction
command templates; preserve the existing templateType parameter.
---
Nitpick comments:
In `@src/app/loans/loans.service.ts`:
- Around line 673-681: Replace the Observable<any> return types in
getWorkingCapitalLoanPayoutTemplate and getWorkingCapitalLoanTransactionTemplate
with interfaces modeled on the Fineract template responses, and apply those
types to the corresponding HTTP GET calls. Define or reuse appropriately named
response interfaces in the service’s response-model layer so template field
changes are checked at compile time.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f41b97fb-faee-4eb9-b8bd-85d207073075
📒 Files selected for processing (6)
src/app/loans/common-resolvers/loan-action-button.resolver.tssrc/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.htmlsrc/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.tssrc/app/loans/loans-view/loan-accounts-button-config.tssrc/app/loans/loans-view/transactions/view-transaction/view-transaction.component.tssrc/app/loans/loans.service.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.html
- src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts
- src/app/loans/loans-view/loan-accounts-button-config.ts
- src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts
e0da54a to
4b7573e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/app/clients/clients-view/dispute-management/dispute-management.component.ts (1)
172-180: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRestrict status values to the dispute status type.
updateStatusaccepts any string and forwards it toupdateDisputeStatus. The component defines a fixed status set elsewhere. Use the status union fromDisputeCaseor the credit-bureau model. Validate the allowed transition before sending the request.As per coding guidelines and path instructions, Angular TypeScript must use strict type safety.
Also applies to: 201-212
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/app/clients/clients-view/dispute-management/dispute-management.component.ts` around lines 172 - 180, Update updateStatus and its corresponding success/error handling path to use the DisputeCase or credit-bureau status union instead of string, and validate newStatus against the component’s defined allowed status set before calling updateDisputeStatus. Preserve the existing update flow for valid statuses and reject invalid transitions without sending a request.Sources: Coding guidelines, Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/app/clients/clients-view/dispute-management/dispute-management.component.ts`:
- Line 14: Update the raiseForm definition and submission flow in the
dispute-management component to use a typed reactive form that declares
submissionRecordId and disputeDetails. Read the typed raw form value before
calling createDispute, and pass submissionRecordId directly without the unary +
because createDispute already expects a number.
---
Nitpick comments:
In
`@src/app/clients/clients-view/dispute-management/dispute-management.component.ts`:
- Around line 172-180: Update updateStatus and its corresponding success/error
handling path to use the DisputeCase or credit-bureau status union instead of
string, and validate newStatus against the component’s defined allowed status
set before calling updateDisputeStatus. Preserve the existing update flow for
valid statuses and reject invalid transitions without sending a request.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9dfc8b6a-e525-4373-b471-e1b778ff7051
📒 Files selected for processing (8)
src/app/clients/clients-view/dispute-management/dispute-management.component.tssrc/app/loans/common-resolvers/loan-action-button.resolver.tssrc/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.htmlsrc/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.tssrc/app/loans/loans-view/loan-accounts-button-config.tssrc/app/loans/loans-view/transactions-tab/transactions-tab.component.tssrc/app/loans/loans-view/transactions/view-transaction/view-transaction.component.tssrc/app/loans/loans.service.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- src/app/loans/loans.service.ts
- src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts
- src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.html
- src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts
- src/app/loans/loans-view/loan-accounts-button-config.ts
- src/app/loans/common-resolvers/loan-action-button.resolver.ts
4b7573e to
5f85c8b
Compare
|
@alberto-art3ch Please rebase |
5f85c8b to
a8851b8
Compare
Description
User should be able to add a Payout refund transaction on active and closed loan accounts
Related issues and discussion
WEB-657
Screenshots, if any
Screen.Recording.2026-08-02.at.9.36.02.PM.mov
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
If you have multiple commits please combine them into one commit by squashing them.
Read and understood the contribution guidelines at
web-app/.github/CONTRIBUTING.md.Summary by CodeRabbit
New Features
Bug Fixes