Skip to content

WEB-657: Fix wc loan undo command - #3752

Merged
adamsaghy merged 1 commit into
openMF:devfrom
Cocoa-Puffs:WEB-657-fix-working-capital-transaction-undo
Aug 4, 2026
Merged

WEB-657: Fix wc loan undo command#3752
adamsaghy merged 1 commit into
openMF:devfrom
Cocoa-Puffs:WEB-657-fix-working-capital-transaction-undo

Conversation

@Cocoa-Puffs

@Cocoa-Puffs Cocoa-Puffs commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

Currently the transaction reversal is broken for Working Capital loans.

  • If a user tries to revert a transaction from the 3 dot menu on the transactions table, the UI application sends transactionDate and transactionAmount unsupported parameters as well.

  • If a user clicks on the transaction to go to the details screen and tries to undo the transaction through that button the request is sent to the generic adjustLoanTransaction endpoint, which does not support Working Capital loans.

In case of working capital loan products the unsupported parameters aren't being sent, the undo button on the details view calls the right endpoint and the other two buttons are disabled, as WC loans currently don't permit editing a transaction and chargebacks. These can be enabled later as desired.

Related issues and discussion

#{WEB-657}

Screenshots, if any

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

  • Bug Fixes
    • Improved transaction undo and write-off handling for working-capital accounts.
    • Prevented unsupported editing and chargeback actions for working-capital transactions.
    • Ensured transaction dates, amounts, locale, and date formats are applied correctly when reversing transactions.
    • Improved navigation after completing undo, write-off, and charge-off actions.
    • Preserved confirmation prompts before transactions are reversed.
    • Applied the correct transaction identifiers when processing write-offs.

@Cocoa-Puffs
Cocoa-Puffs requested a review from a team July 24, 2026 11:44
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8fcdacdd-9ea4-4338-b792-f0038270619e

📥 Commits

Reviewing files that changed from the base of the PR and between e35ce87 and 5a0db3f.

📒 Files selected for processing (2)
  • src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts
  • src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts
  • src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts

Walkthrough

Undo handling now builds product-specific payloads, disables editing and chargeback for working-capital transactions, and routes undo commands through working-capital or standard loan services before navigating back.

Changes

Transaction undo behavior

Layer / File(s) Summary
Product-specific undo payloads
src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts
Undo requests now use product-specific fields. Charge-off undo retains its empty payload.
Working-capital undo execution
src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts
Working-capital transactions disable editing and chargeback and use a dedicated action command. Standard transactions retain the loan command flow and write-off transaction ID handling.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ViewTransactionComponent
  participant LoanCommandService
  participant Navigation
  ViewTransactionComponent->>ViewTransactionComponent: Determine transaction type and command
  alt Working-capital transaction
    ViewTransactionComponent->>LoanCommandService: applyWorkingCapitalLoanActionCommand(payload)
  else Standard loan transaction
    ViewTransactionComponent->>LoanCommandService: executeLoansAccountTransactionsCommand(payload, transactionId)
  end
  LoanCommandService-->>ViewTransactionComponent: Command completion
  ViewTransactionComponent->>Navigation: Navigate back
Loading

Possibly related PRs

  • openMF/web-app#3750: Updates overlapping working-capital undo handling in ViewTransactionComponent.
🚥 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: fixing the Working Capital loan undo command.
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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts (1)

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

Type the product-specific undo payload.

payload: any defeats validation of the Working Capital versus standard-loan request shapes. Use a bounded UndoPayload union covering the empty charge-off, Working Capital, and standard-loan payloads.

As per coding guidelines, src/app/**/*.ts must “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/transactions-tab/transactions-tab.component.ts` at
line 440, Replace the any-typed payload in the transaction undo flow with a
bounded UndoPayload union covering the empty charge-off, Working Capital, and
standard-loan request shapes. Define or reuse the corresponding product-specific
types, and ensure payload construction and downstream usage satisfy strict
TypeScript validation without broad casts.

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.

Inline comments:
In
`@src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts`:
- Around line 298-310: Update the Working Capital action flow around isWriteOff,
applyWorkingCapitalLoanActionCommand, and navigateBack to derive arguments by
transaction type: use the tab flow’s undo-charge-off command with an empty
payload and null transaction ID for charge-offs, while preserving the
corresponding write-off command semantics and null transaction ID. Pass the
derived command, payload, and ID to the service call.

---

Nitpick comments:
In `@src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts`:
- Line 440: Replace the any-typed payload in the transaction undo flow with a
bounded UndoPayload union covering the empty charge-off, Working Capital, and
standard-loan request shapes. Define or reuse the corresponding product-specific
types, and ensure payload construction and downstream usage satisfy strict
TypeScript validation without broad casts.
🪄 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: aff89802-02f5-42f3-a015-8eba7ba9a942

📥 Commits

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

📒 Files selected for processing (2)
  • src/app/loans/loans-view/transactions-tab/transactions-tab.component.ts
  • src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts

@alberto-art3ch alberto-art3ch 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

Copy link
Copy Markdown
Contributor

LGTM

@Cocoa-Puffs please rebase

@Cocoa-Puffs
Cocoa-Puffs force-pushed the WEB-657-fix-working-capital-transaction-undo branch from e35ce87 to 5a0db3f Compare August 4, 2026 07:31
@adamsaghy
adamsaghy merged commit ae1cadc 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