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

Screenshot 2026-05-22 at 7 35 12 PM

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

    • Fixed discount flow so the Discount input now updates and submits the correct discount amount.
    • Ensured discount updates are processed reliably when saving changes.
  • New Features

    • Renamed the action/button label from "Update discount" to "Discount Fee" across the loan actions UI.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 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: "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

Move WorkingCapitalLoanDiscountUpdateRequest into the working-capital model, add LoansService.updateWorkingCapitalDiscount(), update UpdateDiscountComponent to use discountAmount (template, form key, submit), and rename related UI action strings to "Discount Fee".

Changes

Working Capital Discount Update Refactor

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
Loading

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

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

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.

1 participant