1
This commit is contained in:
16
platformapi/tiktok_shop/tiktok_api/afs_test.go
Normal file
16
platformapi/tiktok_shop/tiktok_api/afs_test.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package tiktok_api
|
||||
|
||||
import "testing"
|
||||
|
||||
var token = `{"access_token":"60f530b2-9ab6-4723-b487-c094918f0d21","expires_in":1666257163,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"1220666a-5e88-458c-a8c0-06d949fbbd3f","authority_id":""}`
|
||||
var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||
|
||||
// 查询售后单详情
|
||||
func TestAfsOrder(t *testing.T) {
|
||||
a.QueryAfsOrderDetail("7154266161041899779", true)
|
||||
}
|
||||
|
||||
// 同意/拒绝售后单
|
||||
func TestAggreOrNotAggreAfs(t *testing.T) {
|
||||
//a.AfterSaleOperate()
|
||||
}
|
||||
@@ -9,13 +9,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
CallbackSuccessCode = 0
|
||||
CallbackSuccess = "success"
|
||||
CallbackFailCode = 1000
|
||||
CallbackFail = "fail"
|
||||
)
|
||||
|
||||
type API struct {
|
||||
appKey string
|
||||
appSecret string
|
||||
@@ -72,7 +65,7 @@ func (a *API) CreateToken(code string) (*doudian_sdk.CreateTokenData, error) {
|
||||
doudian_sdk.GlobalConfig.AppKey = a.appKey
|
||||
doudian_sdk.GlobalConfig.AppSecret = a.appSecret
|
||||
buildParam := &doudian_sdk.BuildAccessTokenParam{
|
||||
Code: code, // 定死还是自动获取
|
||||
Code: code,
|
||||
ShopId: 0,
|
||||
Config: nil,
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package tiktok_api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
order_getSettleBillDetailV3_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_getSettleBillDetailV3/request"
|
||||
order_logisticsAdd_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_logisticsAdd/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
@@ -30,7 +31,8 @@ func TestQueryOrderDetail(t *testing.T) {
|
||||
|
||||
func TestRefaseToken(t *testing.T) {
|
||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", "")
|
||||
a.CreateToken("41155cd5-d30f-4075-9c44-b75ffa1a84ee")
|
||||
a.CreateToken("bb52688c-7bca-4b64-8747-5258a9a6ba33")
|
||||
// {"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}
|
||||
//{"access_token":"37f41ac7-49ac-4848-a0ee-ea86bb0dfd9f","expires_in":519389,"scope":"SCOPE","shop_id":"","shop_name":"抖店开放平台测试专用店","refresh_token":"3dd8f638-fdf1-46e7-b974-88df382f03c6","authority_id" :""}
|
||||
}
|
||||
|
||||
@@ -40,13 +42,11 @@ func TestTimeNow(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendGoods(t *testing.T) {
|
||||
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||
param := &order_logisticsAdd_request.OrderLogisticsAddParam{
|
||||
OrderId: "7136048270014416392",
|
||||
OrderId: "4989178132980723098",
|
||||
Company: "",
|
||||
CompanyCode: "chengdouruoxi",
|
||||
LogisticsCode: "7136048270014416392111",
|
||||
LogisticsCode: "4989178132980723098111",
|
||||
IsRefundReject: false,
|
||||
IsRejectRefund: false,
|
||||
SerialNumberList: nil,
|
||||
@@ -61,3 +61,32 @@ func TestCreateExpss(t *testing.T) {
|
||||
a := NewExpress("7152420904331429407", "cc7ba367-2394-4cbb-81c6-26f0e929d1c6", "")
|
||||
a.CreateToken()
|
||||
}
|
||||
|
||||
// 同意退货申请
|
||||
func TestReturnGoodsToWareHouseSuccess(t *testing.T) {
|
||||
token := `{"access_token":"60f530b2-9ab6-4723-b487-c094918f0d21","expires_in":1666257163,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"1220666a-5e88-458c-a8c0-06d949fbbd3f","authority_id":""}`
|
||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||
a.ReturnGoodsToWareHouseSuccess("7154200345302827303")
|
||||
}
|
||||
|
||||
// 获取订单结算信息
|
||||
func TestGetSettleBillDetailV3(t *testing.T) {
|
||||
token := `{"access_token":"60f530b2-9ab6-4723-b487-c094918f0d21","expires_in":1666257163,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"1220666a-5e88-458c-a8c0-06d949fbbd3f","authority_id":""}`
|
||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||
a.GetSettleBillDetailV3(&order_getSettleBillDetailV3_request.OrderAddressModifyParam{
|
||||
Size: 100,
|
||||
StartTime: "2022-10-07 00:00:00",
|
||||
EndTime: "2022-10-14 00:00:00",
|
||||
//OrderId: "4980573848886616007",
|
||||
ProductId: "",
|
||||
PayType: "",
|
||||
FlowType: "",
|
||||
TimeType: "1",
|
||||
StartIndex: "",
|
||||
})
|
||||
}
|
||||
|
||||
// 多订单同一个物流包裹
|
||||
func TestLogisticsAddSinglePack(t *testing.T) {
|
||||
a.LogisticsAddSinglePack()
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func (a *APIExpress) CreateToken() (*token_create_response.TokenCreateData, erro
|
||||
param := request.GetParams()
|
||||
param.Code = ""
|
||||
param.GrantType = "authorization_self"
|
||||
param.AuthId = "powertestexpress"
|
||||
param.AuthId = TiktokExpressCode
|
||||
param.AuthSubjectType = "WuLiuShang"
|
||||
response, err := request.Execute(nil)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,6 +3,7 @@ package tiktok_api
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi"
|
||||
address_list_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/address_list/request"
|
||||
afterSale_applyMarketAfterSale_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/afterSale_ApplyMarketAfterSale/request"
|
||||
@@ -14,6 +15,7 @@ import (
|
||||
afterSale_rejectReasonCodeList_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/afterSale_rejectReasonCodeList/response"
|
||||
afterSale_returnGoodsToWareHouseSuccess_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/afterSale_returnGoodsToWareHouseSuccess/request"
|
||||
order_logisticsAdd_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_logisticsAdd/request"
|
||||
order_logisticsAddSinglePack_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_logisticsAddSinglePack/request"
|
||||
order_orderDetail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_orderDetail/request"
|
||||
order_orderDetail_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_orderDetail/response"
|
||||
order_searchList_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_searchList/request"
|
||||
@@ -273,7 +275,7 @@ func (a *API) ReturnGoodsToWareHouseSuccess(afsOrderId string) error {
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return err
|
||||
return err // 202210141114300102101071350D6F3847
|
||||
}
|
||||
if result.Code != RequestSuccessCode {
|
||||
return errors.New(result.SubMsg)
|
||||
@@ -609,3 +611,20 @@ func (a *API) OrderDelivering(param *order_logisticsAdd_request.OrderLogisticsAd
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// LogisticsAddSinglePack 支持多个订单发同一个物流包裹
|
||||
func (a *API) LogisticsAddSinglePack() {
|
||||
request := order_logisticsAddSinglePack_request.New()
|
||||
request.Param.OrderIdList = []string{"4989180160180927898"}
|
||||
request.Param.ShippedOrderInfo = []order_logisticsAddSinglePack_request.ShippedOrderInfoItem{
|
||||
{ShippedOrderId: "4989180160180927898", ShippedNum: 1},
|
||||
}
|
||||
request.Param.LogisticsCode = "4989180160180927898fake"
|
||||
request.Param.RequestId = "1267250f-8b9d-4d9e-9fad-0cd9629c83de"
|
||||
request.Param.CompanyCode = "dajiangwangluo"
|
||||
request.Param.StoreId = 63114504
|
||||
|
||||
data, err := request.Execute(a.accessTokenObj)
|
||||
fmt.Println(data)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,13 @@ package tiktok_api
|
||||
const RequestSuccessCode = 10000
|
||||
const TiktokExpressCode = "chengduruoxi"
|
||||
|
||||
const (
|
||||
CallbackSuccessCode = 0
|
||||
CallbackSuccess = "success"
|
||||
CallbackFailCode = 1000
|
||||
CallbackFail = "fail"
|
||||
)
|
||||
|
||||
// 订单消息回调类型(正向订单)
|
||||
const (
|
||||
CallbackCreatedOrderMsgTagId = "100" // 创建订单回调 ok
|
||||
|
||||
22
platformapi/tiktok_shop/tiktok_api/settle_bill_detail.go
Normal file
22
platformapi/tiktok_shop/tiktok_api/settle_bill_detail.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package tiktok_api
|
||||
|
||||
import (
|
||||
order_getSettleBillDetailV3_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_getSettleBillDetailV3/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
// GetSettleBillDetailV3 商家结算账单
|
||||
// 已结算的订单才会有数据,数据T+1生成,建议第二天15点之后查询。如因任务积压导致延迟的情况,建议重试。
|
||||
// 1、推荐使用start_index方式查询
|
||||
func (a *API) GetSettleBillDetailV3(param *order_getSettleBillDetailV3_request.OrderAddressModifyParam) {
|
||||
request := order_getSettleBillDetailV3_request.New()
|
||||
request.Param = param
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
globals.SugarLogger.Debugf("======:%s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("======:%s", err)
|
||||
}
|
||||
@@ -37,6 +37,7 @@ func (a *API) UpdateSkuStock(param *sku_syncStock_request.SkuSyncStockParam) err
|
||||
request := sku_syncStock_request.New()
|
||||
request.Param = param
|
||||
resp, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debug("======/sku/syncStock:%s", utils.Format4Output(resp, false))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -116,7 +117,7 @@ func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2P
|
||||
return nil, err
|
||||
}
|
||||
|
||||
globals.SugarLogger.Debug("=========", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debug("=========/product/addV2", utils.Format4Output(result, false))
|
||||
if result.Code != RequestSuccessCode {
|
||||
return nil, errors.New(result.SubMsg)
|
||||
}
|
||||
|
||||
@@ -232,10 +232,7 @@ func TestGetSkuDetail(t *testing.T) {
|
||||
|
||||
// 查询商品详情本地商品id
|
||||
func TestGetSkuDetailLocalId(t *testing.T) {
|
||||
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
||||
|
||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||
data, err := a.GetSkuDetail("", "")
|
||||
data, err := a.GetSkuDetail("3576767557912375101", "")
|
||||
fmt.Println(err)
|
||||
globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false))
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func TestUploadImg(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRefundToken(t *testing.T) {
|
||||
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652252,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对 接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authorit y_id":""}`
|
||||
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
|
||||
|
||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||
a.RefreshToken()
|
||||
|
||||
Reference in New Issue
Block a user