Skip to content

Commit 3c15f6b

Browse files
committed
update
1 parent 7a9bd05 commit 3c15f6b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

driver/wechat/wechat.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (a *Wechat) Pay(ctx echo.Context, cfg *config.Pay) (param.StringMap, error)
6969
case config.Wap:
7070
tradeType = `MWEB`
7171
case config.App:
72-
tradeType = `App`
72+
tradeType = `APP`
7373
default:
7474
tradeType = `MWEB`
7575
}
@@ -90,13 +90,16 @@ func (a *Wechat) Pay(ctx echo.Context, cfg *config.Pay) (param.StringMap, error)
9090
wxParams[k] = params.String(k)
9191
}
9292
}
93+
// documentation https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1
9394
params, err := a.Client().UnifiedOrder(wxParams)
9495
if err != nil {
9596
return nil, err
9697
}
9798
return param.ToStringMap(a.translateWxpayAppResult(cfg, params)), nil
9899
}
99100

101+
// Notify 回调处理
102+
// documentation https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7&index=8
100103
func (a *Wechat) Notify(ctx echo.Context) error {
101104
result := param.StringMap{}
102105
body := ctx.Request().Body()
@@ -165,6 +168,7 @@ func (a *Wechat) Query(ctx echo.Context, cfg *config.Query) (config.TradeStatus,
165168
} else {
166169
params.SetString("out_trade_no", cfg.OutTradeNo)
167170
}
171+
// documentation https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2
168172
resp, err := a.Client().OrderQuery(params)
169173
if err != nil {
170174
return config.EmptyTradeStatus, err
@@ -205,6 +209,7 @@ func (a *Wechat) Refund(ctx echo.Context, cfg *config.Refund) (param.StringMap,
205209
"total_fee": MoneyFeeToString(cfg.TotalAmount),
206210
"refund_fee": MoneyFeeToString(cfg.RefundAmount),
207211
}
212+
// documentation https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4
208213
resp, err := a.Client().Refund(refundConfig)
209214
if err != nil {
210215
return nil, err

0 commit comments

Comments
 (0)