package lakala

import (
	"git.rosy.net.cn/baseapi/utils"
	"git.rosy.net.cn/jx-callback/globals"
	"testing"
)

func TestPayStatusQuery(t *testing.T) {
	api.PayStatusQuery(&PayStatusQueryReq{
		MerchantNo: "822290059430BFA",
		TermNo:     "29034705",
		OutTradeNo: "FD660E1FAA3A4470933CDEDAE1EC1D8E",
		TradeNo:    "",
	})
}

func TestClosePay(t *testing.T) {
	api.ClosePay(&ClosePayMiniOrder{
		MerchantNo:       "822651059990E2S",
		TermNo:           "M3595962",
		OriginOutTradeNo: "88491756370416",
		OriginTradeNo:    "",
		LocationInfo: struct {
			RequestIp   string `json:"request_ip"`
			BaseStation string `json:"base_station"`
			Location    string `json:"location"`
		}{
			RequestIp: "127.0.0.1",
		},
	})
}

func TestCardBin(t *testing.T) {
	result, err := api.QueryCarBin(GetOrderNumber(8), OrgCode, "4275711234554321")
	globals.SugarLogger.Debugf("result := %s", utils.Format4Output(result, false))
	globals.SugarLogger.Debugf("result := %v", err)
}

func TestPayActive(t *testing.T) {
	api.AggregatePay(&AggregatePayReq{
		MerchantNo:        "",
		TermNo:            "",
		OutTradeNo:        "",
		AccountType:       "",
		TransType:         "",
		TotalAmount:       "",
		LocationInfo:      LocationInfoObj{},
		BusiMode:          "",
		Subject:           "",
		PayOrderNo:        "",
		NotifyUrl:         "",
		SettleType:        "",
		Remark:            "",
		PnrInsIdCd:        "",
		AccBusiFields:     nil,
		CompleteNotifyUrl: "",
	})
}

func TestAggregateRefund(t *testing.T) {
	api.AggregateRefund(&AggregateRefundReq{
		MerchantNo:       "822651059990E2S",
		TermNo:           "M3595962",
		OutTradeNo:       "88492359533733-1",
		RefundAmount:     "100",
		RefundReason:     "测试",
		OriginOutTradeNo: "88492359533733",
		OriginTradeNo:    "",
		OriginLogNo:      "66222344989495",
		LocationInfo:     LocationInfoObj{RequestIp: "192.168.255.132"},
	})
}
