Browse Source

更新

master
huangjiajun 10 months ago
parent
commit
225fe46882
5 changed files with 28 additions and 4 deletions
  1. +1
    -0
      go.mod
  2. +4
    -3
      lib/fb_pay/api.go
  3. +16
    -0
      lib/local_wechat/api.go
  4. +1
    -1
      pay/alipay.go
  5. +6
    -0
      pay/pay_by_own.go

+ 1
- 0
go.mod View File

@@ -14,6 +14,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/shopspring/decimal v1.2.0
github.com/syyongx/php2go v0.9.7
github.com/tidwall/gjson v1.17.0
go.uber.org/zap v1.16.0
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/net v0.0.0-20221004154528-8021a29435af // indirect


+ 4
- 3
lib/fb_pay/api.go View File

@@ -36,9 +36,9 @@ type RequestParameters struct {

type OrderCreateParameters struct {
OrderCreateMustParameters
PayWay string `json:"pay_way" label:"02:公众号,03:小程序"`
StoreId int64 `json:"store_id" label:"商户门店号(如果只有一家有效门店,可不传)"`
CashierId int64 `json:"cashier_id" label:"收银员ID"`
PayWay string `json:"pay_way" label:"02:公众号,03:小程序"`
StoreId int64 `json:"store_id" label:"商户门店号(如果只有一家有效门店,可不传)"`
//CashierId int64 `json:"cashier_id" label:"收银员ID"`
SubAppid string `json:"sub_appid" label:"公众号appid/小程序appid。当微信支付时,该字段必填(user_id需要保持一致,即为该公众号appid获取的)间联商户需提前配置对应公众号appid,对应配置接口"`
Royalty int `json:"royalty" label:"1 分账自定义打标参数,1:参与分账(需开白名单),不传则默认不参与分账"`
GoodsTag string `json:"goods_tag" label:"订单优惠标记,代金券或立减优惠功能的参数(使用单品券时必传)"`
@@ -52,6 +52,7 @@ type OrderCreateParameters struct {
PlatformStoreId string `json:"platform_store_id" label:"平台方门店号(即微信/支付宝的storeid)"`
DisablePayChannels string `json:"disable_pay_channels" label:"禁止使用优惠券标识,promotion-支付宝优惠(包含实时优惠+商户优惠)"`
Remark string `json:"remark" label:"备注"`
PayScene string `json:"pay_scene"`
}

type OrderCreateMustParameters struct {


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

@@ -82,6 +82,22 @@ func TradeAppRefundQuery(client *wechat.Client, transactionId string) (*wechat.Q
}
return wxRsp, resBm, nil
}
func TradeShowQuery(client *wechat.Client, transactionId string) (*wechat.QueryOrderResponse, 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.QueryOrder(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) {


+ 1
- 1
pay/alipay.go View File

@@ -177,7 +177,7 @@ func CreditagreementOrderQuery(args map[string]string) (*md.ZhimaCreditPayafteru
bm := make(gopay.BodyMap)
// biz_content
bm.SetBodyMap("biz_content", func(bz gopay.BodyMap) {
bz.Set("credit_biz_order_id", args["credit_biz_order_id"])
bz.Set("out_order_no", args["out_request_no"])
})

var aliPsp md.ZhimaCreditPayafteruseCreditbizorderQuery


+ 6
- 0
pay/pay_by_own.go View File

@@ -146,3 +146,9 @@ func WxAppRefundQuery(params map[string]string) (*wechat.QueryRefundResponse, go
r, r1, err := local_wxpay.TradeAppRefundQuery(client, params["transaction_id"])
return r, r1, err
}

func WxShowQuery(params map[string]string) (*wechat.QueryOrderResponse, 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.TradeShowQuery(client, params["transaction_id"])
return r, r1, err
}

Loading…
Cancel
Save