迭代饿了么商户取消订单和部分退款接口
This commit is contained in:
@@ -99,224 +99,6 @@ const (
|
|||||||
ListOrderPageSize = 100 // order.list的每页条数
|
ListOrderPageSize = 100 // order.list的每页条数
|
||||||
)
|
)
|
||||||
|
|
||||||
type ExpressInfo struct {
|
|
||||||
OrderID string `json:"order_id"`
|
|
||||||
ExpressID string `json:"express_id"`
|
|
||||||
ExpressCompany string `json:"express_company"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PrivateMobileInfo struct {
|
|
||||||
ShortNumber string `json:"short_number"`
|
|
||||||
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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProductSubsidyInfo 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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type OrderProductInfo struct {
|
|
||||||
BaiduProductID string `json:"baidu_product_id"`
|
|
||||||
SkuID string `json:"sku_id"` // 部分退款信息中是这个而不是BaiduProductID
|
|
||||||
|
|
||||||
CustomSkuID string `json:"custom_sku_id"`
|
|
||||||
|
|
||||||
PackageAmount int `json:"package_amount"`
|
|
||||||
PackageFee int `json:"package_fee"`
|
|
||||||
PackagePrice int `json:"package_price"`
|
|
||||||
PrescriptionID string `json:"prescription_id"`
|
|
||||||
|
|
||||||
ProductAmount int `json:"product_amount"`
|
|
||||||
Number int `json:"number"` // 部分退款信息中是这个而不是ProductAmount
|
|
||||||
|
|
||||||
ProductAttr []interface{} `json:"product_attr"`
|
|
||||||
ProductCustomIndex string `json:"product_custom_index"`
|
|
||||||
ProductFeatures []interface{} `json:"product_features"`
|
|
||||||
ProductFee int `json:"product_fee"`
|
|
||||||
ProductName string `json:"product_name"`
|
|
||||||
ProductPrice int `json:"product_price"`
|
|
||||||
ProductSubsidy *ProductSubsidyInfo `json:"product_subsidy"`
|
|
||||||
ProductType int `json:"product_type"`
|
|
||||||
SupplyType int `json:"supply_type"`
|
|
||||||
TotalFee int `json:"total_fee"`
|
|
||||||
TotalWeight int `json:"total_weight"`
|
|
||||||
Upc string `json:"upc"`
|
|
||||||
WeightType int `json:"weight_type"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type OrderDiscountInfo struct {
|
|
||||||
ActivityID string `json:"activity_id"`
|
|
||||||
AgentRate int `json:"agent_rate"`
|
|
||||||
BaiduRate int `json:"baidu_rate"`
|
|
||||||
Desc string `json:"desc"`
|
|
||||||
Fee int `json:"fee"`
|
|
||||||
LogisticsRate int `json:"logistics_rate"`
|
|
||||||
Products []*struct {
|
|
||||||
ActivityID string `json:"activity_id"`
|
|
||||||
ActivityProductNum int `json:"activity_product_num"`
|
|
||||||
BaiduProductID int64 `json:"baidu_product_id"`
|
|
||||||
NowPrice int `json:"now_price"`
|
|
||||||
OrigPrice int `json:"orig_price"`
|
|
||||||
SavePrice int `json:"save_price"`
|
|
||||||
} `json:"products,omitempty"`
|
|
||||||
RuleID string `json:"rule_id"`
|
|
||||||
ShopRate int `json:"shop_rate"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type OrderDetailInfo struct {
|
|
||||||
Discount []*OrderDiscountInfo `json:"discount"`
|
|
||||||
Order *struct {
|
|
||||||
AtshopTime int `json:"atshop_time"`
|
|
||||||
CancelTime string `json:"cancel_time"`
|
|
||||||
ColdBoxFee string `json:"cold_box_fee"`
|
|
||||||
Commission int `json:"commission"`
|
|
||||||
ConfirmTime string `json:"confirm_time"`
|
|
||||||
CreateTime string `json:"create_time"`
|
|
||||||
DeliveryParty int `json:"delivery_party"` // 此字段会在配送变化后变化
|
|
||||||
DeliveryPhone string `json:"delivery_phone"`
|
|
||||||
DeliveryTime int `json:"delivery_time"`
|
|
||||||
DiscountFee int `json:"discount_fee"`
|
|
||||||
DownFlag int `json:"down_flag"`
|
|
||||||
ElemeOrderID string `json:"eleme_order_id"`
|
|
||||||
ExpectTimeMode int `json:"expect_time_mode"`
|
|
||||||
Ext struct {
|
|
||||||
TaoxiFlag int `json:"taoxi_flag"`
|
|
||||||
} `json:"ext"`
|
|
||||||
FinishedTime string `json:"finished_time"`
|
|
||||||
InvoiceTitle string `json:"invoice_title"`
|
|
||||||
IsColdBoxOrder int `json:"is_cold_box_order"`
|
|
||||||
IsPrivate int `json:"is_private"`
|
|
||||||
LatestSendTime int `json:"latest_send_time"`
|
|
||||||
MealNum string `json:"meal_num"`
|
|
||||||
NeedInvoice int `json:"need_invoice"`
|
|
||||||
OrderFlag int `json:"order_flag"`
|
|
||||||
OrderFrom string `json:"order_from"`
|
|
||||||
OrderID string `json:"order_id"`
|
|
||||||
OrderIndex string `json:"order_index"`
|
|
||||||
PackageFee int `json:"package_fee"`
|
|
||||||
PayStatus int `json:"pay_status"`
|
|
||||||
PayType int `json:"pay_type"`
|
|
||||||
PickupTime int `json:"pickup_time"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
// ResponsibleParty string `json:"responsible_party"`
|
|
||||||
SendFee int `json:"send_fee"`
|
|
||||||
SendImmediately int `json:"send_immediately"`
|
|
||||||
SendTime int `json:"send_time"`
|
|
||||||
ShopFee int `json:"shop_fee"`
|
|
||||||
Status int `json:"status"`
|
|
||||||
TaxerID string `json:"taxer_id"`
|
|
||||||
TotalFee int `json:"total_fee"`
|
|
||||||
UserFee int `json:"user_fee"`
|
|
||||||
} `json:"order"`
|
|
||||||
Products [][]*OrderProductInfo `json:"products"`
|
|
||||||
Shop *struct {
|
|
||||||
BaiduShopID string `json:"baidu_shop_id"`
|
|
||||||
ID string `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
} `json:"shop"`
|
|
||||||
Source string `json:"source"`
|
|
||||||
User *struct {
|
|
||||||
Address string `json:"address"`
|
|
||||||
// City string `json:"city"`
|
|
||||||
Coord *struct {
|
|
||||||
Latitude string `json:"latitude"`
|
|
||||||
Longitude string `json:"longitude"`
|
|
||||||
} `json:"coord"`
|
|
||||||
CoordAmap *struct {
|
|
||||||
Latitude string `json:"latitude"`
|
|
||||||
Longitude string `json:"longitude"`
|
|
||||||
} `json:"coord_amap"`
|
|
||||||
// District string `json:"district"`
|
|
||||||
Gender string `json:"gender"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Phone string `json:"phone"`
|
|
||||||
PrivacyPhone string `json:"privacy_phone"`
|
|
||||||
// Province string `json:"province"`
|
|
||||||
UserID string `json:"user_id"`
|
|
||||||
} `json:"user"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RefundOrderDetailInfo 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 *ProductSubsidyInfo `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 []*RefundOrderDetailInfo `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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ListOrderItemInfo struct {
|
|
||||||
BaiduShopID int64 `json:"baidu_shop_id"`
|
|
||||||
CreateTime int64 `json:"create_time"`
|
|
||||||
OrderFrom int `json:"order_from"`
|
|
||||||
OrderID string `json:"order_id"`
|
|
||||||
OrderStatus int `json:"order_status"`
|
|
||||||
PayStatus int `json:"pay_status"`
|
|
||||||
PayType int `json:"pay_type"`
|
|
||||||
ShopID string `json:"shop_id"`
|
|
||||||
Status int `json:"status"`
|
|
||||||
UserPhone string `json:"user_phone"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ListOrderInfo struct {
|
|
||||||
Total int `json:"total"`
|
|
||||||
Page int `json:"Page"`
|
|
||||||
Pages int `json:"pages"`
|
|
||||||
List []*ListOrderItemInfo `json:"list"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// 提供给合作方确认订单所用。 注: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) {
|
||||||
data, err := a.AccessAPI("order.confirm", map[string]interface{}{
|
data, err := a.AccessAPI("order.confirm", map[string]interface{}{
|
||||||
@@ -335,16 +117,6 @@ func (a *API) OrderPickComplete(orderID string) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提供给合作方取消订单所用。 注:1、百度物流配送且已经确认的订单无法取消。
|
|
||||||
func (a *API) OrderCancel(orderID, cancelType, cancelReason string) (err error) {
|
|
||||||
_, err = a.AccessAPI("order.cancel", map[string]interface{}{
|
|
||||||
"order_id": orderID,
|
|
||||||
"type": cancelType,
|
|
||||||
"reason": cancelReason,
|
|
||||||
})
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 蜂鸟众包订单呼叫骑士配送,仅限蜂鸟众包商户调用
|
// 蜂鸟众包订单呼叫骑士配送,仅限蜂鸟众包商户调用
|
||||||
func (a *API) OrderCallDelivery(orderID string) (err error) {
|
func (a *API) OrderCallDelivery(orderID string) (err error) {
|
||||||
_, err = a.AccessAPI("order.callDelivery", map[string]interface{}{
|
_, err = a.AccessAPI("order.callDelivery", map[string]interface{}{
|
||||||
@@ -372,29 +144,6 @@ func (a *API) OrderselfDeliveryStateSync(orderID, phone string) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
type PushRiderInfo struct {
|
|
||||||
DistributorId int `json:"distributor_id"` // 固定值:201
|
|
||||||
Knight Knight `json:"knight"`
|
|
||||||
OrderId string // 订单id
|
|
||||||
State int // 配送状态,传固定值:21 开始配送(已废弃,已接入商家不影响)
|
|
||||||
SelfStatus int `json:"selfStatus"` // 配送状态
|
|
||||||
SelfStatusDesc string `json:"selfStatusDesc"` // 配送状态文案描述
|
|
||||||
SelfSubStatus int `json:"selfSubStatus"` // 配送取消(6)子原因:
|
|
||||||
SelfSubStatusDesc string `json:"selfSubStatusDesc"` // 配送异常子状态文案描述
|
|
||||||
DistributorInfoDTO DistributorInfoDTO `json:"distributorInfoDTO"` // 配送服务商信息
|
|
||||||
}
|
|
||||||
type Knight struct {
|
|
||||||
Id int64 `json:"id"` // 骑手id,商家自定义
|
|
||||||
Name string `json:"name"` // 骑手姓名
|
|
||||||
Phone string `json:"phone"` // 骑手手机号码
|
|
||||||
}
|
|
||||||
|
|
||||||
type DistributorInfoDTO struct {
|
|
||||||
DistributorTypeId string `json:"distributorTypeId"` // 配送商类型id:
|
|
||||||
DistributorName string `json:"distributorName"` // 配送商名称
|
|
||||||
DistributorPhone string `json:"distributorPhone"` // 配送商电话
|
|
||||||
}
|
|
||||||
|
|
||||||
// OrderselfDeliveryStateSync2 饿了么自配送订单接入骑手状态
|
// OrderselfDeliveryStateSync2 饿了么自配送订单接入骑手状态
|
||||||
func (a *API) OrderselfDeliveryStateSync2(info *PushRiderInfo) (err error) {
|
func (a *API) OrderselfDeliveryStateSync2(info *PushRiderInfo) (err error) {
|
||||||
_, err = a.AccessAPI("order.selfDeliveryStateSync", utils.Struct2MapByJson(info))
|
_, err = a.AccessAPI("order.selfDeliveryStateSync", utils.Struct2MapByJson(info))
|
||||||
@@ -594,17 +343,6 @@ func (a *API) OrderDisagreeRefund(param *RefundOrderExamine) (err error) {
|
|||||||
//return err
|
//return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 商家主动发起多次部分退
|
|
||||||
func (a *API) OrderPartRefund(orderID string, removeSkuList []*RefundSku) (err error) {
|
|
||||||
//return a.EbaiRefundOrder(param)
|
|
||||||
|
|
||||||
_, err = a.AccessAPI("order.manyTimesPartrefund", map[string]interface{}{
|
|
||||||
"order_id": orderID,
|
|
||||||
"products": removeSkuList,
|
|
||||||
})
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 用户多次退商家同意
|
// 用户多次退商家同意
|
||||||
func (a *API) OrderAgreePartRefund(param *RefundOrderExamine) (err error) {
|
func (a *API) OrderAgreePartRefund(param *RefundOrderExamine) (err error) {
|
||||||
return a.EbaiRefundOrder(param)
|
return a.EbaiRefundOrder(param)
|
||||||
@@ -688,20 +426,28 @@ func (a *API) GetReverseOrder(orderId string) ([]interface{}, bool, error) {
|
|||||||
return data["sub_reverse_order_list"].([]interface{}), isAll, nil
|
return data["sub_reverse_order_list"].([]interface{}), isAll, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RefundOrderExamine 商家审核是售后单
|
// OrderPartRefund 商家主动发起多次部分退
|
||||||
type RefundOrderExamine struct {
|
func (a *API) OrderPartRefund(orderID string, removeSkuList []*RefundSku) (err error) {
|
||||||
ReverseOrderId string `json:"reverse_order_id" required:"true"` // 逆向单ID
|
//return a.EbaiRefundOrder(param)
|
||||||
OrderId string `json:"order_id" required:"true"` // 订单id
|
_, err = a.AccessAPI("order.manyTimesPartrefund", map[string]interface{}{
|
||||||
IdempotentId string `json:"idempotent_id" required:"true"` // 请求唯一标示
|
"order_id": orderID,
|
||||||
ActionType string `json:"action_type" required:"true"` // 逆向单审批操作类型,枚举值:【1-同意全单/部分退款申请 、 2-拒绝全单/部分退款申请、 3-同意退货申请 、 4-拒绝退货申请】
|
"products": removeSkuList,
|
||||||
ReasonCode string `json:"reason_code" required:"false"` // 当拒绝场景必填,即action_type = 2 or action_type =4 时 必填,枚举值: 7019-双方协商一致不再取消订单、 7020-商品已经备货完成、 7021-商品已送出、 7802-商品发出时完好、 7803-用户未举证/举证无效、 7804-商品影响二次销售、 7805-商品不符合7天无理由退款、 7302-未收到退货(仅退货单支持传入该code)、 7001-其他原因
|
})
|
||||||
ReasonRemarks string `json:"reason_remarks" required:"false"` // 原因备注说明信息
|
return err
|
||||||
RefundProductList []*RefundProductList `json:"refund_product_list" required:"false"` // 订单id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type RefundProductList struct {
|
// OrderCancel 提供给合作方取消订单所用。 注:1、百度物流配送且已经确认的订单无法取消。
|
||||||
SubBizOrderId string `json:"sub_biz_order_id" required:"false"` // 商品子单ID
|
func (a *API) OrderCancel(orderID, cancelType, cancelReason string) (err error) {
|
||||||
PlatformSkuId string `json:"platform_sku_id" required:"false"` // 平台商品ID
|
_, err = a.AccessAPI("order.cancel", map[string]interface{}{
|
||||||
Number string `json:"number"`
|
"order_id": orderID,
|
||||||
RefundAmount string `json:"refund_amount"`
|
"type": cancelType,
|
||||||
|
"reason": cancelReason,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// OrderReverseApply 商户发起全退和部分退款(整合OrderPartRefund/OrderCancel)
|
||||||
|
func (a *API) OrderReverseApply(param *OrderReverseApplyParam) error {
|
||||||
|
_, err := a.AccessAPI("order.reverse.apply", utils.Struct2MapByJson(param))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
287
platformapi/ebaiapi/order_model.go
Normal file
287
platformapi/ebaiapi/order_model.go
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
package ebaiapi
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
|
MerchantOrderReverseApplyCancel = "1" // 商户发起全退
|
||||||
|
MerchantOrderReverseApplyPartCancel = "2" // 商户发起部分退款
|
||||||
|
)
|
||||||
|
|
||||||
|
type ExpressInfo struct {
|
||||||
|
OrderID string `json:"order_id"`
|
||||||
|
ExpressID string `json:"express_id"`
|
||||||
|
ExpressCompany string `json:"express_company"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PrivateMobileInfo struct {
|
||||||
|
ShortNumber string `json:"short_number"`
|
||||||
|
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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductSubsidyInfo 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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrderProductInfo struct {
|
||||||
|
BaiduProductID string `json:"baidu_product_id"`
|
||||||
|
SkuID string `json:"sku_id"` // 部分退款信息中是这个而不是BaiduProductID
|
||||||
|
SubBizOrderID string `json:"sub_biz_order_id"`
|
||||||
|
CustomSkuID string `json:"custom_sku_id"`
|
||||||
|
|
||||||
|
PackageAmount int `json:"package_amount"`
|
||||||
|
PackageFee int `json:"package_fee"`
|
||||||
|
PackagePrice int `json:"package_price"`
|
||||||
|
PrescriptionID string `json:"prescription_id"`
|
||||||
|
|
||||||
|
ProductAmount int `json:"product_amount"`
|
||||||
|
Number int `json:"number"` // 部分退款信息中是这个而不是ProductAmount
|
||||||
|
|
||||||
|
ProductAttr []interface{} `json:"product_attr"`
|
||||||
|
ProductCustomIndex string `json:"product_custom_index"`
|
||||||
|
ProductFeatures []interface{} `json:"product_features"`
|
||||||
|
ProductFee int `json:"product_fee"`
|
||||||
|
ProductName string `json:"product_name"`
|
||||||
|
ProductPrice int `json:"product_price"`
|
||||||
|
ProductSubsidy *ProductSubsidyInfo `json:"product_subsidy"`
|
||||||
|
ProductType int `json:"product_type"`
|
||||||
|
SupplyType int `json:"supply_type"`
|
||||||
|
TotalFee int `json:"total_fee"`
|
||||||
|
TotalWeight int `json:"total_weight"`
|
||||||
|
Upc string `json:"upc"`
|
||||||
|
WeightType int `json:"weight_type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrderDiscountInfo struct {
|
||||||
|
ActivityID string `json:"activity_id"`
|
||||||
|
AgentRate int `json:"agent_rate"`
|
||||||
|
BaiduRate int `json:"baidu_rate"`
|
||||||
|
Desc string `json:"desc"`
|
||||||
|
Fee int `json:"fee"`
|
||||||
|
LogisticsRate int `json:"logistics_rate"`
|
||||||
|
Products []*struct {
|
||||||
|
ActivityID string `json:"activity_id"`
|
||||||
|
ActivityProductNum int `json:"activity_product_num"`
|
||||||
|
BaiduProductID int64 `json:"baidu_product_id"`
|
||||||
|
NowPrice int `json:"now_price"`
|
||||||
|
OrigPrice int `json:"orig_price"`
|
||||||
|
SavePrice int `json:"save_price"`
|
||||||
|
} `json:"products,omitempty"`
|
||||||
|
RuleID string `json:"rule_id"`
|
||||||
|
ShopRate int `json:"shop_rate"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrderDetailInfo struct {
|
||||||
|
Discount []*OrderDiscountInfo `json:"discount"`
|
||||||
|
Order *struct {
|
||||||
|
AtshopTime int `json:"atshop_time"`
|
||||||
|
CancelTime string `json:"cancel_time"`
|
||||||
|
ColdBoxFee string `json:"cold_box_fee"`
|
||||||
|
Commission int `json:"commission"`
|
||||||
|
ConfirmTime string `json:"confirm_time"`
|
||||||
|
CreateTime string `json:"create_time"`
|
||||||
|
DeliveryParty int `json:"delivery_party"` // 此字段会在配送变化后变化
|
||||||
|
DeliveryPhone string `json:"delivery_phone"`
|
||||||
|
DeliveryTime int `json:"delivery_time"`
|
||||||
|
DiscountFee int `json:"discount_fee"`
|
||||||
|
DownFlag int `json:"down_flag"`
|
||||||
|
ElemeOrderID string `json:"eleme_order_id"`
|
||||||
|
ExpectTimeMode int `json:"expect_time_mode"`
|
||||||
|
Ext struct {
|
||||||
|
TaoxiFlag int `json:"taoxi_flag"`
|
||||||
|
} `json:"ext"`
|
||||||
|
FinishedTime string `json:"finished_time"`
|
||||||
|
InvoiceTitle string `json:"invoice_title"`
|
||||||
|
IsColdBoxOrder int `json:"is_cold_box_order"`
|
||||||
|
IsPrivate int `json:"is_private"`
|
||||||
|
LatestSendTime int `json:"latest_send_time"`
|
||||||
|
MealNum string `json:"meal_num"`
|
||||||
|
NeedInvoice int `json:"need_invoice"`
|
||||||
|
OrderFlag int `json:"order_flag"`
|
||||||
|
OrderFrom string `json:"order_from"`
|
||||||
|
OrderID string `json:"order_id"`
|
||||||
|
OrderIndex string `json:"order_index"`
|
||||||
|
PackageFee int `json:"package_fee"`
|
||||||
|
PayStatus int `json:"pay_status"`
|
||||||
|
PayType int `json:"pay_type"`
|
||||||
|
PickupTime int `json:"pickup_time"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
// ResponsibleParty string `json:"responsible_party"`
|
||||||
|
SendFee int `json:"send_fee"`
|
||||||
|
SendImmediately int `json:"send_immediately"`
|
||||||
|
SendTime int `json:"send_time"`
|
||||||
|
ShopFee int `json:"shop_fee"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
TaxerID string `json:"taxer_id"`
|
||||||
|
TotalFee int `json:"total_fee"`
|
||||||
|
UserFee int `json:"user_fee"`
|
||||||
|
} `json:"order"`
|
||||||
|
Products [][]*OrderProductInfo `json:"products"`
|
||||||
|
Shop *struct {
|
||||||
|
BaiduShopID string `json:"baidu_shop_id"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
} `json:"shop"`
|
||||||
|
Source string `json:"source"`
|
||||||
|
User *struct {
|
||||||
|
Address string `json:"address"`
|
||||||
|
// City string `json:"city"`
|
||||||
|
Coord *struct {
|
||||||
|
Latitude string `json:"latitude"`
|
||||||
|
Longitude string `json:"longitude"`
|
||||||
|
} `json:"coord"`
|
||||||
|
CoordAmap *struct {
|
||||||
|
Latitude string `json:"latitude"`
|
||||||
|
Longitude string `json:"longitude"`
|
||||||
|
} `json:"coord_amap"`
|
||||||
|
// District string `json:"district"`
|
||||||
|
Gender string `json:"gender"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Phone string `json:"phone"`
|
||||||
|
PrivacyPhone string `json:"privacy_phone"`
|
||||||
|
// Province string `json:"province"`
|
||||||
|
UserID string `json:"user_id"`
|
||||||
|
} `json:"user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RefundOrderDetailInfo 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 *ProductSubsidyInfo `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 []*RefundOrderDetailInfo `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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListOrderItemInfo struct {
|
||||||
|
BaiduShopID int64 `json:"baidu_shop_id"`
|
||||||
|
CreateTime int64 `json:"create_time"`
|
||||||
|
OrderFrom int `json:"order_from"`
|
||||||
|
OrderID string `json:"order_id"`
|
||||||
|
OrderStatus int `json:"order_status"`
|
||||||
|
PayStatus int `json:"pay_status"`
|
||||||
|
PayType int `json:"pay_type"`
|
||||||
|
ShopID string `json:"shop_id"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
UserPhone string `json:"user_phone"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListOrderInfo struct {
|
||||||
|
Total int `json:"total"`
|
||||||
|
Page int `json:"Page"`
|
||||||
|
Pages int `json:"pages"`
|
||||||
|
List []*ListOrderItemInfo `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PushRiderInfo struct {
|
||||||
|
DistributorId int `json:"distributor_id"` // 固定值:201
|
||||||
|
Knight Knight `json:"knight"`
|
||||||
|
OrderId string // 订单id
|
||||||
|
State int // 配送状态,传固定值:21 开始配送(已废弃,已接入商家不影响)
|
||||||
|
SelfStatus int `json:"selfStatus"` // 配送状态
|
||||||
|
SelfStatusDesc string `json:"selfStatusDesc"` // 配送状态文案描述
|
||||||
|
SelfSubStatus int `json:"selfSubStatus"` // 配送取消(6)子原因:
|
||||||
|
SelfSubStatusDesc string `json:"selfSubStatusDesc"` // 配送异常子状态文案描述
|
||||||
|
DistributorInfoDTO DistributorInfoDTO `json:"distributorInfoDTO"` // 配送服务商信息
|
||||||
|
}
|
||||||
|
type Knight struct {
|
||||||
|
Id int64 `json:"id"` // 骑手id,商家自定义
|
||||||
|
Name string `json:"name"` // 骑手姓名
|
||||||
|
Phone string `json:"phone"` // 骑手手机号码
|
||||||
|
}
|
||||||
|
|
||||||
|
type DistributorInfoDTO struct {
|
||||||
|
DistributorTypeId string `json:"distributorTypeId"` // 配送商类型id:
|
||||||
|
DistributorName string `json:"distributorName"` // 配送商名称
|
||||||
|
DistributorPhone string `json:"distributorPhone"` // 配送商电话
|
||||||
|
}
|
||||||
|
|
||||||
|
// RefundOrderExamine 商家审核是售后单
|
||||||
|
type RefundOrderExamine struct {
|
||||||
|
ReverseOrderId string `json:"reverse_order_id" required:"true"` // 逆向单ID
|
||||||
|
OrderId string `json:"order_id" required:"true"` // 订单id
|
||||||
|
IdempotentId string `json:"idempotent_id" required:"true"` // 请求唯一标示
|
||||||
|
ActionType string `json:"action_type" required:"true"` // 逆向单审批操作类型,枚举值:【1-同意全单/部分退款申请 、 2-拒绝全单/部分退款申请、 3-同意退货申请 、 4-拒绝退货申请】
|
||||||
|
ReasonCode string `json:"reason_code" required:"false"` // 当拒绝场景必填,即action_type = 2 or action_type =4 时 必填,枚举值: 7019-双方协商一致不再取消订单、 7020-商品已经备货完成、 7021-商品已送出、 7802-商品发出时完好、 7803-用户未举证/举证无效、 7804-商品影响二次销售、 7805-商品不符合7天无理由退款、 7302-未收到退货(仅退货单支持传入该code)、 7001-其他原因
|
||||||
|
ReasonRemarks string `json:"reason_remarks" required:"false"` // 原因备注说明信息
|
||||||
|
RefundProductList []*RefundProductList `json:"refund_product_list" required:"false"` // 订单id
|
||||||
|
}
|
||||||
|
|
||||||
|
type RefundProductList struct {
|
||||||
|
SubBizOrderId string `json:"sub_biz_order_id" required:"false"` // 商品子单ID
|
||||||
|
PlatformSkuId string `json:"platform_sku_id" required:"false"` // 平台商品ID
|
||||||
|
Number string `json:"number"`
|
||||||
|
RefundAmount string `json:"refund_amount"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OrderReverseApplyParam 商家发起取消订单或者部分退款
|
||||||
|
type OrderReverseApplyParam struct {
|
||||||
|
OrderId string `json:"order_id"` // 订单号
|
||||||
|
IdempotentId string `json:"idempotent_id"` // 幂等id (商家自定义,同一操作重试需保证幂等Id一致)
|
||||||
|
RefundType string `json:"refund_type"` // 申请退款类型, 枚举值:1 全退 , 2 部分退(按商品部分退),如 部分退(2) 则 refund_product_list 参数不能为空
|
||||||
|
ReasonCode string `json:"reason_code"` // 发起退款原因 code,枚举值:7015-商品已售完、 7017-无骑手接单/无运力、 7053-骑手无法配送、 7054-无法联系到用户(未接听、关机、号码错误)、 7018-商户暂时不营业、 7070-拣货人力不足、 7908-补差退款、 7001-其他原因、 7052-药师审核处方笺不通过(仅支持医药处方订单)、7080-包装费退款(仅支持订单级包装费可选)
|
||||||
|
ReasonRemarks string `json:"reason_remarks"` // 详细原因信息,reason_code为7001时必填
|
||||||
|
NeedIvrUser int64 `json:"need_ivr_user"` // 非必填,reason_code为7015 缺货售中部分取消退款场景,是否需要平台外呼通知用户,仅refund_type=2时 传入有效;枚举值: 1:通知 , 0 or null :不通知
|
||||||
|
RefundProductList []*RefundProductListParam `json:"refund_product_list"` // 申请退款商品列表信息(非必填),部分退( refund_type = 2)时,refund_product_list 必填
|
||||||
|
}
|
||||||
|
|
||||||
|
// RefundProductListParam 申请退款商品列表信息
|
||||||
|
type RefundProductListParam struct {
|
||||||
|
SubBizOrderId string `json:"sub_biz_order_id"` // 子单ID,对应订单中商品唯一ID
|
||||||
|
PlatformSkuId string `json:"platform_sku_id"` // 平台商品ID
|
||||||
|
Number string `json:"number"` // 申请退款件数(整型),范围:1-商品最大可退(通过order.reverse.consult接口查询),称重品金支持按金额退款,需指定refund_amount进行退款,传入数量无效
|
||||||
|
RefundAmount string `json:"refund_amount"` // 申请退款金额(单位 分,整型)
|
||||||
|
FundCalculateType string `json:"fund_calculate_type"` // 非必填,部分退类型:0按件数退,1按照金额退, 默认为按件数退(0); 按件退 number字段必传, 按金额退 refund_amount字段必传
|
||||||
|
}
|
||||||
@@ -11,10 +11,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCancelOrder(t *testing.T) {
|
func TestCancelOrder(t *testing.T) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderGet(t *testing.T) {
|
func TestOrderGet(t *testing.T) {
|
||||||
result, err := api.OrderGet("4013460139778872942")
|
result, err := api.OrderGet2("4013460139778872942")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user