186 lines
4.0 KiB
Go
186 lines
4.0 KiB
Go
package mtwmapi
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"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(1100335050573312765, 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(1300248543772157444, 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(140382472052682640)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if 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("8872485", 0, MaxBatchPullPhoneNumberLimit)
|
|
t.Log(utils.Format4Output(result, false))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestGetOrderRefundDetail(t *testing.T) {
|
|
result, err := api.GetOrderRefundDetail(70263190513673732, 0)
|
|
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("8050205", utils.Str2Time("2021-02-21"), 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": "12422751",
|
|
"response_type": "token",
|
|
}), time)
|
|
}
|
|
|
|
func TestDeleving(t *testing.T) {
|
|
err := api.OrderLogisticsChange2Self(148815413321281654)
|
|
|
|
fmt.Println(strings.Contains(err.Error(), "1047"))
|
|
t.Fatal(err)
|
|
}
|
|
|
|
func TestOrderDelivering(t *testing.T) {
|
|
err := api.OrderDelivering(148815413321281654)
|
|
t.Fatal(err)
|
|
}
|