Commit Graph
2557 Commits
Author SHA1 Message Date
erio cc858c3cc9 feat(admin): enhance refund workflow to match sub2apipay
Admin order list:
- Add REFUND_REQUESTED "approve refund" button with amount badge
- Add REFUND_FAILED "retry refund" button
- Add missing status filters (REFUND_REQUESTED, REFUND_FAILED)
- Order detail dialog: show refund request info + audit logs

Admin refund dialog:
- Show refund request info card (violet) when user requested
- Display user balance with insufficient balance warning
- Add "no deduction" info when deduct_balance unchecked
- Add force refund checkbox (shown when requireForce=true)
- Add warning display prop
- Pre-fill reason from user's refund request
- Default deduct_balance to true

chore: bump version to 0.1.108.141
2026-04-09 21:47:39 +08:00
erio ceee2d0584 fix: audit fixes - magic strings to constants, frontend any/catch, LB tests
Backend:
- Define OrderTypeBalance/Subscription, EntityStatusActive, DeductionType*,
  NotificationStatus* constants in payment/types.go
- Replace all magic strings in payment_order, payment_fulfillment, payment_refund
- Add local constants in easypay.go (tradeStatusSuccess, signTypeMD5)
- Add 27 unit tests for load balancer (filterByLimits, pickLeastAmount,
  getInstanceChannelLimits, startOfDay)

Frontend:
- Remove all `any` types in SettingsView.vue (18 catch blocks + 1 payload)
- Fix bare catch blocks in PaymentResultView, PaymentView
- Add `unknown` type annotation to all catch blocks

chore: bump version to 0.1.108.140
2026-04-09 21:29:49 +08:00
erio 44a9d91c8f refactor(payment): rewrite load balancer with complete limit checking
- Batch-query daily usage in one SQL (GroupBy) instead of N queries
- Include PENDING orders in daily usage to prevent over-committing
- Check remaining capacity (used + orderAmount > limit) not just used >= limit
- Check SingleMin/SingleMax per-channel limits
- Pre-attach usage to candidates, reuse across filter and strategy pick
- Fallback to full list with warn log when all instances exhausted

chore: bump version to 0.1.108.139
2026-04-09 21:20:13 +08:00
erio 8808910ee7 fix(frontend): unify currency to $ and add order number to admin orders
- Replace all ¥ / ¥ with $ across all payment views and components
- Add out_trade_no column to admin order list table
- Add order number field to admin order detail dialog

chore: bump version to 0.1.108.138
2026-04-09 21:14:57 +08:00
erio e5dd87743f fix(payment): filter instances by remaining capacity and single amount range
Check used + orderAmount > dailyLimit (not just used >= limit) and
also filter by SingleMin/SingleMax per-channel limits.

chore: bump version to 0.1.108.137
2026-04-09 19:33:36 +08:00
erio fc99a88fee fix(payment): implement least-amount load balance strategy
Previously SelectInstance always used round-robin regardless of the
configured strategy. Now it reads the strategy from payment config
and selects the instance with the lowest daily transaction amount
when "least-amount" is configured.

chore: bump version to 0.1.108.136
2026-04-09 19:20:20 +08:00
erio b25d7f3179 fix(frontend): restore RechargeSubscriptionIcon for purchase menu
chore: bump version to 0.1.108.135
2026-04-09 19:01:34 +08:00
erio 05ce6d6bc0 feat(admin): add platform colors to plan edit group selector
chore: bump version to 0.1.108.134
2026-04-09 18:46:58 +08:00
erio acb86102f4 feat(admin): color plan names by group platform
chore: bump version to 0.1.108.133
2026-04-09 18:33:36 +08:00
erio 0c00a883a3 chore: bump version to 0.1.108.132 2026-04-09 18:19:32 +08:00
erio 3d547d85cb chore: bump version to 0.1.108.131 2026-04-09 18:04:04 +08:00
erio 5c17718633 chore: bump version to 0.1.108.130 2026-04-09 17:49:09 +08:00
erio aa1b87fdbb chore: bump version to 0.1.108.129 2026-04-09 17:43:42 +08:00
erio 8c73ded205 chore: bump version to 0.1.108.128 2026-04-09 17:34:23 +08:00
erio 2f6d926a9b chore: bump version to 0.1.108.127 2026-04-09 17:29:18 +08:00
erio e42838eb82 chore: bump version to 0.1.108.126 2026-04-09 17:23:23 +08:00
erio 01864a7a1e fix(payment): ensure providers loaded before webhook, show out_trade_no
- Call EnsureProviders before webhook provider lookup to fix
  "provider not registered" error after restart or config changes
- Display out_trade_no instead of numeric ID in payment result pages
2026-04-09 17:23:23 +08:00
erio 3f557d0f9d chore: bump version to 0.1.108.125 2026-04-09 17:14:39 +08:00
erio 8e4641e176 chore: bump version to 0.1.108.124 2026-04-09 16:39:22 +08:00
erio 9fdc7c92e2 chore: bump version to 0.1.108.123 2026-04-09 16:07:26 +08:00
erio 1ffea8faec chore: bump version to 0.1.108.122 2026-04-09 15:41:24 +08:00
erio 7505c745d2 chore: bump version to 0.1.108.121 2026-04-09 15:21:44 +08:00
erio 5c94b51d04 chore: bump version to 0.1.108.120 2026-04-09 14:56:38 +08:00
erio 03b97f14ad fix(payment): add return_url verification for popup payment mode
EasyPay popup mode relies on notify_url (webhook) to update order status,
but if the callback is missed, orders stay PENDING forever. This adds:

