payPartner2

This commit is contained in:
jiangyong27 2024-10-27 20:58:17 +08:00
parent 419f0b3579
commit 3e109ec65a
2 changed files with 19 additions and 2 deletions

View File

@ -54,9 +54,15 @@ func (p *Pay) CreateOrder(order *CreateOrderReq) (map[string]interface{}, error)
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{
"x-token": p.token,

View File

@ -33,6 +33,17 @@ type CreateOrderReq struct {
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 {
Code int `json:"code"`
Message string `json:"message"`