mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-04 12:52:27 +08:00
修复微信支付缺少notify_url的bug (#472)
This commit is contained in:
@@ -210,6 +210,12 @@ func (o *Order) BridgeAppConfig(p *Params) (cfg ConfigForApp, err error) {
|
|||||||
// PrePayOrder return data for invoke wechat payment
|
// PrePayOrder return data for invoke wechat payment
|
||||||
func (o *Order) PrePayOrder(p *Params) (payOrder PreOrder, err error) {
|
func (o *Order) PrePayOrder(p *Params) (payOrder PreOrder, err error) {
|
||||||
nonceStr := util.RandomStr(32)
|
nonceStr := util.RandomStr(32)
|
||||||
|
|
||||||
|
// 通知地址
|
||||||
|
if len(p.NotifyURL) == 0 {
|
||||||
|
p.NotifyURL = o.NotifyURL // 默认使用order.NotifyURL
|
||||||
|
}
|
||||||
|
|
||||||
param := map[string]string{
|
param := map[string]string{
|
||||||
"appid": o.AppID,
|
"appid": o.AppID,
|
||||||
"body": p.Body,
|
"body": p.Body,
|
||||||
@@ -224,17 +230,13 @@ func (o *Order) PrePayOrder(p *Params) (payOrder PreOrder, err error) {
|
|||||||
"detail": p.Detail,
|
"detail": p.Detail,
|
||||||
"attach": p.Attach,
|
"attach": p.Attach,
|
||||||
"goods_tag": p.GoodsTag,
|
"goods_tag": p.GoodsTag,
|
||||||
|
"notify_url": p.NotifyURL,
|
||||||
}
|
}
|
||||||
// 签名类型
|
// 签名类型
|
||||||
if param["sign_type"] == "" {
|
if param["sign_type"] == "" {
|
||||||
param["sign_type"] = util.SignTypeMD5
|
param["sign_type"] = util.SignTypeMD5
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通知地址
|
|
||||||
if p.NotifyURL != "" {
|
|
||||||
param["notify_url"] = p.NotifyURL
|
|
||||||
}
|
|
||||||
|
|
||||||
if p.TimeExpire != "" {
|
if p.TimeExpire != "" {
|
||||||
// 如果有传入交易结束时间
|
// 如果有传入交易结束时间
|
||||||
param["time_expire"] = p.TimeExpire
|
param["time_expire"] = p.TimeExpire
|
||||||
|
|||||||
Reference in New Issue
Block a user