Browse Source

更新

master
huangjiajun 3 months ago
parent
commit
42c4bac4e5
2 changed files with 22 additions and 0 deletions
  1. +17
    -0
      lib/local_wechat/api.go
  2. +5
    -0
      pay/pay_by_own.go

+ 17
- 0
lib/local_wechat/api.go View File

@@ -99,6 +99,23 @@ func TradeShowQuery(client *wechat.Client, transactionId string) (*wechat.QueryO
return wxRsp, resBm, nil
}

func TradeShowRefundQuery(client *wechat.Client, transactionId string) (*wechat.QueryRefundResponse, gopay.BodyMap, error) {
// 初始化 BodyMap
bm := make(gopay.BodyMap)
bm.Set("transaction_id", transactionId).
Set("nonce_str", util.GetRandomString(32)).
Set("sign_type", wechat.SignType_MD5)
wxRsp, resBm, err := client.QueryRefund(bm)
fmt.Println(wxRsp)
fmt.Println(resBm)
if err != nil {
xlog.Error(err)
fmt.Println(err)
return wxRsp, resBm, err
}
return wxRsp, resBm, nil
}

// TradeAppPay is 微信APP支付
func TradeAppPay(client *wechat.Client, subject, orderID, amount, notifyUrl string) (map[string]string, error) {
// 初始化 BodyMap


+ 5
- 0
pay/pay_by_own.go View File

@@ -152,3 +152,8 @@ func WxShowQuery(params map[string]string) (*wechat.QueryOrderResponse, gopay.Bo
r, r1, err := local_wxpay.TradeShowQuery(client, params["transaction_id"])
return r, r1, err
}
func TradeShowRefundQuery(params map[string]string) (*wechat.QueryRefundResponse, gopay.BodyMap, error) {
client := local_wxpay.NewClient(params["pay_wx_appid"], params["pay_wx_mch_id"], params["pay_wx_api_key"], true)
r, r1, err := local_wxpay.TradeShowRefundQuery(client, params["transaction_id"])
return r, r1, err
}

Loading…
Cancel
Save