Files
baseapi/platformapi/fnpsapi/order_test.go
苏尹岚 5778298819 fnps
2020-12-14 16:53:14 +08:00

75 lines
2.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package fnpsapi
import (
"testing"
"time"
"git.rosy.net.cn/baseapi/utils"
)
func TestQueryOrder(t *testing.T) {
err := api.QueryOrder("11")
if err != nil {
t.Fatal(err)
}
// t.Log(utils.Format4Output(result, false))
}
func TestCreateOrder(t *testing.T) {
params := &CreateOrderParam{
PartnerOrderCode: "2140252158517300353",
NotifyURL: "https://callback.test.jxc4.com/fn/msg",
ChainStoreCode: "667281",
OrderType: 1, //即时达
TransportInfo: &TransportInfo{
TransportName: "测试西南交大店",
TransportAddress: "成都市金牛区交大路银桂桥二巷60号",
TransportLongitude: 104.047773,
TransportLatitude: 30.695838,
PositionSource: 3,
TransportTel: "18160030913",
},
OrderAddTime: time.Now().UnixNano() / 1e6,
OrderTotalAmount: 12,
OrderActualAmount: 10,
OrderWeight: 1.2,
OrderRemark: utils.FilterMb4("客户电话18160030913,测试取货失败或配送遇到问题请联系18048531223禁止未配送直接完成定单"),
IsInvoiced: 0,
OrderPaymentStatus: 1,
OrderPaymentMethod: 1,
IsAgentPayment: 0,
GoodsCount: 2,
ReceiverInfo: &ReceiverInfo{
ReceiverName: "苏尹岚",
ReceiverAddress: "武侯大道金色花园A区",
ReceiverLongitude: 104.01459,
ReceiverLatitude: 30.636258,
ReceiverPrimaryPhone: "18160030913",
ReceiverSecondPhone: "18160030913",
PositionSource: 3,
},
SerialNumber: "测试1#",
}
var skuInfo []*ItemsJSON
// for _, v := range order.Skus {
skuInfo = append(skuInfo, &ItemsJSON{
ItemID: "30677",
ItemName: "测试商品",
ItemQuantity: 1,
ItemPrice: 3.6,
ItemActualPrice: 2,
})
// }
params.ItemsJSON = skuInfo
//要求饿百的订单要传来源
// if order.VendorID == model.VendorIDEBAI {
// params.OrderSource = "109"
// params.ChannelOrderCode = order.VendorOrderID
// }
err := api.CreateOrder(params)
if err != nil {
t.Fatal(err)
}
// t.Log(utils.Format4Output(result, false))
}