Skip to content

WEB-657: Working Capital Loan Discount Fee update#3604

Open
alberto-art3ch wants to merge 1 commit into
openMF:devfrom
alberto-art3ch:WEB-657/working-capital-loan-discount-update
Open

WEB-657: Working Capital Loan Discount Fee update#3604
alberto-art3ch wants to merge 1 commit into
openMF:devfrom
alberto-art3ch:WEB-657/working-capital-loan-discount-update

Conversation

@alberto-art3ch
Copy link
Copy Markdown
Collaborator

@alberto-art3ch alberto-art3ch commented May 23, 2026

Description

Due the latest changes in backend, the discount api 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

    • Added multi-language support for the "Discount Fee" label across 12 locales (cs, de, en, es-CL, es-MX, fr, it, ko, lt, lv, ne, pt, sw).
  • UI Updates

    • Renamed discount action/label to "Discount Fee" across menus and action buttons.
  • Behavior

    • Discount update form now prefers an existing discount value when populating the amount field.
    • Discount submissions now route through the working-capital transaction flow while preserving existing success/error handling.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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

This PR moves the WorkingCapitalLoanDiscountUpdateRequest interface to the working-capital model, adds a new LoansService method for executing working-capital transactions, updates the UpdateDiscountComponent to use transactionAmount and call the new service with command 'discountFee', renames the UI action key to "Discount Fee", and adds translations.

Changes

Working Capital Discount Update Refactor

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.discountdataObject.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.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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.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

📥 Commits

Reviewing files that changed from the base of the PR and between d3a4a99 and 40cdbcc.

📒 Files selected for processing (4)
  • 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/app/loans/models/working-capital/working-capital-loan-account.model.ts

Comment thread src/app/loans/loans.service.ts Outdated
@alberto-art3ch alberto-art3ch force-pushed the WEB-657/working-capital-loan-discount-update branch from 40cdbcc to cb8cec6 Compare May 23, 2026 00:57
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 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

📥 Commits

Reviewing files that changed from the base of the PR and between 40cdbcc and cb8cec6.

📒 Files selected for processing (4)
  • 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/app/loans/models/working-capital/working-capital-loan-account.model.ts

@alberto-art3ch alberto-art3ch force-pushed the WEB-657/working-capital-loan-discount-update branch from cb8cec6 to fc1072e Compare May 26, 2026 00:19
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.html (1)

17-19: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Localize 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/core for 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

📥 Commits

Reviewing files that changed from the base of the PR and between cb8cec6 and fc1072e.

📒 Files selected for processing (9)
  • src/app/loans/common-resolvers/loan-action-button.resolver.ts
  • src/app/loans/loans-view/loan-account-actions/loan-account-actions.component.html
  • src/app/loans/loans-view/loan-account-actions/loan-account-actions.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-view/loans-view.component.ts
  • src/app/loans/loans.service.ts
  • src/app/loans/models/working-capital/working-capital-loan-account.model.ts
  • src/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

@alberto-art3ch alberto-art3ch force-pushed the WEB-657/working-capital-loan-discount-update branch 3 times, most recently from 910a134 to 49ffdb2 Compare May 27, 2026 13:28
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 910a134 and 49ffdb2.

📒 Files selected for processing (20)
  • src/app/loans/common-resolvers/loan-action-button.resolver.ts
  • src/app/loans/loans-view/loan-account-actions/loan-account-actions.component.html
  • src/app/loans/loans-view/loan-account-actions/loan-account-actions.component.ts
  • src/app/loans/loans-view/loan-account-actions/update-discount/update-discount.component.ts
  • src/app/loans/loans-view/loans-view.component.ts
  • src/app/loans/loans.service.ts
  • src/app/loans/models/working-capital/working-capital-loan-account.model.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 (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

Comment thread src/app/loans/loans.service.ts
Comment thread src/app/loans/loans.service.ts Outdated
@alberto-art3ch alberto-art3ch force-pushed the WEB-657/working-capital-loan-discount-update branch from 49ffdb2 to 03ae599 Compare May 28, 2026 04:51
@alberto-art3ch alberto-art3ch force-pushed the WEB-657/working-capital-loan-discount-update branch from 03ae599 to 3ce8b8a Compare May 28, 2026 12:49
Copy link
Copy Markdown
Collaborator

@adamsaghy adamsaghy 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