Commit Graph
1166 Commits
Author SHA1 Message Date
erio ac00a0aeb3 fix(payment): full-replace config update + fix min/max defaults
- Payment config update is now full-replace (not patch): all fields sent every time
- 0 values for min/max/daily = clear (use default: min=1, max=unlimited)
- Payment page: provider-level limits override global, proper fallback chain
- Fix quick amounts disappearing when global min/max is empty
2026-04-07 01:11:20 +08:00
erio ed03fbf7ba fix: add help_image_url/help_text to AdminPaymentConfig TypeScript types 2026-04-07 00:57:00 +08:00
erio a481724140 fix(payment): add missing help_image_url/help_text fields + fix config merge on update
- Add help_image_url and help_text to PaymentConfig, UpdateRequest, read/write logic
- Add these fields to frontend paymentPayload save and load
- Fix provider config update: merge new config with existing (preserves sensitive
  fields that frontend skips as ••••••••, prevents data loss on edit)
2026-04-07 00:55:13 +08:00
erio 8648950f44 fix(payment): card/link are Stripe sub-methods, not top-level providers
- Remove card/link from global allPaymentTypes (they belong inside Stripe provider)
- Resolve i18n labels for Stripe sub-methods in provider dialog and card
2026-04-07 00:46:11 +08:00
erio f906b5f1f3 feat(payment): add Link payment method for Stripe
- Add TypeLink payment type
- Stripe provider now supports card/alipay/wxpay/link
- Add Link i18n labels and PaymentMethodSelector styles
2026-04-07 00:32:25 +08:00
erio 55b526582b feat(payment): Stripe multi-method support + card type + hide single-type selector
- Add TypeCard payment type for bank card payments
- Stripe provider now supports card/alipay/wxpay payment methods
- Map payment types to Stripe payment_method_types (card, alipay, wechat_pay)
- Hide supported types selector for single-type providers (alipay/wxpay official)
- Add card i18n labels and PaymentMethodSelector styles
2026-04-07 00:23:54 +08:00
erio ec88ca6c57 fix(payment): add placeholder hint on per-provider limit inputs 2026-04-07 00:01:45 +08:00
erio b1a8252f25 feat(payment): independent callback URLs + sensitive field visibility toggle
- Split callback URLs into two independent inputs (notify/return each with own base URL + fixed path)
- Add eye icon toggle for sensitive fields (PKey etc.) to reveal/hide values
- Bump version to 0.1.108.35
2026-04-06 23:58:16 +08:00
erio 5e723b2911 fix(payment): collapsible limits, reject <=0, hint uses global config
- Limits section collapsible (default collapsed, auto-expand if has values)
- Empty input = use global config; reject values <= 0
- Input min changed from 0 to 1, placeholder changed to empty
- Hint: "留空表示使用全局配置"
2026-04-06 23:30:57 +08:00
erio 438782d536 fix(payment): split callback URL into base URL + fixed path, wider dialog
- Callback URLs now split: editable base URL + read-only fixed path
- Base URL defaults to current domain, user can change it
- notifyUrl/returnUrl computed as baseUrl + fixed webhook path
- Edit loads existing base URL by extracting it from stored notifyUrl
- Dialog width set to wide for more space
- Strict validation: all required fields must be filled on both create/edit
2026-04-06 23:15:32 +08:00
erio 34bd16ea3c fix(payment): strict validation — all required fields must be filled on edit
- Edit mode: sensitive fields show ••••••••, must remain filled to save
- Non-sensitive fields pre-filled from backend on edit
- Empty defaults (notifyUrl/returnUrl) auto-filled if backend has no value
- Submit filters out ••••••••  to keep existing backend credentials
- All required fields validated regardless of create/edit mode
2026-04-06 23:02:34 +08:00
erio eff86c9a72 fix(payment): return decrypted non-sensitive config on provider list
- Backend: add ListProviderInstancesWithConfig that decrypts config
  and masks sensitive fields (keys, secrets) as "••••••••"
- Frontend: pre-fill non-sensitive config values when editing provider
  (PID, API base URL, notify URL, return URL, channel IDs etc.)
- Sensitive fields left empty for user to re-enter if needed
2026-04-06 22:54:17 +08:00
erio 9bc8a4b4df fix(payment): reduce provider dialog width to default 2026-04-06 22:37:55 +08:00
erio c891439d2a refactor(payment): extract provider management into components + add limits UI
Components extracted from SettingsView:
- providerConfig.ts: shared constants, types, helpers
- PaymentProviderList.vue: provider card list with header
- ProviderCard.vue: single provider card with inline toggles
- ToggleSwitch.vue: reusable toggle switch component
- PaymentProviderDialog.vue: create/edit dialog with config + limits

