WEB-657: Working Capital Loan Discount Fee update#3604
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 |
|---|---|
Request contract relocation src/app/loans/models/working-capital/working-capital-loan-account.model.ts, src/app/loans/loans.service.ts |
WorkingCapitalLoanDiscountUpdateRequest is added to the working-capital model and removed from LoansService; LoansService imports the type from the model. |
LoansService: execute transactions command src/app/loans/loans.service.ts |
Adds executeWorkingCapitalLoanAccountTransactionsCommand(accountId, command, data, transactionId?) to POST working-capital loan transaction commands, using an optional transactionId path when provided. |
Component form and submit flow src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts |
UpdateDiscountComponent now imports the relocated interface, initializes transactionAmount from dataObject.discount → dataObject.transactionAmount → '', and submits via executeWorkingCapitalLoanAccountTransactionsCommand with command 'discountFee', keeping the same payload and success/error handling. |
UI action-key rename and translations src/app/loans/loans-view/loan-account-actions/loan-account-actions.component.ts, src/app/loans/loans-view/loan-account-actions/loan-account-actions.component.html, src/app/loans/common-resolvers/loan-action-button.resolver.ts, src/app/loans/loans-view/loans-view.component.ts, src/assets/translations/* |
Rename action key from 'Update discount' to 'Discount Fee' across action map, template condition, resolver routing, and button label. Add menus["Discount Fee"] translations in multiple locale files. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- openMF/web-app#3436: Earlier PR that implemented the working-capital discount update UI component and action flow; this PR refactors the contract location and renames the action key from "Update discount" to "Discount Fee".
Suggested reviewers
- adamsaghy
- gkbishnoi07
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title accurately summarizes the main change: renaming the working capital loan discount action from 'Update discount' to 'Discount Fee' and updating the corresponding service layer to use a new API endpoint. |
| 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. |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ 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 and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 858-859: Change updateWorkingCapitalDiscount to use concrete
types: replace loanId: any with loanId: string and payload: any with payload:
WorkingCapitalLoanDiscountUpdateRequest, add an explicit Observable return type
(e.g. : Observable<void>) and call the typed HTTP method
this.http.put<void>(...) so the method signature reads
updateWorkingCapitalDiscount(loanId: string, payload:
WorkingCapitalLoanDiscountUpdateRequest): Observable<void>; import
WorkingCapitalLoanDiscountUpdateRequest and Observable where needed.
🪄 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
Run ID: 4c6c60cc-0719-402b-b0aa-9daa65958ec9
📒 Files selected for processing (4)
src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.htmlsrc/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.tssrc/app/loans/loans.service.tssrc/app/loans/models/working-capital/working-capital-loan-account.model.ts
40cdbcc to
cb8cec6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/loan-account-actions/update-discount/update-discount.component.html`:
- Around line 17-19: The hardcoded label "'Discount'" should be replaced with a
translation key using ngx-translate; update the template binding for inputLabel
(where updateDiscountForm.controls.discountAmount is used) to pass a translated
string, e.g. [inputLabel]="'loan.updateDiscount.discount' | translate" or obtain
the translation via TranslateService and bind that value; ensure you add the
corresponding key (loan.updateDiscount.discount) to the translation JSONs and
update usages of inputLabel in update-discount.component.html to use the
translate pipe or a translated variable instead of the literal.
🪄 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
Run ID: fb4c54da-c0f1-4831-b71a-dad428584023
📒 Files selected for processing (4)
src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.htmlsrc/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.tssrc/app/loans/loans.service.tssrc/app/loans/models/working-capital/working-capital-loan-account.model.ts
cb8cec6 to
fc1072e
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html (1)
17-19:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winLocalize the discount input label.
Line 18 still uses a hardcoded user-facing label (
'Discount'). Use a translation key instead.🌐 Proposed fix
- [inputLabel]="'Discount'" + [inputLabel]="'labels.inputs.Discount' | translate"As per coding guidelines "Use proper i18n variables from
@ngx-translate/corefor all user-facing strings instead of hardcoded text".🤖 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/update-discount/update-discount.component.html` around lines 17 - 19, The template uses a hardcoded label string in the update-discount component; replace the literal 'Discount' passed to the inputLabel attribute with the appropriate i18n translation key (e.g. use the translate pipe or translated string token such as "loans.updateDiscount.discountLabel") so the inputLabel for updateDiscountForm.controls.discountAmount is localized; update the translation JSON/resource with the new key and ensure the template references the key (via | translate or translated variable) instead of the hardcoded text.
🤖 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.
Duplicate comments:
In
`@src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html`:
- Around line 17-19: The template uses a hardcoded label string in the
update-discount component; replace the literal 'Discount' passed to the
inputLabel attribute with the appropriate i18n translation key (e.g. use the
translate pipe or translated string token such as
"loans.updateDiscount.discountLabel") so the inputLabel for
updateDiscountForm.controls.discountAmount is localized; update the translation
JSON/resource with the new key and ensure the template references the key (via |
translate or translated variable) instead of the hardcoded text.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0b3932f0-4027-433c-9a5a-a4faf47e2a85
📒 Files selected for processing (9)
src/app/loans/common-resolvers/loan-action-button.resolver.tssrc/app/loans/loans-view/loan-account-actions/loan-account-actions.component.htmlsrc/app/loans/loans-view/loan-account-actions/loan-account-actions.component.tssrc/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.htmlsrc/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.tssrc/app/loans/loans-view/loans-view.component.tssrc/app/loans/loans.service.tssrc/app/loans/models/working-capital/working-capital-loan-account.model.tssrc/environments/.env.ts
💤 Files with no reviewable changes (1)
- src/environments/.env.ts
✅ Files skipped from review due to trivial changes (1)
- src/app/loans/loans-view/loans-view.component.ts
910a134 to
49ffdb2
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 386-387: Replace the truthy check "if (transactionId)" with a
nullish check so a valid numeric 0 is not treated as absent; change the
condition around the POST call that constructs
`/working-capital-loans/${accountId}/transactions/${transactionId}` to use a
nullish test (e.g., `transactionId != null`) before calling this.http.post,
ensuring the correct endpoint is used when transactionId is 0.
- Around line 379-384: Change the loose types on
executeWorkingCapitalLoanAccountTransactionsCommand: replace data: any with the
concrete request type WorkingCapitalLoanDiscountUpdateRequest, make
transactionId optional and typed (e.g., transactionId?: number | null), and
tighten the return type from Observable<any> to a specific response Observable
(e.g., Observable<WorkingCapitalLoanDiscountUpdateResponse> or another
appropriate response type used elsewhere). Also update the presence check from
if (transactionId) to if (transactionId != null) to avoid treating 0 as missing.
Reference: executeWorkingCapitalLoanAccountTransactionsCommand,
WorkingCapitalLoanDiscountUpdateRequest, transactionId, and the method's
Observable return type.
🪄 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
Run ID: c205432a-ba55-4a82-8406-c3d28482c951
📒 Files selected for processing (20)
src/app/loans/common-resolvers/loan-action-button.resolver.tssrc/app/loans/loans-view/loan-account-actions/loan-account-actions.component.htmlsrc/app/loans/loans-view/loan-account-actions/loan-account-actions.component.tssrc/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.tssrc/app/loans/loans-view/loans-view.component.tssrc/app/loans/loans.service.tssrc/app/loans/models/working-capital/working-capital-loan-account.model.tssrc/assets/translations/cs-CS.jsonsrc/assets/translations/de-DE.jsonsrc/assets/translations/en-US.jsonsrc/assets/translations/es-CL.jsonsrc/assets/translations/es-MX.jsonsrc/assets/translations/fr-FR.jsonsrc/assets/translations/it-IT.jsonsrc/assets/translations/ko-KO.jsonsrc/assets/translations/lt-LT.jsonsrc/assets/translations/lv-LV.jsonsrc/assets/translations/ne-NE.jsonsrc/assets/translations/pt-PT.jsonsrc/assets/translations/sw-SW.json
✅ Files skipped from review due to trivial changes (13)
- src/assets/translations/ko-KO.json
- src/assets/translations/lv-LV.json
- src/assets/translations/de-DE.json
- src/assets/translations/fr-FR.json
- src/assets/translations/it-IT.json
- src/app/loans/loans-view/loans-view.component.ts
- src/assets/translations/ne-NE.json
- src/assets/translations/sw-SW.json
- src/assets/translations/es-MX.json
- src/app/loans/loans-view/loan-account-actions/loan-account-actions.component.ts
- src/assets/translations/cs-CS.json
- src/assets/translations/es-CL.json
- src/assets/translations/en-US.json
🚧 Files skipped from review as they are similar to previous changes (5)
- src/app/loans/models/working-capital/working-capital-loan-account.model.ts
- src/app/loans/loans-view/loan-account-actions/loan-account-actions.component.html
- src/app/loans/common-resolvers/loan-action-button.resolver.ts
- src/assets/translations/lt-LT.json
- src/assets/translations/pt-PT.json
49ffdb2 to
03ae599
Compare
03ae599 to
3ce8b8a
Compare
Description
Due the latest changes in backend, the
discountapi was changed, then UI shall be done corresponding changes.Related issues and discussion
WEB-657
Screenshots
Screen.Recording.2026-05-28.at.7.42.30.AM.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
Localization
UI Updates
Behavior