WEB-657: Fix wc loan undo command - #3752
Conversation
|
Note
|
| 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
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.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
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 winType the product-specific undo payload.
payload: anydefeats validation of the Working Capital versus standard-loan request shapes. Use a boundedUndoPayloadunion covering the empty charge-off, Working Capital, and standard-loan payloads.As per coding guidelines,
src/app/**/*.tsmust “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
📒 Files selected for processing (2)
src/app/loans/loans-view/transactions-tab/transactions-tab.component.tssrc/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts
@Cocoa-Puffs please rebase |
e35ce87 to
5a0db3f
Compare
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
transactionDateandtransactionAmountunsupported 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