WEB-657: Working Capital Loan Discount Fee update#3604
Conversation
|
Note
|
| Layer / File(s) | Summary |
|---|---|
Request contract and service method src/app/loans/models/working-capital/working-capital-loan-account.model.ts, src/app/loans/loans.service.ts |
Add exported WorkingCapitalLoanDiscountUpdateRequest to the working-capital model, remove the local request type from the service file, and add LoansService.updateWorkingCapitalDiscount() which sends a PUT to /working-capital-loans/{loanId}/discount. |
Component form binding and submit src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts, src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html |
UpdateDiscountComponent now imports the request type from the model, renames the form control to discountAmount, updates the template input binding, and submits via loanService.updateWorkingCapitalDiscount(...) (previous follow-up command call removed). |
UI wiring and action-key rename src/app/loans/loans-view/loans-view.component.ts, 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 |
Change action display key and conditional guards from "Update discount" to "Discount Fee" and route that action to the working-capital details resolver branch. |
Sequence Diagram(s)
sequenceDiagram
participant UpdateDiscountComponent
participant LoansService
participant BackendAPI
UpdateDiscountComponent->>LoansService: updateWorkingCapitalDiscount(loanId, {discountAmount,...})
LoansService->>BackendAPI: PUT /working-capital-loans/{loanId}/discount (payload)
BackendAPI-->>LoansService: 200/response
LoansService-->>UpdateDiscountComponent: response/complete
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- openMF/web-app#3436: Introduces the working-capital "Update discount" UI/component and overlapping routing/handler changes.
- openMF/web-app#3447: Modifies working-capital loan UI/forms to include and submit
discountAmountin payloads.
Suggested reviewers
- adamsaghy
- IOhacker
🚥 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 PR title accurately describes the main change: renaming the discount update action from 'Update discount' to 'Discount Fee' and refactoring the working capital loan discount update workflow. |
| 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. |
✏️ 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
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
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
New Features