WEB-711: WC Product with discount attribute#3458
Conversation
|
Note
|
| 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
- WEB-813: Working Capital loan account creation #3257: Directly modifies the same Working Capital loan terms and summary UI to add and handle the discount field across form and display components.
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.htmlsrc/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.htmlsrc/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts
| <div class="flex-fill layout-row"> | ||
| <span class="flex-40">{{ 'labels.inputs.Discount' | translate }}:</span> | ||
| <span class="flex-60">{{ loanProduct.discount | formatNumber }}</span> | ||
| </div> |
There was a problem hiding this comment.
🧩 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=tsRepository: 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.
Description
The Working Capital Product has the discount value that must be a kind of rate
WEB-711
Screenshots
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