feat: 支付回调通知下游状态fix
This commit is contained in:
		
							parent
							
								
									9a2c47ec0d
								
							
						
					
					
						commit
						888fb18165
					
				| 
						 | 
				
			
			@ -1,7 +1,6 @@
 | 
			
		|||
package front
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"PaymentCenter/app/constants/common"
 | 
			
		||||
	"PaymentCenter/app/constants/errorcode"
 | 
			
		||||
	"PaymentCenter/app/http/controllers"
 | 
			
		||||
	"PaymentCenter/app/http/entities/front"
 | 
			
		||||
| 
						 | 
				
			
			@ -43,11 +42,11 @@ func WxCallback(c *gin.Context) {
 | 
			
		|||
		c.String(http.StatusBadRequest, "%s", "fail")
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if !(payChannelModel.ChannelType == common.PAY_CHANNEL_WECHAT_H5 || payChannelModel.ChannelType == common.PAY_CHANNEL_WECHAT_JSAPI) {
 | 
			
		||||
		logger.Error(c, "WxCallback-回调数据解析支付配置错误,查询的数据不是当前渠道")
 | 
			
		||||
		c.String(http.StatusBadRequest, "%s", "fail")
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	//if !(payChannelModel.ChannelType == common.PAY_CHANNEL_WECHAT_H5 || payChannelModel.ChannelType == common.PAY_CHANNEL_WECHAT_JSAPI) {
 | 
			
		||||
	//	logger.Error(c, "WxCallback-回调数据解析支付配置错误,查询的数据不是当前渠道")
 | 
			
		||||
	//	c.String(http.StatusBadRequest, "%s", "fail")
 | 
			
		||||
	//	return
 | 
			
		||||
	//}
 | 
			
		||||
 | 
			
		||||
	var wxConfig paymentService.WxPay
 | 
			
		||||
	err := json.Unmarshal([]byte(payChannelModel.ExtJson), &wxConfig)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -179,7 +179,7 @@ func ALiCallBack(notifyReq gopay.BodyMap, aliConfig AliPay) error {
 | 
			
		|||
		return errors.New("订单状态异常,无法进行后续回调")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	res := thirdpay_notify.NewOrderNotifyWithHandle(int64(orderId), orderStatus, errCode, payerTotal, msg)
 | 
			
		||||
	res := thirdpay_notify.NewOrderNotifyWithHandle(int64(orderId), errCode, orderStatus, payerTotal, msg)
 | 
			
		||||
	merchantCallback, _ := json.Marshal(res)
 | 
			
		||||
	//	记录日志
 | 
			
		||||
	go func() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -201,7 +201,7 @@ func WxPayCallBack(notifyReq *wechat.V3NotifyReq, wxConfig WxPay) error {
 | 
			
		|||
 | 
			
		||||
	//	触发下游回调的格式
 | 
			
		||||
	orderId, _ := strconv.Atoi(CallBackInfo.OutTradeNo)
 | 
			
		||||
	res := thirdpay_notify.NewOrderNotifyWithHandle(int64(orderId), orderStatus, errCode, int(CallBackInfo.Amount.PayerTotal), msg)
 | 
			
		||||
	res := thirdpay_notify.NewOrderNotifyWithHandle(int64(orderId), errCode, orderStatus, int(CallBackInfo.Amount.PayerTotal), msg)
 | 
			
		||||
	merchantCallback, _ := json.Marshal(res)
 | 
			
		||||
	//	记录日志
 | 
			
		||||
	go func() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -455,7 +455,7 @@ func PayType(payChannel int) int {
 | 
			
		|||
	switch payChannel {
 | 
			
		||||
	case common.PAY_CHANNEL_WECHAT_H5, common.PAY_CHANNEL_WECHAT_JSAPI, common.PAY_CHANNEL_WECHAT_NATIVE, common.PAY_CHANNEL_WECHAT_APP, common.PAY_CHANNEL_WECHAT_MINI:
 | 
			
		||||
		return common.PAY_CHANNLE_TYPE_WECHAT
 | 
			
		||||
	case common.PAY_CHANNEL_ALIPAY_JSAPI, common.PAY_CHANNEL_ALIPAY_WEB, common.PAY_CHANNEL_ALIPAY_MINI:
 | 
			
		||||
	case common.PAY_CHANNEL_ALIPAY_JSAPI, common.PAY_CHANNEL_ALIPAY_WEB, common.PAY_CHANNEL_ALIPAY_MINI, common.PAY_CHANNEL_ALIPAY_PC:
 | 
			
		||||
		return common.PAY_CHANNLE_TYPE_ZFB
 | 
			
		||||
	default:
 | 
			
		||||
		return 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue