fn test
This commit is contained in:
@@ -142,7 +142,7 @@ type TokenInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) GetAccessToken() (tokenInfo *TokenInfo, err error) {
|
func (a *API) GetAccessToken() (tokenInfo *TokenInfo, err error) {
|
||||||
result, err := a.AccessAPI(tokenAction, URL, nil, false)
|
result, err := a.AccessAPI(tokenAction, TestURL, nil, false)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
utils.Map2StructByJson(result["data"], &tokenInfo, false)
|
utils.Map2StructByJson(result["data"], &tokenInfo, false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func init() {
|
|||||||
sugarLogger = logger.Sugar()
|
sugarLogger = logger.Sugar()
|
||||||
baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
api = New("6a3e2073-1850-413b-9eb7-6c342ec36e1c", "a8248088-a742-4c33-a0db-03aeae00ca7d")
|
api = New("6a3e2073-1850-413b-9eb7-6c342ec36e1c", "a8248088-a742-4c33-a0db-03aeae00ca7d")
|
||||||
api.SetToken("n-6446dfbe-322d-434c-a4eb-9dae44436c08-w")
|
api.SetToken("n-c6e3d9e2-8003-4855-ac88-ca8b9042d616-w")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetAccessToken(t *testing.T) {
|
func TestGetAccessToken(t *testing.T) {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ type ItemsJSON struct {
|
|||||||
//https://open.ele.me/documents/%E5%88%9B%E5%BB%BA%E8%9C%82%E9%B8%9F%E8%AE%A2%E5%8D%95
|
//https://open.ele.me/documents/%E5%88%9B%E5%BB%BA%E8%9C%82%E9%B8%9F%E8%AE%A2%E5%8D%95
|
||||||
func (a *API) CreateOrder(createOrderParam *CreateOrderParam) (err error) {
|
func (a *API) CreateOrder(createOrderParam *CreateOrderParam) (err error) {
|
||||||
params := utils.Struct2FlatMap(createOrderParam)
|
params := utils.Struct2FlatMap(createOrderParam)
|
||||||
_, err = a.AccessAPI("v2/order", URL, params, true)
|
_, err = a.AccessAPI("v2/order", TestURL, params, true)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,12 +112,19 @@ type CancelOrderParam struct {
|
|||||||
|
|
||||||
func (a *API) CancelOrder(cancelOrderParam *CancelOrderParam) (err error) {
|
func (a *API) CancelOrder(cancelOrderParam *CancelOrderParam) (err error) {
|
||||||
params := utils.Struct2FlatMap(cancelOrderParam)
|
params := utils.Struct2FlatMap(cancelOrderParam)
|
||||||
_, err = a.AccessAPI("v2/order/cancel", URL, params, true)
|
_, err = a.AccessAPI("v2/order/cancel", TestURL, params, true)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) ComplaintOrder(cancelOrderParam *CancelOrderParam) (err error) {
|
func (a *API) ComplaintOrder(cancelOrderParam *CancelOrderParam) (err error) {
|
||||||
params := utils.Struct2FlatMap(cancelOrderParam)
|
params := utils.Struct2FlatMap(cancelOrderParam)
|
||||||
_, err = a.AccessAPI("v2/order/complaint", URL, params, true)
|
_, err = a.AccessAPI("v2/order/complaint", TestURL, params, true)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *API) QueryOrder(partnerOrderCode string) (err error) {
|
||||||
|
_, err = a.AccessAPI("v2/order/complaint", TestURL, map[string]interface{}{
|
||||||
|
"partner_order_code": partnerOrderCode,
|
||||||
|
}, true)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,13 @@
|
|||||||
package fnpsapi
|
package fnpsapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestQueryOrder(t *testing.T) {
|
||||||
|
err := api.QueryOrder("11")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
// t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type CreateStoreParam struct {
|
|||||||
func (a *API) CreateStore(createStoreParam *CreateStoreParam) (err error) {
|
func (a *API) CreateStore(createStoreParam *CreateStoreParam) (err error) {
|
||||||
createStoreParam.ServiceCode = "1"
|
createStoreParam.ServiceCode = "1"
|
||||||
params := utils.Struct2FlatMap(createStoreParam)
|
params := utils.Struct2FlatMap(createStoreParam)
|
||||||
_, err = a.AccessAPI("v2/chain_store", URL, params, true)
|
_, err = a.AccessAPI("v2/chain_store", TestURL, params, true)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ type GetStoreResult struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) GetStore(storeID string) (getStoreResult *GetStoreResult, err error) {
|
func (a *API) GetStore(storeID string) (getStoreResult *GetStoreResult, err error) {
|
||||||
result, err := a.AccessAPI("v2/chain_store/query", URL, map[string]interface{}{
|
result, err := a.AccessAPI("v2/chain_store/query", TestURL, map[string]interface{}{
|
||||||
"chain_store_code": []string{storeID},
|
"chain_store_code": []string{storeID},
|
||||||
}, true)
|
}, true)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user