From a17d6c31eadc95416151a88f9299a6f08c34145f Mon Sep 17 00:00:00 2001 From: gazebo Date: Sat, 13 Apr 2019 18:32:39 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=B8=89=E5=A4=A7=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=80=E6=AC=BE=E4=B8=8E=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E7=9B=B8=E5=85=B3=E7=9A=84API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/ebaiapi/order.go | 30 ++++++++++++++++++++++++++++++ platformapi/jdapi/order.go | 30 ++++++++++++++++++++++++++++++ platformapi/mtwmapi/order.go | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/platformapi/ebaiapi/order.go b/platformapi/ebaiapi/order.go index 681b6a9b..f778d182 100644 --- a/platformapi/ebaiapi/order.go +++ b/platformapi/ebaiapi/order.go @@ -69,6 +69,13 @@ type PrivateMobileInfo struct { ExpireDate *time.Time `json:"expire_date"` } +type RefundSku struct { + SkuID string `json:"sku_id,omitempty"` + Upc string `json:"upc,omitempty"` + CustomeSkuID string `json:"custom_sku_id,omitempty"` + Number string `json:"number"` +} + // 提供给合作方确认订单所用。 注:1、10分钟内未确认的订单系统自动取消。2、确认失败的订单请不要做餐。 2016年7月4号起,将由百度外卖负责完成订单。届时,对接方无需调用完成订单接口,继续调用可能导致订单结算有问题。 func (a *API) OrderConfirm(orderID string) (err error) { _, err = a.AccessAPI("order.confirm", map[string]interface{}{ @@ -216,3 +223,26 @@ func (a *API) SmartOrderIdConvert(orderID string) (convertedOrderID string, err func isOrderIDEleme(orderID string) bool { return len(orderID) == len("3026328756122155111") } + +func (a *API) OrderAgreeRefund(orderID string) (err error) { + _, err = a.AccessAPI("order.agreerefund", map[string]interface{}{ + "order_id": orderID, + }) + return err +} + +func (a *API) OrderDisagreeRefund(orderID, refuseReason string) (err error) { + _, err = a.AccessAPI("order.disagreerefund", map[string]interface{}{ + "order_id": orderID, + "refuse_reason": refuseReason, + }) + return err +} + +func (a *API) OrderPartRefund(orderID string, removeSkuList []*RefundSku) (err error) { + _, err = a.AccessAPI("order.partrefund", map[string]interface{}{ + "order_id": orderID, + "products": removeSkuList, + }) + return err +} diff --git a/platformapi/jdapi/order.go b/platformapi/jdapi/order.go index 26f74f9f..7317476c 100644 --- a/platformapi/jdapi/order.go +++ b/platformapi/jdapi/order.go @@ -75,6 +75,12 @@ var ( orderOperationResultParser = genNoPageResultParser("code", "msg", "detail", "0") ) +type OAOSAdjustDTO struct { + SkuID int64 `json:"skuId,omitempty"` + OutSkuID string `json:"outSkuId,omitempty"` + SkuCount int `json:"skuCount"` +} + // 订单列表查询接口 // https://opendj.jd.com/staticnew/widgets/resources.html?groupid=169&apiid=ba3027848c3c4fda9674966e2a466482 func (a *API) OrderQuery(jdParams map[string]interface{}) (retVal []interface{}, totalCount int, err error) { @@ -228,3 +234,27 @@ func (a *API) GetAfsService(orderId string) (map[string]interface{}, error) { } return result.(map[string]interface{}), nil } + +// 商家审核用户取消申请接口 +// https://openo2o.jddj.com/staticnew/widgets/resources.html?groupid=169&apiid=906b430307764a3ca3698c05c72f33d0 +func (a *API) OrderCancelOperate(orderId string, isAgreed bool, operator, remark string) (err error) { + jdParams := map[string]interface{}{ + "orderId": orderId, + "isAgreed": isAgreed, + "operator": operator, + "remark": remark, + } + _, err = a.AccessAPINoPage("ocs/orderCancelOperate", jdParams, nil, nil, nullResultParser) + return err +} + +func (a *API) AdjustOrder(orderId, operPin, remark string, oaosAdjustDTOList []*OAOSAdjustDTO) (err error) { + jdParams := map[string]interface{}{ + "orderId": orderId, + "operPin": operPin, + "remark": remark, + "oaosAdjustDTOList": oaosAdjustDTOList, + } + _, err = a.AccessAPINoPage("orderAdjust/adjustOrder", jdParams, nil, nil, nullResultParser) + return err +} diff --git a/platformapi/mtwmapi/order.go b/platformapi/mtwmapi/order.go index 6825b1ce..4d5e6dec 100644 --- a/platformapi/mtwmapi/order.go +++ b/platformapi/mtwmapi/order.go @@ -29,10 +29,29 @@ const ( WaybillStatusCanceled = "100" // 配送单已取消 ) +const ( + CancelReasonAcceptTimeout = 1001 // 系统取消,超时未确认 + CancelReasonPayTimeout = 1002 // 系统取消,在线支付订单15分钟未支付 + CancelReasonPayCanceled = 1101 // 用户取消,在线支付中取消 + CancelReasonCancelBeforeAccepted = 1102 // 用户取消,商家确认前取消 + CancelReasonRefundCanceled = 1103 // 用户取消,用户退款取消 + CancelReasonWrongOrder = 1201 // 客服取消,用户下错单 + CancelReasonUserTest = 1202 // 客服取消,用户测试 + CancelReasonDuplicatedOrder = 1203 // 客服取消,重复订单 + CancelReasonCSOther = 1204 // 客服取消,其他原因 + CancelReasonOther = 1301 // 其他原因 +) + const ( NotifyTypeSuccess = "agree" ) +type RefundSku struct { + AppFoodCode string `json:"app_food_code"` + SkuID string `json:"sku_id,omitempty"` + Count int `json:"count"` +} + func (a *API) OrderReceived(orderID int64) (err error) { _, err = a.AccessAPI("order/poi_received", true, map[string]interface{}{ KeyOrderID: orderID, @@ -47,9 +66,11 @@ func (a *API) OrderConfirm(orderID int64) (err error) { return err } -func (a *API) OrderCancel(orderID int64) (err error) { +func (a *API) OrderCancel(orderID int64, cancelReason string, cancelReasonCode int) (err error) { _, err = a.AccessAPI("order/cancel", true, map[string]interface{}{ - KeyOrderID: orderID, + KeyOrderID: orderID, + "reason": cancelReason, + "reason_code": cancelReasonCode, }) return err } @@ -84,6 +105,15 @@ func (a *API) OrderRefundReject(orderID int64, reason string) (err error) { return err } +func (a *API) OrderApplyPartRefund(orderID int64, reason string, removeSkuList []*RefundSku) (err error) { + _, err = a.AccessAPI("order/applyPartRefund", true, map[string]interface{}{ + KeyOrderID: orderID, + "reason": reason, + "food_data": removeSkuList, + }) + return err +} + func (a *API) OrderViewStatus(orderID int64) (status int, err error) { result, err := a.AccessAPI("order/viewstatus", true, map[string]interface{}{ KeyOrderID: orderID,