-
Notifications
You must be signed in to change notification settings - Fork 7
/
订单-修改订单价格.go
executable file
·57 lines (47 loc) · 1.38 KB
/
订单-修改订单价格.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package apis
import (
"encoding/json"
)
// 修改订单价格
// 文档:https://developers.weixin.qq.com/doc/channels/API/order/price_update.html
type ReqOrderPriceUpdate struct {
ChangeExpress bool `json:"change_express"`
ChangeOrderInfos []ChangeOrderInfosItem `json:"change_order_infos"`
ExpressFee *int `json:"express_fee,omitempty"`
OrderID string `json:"order_id"`
}
type ChangeOrderInfosItem struct {
ChangePrice int `json:"change_price"`
ProductID string `json:"product_id"`
SkuID string `json:"sku_id"`
}
var _ bodyer = ReqOrderPriceUpdate{}
func (x ReqOrderPriceUpdate) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
type RespOrderPriceUpdate struct {
CommonResp
}
var _ bodyer = RespOrderPriceUpdate{}
func (x RespOrderPriceUpdate) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
func (c *ApiClient) ExecOrderPriceUpdate(req ReqOrderPriceUpdate) (RespOrderPriceUpdate, error) {
var resp RespOrderPriceUpdate
err := c.executeWXApiPost("/channels/ec/order/price/update", req, &resp, true)
if err != nil {
return RespOrderPriceUpdate{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespOrderPriceUpdate{}, bizErr
}
return resp, nil
}