Skip to content

feat(waffo): Waffo payment gateway integration with configurable methods and refund - #3138

Closed
zhongyuanzhao-alt wants to merge 5425 commits into
QuantumNous:mainfrom
zhongyuanzhao-alt:ft-waffo-payment-zzy20260209
Closed

feat(waffo): Waffo payment gateway integration with configurable methods and refund#3138
zhongyuanzhao-alt wants to merge 5425 commits into
QuantumNous:mainfrom
zhongyuanzhao-alt:ft-waffo-payment-zzy20260209

Conversation

@zhongyuanzhao-alt

@zhongyuanzhao-alt zhongyuanzhao-alt commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Integrate Waffo payment gateway as a new payment provider for quota top-up, with full admin configuration UI, configurable payment methods, and refund support.

Backend

  • Payment: controller/topup_waffo.go — order creation via Waffo SDK, webhook handler (payment + refund notifications), RSA signature verification
  • Refund: model/refund.go — admin-initiated refund with configurable quota deduction, webhook-driven status updates
  • Settings: setting/payment_waffo.go + model/option.go — runtime-configurable Waffo credentials, sandbox/production mode, currency, payment methods
  • Unit tests: controller/topup_waffo_test.go — 651 lines covering webhook signature verification, payment/refund event handling, edge cases

Frontend

  • Top-up page: Dynamic Waffo payment buttons with icons per payment method (Dana, GoPay, QRIS, Credit Card, etc.)
  • Refund modal: Admin can initiate refund with configurable quota deduction amount
  • Admin settings: Full Waffo configuration page — API keys, sandbox toggle, currency, payment method management with icon upload
  • i18n: All new UI strings added to en/zh/fr/ja/ru/vi locales

Cleanup

  • Removed subscription payment feature (SubscriptionPlansCard, SubscriptionPurchaseModal, subscription webhook handlers) — will be re-added in a dedicated branch
  • Removed E2E tests from this repo (moved to standalone test repository)

Key Design Decisions

  • paymentRequestId = merchantOrderId for simplified order tracking across logs, DB, and Waffo dashboard
  • Webhook signature verification uses RSA + separate sandbox/production public keys
  • Payment method list is admin-configurable (stored in options table as JSON), not hardcoded
  • Refund quota deduction is decoupled from refund amount — admin can choose how much quota to reclaim

Test Plan

  • Unit tests: go test ./controller/ -run TestWaffo -v (webhook signature, payment events, refund events)
  • E2E tests: 49 test cases in standalone newApiTest repo covering payment flow, refund flow, settings, UI layout
  • Manual: admin configures Waffo in Settings > Payment, user completes top-up via Waffo checkout page

Summary by CodeRabbit

  • New Features

    • Waffo payment gateway: in-app top-up flow (Card/Apple/Google Pay), webhook support, and admin refund APIs.
    • Admin refund management: create/refund top-up requests, refund history, and refund modal in top-up UI.
    • Waffo settings panel for keys, pricing, methods, and pay-method management.
  • Chores

    • Extensive localization additions across languages.
    • Added ignore rules for development and test artifacts.

Calcium-Ion and others added 30 commits February 8, 2026 00:13
feat(oauth): implement custom OAuth provider
fix: Claude stream block index/type transitions
fix: add paragraph breaks between reasoning summary chunks
# Conflicts:
#	service/openaicompat/chat_to_responses.go
…t-stream

feat: channel test with stream=true
…fo-input-token

fix: 使用openai兼容接口调用部分渠道在最终端点为claude原生端点下还是走了openai扣减input_token的逻辑
fix: 补全 streaming message_delta 事件缺失的 input_tokens 和 cache 相关字段
…sponses

feat: /v1/messages -> /v1/responses
…ion-configurable

feat: make 5m cache-creation ratio configurable
fix: 如果模型管理有自定义配置则不合并默认配置
fix: 修复模型管理"参与官方同步"与"状态"开关无法保存的问题
…inity-tips

optimize: channel affinity tips
Replace icon-based language options with plain text labels in both the
header dropdown and preferences settings to keep the UI clean and
avoid potential controversies. Remove unused country-flag-icons dependency.
Bumps [axios](https://github.com/axios/axios) from 1.12.0 to 1.13.5.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.12.0...v1.13.5)

---
updated-dependencies:
- dependency-name: axios
  dependency-version: 1.13.5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
…nd_yarn/web/axios-1.13.5

chore(deps): bump axios from 1.12.0 to 1.13.5 in /web
* feat(localization): added zh_TW

* fixed based on @coderabbitai

* updated false translation for zh_TW

* new workflow

* revert

* fixed a lot of translations

* turned most zh to zh-CN

* fallbacklang

* bruh

* eliminate ALL _

* fix: paths and other miscs thanks @Calcium-Ion

* fixed translation and temp fix for preferencessettings.js

* fixed translation error

* fixed issue about legacy support

* reverted stupid coderabbit's suggestion
* feat: logs cache field

* feat: logs cache field

* feat: logs cache field
# Conflicts:
#	README.fr.md
#	README.ja.md
#	README.md
#	README.zh_CN.md
Calcium-Ion and others added 28 commits March 9, 2026 22:19
…4f8a4248b0ab3b03ba703796ea3

fix: kling risk fail return openAIVideo error
…ride-beta-header-append

feat:support $keep_only_declared and deduped $append for header override
The previous merge lost subscription state, API calls, and RechargeCard
props that were added to main after our branch diverged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add default payment method icons (Card/Apple Pay/Google Pay) as static
  assets in web/public/ and reference by path in DefaultWaffoPayMethods
- Make refund reason a required field with validation
- Add maxLength=64 to Pay Method Type and Pay Method Name inputs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove all Waffo payment refund code including:
- Backend: Refund model, controller endpoints, webhook handler, router routes, status constants
- Frontend: RefundModal component, refund button in TopupHistoryModal
- i18n: refund translation keys across all 6 locale files

Task billing RefundTaskQuota (async task quota refund) is preserved as it's unrelated to Waffo.
Backup branch: ft-waffo-payment-zzy20260209-backup-with-refund

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This field was only used by the now-removed refund functionality.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chore: update model lists for frequently used channels
…error

Waffo API validates userInfo.userEmail max length is 64. Some users have
emails exceeding this limit, causing A0003 validation failure. Use a
fixed format {userId}@examples.com (max 32 chars) for all users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.