- POST /api/v1/payment/orders/verify endpoint that actively queries
  the upstream provider to check payment status
- Frontend PaymentResultView calls verify when receiving EasyPay
  return_url params (out_trade_no)
- Fix checkPaid to fall back to OutTradeNo when PaymentTradeNo is empty
  (popup mode doesn't have trade_no until the notify callback)
2026-04-09 14:56:24 +08:00
erio 6575fc1d1c chore: bump version to 0.1.108.119 2026-04-09 13:09:28 +08:00
erio 3844c8688e refactor(payment): remove DB ID from order number, use out_trade_no lookup
Order ID format changed from sub2_5 to sub2_20250409aB3kX9mQ
(prefix + date + 8-char random, no DB ID embedded).

- Add out_trade_no column to payment_orders table
- Store generated external ID on order creation
- Webhook handler looks up order by out_trade_no instead of parsing DB ID
- Fallback to legacy sub2_N format for existing orders
2026-04-09 13:09:27 +08:00
erio a7a7257603 chore: bump version to 0.1.108.118 2026-04-09 12:21:13 +08:00
erio f211c7f22b fix: order ID format sub2_20250409aB3kX9mQ_N, parse via last underscore 2026-04-09 12:21:13 +08:00
erio 7ef11b3180 chore: bump version to 0.1.108.117 2026-04-09 11:58:49 +08:00
erio 6c9fd2ed00 fix: prevent settings save on provider edit, randomize order IDs
- Remove saveSettings() call from handleSaveProvider - editing a
  provider should not save the entire settings form
- Change order ID format from sub2_5 to sub2_20250409_5_aB3kX9mQ
  (prefix + date + dbID + 8-char alphanumeric random) to avoid
  collisions with external payment providers
- parseOrderID supports both legacy and new format
2026-04-09 11:58:49 +08:00
erio 7de6de09d7 chore: bump version to 0.1.108.116 2026-04-09 11:44:32 +08:00
erio 1d8f39e473 chore: bump version to 0.1.108.115 2026-04-09 03:35:38 +08:00
erio 7d45fad287 chore: bump version to 0.1.108.114 2026-04-09 03:20:53 +08:00
erio 2fc413c82e chore: bump version to 0.1.108.113 2026-04-09 03:13:35 +08:00
erio dd87c273da chore: bump version to 0.1.108.112 2026-04-09 03:00:49 +08:00
erio 173aa9325e chore: bump version to 0.1.108.111 2026-04-09 02:29:18 +08:00
erio a8a98cc5a1 fix: order expiry cancels upstream, subscription layout, popup & label fixes
- ExpireTimedOutOrders now cancels upstream payment (Stripe PaymentIntent)
  before marking order as expired
- Active subscriptions moved below plan list with compact inline style
- StripePaymentView uses minimal layout (no AppLayout) in popup mode
- Fix misleading "服务商" label → "支持的支付方式" for payment type toggles
2026-04-09 02:29:18 +08:00
erio 302e6acbd9 chore: bump version to 0.1.108.110 2026-04-09 02:13:34 +08:00
erio 74a38ead49 chore: bump version to 0.1.108.109 2026-04-09 02:04:23 +08:00
erio 204fa00bf5 chore: bump version to 0.1.108.108 2026-04-09 01:50:48 +08:00
erio ad2b240fd8 chore: bump version to 0.1.108.107 2026-04-09 01:24:30 +08:00
erio 373464db26 fix(payment): add cid and fix double-slash in easypay redirect mode
createRedirectPayment was missing the cid parameter (channel ID) that
createAPIPayment already included via resolveCID(). This caused EasyPay
to use a default channel instead of the configured one (e.g. 13256/13264).

Also trim trailing slash from apiBase to prevent double-slash in URLs.
2026-04-09 01:24:15 +08:00
erio bfef48f932 chore: bump version to 0.1.108.106 2026-04-09 01:13:32 +08:00
erio 4f88ee637a fix(payment): inject paymentMode into provider config for correct redirect
The EasyPay provider reads paymentMode from e.config["paymentMode"] to decide
between redirect (submit.php) and API (mapi.php) paths. However, paymentMode
is stored as a separate DB column, not inside the encrypted config JSON.
SelectInstance() returned it in the InstanceSelection struct but never injected
it into the Config map, so the provider always fell through to the API/QR path.

Also includes:
- Subscription success flow: show "订阅成功" and refresh on return
- Active subscription card: platform colors, rate/quota display
- Subscription plan card: compact layout to save height
- Provider list: drag-and-drop reorder via sort_order
2026-04-09 01:13:16 +08:00
erio 47021dae14 chore: bump version to 0.1.108.105 2026-04-09 00:15:25 +08:00
erio e95cc3cbbe chore: bump version to 0.1.108.104 2026-04-09 00:11:01 +08:00
erio 6a3fa290af chore: bump version to 0.1.108.103 2026-04-09 00:00:44 +08:00
erio 5f4378b4ae feat(payment): show group details and quota info on subscription plan cards
Extend checkout API to return group name, rate multiplier, daily/weekly/monthly
limits and supported model scopes. Redesign SubscriptionPlanCard to display
platform badge, group quota info, and model scope tags.
2026-04-09 00:00:25 +08:00
erio 7324f458de chore: bump version to 0.1.108.102 2026-04-08 22:16:30 +08:00
erio 2cc97a0bda chore: bump version to 0.1.108.101 2026-04-08 22:08:13 +08:00