Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

退款的状态解析错误 #160

Open
CoMixCo opened this issue Jan 9, 2023 · 8 comments
Open

退款的状态解析错误 #160

CoMixCo opened this issue Jan 9, 2023 · 8 comments
Assignees

Comments

@CoMixCo
Copy link

CoMixCo commented Jan 9, 2023

  • Go 版本:1.192
  • wechatpay-go 版本:v0.2.16

/services/refunddomestic/models.go
第880行: Status *Status json:"status"
解析失败,无法获取退款状态
json字段应该是 json:"json_status"

@zhangllee
Copy link

应该是 refund_status 吧 这个问题什么时候给更新啊

@yinmingming
Copy link

没人管吗?大家遇到这个问题是怎么解决的呢?

@jianxing-xu
Copy link

@zhangllee 很奇怪的是,退款接口返回的里面是status,推送通知过来的又是refund_status,而且通知里推过来的channel是空的,导致解析报错了,服了

@kokais
Copy link

kokais commented Aug 11, 2023

你们怎么处理的?手撸一份?

@reechou
Copy link

reechou commented Aug 18, 2023

通知里推过来的channel是空的,导致解析报错了

这个有人处理吗?

@ccfish86
Copy link

ccfish86 commented Aug 21, 2023

反正我是通过if notifyReq.EventType == "REFUND.SUCCESS" {判断,然后传的【refunddomestic.STATUS_SUCCESS,】给业务层处理。
或者自己手撸一个struct用于接收 /Resource/Plaintext

'''

handler, err := mall.GetWechatPayHandler(mchid)
if err != nil {
	global.GVA_LOG.Warn("微信退款回调处理失败", zap.Error(err))
	return mparam.WxPayCallbackResp{Code: "failed", Message: "处理失败"}, err
}

// 解析异步通知的参数
refund := new(refunddomestic.Refund)
notifyReq, err := handler.ParseNotifyRequest(context.Background(), c.Request, refund)

if err != nil {
	global.GVA_LOG.Warn("微信退款回调处理失败", zap.Error(err))
	return mparam.WxPayCallbackResp{Code: "failed", Message: "验签或解密失败"}, err
}

if notifyReq.EventType == "REFUND.SUCCESS" {

	//  业务处理
	// 解析异步通知的参数
	if err = json.Unmarshal([]byte(notifyReq.Resource.Plaintext), &refund); err != nil {
		global.GVA_LOG.Warn("微信退款回调处理失败", zap.Error(err))
		return mparam.WxPayCallbackResp{Code: "failed", Message: "解析参数失败"}, err
	}

	outRefundNo := strings.TrimPrefix(*refund.OutRefundNo, global.GVA_CONFIG.Wechat.TradeNoPrefix)
	outTradeNo := strings.TrimPrefix(*refund.OutTradeNo, global.GVA_CONFIG.Wechat.TradeNoPrefix)

	// 后续处理 .......................
}

'''

@Jeremyly
Copy link

直到今天,这个问题依旧,是go用户量太小懒得理?这个问题很难解决吗?改个字段名就行了的,愣是不修复,搞到测试半天,测试又麻烦!

@ccfish86
Copy link

直到今天,这个问题依旧,是go用户量太小懒得理?这个问题很难解决吗?改个字段名就行了的,愣是不修复,搞到测试半天,测试又麻烦!

这个BUG 但凡你提交个commit,也不至于留到现在

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

No branches or pull requests

9 participants