github.com/fastwego/offiaccount@v1.0.1/apis/store/order/order.go (about) 1 // Copyright 2020 FastWeGo 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package order 微信小店/订单管理 16 package order 17 18 import ( 19 "bytes" 20 21 "github.com/fastwego/offiaccount" 22 ) 23 24 const ( 25 apiGetById = "/merchant/order/getbyid" 26 apiGetByFilter = "/merchant/order/getbyfilter" 27 apiSetDelivery = "/merchant/order/setdelivery" 28 apiClose = "/merchant/order/close" 29 ) 30 31 /* 32 根据订单ID获取订单详情 33 34 35 36 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 37 38 POST https://api.weixin.qq.com/merchant/order/getbyid?access_token=ACCESS_TOKEN 39 */ 40 func GetById(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) { 41 return ctx.Client.HTTPPost(apiGetById, bytes.NewReader(payload), "application/json;charset=utf-8") 42 } 43 44 /* 45 根据订单状态/创建时间获取订单详情 46 47 48 49 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 50 51 POST https://api.weixin.qq.com/merchant/order/getbyfilter?access_token=ACCESS_TOKEN 52 */ 53 func GetByFilter(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) { 54 return ctx.Client.HTTPPost(apiGetByFilter, bytes.NewReader(payload), "application/json;charset=utf-8") 55 } 56 57 /* 58 设置订单发货信息 59 60 61 62 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 63 64 POST https://api.weixin.qq.com/merchant/order/setdelivery?access_token=ACCESS_TOKEN 65 */ 66 func SetDelivery(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) { 67 return ctx.Client.HTTPPost(apiSetDelivery, bytes.NewReader(payload), "application/json;charset=utf-8") 68 } 69 70 /* 71 关闭订单 72 73 74 75 See: https://developers.weixin.qq.com/doc/offiaccount/Instant_Stores/WeChat_Store_Interface.html 76 77 POST https://api.weixin.qq.com/merchant/order/close?access_token=ACCESS_TOKEN 78 */ 79 func Close(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error) { 80 return ctx.Client.HTTPPost(apiClose, bytes.NewReader(payload), "application/json;charset=utf-8") 81 }