fnps
This commit is contained in:
@@ -34,11 +34,11 @@ type CreateOrderParam struct {
|
||||
OrderActualAmount float64 `json:"order_actual_amount,omitempty"`
|
||||
OrderWeight float64 `json:"order_weight,omitempty"`
|
||||
OrderRemark string `json:"order_remark,omitempty"`
|
||||
IsInvoiced int `json:"is_invoiced,omitempty"`
|
||||
IsInvoiced int `json:"is_invoiced"`
|
||||
Invoice string `json:"invoice,omitempty"`
|
||||
OrderPaymentStatus int `json:"order_payment_status,omitempty"`
|
||||
OrderPaymentMethod int `json:"order_payment_method,omitempty"`
|
||||
IsAgentPayment int `json:"is_agent_payment,omitempty"`
|
||||
IsAgentPayment int `json:"is_agent_payment"`
|
||||
RequirePaymentPay float64 `json:"require_payment_pay,omitempty"`
|
||||
GoodsCount int `json:"goods_count,omitempty"`
|
||||
RequireReceiveTime int64 `json:"require_receive_time,omitempty"`
|
||||
@@ -81,8 +81,8 @@ type ItemsJSON struct {
|
||||
ItemActualPrice float64 `json:"item_actual_price,omitempty"`
|
||||
ItemSize int `json:"item_size,omitempty"`
|
||||
ItemRemark string `json:"item_remark,omitempty"`
|
||||
IsNeedPackage int `json:"is_need_package,omitempty"`
|
||||
IsAgentPurchase int `json:"is_agent_purchase,omitempty"`
|
||||
IsNeedPackage int `json:"is_need_package"`
|
||||
IsAgentPurchase int `json:"is_agent_purchase"`
|
||||
AgentPurchasePrice float64 `json:"agent_purchase_price,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package fnpsapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
func TestQueryOrder(t *testing.T) {
|
||||
@@ -11,3 +14,61 @@ func TestQueryOrder(t *testing.T) {
|
||||
}
|
||||
// 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))
|
||||
}
|
||||
|
||||
@@ -76,3 +76,9 @@ func IsErrShopExist(err error) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (a *API) UpdateStore(createStoreParam *CreateStoreParam) (err error) {
|
||||
params := utils.Struct2FlatMap(createStoreParam)
|
||||
_, err = a.AccessAPI("v2/chain_store/update", TestURL, params, true)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@ import (
|
||||
|
||||
func TestCreateStore(t *testing.T) {
|
||||
err := api.CreateStore(&CreateStoreParam{
|
||||
ChainStoreCode: "123",
|
||||
ChainStoreName: "测试门店1",
|
||||
ChainStoreCode: "667281",
|
||||
ChainStoreName: "测试西南交大店 ",
|
||||
ChainStoreType: 2,
|
||||
ContactPhone: "18160030913",
|
||||
Address: "金牛区加州湾",
|
||||
Address: "成都市金牛区交大路银桂桥二巷60号",
|
||||
PositionSource: 3,
|
||||
Longitude: "104.045409",
|
||||
Latitude: "30.693387",
|
||||
Longitude: "104.047773",
|
||||
Latitude: "30.695838",
|
||||
ServiceCode: "1",
|
||||
})
|
||||
if err != nil {
|
||||
@@ -25,9 +25,20 @@ func TestCreateStore(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetStore(t *testing.T) {
|
||||
result, err := api.GetStore("2")
|
||||
result, err := api.GetStore("667281")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestUpdateStore(t *testing.T) {
|
||||
err := api.UpdateStore(&CreateStoreParam{
|
||||
ChainStoreCode: "667281",
|
||||
Address: "1111111",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user