sfps
This commit is contained in:
109
platformapi/sfps2/sf_test.go
Normal file
109
platformapi/sfps2/sf_test.go
Normal file
@@ -0,0 +1,109 @@
|
||||
package sfps2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var api = New(AppID, AppKey)
|
||||
|
||||
const (
|
||||
AppID = 1663705378 //开发者ID
|
||||
AppKey = "0838426b310fd2530c57dd6e770ddff1" //开发者密钥
|
||||
TestSFStoreID = "3243279847393" //open测试平台型店铺
|
||||
)
|
||||
|
||||
//预下单
|
||||
func TestPreCreateOrder(t *testing.T) {
|
||||
param := &PreCreateOrderReq{
|
||||
DevId: AppID,
|
||||
ShopId: TestSFStoreID,
|
||||
UserLng: "116.339392",
|
||||
UserLat: "40.002349",
|
||||
UserAddress: "北京市海淀区学清嘉创大厦A座15层",
|
||||
Weight: 1000,
|
||||
ProductType: 4,
|
||||
PushTime: 1684379930,
|
||||
ShopType: 1,
|
||||
LbsType: LbsTypeGD,
|
||||
RiderPickMethod: 1,
|
||||
ReturnFlag: 1,
|
||||
//IsAppoint: 0,
|
||||
//AppointType: 2,
|
||||
//ExpectPickupTime: int64(time.Now().Unix()),
|
||||
//RiderPickMethod: 1,
|
||||
//MultiPickupInfo: []*MultiPickupInfo{{
|
||||
// PickupShopAddress: "海淀区清河龙岗路51号清润家园小区 永辉",
|
||||
// PickupLat: "40.030613",
|
||||
// PickupLng: "116.354787",
|
||||
//}},
|
||||
}
|
||||
resp, err := api.PreCreateOrder(param)
|
||||
fmt.Println(resp)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
//正式下单
|
||||
func TestCreateOrder(t *testing.T) {
|
||||
param := &CreateOrderReq{
|
||||
DevId: AppID,
|
||||
ShopId: TestSFStoreID,
|
||||
ShopOrderId: "20230518Test",
|
||||
OrderSequence: "测试",
|
||||
OrderSource: OrderSourceELM,
|
||||
OrderTime: 1684302448,
|
||||
PushTime: 1684399264,
|
||||
Version: 19,
|
||||
Receive: &ReceiveAddress{
|
||||
UserLng: "116.339392",
|
||||
UserLat: "40.002349",
|
||||
UserAddress: "北京市海淀区学清嘉创大厦A座15层",
|
||||
UserName: "杨玺",
|
||||
UserPhone: "17236456352",
|
||||
},
|
||||
OrderDetail: &OrderDetail{
|
||||
TotalPrice: 890,
|
||||
ProductType: 4,
|
||||
WeightGram: 390,
|
||||
ProductNum: 1,
|
||||
ProductTypeNum: 1,
|
||||
ProductDetail: []*ProductDetail{{
|
||||
ProductName: "新鲜水果拼盘",
|
||||
ProductNum: 1,
|
||||
}},
|
||||
},
|
||||
RiderPickMethod: 1,
|
||||
}
|
||||
sfOrderID, sfBillID, totalPrice, err := api.CreateOrder(param)
|
||||
fmt.Println(sfOrderID, sfBillID)
|
||||
fmt.Println(totalPrice)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
//预取消订单
|
||||
func TestPreCancelOrder(t *testing.T) {
|
||||
resp, err := api.PreCancelOrder("JS4157196256886")
|
||||
fmt.Println(resp)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
//取消订单
|
||||
func TestCancelOrder(t *testing.T) {
|
||||
err := api.CancelOrder("JS4157196256886")
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
//订单实时信息查询
|
||||
func TestGetOrderStatus(t *testing.T) {
|
||||
resp, err := api.GetOrderStatus("JS4157196256886")
|
||||
fmt.Println(utils.Format4Output(resp, false))
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
//
|
||||
func TestGetRiderLatestPosition(t *testing.T) {
|
||||
resp, err := api.GetRiderLatestPosition("JS4157196256886")
|
||||
fmt.Println(utils.Format4Output(resp, false))
|
||||
fmt.Println(err)
|
||||
}
|
||||
Reference in New Issue
Block a user