WEB-957: Add externalId to Working Capital Loan discount fee#3602
Conversation
|
Note
|
| Layer / File(s) | Summary |
|---|---|
Service Contract Extension src/app/loans/loans.service.ts |
WorkingCapitalLoanDiscountUpdateRequest interface adds optional externalId?: string. |
Disburse component form and UI src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts, src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.html |
Add discountExternalId control with maxExternalIdLength = 100, lifecycle-safe discountAmount subscription (uses DestroyRef + takeUntilDestroyed) that clears the field when non-positive, add form-level validator discountExternalIdEqualsExternalId, and conditionally render the input with mat-error messages. |
Update-discount component form and payload 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 |
Add externalId form control with max-length validation, maxExternalIdLength = 100, render input in template, and include externalId in WorkingCapitalLoanDiscountUpdateRequest payload on submit. |
Translations for new fields and errors src/assets/translations/*.json (cs-CS, de-DE, en-US, es-CL, es-MX, fr-FR, it-IT, ko-KO, lt-LT, lv-LV, ne-NE, pt-PT, sw-SW) |
Add localization keys for Discount External Id, Discount External Id must differ from External Id, and External Id is too long across locale files (es-MX also had a leading BOM byte change). |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- openMF/web-app#3436: Related work on working-capital "update discount" flow and request payloads.
- openMF/web-app#3447: Related changes to DisburseComponent's working-capital discountAmount handling.
Suggested reviewers
- adamsaghy
- alberto-art3ch
🚥 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 accurately describes the main change: adding an externalId field to the Working Capital Loan discount fee, which is reflected in all modified components (disburse, update-discount, service, and translations). |
| 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.
|
@oleksii-novikov-onix Please rebase. |
168f139 to
394444d
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 24-27: The input with formControlName "externalId" currently
relies on the form validator
(updateDiscountForm.controls.externalId.hasError('maxlength')) but lacks a
native maxlength attribute; add a matching maxlength attribute on the <input
matInput formControlName="externalId" /> element (use the same limit as the
validator) so the browser enforces the length while typing and aligns UI
behavior with updateDiscountForm.controls.externalId's maxlength validator.
🪄 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: 1391e0f8-7b08-4aa2-b5ee-c62d25a78e7a
📒 Files selected for processing (18)
src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.htmlsrc/app/loans/loans-view/loan-account-actions/disburse/disburse.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.service.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 (8)
- src/assets/translations/it-IT.json
- src/assets/translations/de-DE.json
- src/assets/translations/lv-LV.json
- src/assets/translations/sw-SW.json
- src/assets/translations/ne-NE.json
- src/assets/translations/pt-PT.json
- src/assets/translations/ko-KO.json
- src/assets/translations/es-CL.json
🚧 Files skipped from review as they are similar to previous changes (8)
- src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts
- src/app/loans/loans.service.ts
- src/assets/translations/fr-FR.json
- src/assets/translations/cs-CS.json
- src/assets/translations/lt-LT.json
- src/assets/translations/es-MX.json
- src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.html
- src/assets/translations/en-US.json
@adamsaghy done |
Description
Describe the changes made and why they were made instead of how they were made. List any dependencies that are required for this change.
Related issues and discussion
#{Issue Number}
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