package ejyapi

import (
	"testing"

	"git.rosy.net.cn/baseapi"
	"git.rosy.net.cn/baseapi/utils"
	"go.uber.org/zap"
)

var (
	api         *API
	sugarLogger *zap.SugaredLogger
)

func init() {
	logger, _ := zap.NewDevelopment()
	sugarLogger = logger.Sugar()
	baseapi.Init(sugarLogger)
	// api = New("1Zbve", "ymsrrxlZXlmglK6Q", "MYsFZGgwwprIahzQ")
	api = New("1Zbve", "htvse3XEDhBnCTNo", "QM5RnGl6kNh3ENLT")
}

func TestGetStationList(t *testing.T) {
	result, err := api.GetStationList()
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}

func TestGetUserOrders(t *testing.T) {
	result, err := api.GetUserOrders("13688462300", 1)
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}

func TestUserRefund(t *testing.T) {
	result, err := api.UserRefund("9000000020023544", "13111111111", "测试")
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}
