Просмотр исходного кода

add client.GetVersion() => 获取当前GoPay版本号

Jerry 6 лет назад
Родитель
Сommit
ee6772c78c
4 измененных файлов с 20 добавлено и 8 удалено
  1. 9 7
      README.md
  2. 5 0
      alipay_client.go
  3. 1 1
      constant.go
  4. 5 0
      wechat_client.go

+ 9 - 7
README.md

@@ -16,6 +16,7 @@
 
 * client := gopay.NewWeChatClient() => 初始化微信支付客户端
 * client的其他配置
+    * client.GetVersion() => 获取当前GoPay版本号
     * client.SetCountry() => 设置国家地区,默认中国国内(gopay.China、gopay.China2、gopay.SoutheastAsia、gopay.Other)
 
 ## 微信支付API
@@ -58,6 +59,7 @@
 
 * client := gopay.NewAliPayClient() => 初始化支付宝支付客户端
 * client请求部分公共参数的设置
+    * client.GetVersion() => 获取当前GoPay版本号
     * client.SetReturnUrl() => 设置返回URL
     * client.SetNotifyUrl() => 设置异步通知URL
     * client.SetCharset() => 设置字符编码,默认 utf-8
@@ -318,13 +320,13 @@ body.Set("trade_type", gopay.TradeType_H5)
 body.Set("device_info", "WEB")
 body.Set("sign_type", gopay.SignType_MD5)
 
-//sceneInfo := make(map[string]map[string]string)
-//h5Info := make(map[string]string)
-//h5Info["type"] = "Wap"
-//h5Info["wap_url"] = "http://www.gopay.ink"
-//h5Info["wap_name"] = "H5测试支付"
-//sceneInfo["h5_info"] = h5Info
-//body.Set("scene_info", sceneInfo)
+sceneInfo := make(map[string]map[string]string)
+h5Info := make(map[string]string)
+h5Info["type"] = "Wap"
+h5Info["wap_url"] = "http://www.gopay.ink"
+h5Info["wap_name"] = "H5测试支付"
+sceneInfo["h5_info"] = h5Info
+body.Set("scene_info", sceneInfo)
 
 body.Set("openid", OpenID)
 

+ 5 - 0
alipay_client.go

@@ -32,6 +32,11 @@ func NewAliPayClient(appId, privateKey string, isProd bool) (client *aliPayClien
 	return client
 }
 
+//获取版本号
+func (this *aliPayClient) GetVersion() (version string) {
+	return Version
+}
+
 //alipay.trade.fastpay.refund.query(统一收单交易退款查询)
 //    文档地址:https://docs.open.alipay.com/api_1/alipay.trade.fastpay.refund.query
 func (this *aliPayClient) AliPayTradeFastPayRefundQuery(body BodyMap) (aliRsp *AliPayTradeFastpayRefundQueryResponse, err error) {

+ 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.2.7"
 	//微信
 	//===========================================================================================
 

+ 5 - 0
wechat_client.go

@@ -30,6 +30,11 @@ func NewWeChatClient(appId, mchId, apiKey string, isProd bool) (client *weChatCl
 	return client
 }
 
+//获取版本号
+func (this *weChatClient) GetVersion() (version string) {
+	return Version
+}
+
 //提交付款码支付 ok
 //    文档地址:https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10&index=1
 func (this *weChatClient) Micropay(body BodyMap) (wxRsp *WeChatMicropayResponse, err error) {