1
This commit is contained in:
@@ -9,27 +9,26 @@ import (
|
||||
)
|
||||
|
||||
// PreCreateOrder 预下单生成支付信息
|
||||
func (a *API) PreCreateOrder(param *PreCreateOrderReq) (string, error) {
|
||||
func (a *API) PreCreateOrder(param *PreCreateOrderReq) (*CreateOrderResponseInfo, error) {
|
||||
if a.appId == "" || a.appSecret == "" {
|
||||
return "", errors.New("appId/appSecret 不能为空")
|
||||
return nil, errors.New("appId/appSecret 不能为空")
|
||||
}
|
||||
|
||||
param.Sign = a.sign(utils.Struct2MapByJson(param))
|
||||
result, err := a.AccessAPI1(a.FullUrl(KuaiShouPreCreateOrder), utils.Struct2MapByJson(param))
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
order := PreCreateOrderResponse{}
|
||||
if err := utils.Map2StructByJson(result, &order, false); err != nil {
|
||||
return "", err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if order.Result != 1 {
|
||||
return "", errors.New(order.ErrorMsg)
|
||||
return nil, errors.New(order.ErrorMsg)
|
||||
}
|
||||
|
||||
return order.OrderInfo, nil
|
||||
return &order.OrderInfo, nil
|
||||
}
|
||||
|
||||
// GetOrderDetail 订单详情查询接口
|
||||
|
||||
Reference in New Issue
Block a user