Other changes:
- Add per-payment-type limits config UI (singleMin, singleMax, dailyLimit)
- Remove generic cid from EasyPay config (keep cidAlipay/cidWxpay only)
- Backend: remove paymentMode constants, determine mode by PaymentType
- Backend: add validateProviderRequest for create
- Add limits field to ProviderInstance type
- SettingsView reduced by ~200 lines of provider management code
2026-04-06 22:34:06 +08:00
erio c3a5cc685e fix(payment): merge supported types badges into provider card top row 2026-04-06 22:09:17 +08:00
erio 6676d1f7ca feat(payment): auto-fill callback URLs + complete provider config fields
- notifyUrl/returnUrl auto-fill with current domain + webhook path on create
- Default paths: /api/v1/payment/webhook/{provider} and /payment/result
- Add missing EasyPay config: cid, cidAlipay, cidWxpay (optional channel IDs)
- Stripe: show webhook URL hint with copyable endpoint below config
- Fields with defaults show placeholder text for reference
- Also apply defaults when switching provider type in dialog
2026-04-06 21:50:54 +08:00
erio 12369ae821 fix(payment): provider card toggle badges for supported types + strict validation
- Replace text "alipay,wxpay" with clickable toggle badges on provider cards
- Badges use same style as dialog; click to enable/disable types via API
- Prevent disabling all types (at least one required)
- Strict create validation: all non-optional config fields must be filled
2026-04-06 21:37:46 +08:00
erio 29c3670c62 fix(payment): remove paymentMode config, rename easypay to 跳转, add validation
Backend:
- Remove paymentMode config; determine mode by req.PaymentType directly
  (easypay=redirect/submit.php, alipay/wxpay=API/mapi.php)
- EasyPay.SupportedTypes() always returns [easypay, alipay, wxpay]
- Add validateProviderRequest() for create: name, providerKey, supportedTypes required

Frontend:
- Remove paymentMode dropdown from EasyPay config fields
- Show "跳转" label for easypay type in provider supported types toggle
- Add red * to required fields: provider name, provider key, supported types
- Add strict validation in handleSaveProvider before API call
- Add validation i18n keys for zh/en
2026-04-06 21:17:53 +08:00
erio 2f43e5a8fb fix(payment): redesign provider cards — full-width, inline toggles, greyed-out when type disabled
- Provider cards: one per row (full width), remove 2-column grid
- Add inline toggle switches for enabled/disabled and refund on each card
- Toggle switches call API directly without opening edit dialog
- When provider type is disabled above, entire card is greyed out with
  pointer-events-none and shows hint text
- Rename "启用的支付方式" → "服务商"
2026-04-06 21:07:36 +08:00
erio bfcc487a6b feat(payment): add EasyPay dual-mode support (redirect + API)
- Backend: EasyPay provider supports paymentMode config (redirect/api)
  - redirect: builds submit.php signed URL, browser redirects to hosted page
  - api: calls mapi.php, returns payurl/qrcode (existing behavior)
- Add TypeEasyPay payment type constant
- Fix notify/return URL fallback to instance config
- Handle empty TradeNo for redirect mode (SetNillable)
- Frontend: add paymentMode dropdown in EasyPay provider config
- Auto-update supported_types when paymentMode changes
- Add easypay icon/color in PaymentMethodSelector
- Add i18n for easypay, paymentMode labels
- Rename "启用的支付方式" to "服务商"
- Migration 098: clean easypay from ENABLED_PAYMENT_TYPES
2026-04-06 20:57:45 +08:00
erio d8f2fd3c94 fix(frontend): unify purchase icon with subscriptions (CreditCardIcon)
Use the same CreditCardIcon for both "我的订阅" and "充值/订阅" sidebar
items. Remove unused RechargeSubscriptionIcon.
2026-04-06 19:57:42 +08:00
erio 32907268f9 fix(frontend): mark provider config fields required/optional correctly
- apiBase, notifyUrl, returnUrl: remove optional flag (required — backend
  relies on these in provider config, no fallback)
