Skip to content

WEB-957: Add externalId to Working Capital Loan discount fee#3602

Merged
adamsaghy merged 1 commit into
openMF:devfrom
oleksii-novikov-onix:WEB-957/wc-discount-external-id
Jun 1, 2026
Merged

WEB-957: Add externalId to Working Capital Loan discount fee#3602
adamsaghy merged 1 commit into
openMF:devfrom
oleksii-novikov-onix:WEB-957/wc-discount-external-id

Conversation

@oleksii-novikov-onix

@oleksii-novikov-onix oleksii-novikov-onix commented May 22, 2026

Copy link
Copy Markdown
Contributor

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

  • New Features
    • Added "Discount External ID" input for working-capital loan disbursements, plus an "External ID" input on discount updates; both enforce max-length and a validation that they must differ. The discount external id is cleared when discount amount is empty or non-positive.
  • Localization
    • Added translations for the new labels/validation messages in 13 locales.

@oleksii-novikov-onix oleksii-novikov-onix marked this pull request as draft May 22, 2026 12:42
@coderabbitai

coderabbitai Bot commented May 22, 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

Walkthrough

Adds optional externalId to working-capital discount flows: extends the service request type, adds discountExternalId/externalId form controls with max-length checks and a form-level validator (must differ from externalId), clears the field when discount amount ≤ 0, and adds translations.

Changes

Discount External ID Feature

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

alberto-art3ch
alberto-art3ch previously approved these changes May 23, 2026

@alberto-art3ch alberto-art3ch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adamsaghy adamsaghy marked this pull request as ready for review May 28, 2026 13:21
@adamsaghy

Copy link
Copy Markdown
Collaborator

@oleksii-novikov-onix Please rebase.

@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

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 168f139 and 394444d.

📒 Files selected for processing (18)
  • src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.html
  • src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts
  • src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html
  • src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts
  • src/app/loans/loans.service.ts
  • src/assets/translations/cs-CS.json
  • src/assets/translations/de-DE.json
  • src/assets/translations/en-US.json
  • src/assets/translations/es-CL.json
  • src/assets/translations/es-MX.json
  • src/assets/translations/fr-FR.json
  • src/assets/translations/it-IT.json
  • src/assets/translations/ko-KO.json
  • src/assets/translations/lt-LT.json
  • src/assets/translations/lv-LV.json
  • src/assets/translations/ne-NE.json
  • src/assets/translations/pt-PT.json
  • src/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

@oleksii-novikov-onix

Copy link
Copy Markdown
Contributor Author

@oleksii-novikov-onix Please rebase.

@adamsaghy done

@adamsaghy adamsaghy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adamsaghy adamsaghy merged commit 7e40f67 into openMF:dev Jun 1, 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