- 三大平台添加退款与部分退款相关的API
This commit is contained in:
@@ -69,6 +69,13 @@ type PrivateMobileInfo struct {
|
|||||||
ExpireDate *time.Time `json:"expire_date"`
|
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号起,将由百度外卖负责完成订单。届时,对接方无需调用完成订单接口,继续调用可能导致订单结算有问题。
|
// 提供给合作方确认订单所用。 注:1、10分钟内未确认的订单系统自动取消。2、确认失败的订单请不要做餐。 2016年7月4号起,将由百度外卖负责完成订单。届时,对接方无需调用完成订单接口,继续调用可能导致订单结算有问题。
|
||||||
func (a *API) OrderConfirm(orderID string) (err error) {
|
func (a *API) OrderConfirm(orderID string) (err error) {
|
||||||
_, err = a.AccessAPI("order.confirm", map[string]interface{}{
|
_, 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 {
|
func isOrderIDEleme(orderID string) bool {
|
||||||
return len(orderID) == len("3026328756122155111")
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -75,6 +75,12 @@ var (
|
|||||||
orderOperationResultParser = genNoPageResultParser("code", "msg", "detail", "0")
|
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
|
// 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) {
|
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
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,10 +29,29 @@ const (
|
|||||||
WaybillStatusCanceled = "100" // 配送单已取消
|
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 (
|
const (
|
||||||
NotifyTypeSuccess = "agree"
|
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) {
|
func (a *API) OrderReceived(orderID int64) (err error) {
|
||||||
_, err = a.AccessAPI("order/poi_received", true, map[string]interface{}{
|
_, err = a.AccessAPI("order/poi_received", true, map[string]interface{}{
|
||||||
KeyOrderID: orderID,
|
KeyOrderID: orderID,
|
||||||
@@ -47,9 +66,11 @@ func (a *API) OrderConfirm(orderID int64) (err error) {
|
|||||||
return err
|
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{}{
|
_, err = a.AccessAPI("order/cancel", true, map[string]interface{}{
|
||||||
KeyOrderID: orderID,
|
KeyOrderID: orderID,
|
||||||
|
"reason": cancelReason,
|
||||||
|
"reason_code": cancelReasonCode,
|
||||||
})
|
})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -84,6 +105,15 @@ func (a *API) OrderRefundReject(orderID int64, reason string) (err error) {
|
|||||||
return err
|
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) {
|
func (a *API) OrderViewStatus(orderID int64) (status int, err error) {
|
||||||
result, err := a.AccessAPI("order/viewstatus", true, map[string]interface{}{
|
result, err := a.AccessAPI("order/viewstatus", true, map[string]interface{}{
|
||||||
KeyOrderID: orderID,
|
KeyOrderID: orderID,
|
||||||
|
|||||||
Reference in New Issue
Block a user