Skip to content

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

Draft
oleksii-novikov-onix wants to merge 1 commit into
openMF:devfrom
oleksii-novikov-onix:WEB-957/wc-discount-external-id
Draft

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

Conversation

@oleksii-novikov-onix
Copy link
Copy Markdown
Contributor

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

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 field for working capital loan disbursements with discount amounts.
    • Added "External ID" field to the discount update form.
    • Implemented validation including maximum length constraints and uniqueness checks between related fields.
    • Expanded multi-language support across 12 languages for new fields and validation messages.

Review Change Stack

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

coderabbitai Bot commented May 22, 2026

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(s) in object: '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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fd990c2d-ab58-4057-868e-4d15db8f6e70

📥 Commits

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

📒 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

Walkthrough

This PR adds optional externalId support to working capital loan discount operations. Both DisburseComponent and UpdateDiscountComponent gain new form controls with max-length validation; DisburseComponent additionally enforces that discountExternalId must differ from externalId. Translation strings are added across 13 languages.

Changes

Discount External ID Feature

Layer / File(s) Summary
Service Contract Extension
src/app/loans/loans.service.ts
WorkingCapitalLoanDiscountUpdateRequest interface adds optional externalId?: string field to establish the data contract for both components.
Disburse Component Discount External ID Support
src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts, src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.html
Angular imports updated with DestroyRef and takeUntilDestroyed for lifecycle cleanup. DisburseComponent injects DestroyRef, adds maxExternalIdLength constant, and configures a new discountExternalId form control with max-length validation and a form-level validator requiring it to differ from externalId. A subscription to discountAmount changes clears discountExternalId when discount amount is null, empty, or non-positive. Template conditionally renders the external ID field when discount amount exceeds zero, with inline error messages for validation failures.
Update Discount Component Discount External ID Support
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 adds maxExternalIdLength constant, configures a new externalId form control with max-length validation, and includes externalId from form values in the submission payload to applyWorkingCapitalLoanAccountCommand. Template renders a labeled input field with max-length error messaging.
Internationalization
src/assets/translations/*.json (12 languages: 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)
Translation strings added for the "Discount External Id" label, validation message ("Discount External Id must differ from External Id"), and max-length error ("External Id is too long") across all supported languages.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • openMF/web-app#3436: Extends the existing working-capital "update discount" flow by adding externalId to WorkingCapitalLoanDiscountUpdateRequest and wiring it through UpdateDiscountComponent.
  • openMF/web-app#3447: Both PRs modify the working-capital disbursement UI logic in disburse.component.ts/html by extending form controls and validation logic.
  • openMF/web-app#3419: Both PRs modify DisburseComponent lifecycle and submission logic for working capital disbursement operations.

Suggested reviewers

  • alberto-art3ch
  • adamsaghy
🚥 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 and specifically describes the main change: adding an externalId field to Working Capital Loan discount fees across UI components, service interfaces, 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.

Copy link
Copy Markdown
Collaborator

@alberto-art3ch alberto-art3ch left a comment

Choose a reason for hiding this comment

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

LGTM

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.

2 participants