Files
jx-callback/business/partner/purchase/ebai/financial_test.go

41 lines
896 B
Go

package ebai
import (
"encoding/json"
"fmt"
"testing"
"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) {
msg := &ebaiapi.CallbackMsg{
Timestamp: time.Now().Unix(),
Body: make(map[string]interface{}),
}
msg.Body["order_id"] = "1554939646172038357"
// 部分退款
msg.Cmd = "order.partrefund.push"
msg.Body["status"] = json.Number("20")
// 全单退款
// msg.Cmd = "order.user.cancel"
// msg.Body["type"] = json.Number("40")
// msg.Body["cancel_type"] = json.Number("2")
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)
}
}