Browse Source

init

master
public_host 3 years ago
parent
commit
88656a782a
  1. 5
      src/V2/entity.go
  2. 11
      src/V2/pay.go

5
src/V2/entity.go

@ -188,6 +188,11 @@ type ProfitSharing struct {
Receivers []Receiver `json:"receivers,omitempty"` // 接收方列表
}
// ProfitSharing 单次分账参数
type ProfitSharingAmountQuery struct {
TransactionID string `json:"transaction_id,omitempty"` // 微信支付ID
}
// ProfitSharingQuery 分账结果查询参数
type ProfitSharingQuery struct {
TransactionID string `json:"transaction_id,omitempty"` // 微信支付ID

11
src/V2/pay.go

@ -8,6 +8,7 @@ import (
"errors"
"io"
"io/ioutil"
"log"
"net/http"
"strconv"
"strings"
@ -219,11 +220,13 @@ func (c WxPay) RefundQuery(params RefundQuery) (map[string]string, error) {
}
// ProfitSharingOrderAmountQuery 查询最大分账比例
func (c WxPay) ProfitSharingOrderAmountQuery(params Receiver) (map[string]string, error) {
m := c.publicParams()
b, _ := json.Marshal(params)
m["receiver"] = string(b)
func (c WxPay) ProfitSharingOrderAmountQuery(params ProfitSharingAmountQuery) (map[string]string, error) {
m := utils.MAPMerge(utils.Struct2Map(params), c.publicParams())
delete(m, "appid")
delete(m, "sub_appid")
delete(m, "sub_mch_id")
m["sign"] = utils.SignHMACSHA256(m, c.config.Secret)
log.Println("m,", m)
return c.request("https://api.mch.weixin.qq.com/pay/profitsharingorderamountquery", strings.NewReader(utils.MAP2XML(m)), false)
}

Loading…
Cancel
Save