Repository navigation
fix(payment): configure EasyPay refund success codes per instance - #8566
Merged
Wei-Shaw merged 1 commit intoNov 10, 2026
Merged
Conversation
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
#8533 报告的易支付兼容网关将退款
code=0定义为成功,但当前实现只接受1,会把已成功的退款送入本地失败回滚分支。不同网关的协议确实不同:ZPAY 的退款文档规定1成功,因此不能全局同时接受0和1。新增每个 EasyPay 支付实例的
refundSuccessCode设置,默认保持1。管理员可按该网关的退款接口文档选择0;只接受所选的一个成功码,且只影响退款。下单和查单继续使用成功码1。配置界面提供下拉选择和中英文说明,无需数据库迁移。数字成功码采用精确比较,避免把0.5/1.5截断后误判为成功。回归覆盖真实的
PrepareRefund→ExecuteRefund→ EasyPay HTTP 调用:成功时记录全额/部分退款、金额与时间并保留余额扣回;默认协议或所选协议返回失败码时,保留原有本地回滚行为。另覆盖字符串/数字响应、非法配置与响应,以及前端旧实例默认值和设置往返。验证(macOS arm64,Go 1.27.3,pnpm 9.15.9;基于
main@2c93aea9f):go test -json -tags=unit ./... -count=1:通过,25,865 个 test/subtest 通过、41 个既有门控跳过。go test -json -tags=integration ./... -count=1:通过,15,672 个 test/subtest 通过、16 个既有门控跳过。golangci-lint v2.14.0全仓检查:0 issues。gofmt/git diff --check通过。发布前核对main@d22e0724d的后续增量,仅涉及 Codex 配置导出,与本补丁文件无交集。退款上游均为本地合成 HTTP 服务,未执行真实退款或生产验证。此补丁不自动对账或重试已经在网关退款成功、但本地状态不一致的历史订单。
Refs #8533
AI disclosure: implemented and validated by an autonomous AI agent.