payPartner2
This commit is contained in:
parent
419f0b3579
commit
3e109ec65a
10
unify/pay.go
10
unify/pay.go
|
@ -54,9 +54,15 @@ func (p *Pay) CreateOrder(order *CreateOrderReq) (map[string]interface{}, error)
|
||||||
return rsp.Data, nil
|
return rsp.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Pay) CreatePartnerOrder(params map[string]interface{}) (map[string]interface{}, error) {
|
func (p *Pay) CreatePartnerOrder(order *CreatePartnerOrderReq) (map[string]interface{}, error) {
|
||||||
|
|
||||||
reqBody, _ := json.Marshal(params)
|
if order.PayType == "" {
|
||||||
|
errors.New("payType is nil")
|
||||||
|
}
|
||||||
|
if order.PayPrice <= 0 {
|
||||||
|
return nil, errors.New("payPrice is nil")
|
||||||
|
}
|
||||||
|
reqBody, _ := json.Marshal(order)
|
||||||
|
|
||||||
result, err := util.HttpPostJson(p.address+"/api/pay/partner/order", map[string]string{
|
result, err := util.HttpPostJson(p.address+"/api/pay/partner/order", map[string]string{
|
||||||
"x-token": p.token,
|
"x-token": p.token,
|
||||||
|
|
|
@ -33,6 +33,17 @@ type CreateOrderReq struct {
|
||||||
Goods *OrderGoods `json:"goods,omitempty"`
|
Goods *OrderGoods `json:"goods,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CreatePartnerOrderReq struct {
|
||||||
|
PayType string `json:"payType"`
|
||||||
|
PaySource string `json:"paySource"`
|
||||||
|
PayPrice int64 `json:"payPrice"`
|
||||||
|
GoodsName string `json:"goodsName"`
|
||||||
|
OutTradeNo string `json:"outTradeNo"`
|
||||||
|
NotifyUrl string `json:"notifyUrl"`
|
||||||
|
PartnerId string `json:"partnerId"`
|
||||||
|
Extra interface{} `json:"extra"`
|
||||||
|
}
|
||||||
|
|
||||||
type CommonResponse struct {
|
type CommonResponse struct {
|
||||||
Code int `json:"code"`
|
Code int `json:"code"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
|
|
Loading…
Reference in New Issue