You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): require positive integers for recharge presets - #8495
Recharge presets now accept only positive whole-number amounts, and fractional or invalid values can’t be added or saved.
Valid presets appear in numeric order without duplicates. Empty or null entries no longer appear as a $0 option or prevent other valid presets from displaying.
Valid numeric values, including values entered in exponent notation, are saved as canonical integers.
No actionable comments were generated in the recent review.
Walkthrough
Recharge amount validation now accepts only positive safe integers. The visual editor filters and sorts valid presets. Payment settings rejects invalid JSON amount options and normalizes valid values before submission.
A shared type guard accepts positive safe integers. The visual editor filters, deduplicates, and sorts presets, and disables Add for invalid values. Tests cover fractional input and null placeholders.
Validate and save JSON amount options web/src/features/system-settings/integrations/payment-settings-section.tsx, web/src/features/system-settings/integrations/__tests__/epay-sign-settings.test.tsx
Payment settings accepts JSON amount arrays only when every element is a positive safe integer. Submitted JSON is normalized. Tests cover rejected fractional values and canonicalized integer values.
This change stops administrators from saving fractional recharge presets in either the visual or JSON editor, and it normalizes valid JSON values to integers. It has a narrow blast radius and tests for the changed behavior. No actionable merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: recharge presets now require positive integers. The raw summary confirms that the visual editor, the JSON save path, and the new isPositiveRechargeAmount guard all enf…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: recharge presets now require positive integers. The raw summary confirms that the visual editor, the JSON save path, and the new isPositiveRechargeAmount guard all enforce this rule. The title uses the conventional fix(web) prefix and stays concise. The PR objectives describe the same goal of rejecting fractional presets in both editors.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
A rabbit checks each amount with care, Fractions leave the list behind. Whole numbers line up in order, Safe and positive, neatly aligned. “Presets saved!” the rabbit cheers, Then hops away with sorted ears.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: c3b1694a-6022-46ed-ad6d-c5f6d7fddf8e
Commits
Reviewing files that changed from the base of the PR and between 04dfcbb and b890338.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent: Codex unknown · gpt-6.2-sol · Windows desktop · 2026-11-28 UTC
Related: none
Request summary
修复管理员能在充值预设中添加小数档位的问题,使可视化编辑和 JSON 保存都符合现有后端配置类型。
本 PR 的代码与回归测试使用 AI 辅助编写。
Summary
两个编辑入口共用正安全整数校验,并在保存
payment_setting.amount_options时将合法数值规范化为整数数组。Evidence
v1.0.0-rc.52(04dfcbb)打开/system-settings/billing/payment,输入12.5后点击添加,可以得到$12.5档位。JSON 编辑器只检查顶层是否为数组,而后端将该配置声明为[]int。另一个回归用例确认,原有数组中的null会被显示为$0。12.5,仍可添加25。原列表中的null不再显示为档位,有效档位保留。JSON 编辑器拒绝[10,12.5],接受[10,2.5e1,50]并按[10,25,50]保存。$25。付款请求为 0。本改动仅影响管理员编辑预设档位,充值汇率、折扣与订单应付金额沿用原逻辑。浏览器复核使用本地接口替身。组合构建的控制台记录了一次隔离策略拦截,未记录页面运行时异常。
Merge Danger
Door: two-way
Blast Radius: frontend
Summary by CodeRabbit