Skip to content

WEB-711: WC Product with discount attribute#3458

Merged
alberto-art3ch merged 1 commit intoopenMF:devfrom
alberto-art3ch:WEB-711/wc-product-discount-attribute
Mar 30, 2026
Merged

WEB-711: WC Product with discount attribute#3458
alberto-art3ch merged 1 commit intoopenMF:devfrom
alberto-art3ch:WEB-711/wc-product-discount-attribute

Conversation

@alberto-art3ch
Copy link
Copy Markdown
Collaborator

@alberto-art3ch alberto-art3ch commented Mar 30, 2026

Description

The Working Capital Product has the discount value that must be a kind of rate

WEB-711

Screenshots

Screenshot 2026-03-30 at 9 44 04 AM

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 a discount field to working capital loan product configuration, allowing users to input discount values with validation for minimum value of 0 and support for decimal amounts.
    • Discount values are now displayed in the loan product summary view.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 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

Walkthrough

The changes add discount field support to Working Capital loan products, including UI display in the loan product summary, a form input with validation in the terms configuration step, and corresponding form control initialization and patching logic.

Changes

Cohort / File(s) Summary
Discount Field Display
src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html
Added a new "Discount" row to display the loan product discount value within the Working Capital section.
Discount Field Input & Validation
src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html, loan-product-terms-step.component.ts
Added a discount form field with number input (min=0, step=0.01), conditional min-value error validation message, mat-divider separator, and form control initialization with Validators.min(0). Discount value is patched from template when in Working Capital mode.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • IOhacker
  • adamsaghy
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'WEB-711: WC Product with discount attribute' directly summarizes the main change: adding a discount attribute to the Working Capital product form across multiple components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@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

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 the current code and only fix it if needed.

Inline comments:
In
`@src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html`:
- Around line 106-109: The template uses loanProduct.discount but the
LoanProduct interface lacks this property; update the LoanProduct interface
(symbol: interface LoanProduct) to add discount?: number; so TypeScript enforces
the optional numeric type and prevents undefined from being silently used in the
template—ensure the new optional property follows the same pattern as other
numeric fields in that model file.
🪄 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: 060391a0-9560-4d76-83c5-126b097125a7

📥 Commits

Reviewing files that changed from the base of the PR and between 4b9b2d4 and f506417.

📒 Files selected for processing (3)
  • src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html
  • src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.html
  • src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts

Comment on lines +106 to +109
<div class="flex-fill layout-row">
<span class="flex-40">{{ 'labels.inputs.Discount' | translate }}:</span>
<span class="flex-60">{{ loanProduct.discount | formatNumber }}</span>
</div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for LoanProduct interface/type definition to verify if discount property exists

# Search for LoanProduct interface/type definition
ast-grep --pattern 'interface LoanProduct {
  $$$
}'

# Also search for type alias or class
rg -n -A 20 'export (interface|type|class) LoanProduct' --type=ts

Repository: openMF/web-app

Length of output: 50370


Add the discount property to the LoanProduct interface.

The template accesses loanProduct.discount but this property is not declared in the LoanProduct interface (defined at src/app/products/loan-products/models/loan-product.model.ts:43). This bypasses TypeScript's type safety and could display undefined if the API response doesn't include this field.

Add discount?: number; to the LoanProduct interface to ensure type safety and maintain consistency with other optional numeric properties.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html`
around lines 106 - 109, The template uses loanProduct.discount but the
LoanProduct interface lacks this property; update the LoanProduct interface
(symbol: interface LoanProduct) to add discount?: number; so TypeScript enforces
the optional numeric type and prevents undefined from being silently used in the
template—ensure the new optional property follows the same pattern as other
numeric fields in that model file.

@alberto-art3ch alberto-art3ch merged commit 35b428f into openMF:dev Mar 30, 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.

2 participants