将美团和饿百取消订单申请索赔整合到interface中
This commit is contained in:
@@ -83,8 +83,6 @@ func (p *PurchaseHandler) getStatusFromVendorStatus(vendorStatus string) int {
|
||||
|
||||
func (p *PurchaseHandler) GetOrder(vendorOrgCode, vendorOrderID, vendorStoreID string) (order *model.GoodsOrder, err error) {
|
||||
order, _, err = p.getOrder(vendorOrderID)
|
||||
globals.SugarLogger.Debugf("---------order GetOrder := %s", utils.Format4Output(order, false))
|
||||
globals.SugarLogger.Debugf("---------order err := %v", err)
|
||||
return order, err
|
||||
}
|
||||
|
||||
@@ -1012,3 +1010,36 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64
|
||||
func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
// ApplyCompensationOrder 订单索赔
|
||||
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
|
||||
afsOrderList, err := dao.GetAfsOrders(dao.GetDB(), order.VendorID, order.VendorOrderID, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
refundList := make([]*ebaiapi.ApplyCompensationList, 0, 0)
|
||||
for _, v := range afsOrderList {
|
||||
if v.AfsOrderID != v.VendorOrderID {
|
||||
refundList = append(refundList, &ebaiapi.ApplyCompensationList{
|
||||
RefundId: v.AfsOrderID,
|
||||
CompensationReason: ebaiapi.CompensationCodeE1,
|
||||
Description: "分配骑手缓慢/骑手到店缓慢",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if len(refundList) > 0 {
|
||||
result, err := api.EbaiAPI.ApplyCompensation(order.VendorOrderID, refundList)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
compensationStation := make([]string, 0, 0)
|
||||
for _, r := range result {
|
||||
compensationStation = append(compensationStation, fmt.Sprintf("售后ID:%s,索赔状态:%s,失败:%s", r.RefundId, r.CompensationStatusDesc, r.CompensationFailDesc))
|
||||
}
|
||||
|
||||
return strings.Join(compensationStation, ","), nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user