Jerry 6 سال پیش
والد
کامیت
5b3f0e5a79
5فایلهای تغییر یافته به همراه10 افزوده شده و 105 حذف شده
  1. 2 0
      alipay_rsp.go
  2. 0 53
      alipay_service_api.go
  3. 1 1
      constant.go
  4. 7 0
      release_note.txt
  5. 0 51
      wechat_service_api.go

+ 2 - 0
alipay_rsp.go

@@ -33,6 +33,8 @@ type AliPayNotifyRequest struct {
 	FundBillList      []fundBillListInfo      `json:"fund_bill_list,omitempty"`
 	PassbackParams    string                  `json:"passback_params,omitempty"`
 	VoucherDetailList []voucherDetailListInfo `json:"voucher_detail_list,omitempty"`
+	Method            string                  `json:"method,omitempty"`    //电脑网站支付 支付宝请求 return_url 同步返回参数
+	Timestamp         string                  `json:"timestamp,omitempty"` //电脑网站支付 支付宝请求 return_url 同步返回参数
 }
 
 type fundBillListInfo struct {

+ 0 - 53
alipay_service_api.go

@@ -79,59 +79,6 @@ func ParseAliPayNotifyResult(req *http.Request) (notifyReq *AliPayNotifyRequest,
 	return
 }
 
-//支付通知的签名验证和参数签名后的Sign(Deprecated)
-//    aliPayPublicKey:支付宝公钥
-//    notifyReq:利用 gopay.ParseAliPayNotifyResult() 得到的结构体
-//    返回参数ok:是否验证通过
-//    返回参数err:错误信息
-func VerifyAliPayResultSign(aliPayPublicKey string, notifyReq *AliPayNotifyRequest) (ok bool, err error) {
-	body := make(BodyMap)
-	body.Set("notify_time", notifyReq.NotifyTime)
-	body.Set("notify_type", notifyReq.NotifyType)
-	body.Set("notify_id", notifyReq.NotifyId)
-	body.Set("app_id", notifyReq.AppId)
-	body.Set("charset", notifyReq.Charset)
-	body.Set("version", notifyReq.Version)
-	//body.Set("sign", notifyReq.Sign)          //验签时去掉
-	//body.Set("sign_type", notifyReq.SignType) //验签时去掉
-	body.Set("auth_app_id", notifyReq.AuthAppId)
-	body.Set("trade_no", notifyReq.TradeNo)
-	body.Set("out_trade_no", notifyReq.OutTradeNo)
-	body.Set("out_biz_no", notifyReq.OutBizNo)
-	body.Set("buyer_id", notifyReq.BuyerId)
-	body.Set("buyer_logon_id", notifyReq.BuyerLogonId)
-	body.Set("seller_id", notifyReq.SellerId)
-	body.Set("seller_email", notifyReq.SellerEmail)
-	body.Set("trade_status", notifyReq.TradeStatus)
-	body.Set("total_amount", notifyReq.TotalAmount)
-	body.Set("receipt_amount", notifyReq.ReceiptAmount)
-	body.Set("invoice_amount", notifyReq.InvoiceAmount)
-	body.Set("buyer_pay_amount", notifyReq.BuyerPayAmount)
-	body.Set("point_amount", notifyReq.PointAmount)
-	body.Set("refund_fee", notifyReq.RefundFee)
-	body.Set("subject", notifyReq.Subject)
-	body.Set("body", notifyReq.Body)
-	body.Set("gmt_create", notifyReq.GmtCreate)
-	body.Set("gmt_payment", notifyReq.GmtPayment)
-	body.Set("gmt_refund", notifyReq.GmtRefund)
-	body.Set("gmt_close", notifyReq.GmtClose)
-	body.Set("fund_bill_list", jsonToString(notifyReq.FundBillList))
-	body.Set("passback_params", notifyReq.PassbackParams)
-	body.Set("voucher_detail_list", jsonToString(notifyReq.VoucherDetailList))
-	newBody := make(BodyMap)
-	for k, v := range body {
-		if v != null {
-			newBody.Set(k, v)
-		}
-	}
-	pKey := FormatAliPayPublicKey(aliPayPublicKey)
-	signData := newBody.EncodeAliPaySignParams()
-	if err = verifyAliPaySign(signData, notifyReq.Sign, notifyReq.SignType, pKey); err != nil {
-		return false, err
-	}
-	return true, nil
-}
-
 /*
 Q:使用公钥证书签名方式下,为什么开放平台网关的响应报文需要携带支付宝公钥证书SN(alipay_cert_sn)?
 **

+ 1 - 1
constant.go

@@ -4,7 +4,7 @@ const (
 	null       string = ""
 	TimeLayout string = "2006-01-02 15:04:05"
 	DateLayout string = "2006-01-02"
-	Version    string = "1.3.9"
+	Version    string = "1.4.0"
 	//微信
 	//===========================================================================================
 

+ 7 - 0
release_note.txt

@@ -1,3 +1,10 @@
+版本号:Release 1.4.0
+发布时间:2019/10/10 13:51
+修改记录:
+   (1) AliPayNotifyRequest 结构体,新增加两个字段:method、timestamp,修复电脑网站支付,配置 return_url 支付成功后,支付宝请求该 return_url 返回参数验签失败的问题
+   (2) 去除支付宝老验签方法 VerifyAliPayResultSign()
+   (3) 去除微信老验签方法 VerifyWeChatResultSign()
+
 版本号:Release 1.3.9
 发布时间:2019/09/30 00:01
 修改记录:

+ 0 - 51
wechat_service_api.go

@@ -97,57 +97,6 @@ func ParseWeChatNotifyResult(req *http.Request) (notifyReq *WeChatNotifyRequest,
 	return
 }
 
-//验证微信支付异步通知的Sign值(Deprecated)
-//    ApiKey:API秘钥值
-//    signType:签名类型 MD5 或 HMAC-SHA256(默认请填写 MD5)
-//    notifyReq:利用 gopay.ParseWeChatNotifyResult() 得到的结构体
-//    返回参数ok:是否验证通过
-//    返回参数sign:根据参数计算的sign值,非微信返回参数中的Sign
-func VerifyWeChatResultSign(apiKey, signType string, notifyReq *WeChatNotifyRequest) (ok bool, sign string) {
-	body := make(BodyMap)
-	body.Set("return_code", notifyReq.ReturnCode)
-	body.Set("return_msg", notifyReq.ReturnMsg)
-	body.Set("appid", notifyReq.Appid)
-	body.Set("mch_id", notifyReq.MchId)
-	body.Set("device_info", notifyReq.DeviceInfo)
-	body.Set("nonce_str", notifyReq.NonceStr)
-	body.Set("sign_type", notifyReq.SignType)
-	body.Set("result_code", notifyReq.ResultCode)
-	body.Set("err_code", notifyReq.ErrCode)
-	body.Set("err_code_des", notifyReq.ErrCodeDes)
-	body.Set("openid", notifyReq.Openid)
-	body.Set("is_subscribe", notifyReq.IsSubscribe)
-	body.Set("trade_type", notifyReq.TradeType)
-	body.Set("bank_type", notifyReq.BankType)
-	body.Set("total_fee", notifyReq.TotalFee)
-	body.Set("settlement_total_fee", notifyReq.SettlementTotalFee)
-	body.Set("fee_type", notifyReq.FeeType)
-	body.Set("cash_fee", notifyReq.CashFee)
-	body.Set("cash_fee_type", notifyReq.CashFeeType)
-	body.Set("coupon_fee", notifyReq.CouponFee)
-	body.Set("coupon_count", notifyReq.CouponCount)
-	body.Set("coupon_type_0", notifyReq.CouponType0)
-	body.Set("coupon_type_1", notifyReq.CouponType1)
-	body.Set("coupon_id_0", notifyReq.CouponId0)
-	body.Set("coupon_id_1", notifyReq.CouponId1)
-	body.Set("coupon_fee_0", notifyReq.CouponFee0)
-	body.Set("coupon_fee_1", notifyReq.CouponFee1)
-	body.Set("transaction_id", notifyReq.TransactionId)
-	body.Set("out_trade_no", notifyReq.OutTradeNo)
-	body.Set("attach", notifyReq.Attach)
-	body.Set("time_end", notifyReq.TimeEnd)
-	newBody := make(BodyMap)
-	for key := range body {
-		vStr := body.Get(key)
-		if vStr != null && vStr != "0" {
-			newBody.Set(key, vStr)
-		}
-	}
-	sign = getWeChatReleaseSign(apiKey, signType, newBody)
-	ok = sign == notifyReq.Sign
-	return
-}
-
 //微信同步返回参数验签或异步通知参数验签
 //    ApiKey:API秘钥值
 //    signType:签名类型(调用API方法时填写的类型)