Skip to content

fix(WEB-1054): allow updating zero-interest loan products - #3754

Merged
IOhacker merged 2 commits into
openMF:devfrom
AnvayKharb:fix/WEB-1054-zero-interest-edit
Jul 25, 2026
Merged

fix(WEB-1054): allow updating zero-interest loan products#3754
IOhacker merged 2 commits into
openMF:devfrom
AnvayKharb:fix/WEB-1054-zero-interest-edit

Conversation

@AnvayKharb

@AnvayKharb AnvayKharb commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

Fixes WEB-1054 by correcting the Loan/Credit Product edit flow when updating a product that was originally created with a 0% interest rate.

The update request now sends consistent interest-rate values, allowing the product to be modified successfully when changing the interest rate from zero to a positive value while preserving existing behavior for other loan products.

Related Issue

WEB-1054

Summary by CodeRabbit

  • Bug Fixes

    • Improved zero-interest loan product handling when switching between zero and standard interest rates.
    • Preserved configured minimum and maximum interest rates when updating a product’s interest rate.
    • Ensured interest-rate fields display consistent blank or numeric values based on the selected configuration.
  • Tests

    • Added coverage for zero-interest initialization and interest-rate updates.

@AnvayKharb
AnvayKharb requested a review from a team July 25, 2026 08:45
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

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

The loan product terms component now derives interest-rate values through helper methods when zero-interest mode is disabled. New unit tests cover positive-rate updates, preservation of configured bounds, and zero-interest initialization.

Changes

Loan interest-rate handling

Layer / File(s) Summary
Interest-rate value derivation
src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts
The zero-interest toggle uses shared helpers to return blank values for zero-interest templates or configured min/default/max values for positive-interest templates.
Interest-rate behavior tests
src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.spec.ts
Unit tests cover toggling to positive interest, preserving configured bounds, and retaining zero-interest values after initialization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • openMF/web-app#3701: Updates related interest-rate labels and headings in the loan product terms step.

Suggested reviewers: alberto-art3ch

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: enabling updates to zero-interest loan products.
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.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts (1)

659-673: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace the any return contract.

Use number | '' for the three values so the zero-interest blank-state contract remains type-checked.

Proposed fix
-  private getInterestRateValues(): { min: any; default: any; max: any } {
+  private getInterestRateValues(): { min: number | ''; default: number | ''; max: number | '' } {
🤖 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/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts`
around lines 659 - 673, Update the return type of getInterestRateValues to use
number | '' for min, default, and max instead of any, preserving the existing
blank-string zero-interest behavior and numeric template values.

Source: Coding guidelines

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

Nitpick comments:
In
`@src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts`:
- Around line 659-673: Update the return type of getInterestRateValues to use
number | '' for min, default, and max instead of any, preserving the existing
blank-string zero-interest behavior and numeric template values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e158d701-97c5-48e8-8d93-111c86fc8d64

📥 Commits

Reviewing files that changed from the base of the PR and between 1f3e6d2 and 54889b5.

📒 Files selected for processing (2)
  • src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.spec.ts
  • src/app/products/loan-products/loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component.ts

@IOhacker IOhacker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@IOhacker
IOhacker merged commit 20f48de into openMF:dev Jul 25, 2026
5 of 6 checks passed
@AnvayKharb
AnvayKharb deleted the fix/WEB-1054-zero-interest-edit branch July 25, 2026 17:16
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