package fnpsapi

//
//import (
//	"encoding/json"
//	"fmt"
//	"git.rosy.net.cn/baseapi"
//	"go.uber.org/zap"
//	"testing"
//)
//
//var (
//	api         *API
//	sugarLogger *zap.SugaredLogger
//)
//
//func init() {
//	logger, _ := zap.NewDevelopment()
//	sugarLogger = logger.Sugar()
//	baseapi.Init(sugarLogger)
//
//	//api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "cabrXQf9eFMVWVYg4hNlwu")
//	//token, _ := api.GetAccessToken()
//	//api.accessToken = token.BusinessDataObj.AccessToken
//}
//
//// 查询单个门店
//func TestQueryOneStore(t *testing.T) {
//	api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "")
//	token, err := api.GetAccessToken()
//	api.accessToken = token.BusinessDataObj.AccessToken
//	data, err := api.GetStore("209476483")
//	fmt.Println(data)
//	fmt.Println(err)
//}
//
//// 正式下单
//func TestCreateOrder(t *testing.T) {
//	api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "")
//	token, err := api.GetAccessToken()
//	fmt.Println("22222222222", err)
//	api.accessToken = token.BusinessDataObj.AccessToken
//
//	aa := []*GoodsItemsList{
//		{"白菜", 1, 100, 100, "30011", 1, "备注:大白菜"},
//		//{"白菜2", 1, 100, 100, "30012", 1, "备注:大白菜2"},
//		//	{"白菜3", 1, 100, 100, "1004", 1, "备注:大白菜2"},
//	}
//	_, err = api.CreateOrder(&CreateOrderReqParam{
//		PartnerOrderCode:      "232232992229uue21",
//		OrderType:             1,
//		PositionSource:        3,
//		ReceiverAddress:       "四川成都",
//		ReceiverLongitude:     116.307892,
//		ReceiverLatitude:      40.039115,
//		GoodsTotalAmountCent:  100,
//		GoodsActualAmountCent: 100,
//		GoodsWeight:           0.25,
//		GoodsCount:            1,
//		GoodsItemList:         aa,
//		ReceiverName:          "刘磊",
//		ReceiverPrimaryPhone:  "18981810340",
//		OutShopCode:           "",
//		ChainStoreId:          "209476483",
//	})
//	fmt.Println(err)
//}
//
//// 创建门店,
//func TestCreateStore(t *testing.T) {
//	api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "cabrXQf9eFMVWVYg4hNlwu")
//	token, _ := api.GetAccessToken()
//	api.accessToken = token.BusinessDataObj.AccessToken
//	err, _ := api.CreateStore(&CreateStoreBaseInfo{
//		HeadShopName:           "刘磊测试门店",
//		ContactPhone:           "18981810340",
//		Address:                "四川成都",
//		Longitude:              104.094555,
//		Latitude:               30.661382,
//		PositionSource:         3,
//		OutShopCode:            "637910",
//		CategoryID:             "12",
//		OwnerName:              "刘磊",
//		OwnerIDNum:             "511324199308263974",
//		HandheldLicencePicHash: "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//		OwnerIDPicFrontHash:    "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//		OwnerIDPicBackHash:     "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//		CreditCode:             "12345",
//		BusinessLicencePicHash: "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//
//		BranchShopName:                       "",
//		ChainstoreType:                       2,
//		SettlementModel:                      "1",
//		SettlementAccountID:                  "",
//		FoodLicensePicHash:                   "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//		SecondMedicalEquipmentLicensePicHash: "",
//		MedicalInstitutionLicensePicHash:     "",
//		MedicalEquipmentLicensePicHash:       "",
//		MedicineLicensePicHash:               "",
//		TabacooLicensePicHash:                "",
//	})
//	fmt.Println(err)
//}
//
//func TestUpdataStore(t *testing.T) {
//	api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "cabrXQf9eFMVWVYg4hNlwu")
//	token, _ := api.GetAccessToken()
//	api.accessToken = token.BusinessDataObj.AccessToken
//	err := api.UpdateStore(&UpdateStoreParam{
//		ChainStoreID:           209636747,
//		HeadShopName:           "刘磊测试门店",
//		ContactPhone:           "18981810340",
//		Address:                "四川成都",
//		Longitude:              104.094555,
//		Latitude:               30.661382,
//		PositionSource:         3,
//		OutShopCode:            "637910",
//		CategoryID:             "12",
//		OwnerName:              "刘磊",
//		OwnerIDNum:             "511324199308263974",
//		HandheldLicencePicHash: "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//		OwnerIDPicFrontHash:    "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//		OwnerIDPicBackHash:     "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//		CreditCode:             "12345",
//		BusinessLicencePicHash: "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//
//		BranchShopName:                       "",
//		ChainstoreType:                       2,
//		FoodLicensePicHash:                   "d7c64022f6458f9aa76968e01f5686c5.jpeg",
//		SecondMedicalEquipmentLicensePicHash: "",
//		MedicalInstitutionLicensePicHash:     "",
//		MedicalEquipmentLicensePicHash:       "",
//		MedicineLicensePicHash:               "",
//		TabacooLicensePicHash:                "",
//	})
//	fmt.Println(err)
//}
//
//func TestClient(t *testing.T) {
//	api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "51658", "4W4hqacKND6NOct5gCyjbT")
//	token, err := api.GetAccessToken()
//	api.accessToken = token.BusinessDataObj.AccessToken
//	fmt.Println("token===", token.BusinessDataObj.AccessToken)
//	fmt.Println("err=====", err)
//}
//
//// 预下单
//func TestGetOrder(t *testing.T) {
//	api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "")
//	token, _ := api.GetAccessToken()
//	api.accessToken = token.BusinessDataObj.AccessToken
//
//	aa := []*GoodsItemsList{
//		{"白菜", 1, 100, 100, "30011", 1, "备注:大白菜"},
//		{"白菜2", 1, 100, 100, "30012", 1, "备注:大白菜2"},
//		//	{"白菜3", 1, 100, 100, "1004", 1, "备注:大白菜2"},
//	}
//	deliveryFee, baseDeliveryFee, err := api.PreCreateByShopFn(&PreCreateOrder{
//		PartnerOrderCode:      "817102016000041",
//		OrderType:             1,
//		PositionSource:        3,
//		ReceiverAddress:       "四川成都",
//		ReceiverLongitude:     104.093445,
//		ReceiverLatitude:      30.661585,
//		GoodsTotalAmountCent:  100,
//		GoodsActualAmountCent: 100,
//		GoodsWeight:           0.25,
//		GoodsCount:            1,
//		GoodsItemList:         aa,
//		//ServiceGoodsId:        nil,
//		//BaseGoodsId:           nil,
//		//OutShopCode:           "637910",
//		ChainStoreID: "209476483",
//	})
//	fmt.Println(err)
//	fmt.Println(deliveryFee)
//	fmt.Println(baseDeliveryFee)
//}
//
//func TestDataUnmas(t *testing.T) {
//	data := `{"signature":"5a4270c8fb3c4a3a641d2f5f66990c503c7248ecd51248b020e0b44db75a6761","app_id":"6705486294797503379","timestamp":"1648861445686","business_data":"{\"callback_business_type\":\"orderStatusNotify\",\"param\":{\"app_id\":\"6705486294797503379\",\"carrier_driver_name\":\"\",\"carrier_driver_phone\":\"\",\"order_id\":300000388333833530,\"order_status\":1,\"partner_order_code\":\"88386523916938\",\"push_time\":1648861445686,\"transfer\":0}}"}`
//	fnNotify := &ShortStatus{}
//	if err := json.Unmarshal([]byte(data), fnNotify); err != nil {
//		baseapi.SugarLogger.Debugf("FN callback string to ChainstoreStatusNotify  failed with err:%v", err)
//	}
//
//	fmt.Println("data", fnNotify.BusinessData)
//	fmt.Println("data", fnNotify.AppId)
//	fmt.Println("data", fnNotify.Signature)
//
//	retsult := &OrderStatusNottify{}
//	err := json.Unmarshal([]byte(fnNotify.BusinessData), retsult)
//	fmt.Println("err1======", err)
//	fmt.Println("retsult", retsult)
//	fmt.Println("retsult", retsult.Param)
//	fmt.Println("retsult", retsult.CallbackBusinessType)
//	fmt.Println("retsult", retsult.Param.PartnerOrderCode)
//}
//
//func TestDaDa(t *testing.T) {
//	fmt.Println("美团", 1&1)
//	fmt.Println("达达", 2&1)
//	fmt.Println("蜂鸟", 4&1)
//
//	fmt.Println("美团", 1&0)
//	fmt.Println("达达", 2&0)
//	fmt.Println("蜂鸟", 4&0)
//}
