package fnpsapi

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

func TestPreCreateOrder(t *testing.T) {
	result, err := apiv3.PreCreateOrder(&PreCreateOrderParam{
		PartnerOrderCode:      "2118717546000352",
		OutShopCode:           "667002",
		OrderType:             1,
		PositionSource:        3,
		ReceiverAddress:       "徐州市泉山区大润发(欣欣店)一楼咔啦嘟熊童装店",
		ReceiverLongitude:     117.195360,
		ReceiverLatitude:      34.201010,
		GoodsTotalAmountCent:  66.2,
		GoodsActualAmountCent: 67.2,
		GoodsWeight:           2.3,
		GoodsCount:            6,
		GoodsItemList: []*ItemsJSON2{
			&ItemsJSON2{
				ItemName:             "巨峰葡萄约500g/份",
				ItemQuantity:         2,
				ItemAmountCent:       15.2,
				ItemActualAmountCent: 15.2,
			},
			&ItemsJSON2{
				ItemName:             "[新鲜]苹果150g/个(约150g-250g)",
				ItemQuantity:         2,
				ItemAmountCent:       4.3,
				ItemActualAmountCent: 4.3,
			},
			&ItemsJSON2{
				ItemName:             "脆桃 鲜，甜，脆约500g/份",
				ItemQuantity:         2,
				ItemAmountCent:       14.6,
				ItemActualAmountCent: 14.6,
			},
		},
	})
	if err != nil {
		t.Fatal(err)
	}
	t.Log(utils.Format4Output(result, false))
}
