diff --git a/app/services/thirdpay/do/refund_way.go b/app/services/thirdpay/do/refund_way.go index 4ccb9f5..6149888 100644 --- a/app/services/thirdpay/do/refund_way.go +++ b/app/services/thirdpay/do/refund_way.go @@ -8,8 +8,9 @@ import ( ) var RefundWayList = map[int]func(commonRefundInfo *paymentService.OrderRefundRequest, channel *paychannelmodel.PayChannel) error{ - common.PAY_CHANNEL_WECHAT_H5: WechatH5Refund, - common.PAY_CHANNEL_ALIPAY_WEB: AlipayWebRefund, + common.PAY_CHANNEL_WECHAT_H5: WechatH5Refund, + common.PAY_CHANNEL_ALIPAY_WEB: AlipayWebRefund, + common.PAY_CHANNEL_WECHAT_JSAPI: WechatJSAPIRefund, } func WechatH5Refund(commonRefundInfo *paymentService.OrderRefundRequest, channel *paychannelmodel.PayChannel) error { @@ -31,3 +32,13 @@ func AlipayWebRefund(commonRefundInfo *paymentService.OrderRefundRequest, channe commonRefundInfo.Ali.AppId = channel.AppId return nil } + +func WechatJSAPIRefund(commonRefundInfo *paymentService.OrderRefundRequest, channel *paychannelmodel.PayChannel) error { + commonRefundInfo.PayChannel = common.PAY_CHANNLE_TYPE_WECHAT + err := sonic.Unmarshal([]byte(channel.ExtJson), &commonRefundInfo.Wx) + if err != nil { + return err + } + commonRefundInfo.Wx.AppId = channel.AppId + return nil +}