package alipayapi

import (
	"git.rosy.net.cn/baseapi/utils"
	"testing"
)

func TestCreatePay(t *testing.T) {
	result, err := api.CreatePay(&CreatePayParam{
		OutTradeNo:  utils.GetUUID(),
		TotalAmount: 0.01,
		Subject:     "测试订单",
		StoreID:     "100000",
		BuyerID:     "2088912877320980",
	})
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}

func TestCreatePay2(t *testing.T) {
	result, err := api.CreatePay2(&CreatePayParam2{
		OutTradeNo:  "21175111420002544",
		TotalAmount: 0.01,
		Subject:     "xxx店",
		StoreID:     "100000",
		QuitURL:     "http://www.jxc4.com",
		ProductCode: "QUICK_WAP_WAY",
	})
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}

func TestCreatePay3(t *testing.T) {
	result, err := api.CreatePay3(&CreatePayParam3{
		TotalAmount: 0.01,
		StoreID:     "2021072600077000000025212127",
		OutTradeNo:  utils.GetUUID(),
	})
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}

// 提现操作
func TestCreatePay4(t *testing.T) {
	data, err := api.Withdrawal4AliPay(&WithdrawalParam{
		OutBizNo:    "199308263974Dx171632",
		TransAmount: 0.1,
		ProductCode: "1",
		BizScene:    "1",
		OrderTitle:  "哈哈哈",
		PayeeInfo: &PayeeInfoParam{
			Identity:     "15729837802",
			Name:         "张树伟",
			IdentityType: "1",
		},
		Remark: "ceshituikuan",
	})
	t.Log("data===========", utils.Format4Output(data, false))
	t.Log("err===========", err)
}