- Only wxpay publicKeyId + certSerial remain optional
- Show red * for required fields, (可选) for optional fields
2026-04-06 19:43:50 +08:00
erio 91413cf410 feat(payment): order safety protection for provider/plan CRUD
Backend (matching sub2apipay behavior):
- UpdateProviderInstance: block credential changes (key/secret/password
  fields) when instance has PENDING/PAID/RECHARGING orders (409 Conflict)
- DeleteProviderInstance: block deletion when pending orders exist (409)
- DeletePlan: block deletion when pending orders exist (409)
- Non-credential changes (name/enabled/sort) still allowed with pending orders

Frontend:
- Filter empty config values before sending (avoid overwriting existing
  credentials when editing a provider without re-entering all secrets)
2026-04-06 19:31:26 +08:00
erio f69293c998 fix(frontend): provider creation — fix JSON field names, i18n, remove extra fields
Root cause: frontend sent snake_case (provider_key, supported_types) but
backend expects camelCase (providerKey, supportedTypes) → internal error.

Changes:
- Fix handleSaveProvider to send camelCase payload matching Go struct
- Remove CID/CID Alipay/CID Wxpay fields (not in sub2apipay reference)
- Data-driven config fields: PROVIDER_CONFIG_FIELDS per provider type
  (matches sub2apipay exactly: easypay=5 fields, alipay=5, wxpay=8, stripe=3)
- Full i18n for all config field labels (zh: 异步通知地址/私钥/商户号/etc)
- Dynamic providerConfig as Record<string,string> instead of hardcoded reactive
2026-04-06 19:04:01 +08:00
erio 515f4aa0ce fix(frontend): remove balance-disabled checkbox, disable provider add when no types enabled
- Remove redundant "禁用余额充值" checkbox
- Disable "添加服务商" button when no payment types are enabled
- Show hint "请先在上方启用至少一种支付方式" when empty + no types
2026-04-06 18:28:17 +08:00
erio 6503583162 fix(frontend): order timeout field — required marker + unit hint 2026-04-06 18:15:15 +08:00
erio 4b15704d8e fix(frontend): provider list respects enabled payment types
- Create provider dialog: only show provider types whose payment types
  are enabled (e.g. no Stripe option if stripe not enabled above)
- Provider cards: grey out + disable edit when their type is disabled
- Show "(类型已禁用)" warning on greyed-out provider cards
- Delete still allowed on disabled providers (cleanup)
2026-04-06 18:06:36 +08:00
erio b6757a831f fix(frontend): payment settings UI — layout, i18n, image upload
- Fix layout: 5-col grid -> 4-col + flex, no more truncated labels
- Add easypay to payment type toggles (易支付)
- Internationalize provider key options (易支付/支付宝官方/微信官方/Stripe)
- Help image: URL input -> ImageUpload component (supports upload)
- Help text: input -> textarea (multi-line)
- Add i18n keys: providerEasypay/Alipay/Wxpay/Stripe, helpImage, placeholders
2026-04-06 17:51:06 +08:00
erio 335aaa733b fix(frontend): fix purchase page icon and title i18n
- Replace fill-based 1024x1024 icon with stroke-based Heroicons banknotes
  icon (24x24) matching sidebar style
