饿百由于订单降级而导致结账数据有误 优化
This commit is contained in:
@@ -161,10 +161,21 @@ func (p *PurchaseHandler) AfsOrderDetail2Financial(orderData map[string]interfac
|
||||
|
||||
// 存储饿百正向订单结账信息
|
||||
func (p *PurchaseHandler) OnOrderDetail(result map[string]interface{}, operation string) (err error) {
|
||||
err = partner.CurOrderManager.SaveOrderFinancialInfo(p.OrderDetail2Financial(result), operation)
|
||||
err = partner.CurOrderManager.SaveOrderFinancialInfo(p.OrderDetail2Financial(p.GetTrueEbaiOrder(result)), operation)
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetTrueEbaiOrder(result1 map[string]interface{}) (result2 map[string]interface{}) {
|
||||
order := result1["order"].(map[string]interface{})
|
||||
if utils.MustInterface2Int64(order["down_flag"]) == 1 {
|
||||
result, err := api.EbaiAPI.OrderGet(utils.Interface2String(order["order_id"]))
|
||||
if err == nil {
|
||||
return p.GetTrueEbaiOrder(result)
|
||||
}
|
||||
}
|
||||
return result1
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) OrderDetail2Financial(result map[string]interface{}) (orderFinancial *model.OrderFinancial) {
|
||||
orderFinancial = &model.OrderFinancial{
|
||||
VendorID: model.VendorIDEBAI,
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
func TestOnFinancialMsg(t *testing.T) {
|
||||
@@ -28,3 +30,11 @@ func TestOnFinancialMsg(t *testing.T) {
|
||||
res := OnFinancialMsg(msg)
|
||||
fmt.Println(res)
|
||||
}
|
||||
|
||||
func TestOnOrderDetail(t *testing.T) {
|
||||
orderID := "1554939646172038357"
|
||||
result, err := api.EbaiAPI.OrderGet(orderID)
|
||||
if err == nil {
|
||||
new(PurchaseHandler).OnOrderDetail(result, partner.CreatedPeration)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user