Skip to content

fix: consolidate Waffo payment settings save flow - #5110

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/waffo-setting-save
May 26, 2026
Merged

fix: consolidate Waffo payment settings save flow#5110
seefs001 merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/waffo-setting-save

Conversation

@seefs001

@seefs001 seefs001 commented May 26, 2026

Copy link
Copy Markdown
Collaborator

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

统一waffo和waffo pancake的设置保存到保存全部设置

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • New Features

    • Added support for Waffo payment gateway configuration alongside existing providers.
    • Extended payment settings to include Waffo credentials, merchant details, and payment method management.
    • Added Waffo Pancake store and product binding selection capabilities.
  • Improvements

    • Enhanced form state management for payment settings.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Payment settings form is extended with Waffo gateway configuration support. Child components WaffoPancakeSettingsSection and WaffoSettingsSection are refactored from independent form-managed components to parent-controlled components, centralizing state and submission logic in PaymentSettingsSection.

Changes

Waffo Settings Refactor

Layer / File(s) Summary
Payment form schema and type definitions
web/default/src/features/system-settings/integrations/payment-settings-section.tsx
Zod schema extended with Waffo fields (enablement, credentials, merchant, pricing, URLs, payment methods). New derived types WaffoFormFieldValues and PaymentBaseFormValues separate Waffo pay-method handling from base defaults. PaymentSettingsSectionProps.defaultValues updated to accept base form values.
Form initialization with Waffo and Pancake defaults
web/default/src/features/system-settings/integrations/payment-settings-section.tsx
Form defaults refactored to compute combined defaults via memoized initialFormValues. Component state added for parsed Waffo PayMethods, Pancake binding selection, and saved bindings. Effects synchronize state when defaults or provisioned store/product props change.
Form submission with Waffo field handling and Pancake config save
web/default/src/features/system-settings/integrations/payment-settings-section.tsx
Submission payload extended to sanitize and include Waffo fields (credentials, merchant, pricing, URLs, certificates) and serialize PayMethods JSON. Change detection includes corresponding Waffo fields. Conditional Waffo option updates added to update list. Pancake changes trigger validation of binding selection and call saveWaffoPancakeConfig with error/success handling and cache updates.
Waffo values computation and save button loading state
web/default/src/features/system-settings/integrations/payment-settings-section.tsx
Post-submission, waffoValues and waffoPancakeValues constructed from form state (including serialized PayMethods) for wiring child components. Save button loading state updated to include isSubmitting from react-hook-form.
Payment settings form UI integration of Waffo components
web/default/src/features/system-settings/integrations/payment-settings-section.tsx
Form render tree updated to wire WaffoPancakeSettingsSection and WaffoSettingsSection with controlled props: current values, change handlers, and Pancake binding selection callbacks. Previous form-based Waffo section rendering removed.
Waffo Pancake settings refactor to controlled component
web/default/src/features/system-settings/integrations/waffo-pancake-settings-section.tsx
WaffoPancakeSettingsSection refactored from internal form state to parent-managed controlled component. Derives selected and saved bindings from props. Credential verification remains debounced and guarded; applies binding selection heuristics based on fetched catalog (preselect or product match or first store or clear). Initial-load verification runs only when merchant ID is non-empty. Form-based UI replaced with direct controlled inputs and dropdowns. Save flow removed.
Waffo settings refactor to controlled component
web/default/src/features/system-settings/integrations/waffo-settings-section.tsx
WaffoSettingsSection converted from form-based to parent-controlled component. Form lifecycle and independent save logic removed. All fields (switches, credentials, RSA keys, numeric values, URLs) read from parent values and update via onValueChange callbacks. Payment method management externalized: parent-provided payMethods array and onPayMethodsChange callback replace internal state. Dialog button types updated.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • QuantumNous/new-api#5085: Modifies Waffo Pancake settings UI/handling by changing how WaffoPancake* fields are parsed and rendered in classic page tabs versus new controlled WaffoPancakeSettingsSection wiring in payment settings flow.
  • QuantumNous/new-api#4935: Frontend refactor for Waffo Pancake binding/credential UI and save flow aligns with backend endpoints for admin catalog, pairing (SaveWaffoPancakeConfig), and persisted configuration.

Poem

🐰 A rabbit hops through forms with glee,
State flows up from child to parent tree,
No more forms within each nested nook,
Just props and callbacks—take a look!
Waffo settings dance at parent's call,
Controlled components conquer all. 🎉

🚥 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 and specifically describes the main change: consolidating Waffo payment settings to use a unified save flow rather than individual save mechanisms.
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.

@seefs001
seefs001 merged commit c91ba0c into QuantumNous:main May 26, 2026
1 of 2 checks passed
52assert added a commit to 52assert/new-api that referenced this pull request May 28, 2026
…codes

* origin/main: (34 commits)
  fix: optimize batch update process
  fix: keep token log filters exact
  fix: keep usage log filters exact unless wildcard is explicit (QuantumNous#5097)
  fix(web): improve channel and usage log UI
  feat(theme): add simple-large preset, xl scale and clean up channel badge dots
  🐛 fix(system-settings): resolve save detection and number input NaN issues
  🎨 fix(logs): tune usage table typography
  fix: use actual user id for channel tests (QuantumNous#5109)
  fix: consolidate Waffo payment settings save flow (QuantumNous#5110)
  🎨 fix(charts): improve dark mode chart readability
  🎨 fix(logs): remove hardcoded font-mono to support global theme font inheritance
  🎨 fix(logs): restore timing background badges and optimize model/token spacing
  feat(subscription): support balance purchases
  🎨 fix(theme): default theme font preset falls back to Sans instead of Serif
  🎨 refactor(badge): restore status-badge sizes and classic color scheme
  fix: prevent duplicate channel action toasts (QuantumNous#5015)
  🎨 feat(web/default): add Anthropic theme preset and configurable serif typography
  ♻️ refactor(channels): rebuild channel editor UX with modular sections and Base UI multi-select
  ♻️ refactor(channels): rebuild channel create/edit drawer with modular sections and improved form UX
  fix: handle paginated API key search response (QuantumNous#5014)
  ...

# Conflicts:
#	controller/misc.go
#	web/default/src/features/auth/sign-in/components/user-auth-form.tsx
#	web/default/src/features/auth/sign-in/index.tsx
#	web/default/src/features/auth/sign-up/components/sign-up-form.tsx
#	web/default/src/hooks/use-sidebar-data.ts
#	web/default/src/routes/__root.tsx
xyfacai pushed a commit to xyfacai/new-api that referenced this pull request May 30, 2026
SamuelSxy pushed a commit to SamuelSxy/new-api-rh that referenced this pull request Jun 7, 2026
fx247562340 pushed a commit to fx247562340/vancine-platform that referenced this pull request Jun 11, 2026
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
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