- Change titleKey from purchase.title to nav.buySubscription for consistency
2026-04-06 17:40:05 +08:00
erio f8990f39f8 style(frontend): compact payment settings layout
- Merge amount fields, toggles and limits into fewer rows
- Put payment types + load balance strategy on same line
- Compact provider cards (single-line info, inline edit/delete buttons)
- Reduce padding and gaps throughout
2026-04-06 17:16:59 +08:00
erio 611dcb8ccd cleanup: remove duplicate AdminPaymentConfigView, fix group display
- Delete AdminPaymentConfigView.vue (duplicated in SettingsView Payment tab)
- Remove /admin/orders/config route
- Plans table: show red "缺失/Missing" badge for deleted groups
- Plans table: group_id column shows group name or missing indicator
2026-04-06 16:19:19 +08:00
erio 97a9949085 fix(frontend): 7 payment UI issues
1. Remove duplicate page titles (AppLayout bar already shows them)
2. Fix daily_limit empty value causing Go unmarshal error (NaN -> 0)
3. Enabled payment types: text input -> toggle badges
4. Provider dialog: supported types -> toggle badges per provider key
5. Auto-derive supported types when changing provider key
6. Fix ¥ symbol showing as literal \u00A5 in Vue templates
7. Show payment method selector when >= 1 method (was > 1)
2026-04-06 16:03:58 +08:00
erio 0215b2a1ca refactor(frontend): unify user orders page with DataTable + Pagination
Replace custom table and pill-style filters with project-standard
DataTable, Select, and Pagination components for consistent UI.
2026-04-06 15:37:39 +08:00
erio 6798de6333 fix(frontend): centralize API error handling with extractApiErrorMessage
- Create utils/apiError.ts with extractApiErrorMessage() utility
- Replace all raw err.message/String(err) patterns in payment views
- Fix error display for API client interceptor's plain object errors
- Update CLAUDE.md with API error handling convention (section 13)
- Copy CLAUDE.md to AGENTS.md
2026-04-06 15:21:05 +08:00
erio 4cfcbfabe6 fix(frontend): i18n table headers + remove redundant user subscriptions tab
- Plans page: remove user subscriptions sub-tab (already in subscription mgmt)
- Plans page: internationalize all table column headers
- Orders page: internationalize table column headers
- Add missing i18n key: colUser
2026-04-06 15:02:49 +08:00
erio a6cd294ab6 feat(frontend): enrich payment settings with provider management inline
- Move payment config out of orders submenu (now 3 items: dashboard, orders, plans)
- Embed provider management directly in SettingsView Payment tab
- Add missing fields: product name prefix/suffix with preview, load balance strategy
- Add full provider CRUD dialog (EasyPay/Alipay/Wxpay/Stripe config fields)
2026-04-06 14:51:14 +08:00
erio f2b3cf628e feat(frontend): collapsible payment submenu in sidebar
Group the 4 payment admin pages under a single "订单管理" parent menu
item that expands/collapses to show sub-items with indented tree line.
2026-04-06 14:40:37 +08:00
erio 94585c3c21 refactor(frontend): split payment admin into 4 independent pages
Replace the single AdminOrdersView with 4-tab layout with separate pages:
- /admin/orders/dashboard — payment dashboard with 7/30/90 day switcher
- /admin/orders — pure order list (removed channels/plans tabs)
- /admin/orders/config — payment config + provider management
- /admin/orders/plans — subscription plans (group dropdown) + user subscriptions

Delete AdminProvidersView (merged into config page).
Update sidebar to show 4 menu items instead of 1.
2026-04-06 14:26:28 +08:00
erio acf79ff832 fix: resolve frontend TypeScript build errors
- Remove unused ReceiptIcon/SoraIcon and sora_client_enabled references
- Fix AdminOrdersView pagination response property (data → items)
- Fix PaymentView null safety for amount (use validAmount computed)
- Add missing @stripe/stripe-js dependency
2026-04-06 02:39:07 +08:00
erio 3703b5c08b refactor: migrate legacy purchase subscription to custom menu item
- Restore MigrateLegacyPurchaseURL auto-call on startup: converts old
  purchase_subscription_url into a custom menu item (id: migrated_purchase_subscription)
  and clears the legacy settings
- Delete PurchaseRouter.vue and PurchaseSubscriptionView.vue (replaced
  by existing CustomPageView.vue via custom menu system)
- /purchase route now exclusively serves the new built-in payment system
- Remove purchase_subscription_enabled from sidebar, router, settings UI,
  TypeScript types, and i18n keys
- Legacy purchase URL users will see their link as a custom menu entry
  after upgrade, editable in admin custom menu settings
2026-04-06 02:09:26 +08:00
erio 4a703cb084 fix: backward compatibility for legacy purchase subscription system
- Add PurchaseRouter.vue to dynamically render PaymentView or
  PurchaseSubscriptionView based on payment_enabled vs
  purchase_subscription_enabled settings
- Fix route guard to allow access when either payment system is enabled
- Split sidebar menu: /purchase shows for both systems, /orders only
  for built-in payment
- Remove auto-migration that forcibly disabled legacy purchase system
  on first startup (MigrateLegacyPurchaseURL)
- Add payment_enabled to PublicSettings API response so frontend can
  check both systems from a single endpoint
- Restore legacy purchase link config UI controls in admin Payment tab
- Split payment settings save to use dedicated PUT /admin/payment/config
  API instead of mixing into general settings endpoint
- Add admin payment config API functions (getConfig/updateConfig)
2026-04-06 01:51:12 +08:00
erio c69929bbb7 Merge feature/payment into release/custom-0.1.108
集成支付系统(EasyPay、Alipay、WxPay、Stripe),包含完整的订单管理、
Webhook 回调、管理后台仪表盘和用户充值/订阅流程。
2026-04-06 00:53:57 +08:00
erio db6413039a Merge tag 'v0.1.108' into release/custom-0.1.108
彻底移除 Sora 平台功能,精简代码库约 24000 行;修复渠道平台定价隔离问题。

