1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-07 06:02:26 +08:00
This commit is contained in:
houseme
2024-07-19 12:04:04 +08:00
parent ba0a1477eb
commit d8fde54f2d
118 changed files with 974 additions and 867 deletions

View File

@@ -75,7 +75,7 @@ func (notify *Notify) PaidVerifySign(notifyRes PaidResult) bool {
}
sort.Strings(sortedKeys)
// STEP2, 对key=value的键值对用&连接起来,略过空值 & sign
// STEP2, 对 key=value 的键值对用&连接起来,略过空值 & sign
var signStrings string
for _, k := range sortedKeys {
value := fmt.Sprintf("%v", cast.ToString(resMap[k]))
@@ -84,10 +84,10 @@ func (notify *Notify) PaidVerifySign(notifyRes PaidResult) bool {
}
}
// STEP3, 在键值对的最后加上key=API_KEY
// STEP3, 在键值对的最后加上 key=API_KEY
signStrings = signStrings + "key=" + notify.Key
// STEP4, 根据SignType计算出签名
// STEP4, 根据 SignType 计算出签名
var signType string
if notifyRes.SignType != nil {
signType = *notifyRes.SignType

View File

@@ -18,7 +18,7 @@ type CloseParams struct {
// closeRequest 接口请求参数
type closeRequest struct {
AppID string `xml:"appid"` // 公众账号ID
AppID string `xml:"appid"` // 公众账号 ID
MchID string `xml:"mch_id"` // 商户号
NonceStr string `xml:"nonce_str"` // 随机字符串
Sign string `xml:"sign"` // 签名

View File

@@ -35,7 +35,7 @@ type Params struct {
CreateIP string
Body string
OutTradeNo string
TimeExpire string // 订单失效时间格式为yyyyMMddHHmmss如2009年12月27日9点10分10秒表示为20091227091010。
TimeExpire string // 订单失效时间,格式为 yyyyMMddHHmmss 2009 年 12 月 27 日 9 点 10 分 10 秒表示为 20091227091010。
OpenID string
TradeType string
SignType string
@@ -85,7 +85,7 @@ type PreOrder struct {
// payRequest 接口请求参数
type payRequest struct {
AppID string `xml:"appid"` // 公众账号ID
AppID string `xml:"appid"` // 公众账号 ID
MchID string `xml:"mch_id"` // 商户号
DeviceInfo string `xml:"device_info,omitempty"` // 设备号
NonceStr string `xml:"nonce_str"` // 随机字符串
@@ -97,13 +97,13 @@ type payRequest struct {
OutTradeNo string `xml:"out_trade_no"` // 商户订单号
FeeType string `xml:"fee_type,omitempty"` // 标价币种
TotalFee string `xml:"total_fee"` // 标价金额
SpbillCreateIP string `xml:"spbill_create_ip"` // 终端IP
SpbillCreateIP string `xml:"spbill_create_ip"` // 终端 IP
TimeStart string `xml:"time_start,omitempty"` // 交易起始时间
TimeExpire string `xml:"time_expire,omitempty"` // 交易结束时间
GoodsTag string `xml:"goods_tag,omitempty"` // 订单优惠标记
NotifyURL string `xml:"notify_url"` // 通知地址
TradeType string `xml:"trade_type"` // 交易类型
ProductID string `xml:"product_id,omitempty"` // 商品ID
ProductID string `xml:"product_id,omitempty"` // 商品 ID
LimitPay string `xml:"limit_pay,omitempty"` // 指定支付方式
OpenID string `xml:"openid,omitempty"` // 用户标识
SceneInfo string `xml:"scene_info,omitempty"` // 场景信息
@@ -213,7 +213,7 @@ func (o *Order) PrePayOrder(p *Params) (payOrder PreOrder, err error) {
// 通知地址
if len(p.NotifyURL) == 0 {
p.NotifyURL = o.NotifyURL // 默认使用order.NotifyURL
p.NotifyURL = o.NotifyURL // 默认使用 order.NotifyURL
}
// 签名类型

View File

@@ -19,7 +19,7 @@ type QueryParams struct {
// queryRequest 接口请求参数
type queryRequest struct {
AppID string `xml:"appid"` // 公众账号ID
AppID string `xml:"appid"` // 公众账号 ID
MchID string `xml:"mch_id"` // 商户号
NonceStr string `xml:"nonce_str"` // 随机字符串
Sign string `xml:"sign"` // 签名

View File

@@ -9,12 +9,12 @@ import (
"github.com/silenceper/wechat/v2/pay/transfer"
)
// Pay 微信支付相关API
// Pay 微信支付相关 API
type Pay struct {
cfg *config.Config
}
// NewPay 实例化微信支付相关API
// NewPay 实例化微信支付相关 API
func NewPay(cfg *config.Config) *Pay {
return &Pay{cfg}
}

View File

@@ -35,7 +35,7 @@ type Params struct {
ActName string
Remark string
RootCa string // ca证书
RootCa string // ca 证书
}
// request 接口请求参数

View File

@@ -29,7 +29,7 @@ type Params struct {
TotalFee string
RefundFee string
RefundDesc string
RootCa string // ca证书
RootCa string // ca 证书
NotifyURL string
SignType string
}

View File

@@ -33,7 +33,7 @@ type Params struct {
Amount int
Desc string
SpbillCreateIP string
RootCa string // ca证书
RootCa string // ca 证书
}
// request 接口请求参数