Skip to content

WEB-657: Working Capital loan - Payout Refund transaction - #3750

Merged
alberto-art3ch merged 1 commit into
openMF:devfrom
alberto-art3ch:WEB-657/working-capital-loan-payout-refund-transaction
Aug 4, 2026
Merged

WEB-657: Working Capital loan - Payout Refund transaction#3750
alberto-art3ch merged 1 commit into
openMF:devfrom
alberto-art3ch:WEB-657/working-capital-loan-payout-refund-transaction

Conversation

@alberto-art3ch

@alberto-art3ch alberto-art3ch commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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

  • Added “Payout Refund” actions for eligible working-capital loan accounts.
  • Added working-capital transaction handling for payout refunds and repayments.
  • Enhanced repayment forms with classification options and organized payment details.

Bug Fixes

  • Corrected refund templates, permissions, and repayment amount handling for working-capital products.
  • Improved transaction undo behavior across loan product types.
  • Removed the working-capital breach-actions tab where it was no longer applicable.

@alberto-art3ch
alberto-art3ch requested a review from a team July 23, 2026 23:25
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "pre_merge_checks"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Working-capital loan accounts now support payout refunds for three statuses. Repayment forms handle classification and payment details. Transaction undo uses product-specific payloads and commands. The working-capital breach-actions tab link and an unused progress bar registration were removed.

Changes

Working Capital Actions

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
Loading

Possibly related PRs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 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 win

Avoid introducing an untyped payment-details payload.

any disables checks while constructing data sent to the working-capital action API. Use a guarded Record<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

📥 Commits

Reviewing files that changed from the base of the PR and between 79d72f6 and cf6d96f.

📒 Files selected for processing (5)
  • src/app/loans/common-resolvers/loan-action-button.resolver.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/loans-view/transactions/view-transaction/view-transaction.component.ts

@coderabbitai coderabbitai Bot mentioned this pull request Jul 24, 2026
2 tasks
@Cocoa-Puffs

Cocoa-Puffs commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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?

#3752

It's the view transaction component changes in this pr

@alberto-art3ch
alberto-art3ch force-pushed the WEB-657/working-capital-loan-payout-refund-transaction branch from cf6d96f to 91e2fcc Compare July 30, 2026 03:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/app/loans/loans.service.ts (1)

673-676: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Define strong Fineract loan request/response types.

Add typed contracts for getWorkingCapitalLoanTransactionTemplate and the working-capital payment payload instead of passing Observable<any> / any payloads through paymentDetails. 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

📥 Commits

Reviewing files that changed from the base of the PR and between cf6d96f and 91e2fcc.

📒 Files selected for processing (6)
  • src/app/loans/common-resolvers/loan-action-button.resolver.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/loans-view/transactions/view-transaction/view-transaction.component.ts
  • src/app/loans/loans.service.ts

@alberto-art3ch
alberto-art3ch force-pushed the WEB-657/working-capital-loan-payout-refund-transaction branch from 91e2fcc to e0da54a Compare July 31, 2026 03:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/app/loans/loans.service.ts (1)

673-681: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use 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

📥 Commits

Reviewing files that changed from the base of the PR and between 91e2fcc and e0da54a.

📒 Files selected for processing (6)
  • src/app/loans/common-resolvers/loan-action-button.resolver.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/loans-view/transactions/view-transaction/view-transaction.component.ts
  • src/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

Comment thread src/app/loans/loans.service.ts
@alberto-art3ch
alberto-art3ch force-pushed the WEB-657/working-capital-loan-payout-refund-transaction branch from e0da54a to 4b7573e Compare August 3, 2026 02:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 win

Restrict status values to the dispute status type.

updateStatus accepts any string and forwards it to updateDisputeStatus. The component defines a fixed status set elsewhere. Use the status union from DisputeCase or 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

📥 Commits

Reviewing files that changed from the base of the PR and between e0da54a and 4b7573e.

📒 Files selected for processing (8)
  • src/app/clients/clients-view/dispute-management/dispute-management.component.ts
  • src/app/loans/common-resolvers/loan-action-button.resolver.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/loans-view/transactions-tab/transactions-tab.component.ts
  • src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts
  • src/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

@alberto-art3ch
alberto-art3ch force-pushed the WEB-657/working-capital-loan-payout-refund-transaction branch from 4b7573e to 5f85c8b Compare August 3, 2026 15:38
@adamsaghy

Copy link
Copy Markdown
Contributor

@alberto-art3ch Please rebase

adamsaghy
adamsaghy previously approved these changes Aug 4, 2026

@adamsaghy adamsaghy 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.

LGTM

@alberto-art3ch
alberto-art3ch force-pushed the WEB-657/working-capital-loan-payout-refund-transaction branch from 5f85c8b to a8851b8 Compare August 4, 2026 16:32

@adamsaghy adamsaghy 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.

LGTM

@alberto-art3ch
alberto-art3ch merged commit e842bba into openMF:dev Aug 4, 2026
6 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