- 完全移除 Sora 平台:删除所有 Sora 相关的后端服务、前端组件、数据库 Schema 和 ent 代码
- 移除 Sora 相关的 S3 存储、媒体管理、配额管理、生成服务等模块
- 清理前端 Sora 视图、组件、composables、API 调用和国际化文本
- 移除 Sora OAuth 选项,简化 OpenAI OAuth 流程
- 更新 antigravity User-Agent 版本号至 1.21.9

- 修复 antigravity 分组错误匹配其他平台(anthropic/gemini)定价和模型映射的问题
- 修复渠道未映射模型时 BillingModel 被错误还原导致零计费的问题

# Conflicts:
#	backend/cmd/server/VERSION
#	backend/cmd/server/wire_gen.go
#	backend/ent/group.go
#	backend/ent/mutation.go
#	backend/ent/runtime/runtime.go
#	backend/ent/schema/group.go
#	backend/internal/handler/admin/channel_handler.go
#	backend/internal/handler/admin/channel_handler_test.go
#	backend/internal/handler/gateway_handler.go
#	backend/internal/pkg/antigravity/stream_transformer.go
#	backend/internal/server/api_contract_test.go
#	backend/internal/service/billing_service.go
#	backend/internal/service/channel_service.go
#	backend/internal/service/channel_service_test.go
#	backend/internal/service/gateway_service.go
#	backend/internal/service/openai_account_scheduler.go
#	backend/internal/service/openai_gateway_chat_completions.go
#	backend/internal/service/openai_gateway_service.go
#	backend/internal/service/openai_oauth_service.go
2026-04-05 23:11:04 +08:00
erio 5cde1bcc59 fix: code quality audit — critical bugs + convention compliance
Critical:
- Refund idempotency keys now include UnixNano timestamp (alipay/wxpay)
- PaymentView passes qr/pay_url params to QR code page
- Fix dead code branch in order result handling

Quality:
- Currency symbol $ → ¥ in admin stats and refund dialog
- StripePaymentView setTimeout cleanup on unmount
- Webhook body size limited to 1MB (io.LimitReader)
- SubscriptionPlan features type documented
2026-04-05 22:17:56 +08:00
shaw a07296770c fix: remove remaining Sora references from frontend
The previous Sora removal missed several frontend references, causing
TypeScript build errors for sora_client_enabled and a missing SoraView.vue
import. Clean up all remaining Sora code from types, router, sidebar,
settings, store, and accounts API.
2026-04-05 21:26:47 +08:00
erio aa151ef0e1 fix: resolve all audit findings — registry init, expiry task, dashboard, i18n, stripe
C1: Add EnsureProviders() lazy initialization to populate Registry
    from PaymentProviderInstance DB rows at first use
C2: Delete stale payment/provider_factory.go dead code
C3: Add PaymentOrderExpiryService background ticker (60s interval)
C4: Expand DashboardStats with daily_series, payment_methods, top_users
C5+C6: Add 152 payment i18n keys (en + zh) for admin and settings pages
C7: Fix Stripe global key race — use per-instance client.API
I1: Remove old purchase_subscription_enabled/url from settings form
I2: Add MigrateLegacyPurchaseURL to auto-convert old URL to custom menu
I3: Add migration 092 no-op placeholder for numbering continuity
2026-04-05 18:32:24 +08:00
erio 08e69af572 fix: remove empty DataManagement tab from settings (was Sora S3 storage) 2026-04-05 17:22:22 +08:00
erio 294b4bcbac fix: remove Sora S3 profile code from DataManagementView, keep backup functionality 2026-04-05 17:22:22 +08:00
erio 67008b5d15 fix: restore DataManagementView.vue — incorrectly deleted during Sora removal
This component is used by SettingsView.vue for backup/data management.
It was mistakenly deleted as "Sora storage management" but contains
non-Sora backup functionality from upstream.
2026-04-05 17:22:22 +08:00
erio ff86154a03 refactor: remove unused OpenAIOAuthOptions after Sora platform removal
The options parameter only served to switch between 'openai' and 'sora'
platforms. With Sora removed, the parameter is unnecessary.
2026-04-05 17:19:27 +08:00