Update December 26, 2024 (#132)
This commit is contained in:
58
ozon/fbo.go
58
ozon/fbo.go
@@ -472,64 +472,6 @@ func (c FBO) GetSupplyRequestInfo(ctx context.Context, params *GetSupplyRequestI
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListProductsInSupplyRequestParams struct {
|
|
||||||
// Number of the page returned in the query
|
|
||||||
Page int32 `json:"page"`
|
|
||||||
|
|
||||||
// Number of elements on the page
|
|
||||||
PageSize int32 `json:"page_size"`
|
|
||||||
|
|
||||||
// Supply request identifier
|
|
||||||
SupplyOrderId int64 `json:"supply_order_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ListProductsInSupplyRequestResponse struct {
|
|
||||||
core.CommonResponse
|
|
||||||
|
|
||||||
// Indicates that the response contains not the entire array of supply requests:
|
|
||||||
// - true — make a new request with a different page and page_size values to get the remaining products;
|
|
||||||
// - false — the entire array of product was returned in the response
|
|
||||||
HasNext bool `json:"has_next"`
|
|
||||||
|
|
||||||
// Products list
|
|
||||||
Items []ListProductsInSupplyRequestItem `json:"items"`
|
|
||||||
|
|
||||||
// Total number of products in the request
|
|
||||||
TotalItemsCount int32 `json:"total_items_count"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ListProductsInSupplyRequestItem struct {
|
|
||||||
// Link to product image
|
|
||||||
IconPath string `json:"icon_path"`
|
|
||||||
|
|
||||||
// Product name
|
|
||||||
Name string `json:"name"`
|
|
||||||
|
|
||||||
// Product ID
|
|
||||||
OfferId string `json:"offer_id"`
|
|
||||||
|
|
||||||
// Product quantity
|
|
||||||
Quantity int64 `json:"quantity"`
|
|
||||||
|
|
||||||
// Product identifier in the Ozon system, SKU
|
|
||||||
SKU int64 `json:"sku"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// List of products in the sullpy request
|
|
||||||
func (c FBO) ListProductsInSupplyRequest(ctx context.Context, params *ListProductsInSupplyRequestParams) (*ListProductsInSupplyRequestResponse, error) {
|
|
||||||
url := "/v1/supply-order/items"
|
|
||||||
|
|
||||||
resp := &ListProductsInSupplyRequestResponse{}
|
|
||||||
|
|
||||||
response, err := c.client.Request(ctx, http.MethodPost, url, params, resp, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
response.CopyCommonResponse(&resp.CommonResponse)
|
|
||||||
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetWarehouseWorkloadResponse struct {
|
type GetWarehouseWorkloadResponse struct {
|
||||||
core.CommonResponse
|
core.CommonResponse
|
||||||
|
|
||||||
|
|||||||
@@ -456,68 +456,6 @@ func TestGetSupplyRequestInfo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestListProductsInSupplyRequest(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
tests := []struct {
|
|
||||||
statusCode int
|
|
||||||
headers map[string]string
|
|
||||||
params *ListProductsInSupplyRequestParams
|
|
||||||
response string
|
|
||||||
}{
|
|
||||||
// Test Ok
|
|
||||||
{
|
|
||||||
http.StatusOK,
|
|
||||||
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
|
||||||
&ListProductsInSupplyRequestParams{
|
|
||||||
Page: 0,
|
|
||||||
PageSize: 0,
|
|
||||||
SupplyOrderId: 0,
|
|
||||||
},
|
|
||||||
`{
|
|
||||||
"has_next": true,
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"icon_path": "string",
|
|
||||||
"name": "string",
|
|
||||||
"offer_id": "string",
|
|
||||||
"quantity": 0,
|
|
||||||
"sku": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"total_items_count": 0
|
|
||||||
}`,
|
|
||||||
},
|
|
||||||
// Test No Client-Id or Api-Key
|
|
||||||
{
|
|
||||||
http.StatusUnauthorized,
|
|
||||||
map[string]string{},
|
|
||||||
&ListProductsInSupplyRequestParams{},
|
|
||||||
`{
|
|
||||||
"code": 16,
|
|
||||||
"message": "Client-Id and Api-Key headers are required"
|
|
||||||
}`,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, test := range tests {
|
|
||||||
c := NewMockClient(core.NewMockHttpHandler(test.statusCode, test.response, test.headers))
|
|
||||||
|
|
||||||
ctx, _ := context.WithTimeout(context.Background(), testTimeout)
|
|
||||||
resp, err := c.FBO().ListProductsInSupplyRequest(ctx, test.params)
|
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
compareJsonResponse(t, test.response, &ListProductsInSupplyRequestResponse{})
|
|
||||||
|
|
||||||
if resp.StatusCode != test.statusCode {
|
|
||||||
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetWarehouseWorkload(t *testing.T) {
|
func TestGetWarehouseWorkload(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
@@ -2053,10 +2053,8 @@ type GetProductPriceInfoParams struct {
|
|||||||
// Filter by product
|
// Filter by product
|
||||||
Filter GetProductPriceInfoFilter `json:"filter"`
|
Filter GetProductPriceInfoFilter `json:"filter"`
|
||||||
|
|
||||||
// Identifier of the last value on page.
|
// Cursor for the next data sample
|
||||||
//
|
Cursor string `json:"cursor"`
|
||||||
// To get the next values, specify the recieved value in the next request in the `last_id` parameter
|
|
||||||
LastId string `json:"last_id"`
|
|
||||||
|
|
||||||
// Number of values per page. Minimum is 1, maximum is 1000
|
// Number of values per page. Minimum is 1, maximum is 1000
|
||||||
Limit int32 `json:"limit"`
|
Limit int32 `json:"limit"`
|
||||||
@@ -2076,7 +2074,6 @@ type GetProductPriceInfoFilter struct {
|
|||||||
type GetProductPriceInfoResponse struct {
|
type GetProductPriceInfoResponse struct {
|
||||||
core.CommonResponse
|
core.CommonResponse
|
||||||
|
|
||||||
// Result
|
|
||||||
Result GetProductPriceInfoResult `json:"result"`
|
Result GetProductPriceInfoResult `json:"result"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2084,10 +2081,8 @@ type GetProductPriceInfoResult struct {
|
|||||||
// Products list
|
// Products list
|
||||||
Items []GetProductPriceInfoResultItem `json:"items"`
|
Items []GetProductPriceInfoResultItem `json:"items"`
|
||||||
|
|
||||||
// Identifier of the last value on page. Leave this field blank in the first request.
|
// Cursor for the next data sample
|
||||||
//
|
Cursor string `json:"cursor"`
|
||||||
// To get the next values, specify last_id from the response of the previous request
|
|
||||||
LastId string `json:"last_id"`
|
|
||||||
|
|
||||||
// Products number in the list
|
// Products number in the list
|
||||||
Total int32 `json:"total"`
|
Total int32 `json:"total"`
|
||||||
@@ -2109,11 +2104,6 @@ type GetProductPriceInfoResultItem struct {
|
|||||||
// Product price
|
// Product price
|
||||||
Price GetProductPriceInfoResultItemPrice `json:"price"`
|
Price GetProductPriceInfoResultItemPrice `json:"price"`
|
||||||
|
|
||||||
// Deprected: price index
|
|
||||||
//
|
|
||||||
// Use PriceIndexes instead
|
|
||||||
PriceIndex string `json:"price_index"`
|
|
||||||
|
|
||||||
// Product price indexes
|
// Product price indexes
|
||||||
PriceIndexes GetProductPriceInfoResultItemPriceIndexes `json:"price_indexes"`
|
PriceIndexes GetProductPriceInfoResultItemPriceIndexes `json:"price_indexes"`
|
||||||
|
|
||||||
@@ -2201,11 +2191,11 @@ type GetProductPriceInfoResultItemMarketingActionsAction struct {
|
|||||||
// Date and time when the seller's promotion ends
|
// Date and time when the seller's promotion ends
|
||||||
DateTo time.Time `json:"date_to"`
|
DateTo time.Time `json:"date_to"`
|
||||||
|
|
||||||
// Discount on the seller's promotion
|
|
||||||
DiscountValue string `json:"discount_value"`
|
|
||||||
|
|
||||||
// Promotion name
|
// Promotion name
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
|
|
||||||
|
// Discount on the seller's promotion
|
||||||
|
Value float64 `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetProductPriceInfoResultItemPrice struct {
|
type GetProductPriceInfoResultItemPrice struct {
|
||||||
@@ -2216,72 +2206,50 @@ type GetProductPriceInfoResultItemPrice struct {
|
|||||||
CurrencyCode string `json:"currency_code"`
|
CurrencyCode string `json:"currency_code"`
|
||||||
|
|
||||||
// Product price including all promotion discounts. This value will be indicated on the Ozon storefront
|
// Product price including all promotion discounts. This value will be indicated on the Ozon storefront
|
||||||
MarketingPrice string `json:"marketing_price"`
|
MarketingPrice float64 `json:"marketing_price"`
|
||||||
|
|
||||||
// Product price with seller's promotions applied
|
// Product price with seller's promotions applied
|
||||||
MarketingSellerPrice string `json:"marketing_seller_price"`
|
MarketingSellerPrice float64 `json:"marketing_seller_price"`
|
||||||
|
|
||||||
// Minimum price for similar products on Ozon
|
// Minimum price for similar products on Ozon
|
||||||
MinOzonPrice string `json:"min_ozon_price"`
|
MinOzonPrice float64 `json:"min_ozon_price"`
|
||||||
|
|
||||||
// Minimum product price with all promotions applied
|
// Minimum product price with all promotions applied
|
||||||
MinPrice string `json:"min_price"`
|
MinPrice float64 `json:"min_price"`
|
||||||
|
|
||||||
// Price before discounts. Displayed strikethrough on the product description page
|
// Price before discounts. Displayed strikethrough on the product description page
|
||||||
OldPrice string `json:"old_price"`
|
OldPrice float64 `json:"old_price"`
|
||||||
|
|
||||||
// Product price including discounts. This value is shown on the product description page
|
// Product price including discounts. This value is shown on the product description page
|
||||||
Price string `json:"price"`
|
Price float64 `json:"price"`
|
||||||
|
|
||||||
// Retailer price
|
// Retailer price
|
||||||
RetailPrice string `json:"retail_price"`
|
RetailPrice float64 `json:"retail_price"`
|
||||||
|
|
||||||
// Product VAT rate
|
// Product VAT rate
|
||||||
VAT string `json:"vat"`
|
VAT float64 `json:"vat"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetProductPriceInfoResultItemPriceIndexes struct {
|
type GetProductPriceInfoResultItemPriceIndexes struct {
|
||||||
|
// Resulting price index of the product
|
||||||
|
ColorIndex string `json:"color_index"`
|
||||||
|
|
||||||
// Competitors' product price on other marketplaces
|
// Competitors' product price on other marketplaces
|
||||||
ExternalIndexData GetProductPriceInfoResultItemPriceIndexesExternal `json:"external_index_data"`
|
ExternalIndexData GetProductPriceInfoResultItemPriceIndexesValue `json:"external_index_data"`
|
||||||
|
|
||||||
// Competitors' product price on Ozon
|
// Competitors' product price on Ozon
|
||||||
OzonIndexData GetProductPriceInfoResultItemPriceIndexesOzon `json:"ozon_index_data"`
|
OzonIndexData GetProductPriceInfoResultItemPriceIndexesValue `json:"ozon_index_data"`
|
||||||
|
|
||||||
// Resulting price index of the product
|
|
||||||
PriceIndex string `json:"price_index"`
|
|
||||||
|
|
||||||
// Price of your product on other marketplaces
|
// Price of your product on other marketplaces
|
||||||
SelfMarketplaceIndexData GetProductPriceInfoResultItemPriceIndexesSelfMarketplace `json:"self_marketplaces_index_data"`
|
SelfMarketplaceIndexData GetProductPriceInfoResultItemPriceIndexesValue `json:"self_marketplaces_index_data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetProductPriceInfoResultItemPriceIndexesExternal struct {
|
type GetProductPriceInfoResultItemPriceIndexesValue struct {
|
||||||
// Minimum competitors' product price on other marketplaces
|
|
||||||
MinimalPrice string `json:"minimal_price"`
|
|
||||||
|
|
||||||
// Price currency
|
|
||||||
MinimalPriceCurrency string `json:"minimal_price_currency"`
|
|
||||||
|
|
||||||
// Price index value
|
|
||||||
PriceIndexValue float64 `json:"price_index_value"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetProductPriceInfoResultItemPriceIndexesOzon struct {
|
|
||||||
// Minimum competitors' product price on Ozon
|
|
||||||
MinimalPrice string `json:"minimal_price"`
|
|
||||||
|
|
||||||
// Price currency
|
|
||||||
MinimalPriceCurrency string `json:"minimal_price_currency"`
|
|
||||||
|
|
||||||
// Price index value
|
|
||||||
PriceIndexValue float64 `json:"price_index_value"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetProductPriceInfoResultItemPriceIndexesSelfMarketplace struct {
|
|
||||||
// Minimum price of your product on other marketplaces
|
// Minimum price of your product on other marketplaces
|
||||||
MinimalPrice string `json:"minimal_price"`
|
MinimalPrice float64 `json:"min_price"`
|
||||||
|
|
||||||
// Price currency
|
// Price currency
|
||||||
MinimalPriceCurrency string `json:"minimal_price_currency"`
|
MinimalPriceCurrency string `json:"min_price_currency"`
|
||||||
|
|
||||||
// Price index value
|
// Price index value
|
||||||
PriceIndexValue float64 `json:"price_index_value"`
|
PriceIndexValue float64 `json:"price_index_value"`
|
||||||
@@ -2293,7 +2261,7 @@ type GetProductPriceInfoResultItemPriceIndexesSelfMarketplace struct {
|
|||||||
// The `fbo_direct_flow_trans_max_amount` and `fbo_direct_flow_trans_min_amount` parameters
|
// The `fbo_direct_flow_trans_max_amount` and `fbo_direct_flow_trans_min_amount` parameters
|
||||||
// from the method response are in development and return 0
|
// from the method response are in development and return 0
|
||||||
func (c Products) GetProductPriceInfo(ctx context.Context, params *GetProductPriceInfoParams) (*GetProductPriceInfoResponse, error) {
|
func (c Products) GetProductPriceInfo(ctx context.Context, params *GetProductPriceInfoParams) (*GetProductPriceInfoResponse, error) {
|
||||||
url := "/v4/product/info/prices"
|
url := "/v5/product/info/prices"
|
||||||
|
|
||||||
resp := &GetProductPriceInfoResponse{}
|
resp := &GetProductPriceInfoResponse{}
|
||||||
|
|
||||||
|
|||||||
@@ -2139,66 +2139,72 @@ func TestGetProductPriceInfo(t *testing.T) {
|
|||||||
},
|
},
|
||||||
`{
|
`{
|
||||||
"result": {
|
"result": {
|
||||||
|
"cursor": "string",
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"acquiring": 0,
|
"acquiring": 0,
|
||||||
"product_id": 243686911,
|
"commissions": {
|
||||||
|
"fbo_deliv_to_customer_amount": 14.75,
|
||||||
|
"fbo_direct_flow_trans_max_amount": 46.5,
|
||||||
|
"fbo_direct_flow_trans_min_amount": 31,
|
||||||
|
"fbo_return_flow_amount": 50,
|
||||||
|
"fbs_deliv_to_customer_amount": 60,
|
||||||
|
"fbs_direct_flow_trans_max_amount": 61.5,
|
||||||
|
"fbs_direct_flow_trans_min_amount": 41,
|
||||||
|
"fbs_first_mile_max_amount": 25,
|
||||||
|
"fbs_first_mile_min_amount": 0,
|
||||||
|
"fbs_return_flow_amount": 40,
|
||||||
|
"sales_percent_fbo": 15,
|
||||||
|
"sales_percent_fbs": 0
|
||||||
|
},
|
||||||
|
"marketing_actions": {
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"date_from": "2024-12-13T06:49:37.591Z",
|
||||||
|
"date_to": "2024-12-13T06:49:37.591Z",
|
||||||
|
"title": "string",
|
||||||
|
"value": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"current_period_from": "2024-12-13T06:49:37.591Z",
|
||||||
|
"current_period_to": "2024-12-13T06:49:37.591Z",
|
||||||
|
"ozon_actions_exist": true
|
||||||
|
},
|
||||||
"offer_id": "356792",
|
"offer_id": "356792",
|
||||||
"price": {
|
"price": {
|
||||||
|
"auto_action_enabled": true,
|
||||||
"currency_code": "RUB",
|
"currency_code": "RUB",
|
||||||
"price": "499.0000",
|
"marketing_price": 0,
|
||||||
"old_price": "579.0000",
|
"marketing_seller_price": 0,
|
||||||
"retail_price": "",
|
"min_price": 0,
|
||||||
"vat": "0.200000",
|
"old_price": 579,
|
||||||
"min_ozon_price": "",
|
"price": 499,
|
||||||
"marketing_price": "",
|
"retail_price": 0,
|
||||||
"marketing_seller_price": "",
|
"vat": 0.2
|
||||||
"auto_action_enabled": true
|
|
||||||
},
|
},
|
||||||
"price_indexes": {
|
"price_indexes": {
|
||||||
|
"color_index": "WITHOUT_INDEX",
|
||||||
"external_index_data": {
|
"external_index_data": {
|
||||||
"minimal_price": "string",
|
"min_price": 0,
|
||||||
"minimal_price_currency": "string",
|
"min_price_currency": "string",
|
||||||
"price_index_value": 0
|
"price_index_value": 0
|
||||||
},
|
},
|
||||||
"ozon_index_data": {
|
"ozon_index_data": {
|
||||||
"minimal_price": "string",
|
"min_price": 0,
|
||||||
"minimal_price_currency": "string",
|
"min_price_currency": "string",
|
||||||
"price_index_value": 0
|
"price_index_value": 0
|
||||||
},
|
},
|
||||||
"price_index": "WITHOUT_INDEX",
|
|
||||||
"self_marketplaces_index_data": {
|
"self_marketplaces_index_data": {
|
||||||
"minimal_price": "string",
|
"min_price": 0,
|
||||||
"minimal_price_currency": "string",
|
"min_price_currency": "string",
|
||||||
"price_index_value": 0
|
"price_index_value": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commissions": {
|
"product_id": 243686911,
|
||||||
"sales_percent": 15,
|
|
||||||
"sales_percent_fbo": 15,
|
|
||||||
"sales_percent_fbs": 0,
|
|
||||||
"fbo_fulfillment_amount": 0,
|
|
||||||
"fbo_direct_flow_trans_min_amount": 31,
|
|
||||||
"fbo_direct_flow_trans_max_amount": 46.5,
|
|
||||||
"fbo_deliv_to_customer_amount": 14.75,
|
|
||||||
"fbo_return_flow_amount": 50,
|
|
||||||
"fbo_return_flow_trans_min_amount": 21.7,
|
|
||||||
"fbo_return_flow_trans_max_amount": 21.7,
|
|
||||||
"fbs_first_mile_min_amount": 0,
|
|
||||||
"fbs_first_mile_max_amount": 25,
|
|
||||||
"fbs_direct_flow_trans_min_amount": 41,
|
|
||||||
"fbs_direct_flow_trans_max_amount": 61.5,
|
|
||||||
"fbs_deliv_to_customer_amount": 60,
|
|
||||||
"fbs_return_flow_amount": 40,
|
|
||||||
"fbs_return_flow_trans_min_amount": 41,
|
|
||||||
"fbs_return_flow_trans_max_amount": 61.5
|
|
||||||
},
|
|
||||||
"marketing_actions": null,
|
|
||||||
"volume_weight": 0
|
"volume_weight": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"total": 1,
|
"total": 0
|
||||||
"last_id": "ceVуbA=="
|
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -161,6 +161,9 @@ type GetListOfDeliveryMethodsResult struct {
|
|||||||
// Delivery service identifier
|
// Delivery service identifier
|
||||||
ProviderId int64 `json:"provider_id"`
|
ProviderId int64 `json:"provider_id"`
|
||||||
|
|
||||||
|
// Minimum time to package an order in minutes according to warehouse settings
|
||||||
|
SLACutIn int64 `json:"sla_cut_in"`
|
||||||
|
|
||||||
// Delivery method status:
|
// Delivery method status:
|
||||||
// - NEW—created,
|
// - NEW—created,
|
||||||
// - EDITED—being edited,
|
// - EDITED—being edited,
|
||||||
|
|||||||
@@ -127,7 +127,8 @@ func TestGetListOfDeliveryMethods(t *testing.T) {
|
|||||||
"template_id": 0,
|
"template_id": 0,
|
||||||
"warehouse_id": 15588127982000,
|
"warehouse_id": 15588127982000,
|
||||||
"created_at": "2019-04-04T15:22:31.048202Z",
|
"created_at": "2019-04-04T15:22:31.048202Z",
|
||||||
"updated_at": "2021-08-15T10:21:44.854209Z"
|
"updated_at": "2021-08-15T10:21:44.854209Z",
|
||||||
|
"sla_cut_in": 1440
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_next": false
|
"has_next": false
|
||||||
|
|||||||
Reference in New Issue
Block a user