- ebai调整一些常量类型
This commit is contained in:
@@ -37,6 +37,38 @@ type CallbackMsg struct {
|
||||
Cmd string `json:"cmd"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Body map[string]interface{} `json:"body"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
type CBPartRefundInfo struct {
|
||||
OrderID int64 `json:"order_id"`
|
||||
RefundID string `json:"refund_id"`
|
||||
Type int `json:"type"`
|
||||
Status int `json:"status"`
|
||||
AdditionReason string `json:"addition_reason"`
|
||||
Photos []string `json:"photos"`
|
||||
ReasonType string `json:"reason_type"`
|
||||
Reason string `json:"reason"`
|
||||
RefundProducts []*struct {
|
||||
SkuID string `json:"sku_id"`
|
||||
Upc string `json:"upc"`
|
||||
CustomSkuID string `json:"custom_sku_id"`
|
||||
Name string `json:"name"`
|
||||
Number int `json:"number"`
|
||||
TotalRefund int64 `json:"total_refund"`
|
||||
ShopEleRefund int64 `json:"shop_ele_refund"`
|
||||
} `json:"refund_products"`
|
||||
RefundPrice int64 `json:"refund_price"`
|
||||
}
|
||||
|
||||
type CBUserCancelInfo struct {
|
||||
OrderID int64 `json:"order_id"`
|
||||
CancelReason string `json:"cancel_reason"`
|
||||
AdditionReason string `json:"addition_reason"`
|
||||
RefuseReason string `json:"refuse_reason"`
|
||||
Pictures []string `json:"pictures"`
|
||||
Type int `json:"type"`
|
||||
CancelType int `json:"cancel_type"`
|
||||
}
|
||||
|
||||
func (a *API) Err2CallbackResponse(cmd string, err error, data interface{}) *CallbackResponse {
|
||||
@@ -107,6 +139,20 @@ func (a *API) GetCallbackMsg(request *http.Request) (msg *CallbackMsg, callbackR
|
||||
}
|
||||
msg.Cmd = GetCmd(request)
|
||||
msg.Timestamp = utils.Str2Int64(utils.Interface2String(request.FormValue("timestamp")))
|
||||
var tmpObj interface{}
|
||||
switch msg.Cmd {
|
||||
case CmdOrderPartRefund:
|
||||
var partRefundData CBPartRefundInfo
|
||||
tmpObj = &partRefundData
|
||||
case CmdOrderUserCancel:
|
||||
var userCancelData CBUserCancelInfo
|
||||
tmpObj = &userCancelData
|
||||
}
|
||||
if tmpObj != nil {
|
||||
if utils.Map2StructByJson(msg.Body, tmpObj, true) == nil {
|
||||
msg.Data = tmpObj
|
||||
}
|
||||
}
|
||||
return msg, nil
|
||||
}
|
||||
return nil, a.Err2CallbackResponse("", err, nil)
|
||||
|
||||
@@ -45,27 +45,27 @@ const (
|
||||
|
||||
const (
|
||||
// 订单下行 - order.partrefund.push-部分退款订单信息推送
|
||||
OrderPartRefuncTypeMerchant = "1" // 表示商户发起的部分退款
|
||||
OrderPartRefuncTypeCustomer = "2" // 表示用户发起的部分退款
|
||||
OrderPartRefuncTypeCS = "3" // 表示客服直接发起的部分退款
|
||||
OrderPartRefuncTypeMerchant = 1 // 表示商户发起的部分退款
|
||||
OrderPartRefuncTypeCustomer = 2 // 表示用户发起的部分退款
|
||||
OrderPartRefuncTypeCS = 3 // 表示客服直接发起的部分退款
|
||||
|
||||
OrderPartRefundApply = "10" // 表示商家/用户发起部分退款申请
|
||||
OrderPartRefundSuccess = "20" // 表示部分退款成功
|
||||
OrderPartRefundUserApplyArbitration = "30" // 用户申请仲裁,客服介入
|
||||
OrderPartRefundFailed = "40" // 表示部分退款失败
|
||||
OrderPartRefundMerchantRefused = "50" // 表示商家拒绝用户发起的部分退款申请
|
||||
OrderPartRefundApply = 10 // 表示商家/用户发起部分退款申请
|
||||
OrderPartRefundSuccess = 20 // 表示部分退款成功
|
||||
OrderPartRefundUserApplyArbitration = 30 // 用户申请仲裁,客服介入
|
||||
OrderPartRefundFailed = 40 // 表示部分退款失败
|
||||
OrderPartRefundMerchantRefused = 50 // 表示商家拒绝用户发起的部分退款申请
|
||||
|
||||
// 订单下行 - order.user.cancel-用户申请订单取消/退款
|
||||
OrderUserCancelApply = "10" // 发起申请
|
||||
OrderUserCancelCSIntervene = "20" // 客服介入
|
||||
OrderUserCancelCSRefused = "30" // 客服拒绝
|
||||
OrderUserCancelCSAgreed = "40" // 客服同意
|
||||
OrderUserCancelMerchantRefused = "50" // 商户拒绝
|
||||
OrderUserCancelMerchantAgreed = "60" // 商家同意
|
||||
OrderUserCancelInvalid = "70" // 申请失效
|
||||
OrderUserCancelApply = 10 // 发起申请
|
||||
OrderUserCancelCSIntervene = 20 // 客服介入
|
||||
OrderUserCancelCSRefused = 30 // 客服拒绝
|
||||
OrderUserCancelCSAgreed = 40 // 客服同意
|
||||
OrderUserCancelMerchantRefused = 50 // 商户拒绝
|
||||
OrderUserCancelMerchantAgreed = 60 // 商家同意
|
||||
OrderUserCancelInvalid = 70 // 申请失效
|
||||
|
||||
OrderUserCancelTypeBeforeSale = "1" // 表示订单完成前用户全单取消申请流程
|
||||
OrderUserCancelTypeAfterSale = "2" // 表示订单完成后用户全单退款申请流程
|
||||
OrderUserCancelTypeBeforeSale = 1 // 表示订单完成前用户全单取消申请流程
|
||||
OrderUserCancelTypeAfterSale = 2 // 表示订单完成后用户全单退款申请流程
|
||||
|
||||
SendImmediatelySelf = 6 // 饿百商家自送的配送状态
|
||||
)
|
||||
@@ -97,6 +97,62 @@ type RefundSku struct {
|
||||
Number string `json:"number"`
|
||||
}
|
||||
|
||||
type OrderDetailInfo struct {
|
||||
CustomSkuID string `json:"custom_sku_id"`
|
||||
Name string `json:"name"`
|
||||
Number int `json:"number"`
|
||||
ProductFeatures []interface{} `json:"product_features"`
|
||||
ProductFee int `json:"product_fee"`
|
||||
ProductPrice int `json:"product_price"`
|
||||
ProductSubsidy struct {
|
||||
AgentRate int `json:"agent_rate"`
|
||||
BaiduRate int `json:"baidu_rate"`
|
||||
Discount int `json:"discount"`
|
||||
DiscountDetail []*struct {
|
||||
ActivityID string `json:"activity_id"`
|
||||
BaiduRate int `json:"baidu_rate"`
|
||||
ShopRate int `json:"shop_rate"`
|
||||
Type string `json:"type"`
|
||||
} `json:"discount_detail"`
|
||||
LogisticsRate int `json:"logistics_rate"`
|
||||
ShopRate int `json:"shop_rate"`
|
||||
UserRate int `json:"user_rate"`
|
||||
} `json:"product_subsidy"`
|
||||
SkuID string `json:"sku_id"`
|
||||
TotalWeight int `json:"total_weight"`
|
||||
Upc string `json:"upc"`
|
||||
}
|
||||
|
||||
type RefundDetailInfo struct {
|
||||
ApplyTime string `json:"apply_time"`
|
||||
CustomSkuID string `json:"custom_sku_id"`
|
||||
Desc string `json:"desc"`
|
||||
Name string `json:"name"`
|
||||
Number int `json:"number"`
|
||||
RefundID string `json:"refund_id"`
|
||||
ShopEleRefund int `json:"shop_ele_refund"`
|
||||
SkuID string `json:"sku_id"`
|
||||
Status int `json:"status"`
|
||||
TotalRefund int `json:"total_refund"`
|
||||
Type int `json:"type"`
|
||||
Upc string `json:"upc"`
|
||||
}
|
||||
|
||||
type PartRefundInfo struct {
|
||||
Commission int `json:"commission"`
|
||||
Fee int `json:"fee"`
|
||||
OrderDetail []*OrderDetailInfo `json:"order_detail"`
|
||||
OrderID string `json:"order_id"`
|
||||
PackageFee int `json:"package_fee"`
|
||||
RefundDetail []*RefundDetailInfo `json:"refund_detail"`
|
||||
RefundPrice int `json:"refund_price"`
|
||||
SendFee int `json:"send_fee"`
|
||||
ShopFee int `json:"shop_fee"`
|
||||
TotalPrice int `json:"total_price"`
|
||||
Type int `json:"type"`
|
||||
UserFee int `json:"user_fee"`
|
||||
}
|
||||
|
||||
// 提供给合作方确认订单所用。 注:1、10分钟内未确认的订单系统自动取消。2、确认失败的订单请不要做餐。 2016年7月4号起,将由百度外卖负责完成订单。届时,对接方无需调用完成订单接口,继续调用可能导致订单结算有问题。
|
||||
func (a *API) OrderConfirm(orderID string) (err error) {
|
||||
_, err = a.AccessAPI("order.confirm", map[string]interface{}{
|
||||
@@ -226,8 +282,8 @@ func (a *API) OrderIdConvert(orderID string, isElemeOrder bool) (convertedOrderI
|
||||
return "", err
|
||||
}
|
||||
|
||||
// 查看售后订单详情
|
||||
func (a *API) OrderPartrefundGet(orderID string) (orderMap map[string]interface{}, err error) {
|
||||
// 查看部分退款订单详情
|
||||
func (a *API) OrderPartRefundGet(orderID string) (orderMap map[string]interface{}, err error) {
|
||||
result, err := a.AccessAPI("order.partrefund.get", map[string]interface{}{
|
||||
"order_id": orderID,
|
||||
})
|
||||
@@ -237,6 +293,14 @@ func (a *API) OrderPartrefundGet(orderID string) (orderMap map[string]interface{
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (a *API) OrderPartRefundGet2(orderID string) (partRefundInfo *CBPartRefundInfo, err error) {
|
||||
result, err := a.OrderPartRefundGet(orderID)
|
||||
if err == nil {
|
||||
err = utils.Map2StructByJson(result, &partRefundInfo, false)
|
||||
}
|
||||
return partRefundInfo, err
|
||||
}
|
||||
|
||||
func (a *API) SmartOrderIdConvert(orderID string) (convertedOrderID string, err error) {
|
||||
return a.OrderIdConvert(orderID, isOrderIDEleme(orderID))
|
||||
}
|
||||
|
||||
@@ -15,8 +15,17 @@ func TestOrderGet(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestOrderPartrefundGet(t *testing.T) {
|
||||
result, err := api.OrderPartrefundGet("1556529608021993938")
|
||||
func TestOrderPartRefundGet(t *testing.T) {
|
||||
result, err := api.OrderPartRefundGet("1557459492221457830")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
}
|
||||
|
||||
func TestOrderPartRefundGet2(t *testing.T) {
|
||||
result, err := api.OrderPartRefundGet2("1557459492221457830")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user