package walmart

import (
	"context"
	redeemModel "kami/utility/integration/redeem"
	"testing"

	"github.com/gogf/gf/v2/encoding/gjson"
	"github.com/gogf/gf/v2/os/gctx"
	"github.com/gogf/gf/v2/os/glog"
	"github.com/gogf/gf/v2/util/gconv"
)

func TestClient_QueryBalance(t *testing.T) {
	client := Client{}
	client.QueryBalance(gctx.New(), &redeemModel.QueryBalanceReq{
		Cookie: "e31f54a10bf7459687a7822e971eac17@190c0cdab0d939a5394a124612fe50eb",
	})
}

func TestClient_QueryCard(t *testing.T) {
	client := Client{}
	client.QueryCard(gctx.New(), &redeemModel.CommonSendCardReq{
		Cookie: "e31f54a10bf7459687a7822e971eac17@190c0cdab0d939a5394a124612fe50eb",
		CardNo: "2326992090574709372",
	})
}

func TestClient_BindCard(t *testing.T) {
	//client := Client{}
	//client.BindCard(gctx.New(), &redeemModel.CommonSendCardReq{
	//	Cookie:      "e31f54a10bf7459687a7822e971eac17@190c0cdab0d939a5394a124612fe50eb",
	//	CardNo:      "2326992090574709364",
	//	GiftCardPwd: "206957",
	//	OrderAmount: 10,
	//})
	unicodeString := "{\"code\":20016,\"data\":{\"money\":\"0.0\"},\"msg\":\"\\u8bf7\\u6c42\\u6210\\u529f\"}"

	var respSt QueryCardResp
	if err := gjson.DecodeTo(unicodeString, &respSt); err != nil {
		glog.Error(context.Background(), "查询充值卡余额失败", err, gconv.String(unicodeString))
	}
	glog.Info(context.Background(), "查询充值卡余额", respSt)
}
