Jerry 6 лет назад
Родитель
Сommit
83699719a2
8 измененных файлов с 91 добавлено и 91 удалено
  1. 4 4
      alipay/client.go
  2. 4 4
      alipay/model.go
  3. 2 2
      alipay/service_api.go
  4. 9 9
      qq/client.go
  5. 9 9
      qq/model.go
  6. 24 24
      wechat/client.go
  7. 33 33
      wechat/model.go
  8. 6 6
      wechat/param.go

+ 4 - 4
alipay/client.go

@@ -608,15 +608,15 @@ func (a *Client) doAliPay(bm gopay.BodyMap, method string) (bs []byte, err error
 		return []byte(param), nil
 		return []byte(param), nil
 	case "alipay.trade.wap.pay", "alipay.trade.page.pay", "alipay.user.certify.open.certify":
 	case "alipay.trade.wap.pay", "alipay.trade.page.pay", "alipay.user.certify.open.certify":
 		if !a.IsProd {
 		if !a.IsProd {
-			return []byte(zfbSandboxBaseUrl + "?" + param), nil
+			return []byte(sandboxBaseUrl + "?" + param), nil
 		}
 		}
-		return []byte(zfbBaseUrl + "?" + param), nil
+		return []byte(baseUrl + "?" + param), nil
 	default:
 	default:
 		httpClient := gopay.NewHttpClient()
 		httpClient := gopay.NewHttpClient()
 		if !a.IsProd {
 		if !a.IsProd {
-			url = zfbSandboxBaseUrlUtf8
+			url = sandboxBaseUrlUtf8
 		} else {
 		} else {
-			url = zfbBaseUrlUtf8
+			url = baseUrlUtf8
 		}
 		}
 		res, bs, errs := httpClient.Type(gopay.TypeForm).Post(url).SendString(param).EndBytes()
 		res, bs, errs := httpClient.Type(gopay.TypeForm).Post(url).SendString(param).EndBytes()
 		if len(errs) > 0 {
 		if len(errs) > 0 {

+ 4 - 4
alipay/model.go

@@ -2,10 +2,10 @@ package alipay
 
 
 const (
 const (
 	// URL
 	// URL
-	zfbBaseUrl            = "https://openapi.alipay.com/gateway.do"
-	zfbSandboxBaseUrl     = "https://openapi.alipaydev.com/gateway.do"
-	zfbBaseUrlUtf8        = "https://openapi.alipay.com/gateway.do?charset=utf-8"
-	zfbSandboxBaseUrlUtf8 = "https://openapi.alipaydev.com/gateway.do?charset=utf-8"
+	baseUrl            = "https://openapi.alipay.com/gateway.do"
+	sandboxBaseUrl     = "https://openapi.alipaydev.com/gateway.do"
+	baseUrlUtf8        = "https://openapi.alipay.com/gateway.do?charset=utf-8"
+	sandboxBaseUrlUtf8 = "https://openapi.alipaydev.com/gateway.do?charset=utf-8"
 
 
 	locationShanghai = "Asia/Shanghai"
 	locationShanghai = "Asia/Shanghai"
 )
 )

+ 2 - 2
alipay/service_api.go

@@ -472,7 +472,7 @@ func systemOauthToken(appId, privateKey string, body gopay.BodyMap, method strin
 	body.Set("version", "1.0")
 	body.Set("version", "1.0")
 	var (
 	var (
 		sign string
 		sign string
-		url  = zfbBaseUrlUtf8
+		url  = baseUrlUtf8
 	)
 	)
 	pKey := FormatPrivateKey(privateKey)
 	pKey := FormatPrivateKey(privateKey)
 	if sign, err = getRsaSign(body, "RSA2", pKey); err != nil {
 	if sign, err = getRsaSign(body, "RSA2", pKey); err != nil {
@@ -480,7 +480,7 @@ func systemOauthToken(appId, privateKey string, body gopay.BodyMap, method strin
 	}
 	}
 	body.Set("sign", sign)
 	body.Set("sign", sign)
 	if !isProd {
 	if !isProd {
-		url = zfbSandboxBaseUrlUtf8
+		url = sandboxBaseUrlUtf8
 	}
 	}
 	_, bs, errs := gopay.NewHttpClient().Type(gopay.TypeForm).Post(url).SendString(FormatURLParam(body)).EndBytes()
 	_, bs, errs := gopay.NewHttpClient().Type(gopay.TypeForm).Post(url).SendString(FormatURLParam(body)).EndBytes()
 	if len(errs) > 0 {
 	if len(errs) > 0 {

+ 9 - 9
qq/client.go

@@ -42,7 +42,7 @@ func (q *Client) MicroPay(bm gopay.BodyMap) (qqRsp *MicroPayResponse, err error)
 		return nil, err
 		return nil, err
 	}
 	}
 	bm.Set("trade_type", TradeType_MicroPay)
 	bm.Set("trade_type", TradeType_MicroPay)
-	bs, err := q.doQQ(bm, qqMicroPay, nil)
+	bs, err := q.doQQ(bm, microPay, nil)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -60,7 +60,7 @@ func (q *Client) Reverse(bm gopay.BodyMap) (qqRsp *ReverseResponse, err error) {
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	bs, err := q.doQQ(bm, qqReverse, nil)
+	bs, err := q.doQQ(bm, reverse, nil)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -78,7 +78,7 @@ func (q *Client) UnifiedOrder(bm gopay.BodyMap) (qqRsp *UnifiedOrderResponse, er
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	bs, err := q.doQQ(bm, qqUnifiedOrder, nil)
+	bs, err := q.doQQ(bm, unifiedOrder, nil)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -99,7 +99,7 @@ func (q *Client) OrderQuery(bm gopay.BodyMap) (qqRsp *OrderQueryResponse, err er
 	if bm.Get("out_trade_no") == gopay.NULL && bm.Get("transaction_id") == gopay.NULL {
 	if bm.Get("out_trade_no") == gopay.NULL && bm.Get("transaction_id") == gopay.NULL {
 		return nil, errors.New("out_trade_no and transaction_id are not allowed to be null at the same time")
 		return nil, errors.New("out_trade_no and transaction_id are not allowed to be null at the same time")
 	}
 	}
-	bs, err := q.doQQ(bm, qqOrderQuery, nil)
+	bs, err := q.doQQ(bm, orderQuery, nil)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -117,7 +117,7 @@ func (q *Client) CloseOrder(bm gopay.BodyMap) (qqRsp *CloseOrderResponse, err er
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	bs, err := q.doQQ(bm, qqOrderClose, nil)
+	bs, err := q.doQQ(bm, orderClose, nil)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -143,7 +143,7 @@ func (q *Client) Refund(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FileP
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	bs, err := q.doQQ(bm, qqRefund, tlsConfig)
+	bs, err := q.doQQ(bm, refund, tlsConfig)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -164,7 +164,7 @@ func (q *Client) RefundQuery(bm gopay.BodyMap) (qqRsp *RefundQueryResponse, err
 	if bm.Get("refund_id") == gopay.NULL && bm.Get("out_refund_no") == gopay.NULL && bm.Get("transaction_id") == gopay.NULL && bm.Get("out_trade_no") == gopay.NULL {
 	if bm.Get("refund_id") == gopay.NULL && bm.Get("out_refund_no") == gopay.NULL && bm.Get("transaction_id") == gopay.NULL && bm.Get("out_trade_no") == gopay.NULL {
 		return nil, errors.New("refund_id, out_refund_no, out_trade_no, transaction_id are not allowed to be null at the same time")
 		return nil, errors.New("refund_id, out_refund_no, out_trade_no, transaction_id are not allowed to be null at the same time")
 	}
 	}
-	bs, err := q.doQQ(bm, qqRefundQuery, nil)
+	bs, err := q.doQQ(bm, refundQuery, nil)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -186,7 +186,7 @@ func (q *Client) StatementDown(bm gopay.BodyMap) (qqRsp string, err error) {
 	if billType != "ALL" && billType != "SUCCESS" && billType != "REFUND" && billType != "RECHAR" {
 	if billType != "ALL" && billType != "SUCCESS" && billType != "REFUND" && billType != "RECHAR" {
 		return gopay.NULL, errors.New("bill_type error, please reference: https://qpay.qq.com/buss/wiki/38/1209")
 		return gopay.NULL, errors.New("bill_type error, please reference: https://qpay.qq.com/buss/wiki/38/1209")
 	}
 	}
-	bs, err := q.doQQ(bm, qqStatementDown, nil)
+	bs, err := q.doQQ(bm, statementDown, nil)
 	if err != nil {
 	if err != nil {
 		return gopay.NULL, err
 		return gopay.NULL, err
 	}
 	}
@@ -204,7 +204,7 @@ func (q *Client) AccRoll(bm gopay.BodyMap) (qqRsp string, err error) {
 	if accType != "CASH" && accType != "MARKETING" {
 	if accType != "CASH" && accType != "MARKETING" {
 		return gopay.NULL, errors.New("acc_type error, please reference: https://qpay.qq.com/buss/wiki/38/3089")
 		return gopay.NULL, errors.New("acc_type error, please reference: https://qpay.qq.com/buss/wiki/38/3089")
 	}
 	}
-	bs, err := q.doQQ(bm, qqAccRoll, nil)
+	bs, err := q.doQQ(bm, accRoll, nil)
 	if err != nil {
 	if err != nil {
 		return gopay.NULL, err
 		return gopay.NULL, err
 	}
 	}

+ 9 - 9
qq/model.go

@@ -2,15 +2,15 @@ package qq
 
 
 const (
 const (
 	// URL
 	// URL
-	qqUnifiedOrder  = "https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi"              // 统一下单
-	qqMicroPay      = "https://qpay.qq.com/cgi-bin/pay/qpay_micro_pay.cgi"                  // 提交付款码支付
-	qqOrderQuery    = "https://qpay.qq.com/cgi-bin/pay/qpay_order_query.cgi"                // 订单查询
-	qqOrderClose    = "https://qpay.qq.com/cgi-bin/pay/qpay_close_order.cgi"                // 关闭订单
-	qqRefundQuery   = "https://qpay.qq.com/cgi-bin/pay/qpay_refund_query.cgi"               // 退款查询
-	qqStatementDown = "https://qpay.qq.com/cgi-bin/sp_download/qpay_mch_statement_down.cgi" // 交易账单
-	qqAccRoll       = "https://qpay.qq.com/cgi-bin/sp_download/qpay_mch_acc_roll.cgi"       // 资金账单
-	qqReverse       = "https://api.qpay.qq.com/cgi-bin/pay/qpay_reverse.cgi"                // 撤销订单
-	qqRefund        = "https://api.qpay.qq.com/cgi-bin/pay/qpay_refund.cgi"                 // 申请退款
+	unifiedOrder  = "https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi"              // 统一下单
+	microPay      = "https://qpay.qq.com/cgi-bin/pay/qpay_micro_pay.cgi"                  // 提交付款码支付
+	orderQuery    = "https://qpay.qq.com/cgi-bin/pay/qpay_order_query.cgi"                // 订单查询
+	orderClose    = "https://qpay.qq.com/cgi-bin/pay/qpay_close_order.cgi"                // 关闭订单
+	refundQuery   = "https://qpay.qq.com/cgi-bin/pay/qpay_refund_query.cgi"               // 退款查询
+	statementDown = "https://qpay.qq.com/cgi-bin/sp_download/qpay_mch_statement_down.cgi" // 交易账单
+	accRoll       = "https://qpay.qq.com/cgi-bin/sp_download/qpay_mch_acc_roll.cgi"       // 资金账单
+	reverse       = "https://api.qpay.qq.com/cgi-bin/pay/qpay_reverse.cgi"                // 撤销订单
+	refund        = "https://api.qpay.qq.com/cgi-bin/pay/qpay_refund.cgi"                 // 申请退款
 
 
 	// 支付类型
 	// 支付类型
 	TradeType_MicroPay = "MICROPAY" // 提交付款码支付
 	TradeType_MicroPay = "MICROPAY" // 提交付款码支付

+ 24 - 24
wechat/client.go

@@ -45,9 +45,9 @@ func (w *Client) Micropay(bm gopay.BodyMap) (wxRsp *MicropayResponse, err error)
 	}
 	}
 	var bs []byte
 	var bs []byte
 	if w.IsProd {
 	if w.IsProd {
-		bs, err = w.doWeChat(bm, wxMicropay, nil)
+		bs, err = w.doWeChat(bm, microPay, nil)
 	} else {
 	} else {
-		bs, err = w.doWeChat(bm, wxSandboxMicropay, nil)
+		bs, err = w.doWeChat(bm, sandboxMicroPay, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -68,10 +68,10 @@ func (w *Client) UnifiedOrder(bm gopay.BodyMap) (wxRsp *UnifiedOrderResponse, er
 	}
 	}
 	var bs []byte
 	var bs []byte
 	if w.IsProd {
 	if w.IsProd {
-		bs, err = w.doWeChat(bm, wxUnifiedorder, nil)
+		bs, err = w.doWeChat(bm, unifiedOrder, nil)
 	} else {
 	} else {
 		bm.Set("total_fee", 101)
 		bm.Set("total_fee", 101)
-		bs, err = w.doWeChat(bm, wxSandboxUnifiedorder, nil)
+		bs, err = w.doWeChat(bm, sandboxUnifiedOrder, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -95,9 +95,9 @@ func (w *Client) QueryOrder(bm gopay.BodyMap) (wxRsp *QueryOrderResponse, err er
 	}
 	}
 	var bs []byte
 	var bs []byte
 	if w.IsProd {
 	if w.IsProd {
-		bs, err = w.doWeChat(bm, wxOrderquery, nil)
+		bs, err = w.doWeChat(bm, orderQuery, nil)
 	} else {
 	} else {
-		bs, err = w.doWeChat(bm, wxSandboxOrderquery, nil)
+		bs, err = w.doWeChat(bm, sandboxOrderQuery, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -118,9 +118,9 @@ func (w *Client) CloseOrder(bm gopay.BodyMap) (wxRsp *CloseOrderResponse, err er
 	}
 	}
 	var bs []byte
 	var bs []byte
 	if w.IsProd {
 	if w.IsProd {
-		bs, err = w.doWeChat(bm, wxCloseorder, nil)
+		bs, err = w.doWeChat(bm, closeOrder, nil)
 	} else {
 	} else {
-		bs, err = w.doWeChat(bm, wxSandboxCloseorder, nil)
+		bs, err = w.doWeChat(bm, sandboxCloseOrder, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -148,9 +148,9 @@ func (w *Client) Reverse(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12File
 		if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 		if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 			return nil, err
 			return nil, err
 		}
 		}
-		bs, err = w.doWeChat(bm, wxReverse, tlsConfig)
+		bs, err = w.doWeChat(bm, reverse, tlsConfig)
 	} else {
 	} else {
-		bs, err = w.doWeChat(bm, wxSandboxReverse, nil)
+		bs, err = w.doWeChat(bm, sandboxReverse, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -181,9 +181,9 @@ func (w *Client) Refund(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FileP
 		if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 		if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 			return nil, err
 			return nil, err
 		}
 		}
-		bs, err = w.doWeChat(bm, wxRefund, tlsConfig)
+		bs, err = w.doWeChat(bm, refund, tlsConfig)
 	} else {
 	} else {
-		bs, err = w.doWeChat(bm, wxSandboxRefund, nil)
+		bs, err = w.doWeChat(bm, sandboxRefund, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -207,9 +207,9 @@ func (w *Client) QueryRefund(bm gopay.BodyMap) (wxRsp *QueryRefundResponse, err
 	}
 	}
 	var bs []byte
 	var bs []byte
 	if w.IsProd {
 	if w.IsProd {
-		bs, err = w.doWeChat(bm, wxRefundquery, nil)
+		bs, err = w.doWeChat(bm, refundQuery, nil)
 	} else {
 	} else {
-		bs, err = w.doWeChat(bm, wxSandboxRefundquery, nil)
+		bs, err = w.doWeChat(bm, sandboxRefundQuery, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -234,9 +234,9 @@ func (w *Client) DownloadBill(bm gopay.BodyMap) (wxRsp string, err error) {
 	}
 	}
 	var bs []byte
 	var bs []byte
 	if w.IsProd {
 	if w.IsProd {
-		bs, err = w.doWeChat(bm, wxDownloadbill, nil)
+		bs, err = w.doWeChat(bm, downloadBill, nil)
 	} else {
 	} else {
-		bs, err = w.doWeChat(bm, wxSandboxDownloadbill, nil)
+		bs, err = w.doWeChat(bm, sandboxDownloadBill, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -267,9 +267,9 @@ func (w *Client) DownloadFundFlow(bm gopay.BodyMap, certFilePath, keyFilePath, p
 		if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 		if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 			return gopay.NULL, err
 			return gopay.NULL, err
 		}
 		}
-		bs, err = w.doWeChat(bm, wxDownloadfundflow, tlsConfig)
+		bs, err = w.doWeChat(bm, downloadFundFlow, tlsConfig)
 	} else {
 	} else {
-		bs, err = w.doWeChat(bm, wxSandboxDownloadfundflow, nil)
+		bs, err = w.doWeChat(bm, sandboxDownloadFundFlow, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -296,9 +296,9 @@ func (w *Client) BatchQueryComment(bm gopay.BodyMap, certFilePath, keyFilePath,
 		if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 		if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 			return gopay.NULL, err
 			return gopay.NULL, err
 		}
 		}
-		bs, err = w.doWeChat(bm, wxBatchquerycomment, tlsConfig)
+		bs, err = w.doWeChat(bm, batchQueryComment, tlsConfig)
 	} else {
 	} else {
-		bs, err = w.doWeChat(bm, wxSandboxBatchquerycomment, nil)
+		bs, err = w.doWeChat(bm, sandboxBatchQueryComment, nil)
 	}
 	}
 	if err != nil {
 	if err != nil {
 		return
 		return
@@ -320,7 +320,7 @@ func (w *Client) Transfer(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12Fil
 	bm.Set("mchid", w.MchId)
 	bm.Set("mchid", w.MchId)
 	var (
 	var (
 		tlsConfig *tls.Config
 		tlsConfig *tls.Config
-		url       = wxBaseUrlCh + wxTransfers
+		url       = baseUrlCh + transfers
 	)
 	)
 	if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 	if tlsConfig, err = w.addCertConfig(certFilePath, keyFilePath, pkcs12FilePath); err != nil {
 		return nil, err
 		return nil, err
@@ -330,7 +330,7 @@ func (w *Client) Transfer(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12Fil
 	httpClient := gopay.NewHttpClient().SetTLSConfig(tlsConfig).Type(gopay.TypeXML)
 	httpClient := gopay.NewHttpClient().SetTLSConfig(tlsConfig).Type(gopay.TypeXML)
 	if w.BaseURL != gopay.NULL {
 	if w.BaseURL != gopay.NULL {
 		w.mu.RLock()
 		w.mu.RLock()
-		url = w.BaseURL + wxTransfers
+		url = w.BaseURL + transfers
 		w.mu.RUnlock()
 		w.mu.RUnlock()
 	}
 	}
 	wxRsp = new(TransfersResponse)
 	wxRsp = new(TransfersResponse)
@@ -347,14 +347,14 @@ func (w *Client) Transfer(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12Fil
 // 公众号纯签约(未完成)
 // 公众号纯签约(未完成)
 //    文档地址:https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_1&index=1
 //    文档地址:https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_1&index=1
 func (w *Client) EntrustPublic(bm gopay.BodyMap) (bs []byte, err error) {
 func (w *Client) EntrustPublic(bm gopay.BodyMap) (bs []byte, err error) {
-	bs, err = w.doWeChat(bm, wxEntrustPublic, nil)
+	bs, err = w.doWeChat(bm, entrustPublic, nil)
 
 
 	return nil, nil
 	return nil, nil
 }
 }
 
 
 // 向微信发送请求
 // 向微信发送请求
 func (w *Client) doWeChat(bm gopay.BodyMap, path string, tlsConfig *tls.Config) (bs []byte, err error) {
 func (w *Client) doWeChat(bm gopay.BodyMap, path string, tlsConfig *tls.Config) (bs []byte, err error) {
-	var url = wxBaseUrlCh + path
+	var url = baseUrlCh + path
 	bm.Set("appid", w.AppId)
 	bm.Set("appid", w.AppId)
 	bm.Set("mch_id", w.MchId)
 	bm.Set("mch_id", w.MchId)
 
 

+ 33 - 33
wechat/model.go

@@ -8,43 +8,43 @@ const (
 	Other         Country = 4 // 其他国家
 	Other         Country = 4 // 其他国家
 
 
 	// URL
 	// URL
-	wxBaseUrlCh  = "https://api.mch.weixin.qq.com/"   //中国国内
-	wxBaseUrlCh2 = "https://api2.mch.weixin.qq.com/"  //中国国内
-	wxBaseUrlHk  = "https://apihk.mch.weixin.qq.com/" //东南亚
-	wxBaseUrlUs  = "https://apius.mch.weixin.qq.com/" //其他
+	baseUrlCh  = "https://api.mch.weixin.qq.com/"   //中国国内
+	baseUrlCh2 = "https://api2.mch.weixin.qq.com/"  //中国国内
+	baseUrlHk  = "https://apihk.mch.weixin.qq.com/" //东南亚
+	baseUrlUs  = "https://apius.mch.weixin.qq.com/" //其他
 
 
 	// 正式
 	// 正式
-	wxMicropay          = "pay/micropay"                          //提交付款码支付
-	wxUnifiedorder      = "pay/unifiedorder"                      //统一下单
-	wxOrderquery        = "pay/orderquery"                        //查询订单
-	wxCloseorder        = "pay/closeorder"                        //关闭订单
-	wxRefund            = "secapi/pay/refund"                     //申请退款
-	wxReverse           = "secapi/pay/reverse"                    //撤销订单
-	wxRefundquery       = "pay/refundquery"                       //查询退款
-	wxDownloadbill      = "pay/downloadbill"                      //下载对账单
-	wxDownloadfundflow  = "pay/downloadfundflow"                  //下载资金账单
-	wxBatchquerycomment = "billcommentsp/batchquerycomment"       //拉取订单评价数据
-	wxTransfers         = "mmpaymkttransfers/promotion/transfers" //企业向微信用户个人付款
-	wxEntrustPublic     = "papay/entrustweb"                      //公众号纯签约
-	wxEntrustApp        = "papay/preentrustweb"                   //APP纯签约
-	wxEntrustH5         = "papay/h5entrustweb"                    //H5纯签约
-	wxEntrustQuery      = "papay/querycontract"                   //查询签约关系
-	wxEntrustDelete     = "papay/deletecontract"                  //申请解约
-	wxEntrustApplyPay   = "pay/pappayapply"                       //申请扣款
-	wxEntrustQueryOrder = "pay/paporderquery"                     //查询扣款订单
+	microPay          = "pay/micropay"                          //提交付款码支付
+	unifiedOrder      = "pay/unifiedorder"                      //统一下单
+	orderQuery        = "pay/orderquery"                        //查询订单
+	closeOrder        = "pay/closeorder"                        //关闭订单
+	refund            = "secapi/pay/refund"                     //申请退款
+	reverse           = "secapi/pay/reverse"                    //撤销订单
+	refundQuery       = "pay/refundquery"                       //查询退款
+	downloadBill      = "pay/downloadbill"                      //下载对账单
+	downloadFundFlow  = "pay/downloadfundflow"                  //下载资金账单
+	batchQueryComment = "billcommentsp/batchquerycomment"       //拉取订单评价数据
+	transfers         = "mmpaymkttransfers/promotion/transfers" //企业向微信用户个人付款
+	entrustPublic     = "papay/entrustweb"                      //公众号纯签约
+	entrustApp        = "papay/preentrustweb"                   //APP纯签约
+	entrustH5         = "papay/h5entrustweb"                    //H5纯签约
+	entrustQuery      = "papay/querycontract"                   //查询签约关系
+	entrustDelete     = "papay/deletecontract"                  //申请解约
+	entrustApplyPay   = "pay/pappayapply"                       //申请扣款
+	entrustQueryOrder = "pay/paporderquery"                     //查询扣款订单
 
 
 	// SanBox
 	// SanBox
-	wxSandboxGetsignkey        = "https://api.mch.weixin.qq.com/sandboxnew/pay/getsignkey"
-	wxSandboxMicropay          = "sandboxnew/pay/micropay"
-	wxSandboxUnifiedorder      = "sandboxnew/pay/unifiedorder"
-	wxSandboxOrderquery        = "sandboxnew/pay/orderquery"
-	wxSandboxCloseorder        = "sandboxnew/pay/closeorder"
-	wxSandboxRefund            = "sandboxnew/pay/refund"
-	wxSandboxReverse           = "sandboxnew/pay/reverse"
-	wxSandboxRefundquery       = "sandboxnew/pay/refundquery"
-	wxSandboxDownloadbill      = "sandboxnew/pay/downloadbill"
-	wxSandboxDownloadfundflow  = "sandboxnew/pay/downloadfundflow"
-	wxSandboxBatchquerycomment = "sandboxnew/billcommentsp/batchquerycomment"
+	sandboxGetSignKey        = "https://api.mch.weixin.qq.com/sandboxnew/pay/getsignkey"
+	sandboxMicroPay          = "sandboxnew/pay/micropay"
+	sandboxUnifiedOrder      = "sandboxnew/pay/unifiedorder"
+	sandboxOrderQuery        = "sandboxnew/pay/orderquery"
+	sandboxCloseOrder        = "sandboxnew/pay/closeorder"
+	sandboxRefund            = "sandboxnew/pay/refund"
+	sandboxReverse           = "sandboxnew/pay/reverse"
+	sandboxRefundQuery       = "sandboxnew/pay/refundquery"
+	sandboxDownloadBill      = "sandboxnew/pay/downloadbill"
+	sandboxDownloadFundFlow  = "sandboxnew/pay/downloadfundflow"
+	sandboxBatchQueryComment = "sandboxnew/billcommentsp/batchquerycomment"
 
 
 	// 支付类型
 	// 支付类型
 	TradeType_Mini   = "JSAPI"  // 小程序支付
 	TradeType_Mini   = "JSAPI"  // 小程序支付

+ 6 - 6
wechat/param.go

@@ -26,15 +26,15 @@ func (w *Client) SetCountry(country Country) (client *Client) {
 	w.mu.Lock()
 	w.mu.Lock()
 	switch country {
 	switch country {
 	case China:
 	case China:
-		w.BaseURL = wxBaseUrlCh
+		w.BaseURL = baseUrlCh
 	case China2:
 	case China2:
-		w.BaseURL = wxBaseUrlCh2
+		w.BaseURL = baseUrlCh2
 	case SoutheastAsia:
 	case SoutheastAsia:
-		w.BaseURL = wxBaseUrlHk
+		w.BaseURL = baseUrlHk
 	case Other:
 	case Other:
-		w.BaseURL = wxBaseUrlUs
+		w.BaseURL = baseUrlUs
 	default:
 	default:
-		w.BaseURL = wxBaseUrlCh
+		w.BaseURL = baseUrlCh
 	}
 	}
 	w.mu.Unlock()
 	w.mu.Unlock()
 	return w
 	return w
@@ -162,7 +162,7 @@ func getSanBoxSignKey(mchId, nonceStr, sign string) (key string, err error) {
 	reqs.Set("sign", sign)
 	reqs.Set("sign", sign)
 
 
 	keyResponse := new(getSignKeyResponse)
 	keyResponse := new(getSignKeyResponse)
-	_, errs := gopay.NewHttpClient().Type(gopay.TypeXML).Post(wxSandboxGetsignkey).SendString(generateXml(reqs)).EndStruct(keyResponse)
+	_, errs := gopay.NewHttpClient().Type(gopay.TypeXML).Post(sandboxGetSignKey).SendString(generateXml(reqs)).EndStruct(keyResponse)
 	if len(errs) > 0 {
 	if len(errs) > 0 {
 		return gopay.NULL, errs[0]
 		return gopay.NULL, errs[0]
 	}
 	}