173 lines
3.8 KiB
Go
173 lines
3.8 KiB
Go
package mtwmapi
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
)
|
|
|
|
func TestOrderViewStatus(t *testing.T) {
|
|
result, err := api.OrderViewStatus(123)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(result)
|
|
}
|
|
|
|
func TestOrderGetOrderDetail(t *testing.T) {
|
|
result, err := api.OrderGetOrderDetail(93475541926981203, false)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(result) == 0 {
|
|
t.Fatal("result should have value")
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestOrderGetOrderDetail2(t *testing.T) {
|
|
result, err := api.OrderGetOrderDetail2(98467110652448221, false)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestOrderGetPartRefundFoods(t *testing.T) {
|
|
result, err := api.OrderGetPartRefundFoods(93475541926981203)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestOrderReceived(t *testing.T) {
|
|
err := api.OrderReceived(25236872740350976)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestOrderConfirm(t *testing.T) {
|
|
err := api.OrderConfirm(27058923254735296)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestOrderApplyPartRefund(t *testing.T) {
|
|
err := api.OrderApplyPartRefund(93495654059392270, "缺货", []*RefundSku{
|
|
&RefundSku{
|
|
AppFoodCode: "30831",
|
|
Count: 1,
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestOrderLogisticsStatus(t *testing.T) {
|
|
result, err := api.OrderLogisticsStatus(33762863658107006)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(result) == 0 {
|
|
t.Fatal("result should have value")
|
|
}
|
|
// t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestOrderBatchPullPhoneNumber(t *testing.T) {
|
|
result, err := api.OrderBatchPullPhoneNumber("5873_2705892", 0, MaxBatchPullPhoneNumberLimit)
|
|
t.Log(utils.Format4Output(result, false))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestOrderGetRiderInfoPhoneNumber(t *testing.T) {
|
|
result, err := api.OrderGetRiderInfoPhoneNumber(testPoiCode, 0, MaxBatchPullPhoneNumberLimit)
|
|
t.Log(utils.Format4Output(result, false))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestGetOrderRefundDetail(t *testing.T) {
|
|
result, err := api.GetOrderRefundDetail(25236870166465610, RefundTypePart)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestGetOrderActDetaill(t *testing.T) {
|
|
result, err := api.GetOrderActDetail([]*GetOrderActDetailParam{
|
|
&GetOrderActDetailParam{
|
|
OrderID: 69760842061320598,
|
|
// ActParam: []*GetOrderActDetailParamAct{
|
|
// &GetOrderActDetailParamAct{
|
|
// Type: 1,
|
|
// },
|
|
// },
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestGetOrderIdByDaySeq(t *testing.T) {
|
|
result, err := api.GetOrderIdByDaySeq("10874383", utils.Time2Date(time.Now()), 1, MaxGap4GetOrderIdByDaySeq)
|
|
t.Log(utils.Format4Output(result, false))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestGetOrderIdByDaySeqSingle(t *testing.T) {
|
|
result, err := api.GetOrderIdByDaySeqSingle("7111597", utils.Time2Date(time.Now()), 1)
|
|
t.Log(utils.Format4Output(result, false))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestOrderRefundReject(t *testing.T) {
|
|
err := api.OrderRefundReject(27058923254735296, "测试")
|
|
// t.Log(utils.Format4Output(result, false))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestOrderRefundAgree(t *testing.T) {
|
|
err := api.OrderRefundAgree(27058922456066076, "测试")
|
|
// t.Log(utils.Format4Output(result, false))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestOrderCancel(t *testing.T) {
|
|
err := api.OrderCancel(27058922397679200, "取消", 1)
|
|
// t.Log(utils.Format4Output(result, false))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestAa2(t *testing.T) {
|
|
time := time.Now().Unix()
|
|
fmt.Println(api.signParams(apiURL+"/oauth/authorize?", map[string]interface{}{
|
|
"timestamp": time,
|
|
"app_id": "5873",
|
|
"app_poi_code": "5873_2705892",
|
|
"response_type": "token",
|
|
}), time)
|
|
}
|