Skip to content

Commit 533a243

Browse files
committed
add remained methods for managing prices and stocks
1 parent 9875a19 commit 533a243

File tree

3 files changed

+504
-4
lines changed

3 files changed

+504
-4
lines changed

ENDPOINTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
- [x] Information about product quantity
3333
- [x] Stocks in seller's warehouses (FBS и rFBS)
3434
- [x] Update prices
35-
- [ ] Get product price information
36-
- [ ] Get information about the markdown and the main product by the markdown product SKU
37-
- [ ] Set a discount on a markdown product
35+
- [x] Get product price information
36+
- [x] Get information about the markdown and the main product by the markdown product SKU
37+
- [x] Set a discount on a markdown product
3838

3939
## Promotions
4040
- [x] Available promotions

ozon/products.go

Lines changed: 291 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ type GetDescriptionOfProductResponse struct {
12831283
// Product characteristic value
12841284
Value string `json:"value"`
12851285
} `json:"values"`
1286-
} `json:"attributes`
1286+
} `json:"attributes"`
12871287
} `json:"complex_attributes"`
12881288

12891289
// Depth
@@ -1714,3 +1714,293 @@ func (c Products) StatusOfUploadingActivationCodes(params *StatusOfUploadingActi
17141714

17151715
return resp, nil
17161716
}
1717+
1718+
type GetProductPriceInfoParams struct {
1719+
// Filter by product
1720+
Filter GetProductPriceInfoFilter `json:"filter"`
1721+
1722+
// Identifier of the last value on page.
1723+
//
1724+
// To get the next values, specify the recieved value in the next request in the `last_id` parameter
1725+
LastId string `json:"last_id"`
1726+
1727+
// Number of values per page. Minimum is 1, maximum is 1000
1728+
Limit int32 `json:"limit"`
1729+
}
1730+
1731+
type GetProductPriceInfoFilter struct {
1732+
// Filter by the `offer_id` parameter. It is possible to pass a list of values
1733+
OfferId []string `json:"offer_id"`
1734+
1735+
// Filter by the `product_id` parameter. It is possible to pass a list of up to 1000 values
1736+
ProductId []int64 `json:"product_id"`
1737+
1738+
// Filter by product visibility
1739+
Visibility string `json:"visibility" default:"ALL"`
1740+
}
1741+
1742+
type GetProductPriceInfoResponse struct {
1743+
core.CommonResponse
1744+
1745+
// Result
1746+
Result struct {
1747+
// Products list
1748+
Items []struct {
1749+
// Commissions information
1750+
Commissions struct {
1751+
// Last mile (FBO)
1752+
FBOLastMile float64 `json:"fbo_deliv_to_customer_amount"`
1753+
1754+
// Pipeline to (FBO)
1755+
FBOPipelineTo float64 `json:"fbo_direct_flow_trans_max_amount"`
1756+
1757+
// Pipeline from (FBO)
1758+
FBOPipelineFrom float64 `json:"fbo_direct_flow_trans_min_amount"`
1759+
1760+
// Order packaging fee (FBO)
1761+
FBOOrderPackagingFee float64 `json:"fbo_fulfillment_amount"`
1762+
1763+
// Return and cancellation fees (FBO)
1764+
FBOReturnCancellationFee float64 `json:"fbo_return_flow_amount"`
1765+
1766+
// Reverse logistics fee from (FBO)
1767+
FBOReverseLogisticsFeeFrom float64 `json:"fbo_return_flow_trans_min_amount"`
1768+
1769+
// Reverse logistics fee to (FBO)
1770+
FBOReverseLogisticsFeeTo float64 `json:"fbo_return_flow_trans_max_amount"`
1771+
1772+
// Last mile (FBS)
1773+
FBSLastMile float64 `json:"fbs_deliv_to_customer_amount"`
1774+
1775+
// Pipeline to (FBS)
1776+
FBSPipelineTo float64 `json:"fbs_direct_flow_trans_max_amount"`
1777+
1778+
// Pipeline from (FBS)
1779+
FBSPipelineFrom float64 `json:"fbs_direct_flow_trans_min_amount"`
1780+
1781+
// Shipment processing fee to (FBS)
1782+
FBSShipmentProcessingToFee float64 `json:"fbs_first_mile_min_amount"`
1783+
1784+
// Shipment processing fee from (FBS)
1785+
FBSShipmentProcessingFromFee float64 `json:"Shipment processing fee from (FBS)"`
1786+
1787+
// Return and cancellation fees, shipment processing (FBS)
1788+
FBSReturnCancellationProcessingFee float64 `json:"fbs_return_flow_amount"`
1789+
1790+
// Return and cancellation fees, pipeline to (FBS)
1791+
FBSReturnCancellationToFees float64 `json:"fbs_return_flow_trans_max_amount"`
1792+
1793+
// Return and cancellation fees, pipeline from (FBS)
1794+
FBSReturnCancellationFromFees float64 `json:"fbs_return_flow_trans_min_amount"`
1795+
1796+
// Sales commission percentage (FBO and FBS)
1797+
SalesCommissionRate float64 `json:"sales_percent"`
1798+
} `json:"commissions"`
1799+
1800+
// Promotions information
1801+
MarketingActions []struct {
1802+
// Seller's promotions. The parameters date_from, date_to, discount_value and title are specified for each seller's promotion
1803+
Actions []struct {
1804+
// Date and time when the seller's promotion starts
1805+
DateFrom time.Time `json:"date_from"`
1806+
1807+
// Date and time when the seller's promotion ends
1808+
DateTo time.Time `json:"date_to"`
1809+
1810+
// Discount on the seller's promotion
1811+
DiscountValue string `json:"discount_value"`
1812+
1813+
// Promotion name
1814+
Title string `json:"title"`
1815+
} `json:"actions"`
1816+
1817+
// Current period start date and time for all current promotions
1818+
CurrentPeriodFrom time.Time `json:"current_period_from"`
1819+
1820+
// Current period end date and time for all current promotions
1821+
CurrentPeriodTo time.Time `json:"current_period_to"`
1822+
1823+
// If a promotion can be applied to the product at the expense of Ozon, this field is set to true
1824+
OzonActionsExist bool `json:"ozon_actions_exist"`
1825+
} `json:"marketing_actions"`
1826+
1827+
// Seller product identifier
1828+
OfferId string `json:"offer_id"`
1829+
1830+
// Product price
1831+
Price struct {
1832+
// If promos auto-application is enabled, the value is true
1833+
AutoActionEnabled bool `json:"auto_action_enabled"`
1834+
1835+
// Currency of your prices. It matches the currency set in the personal account settings
1836+
CurrencyCode string `json:"currency_code"`
1837+
1838+
// Product price including all promotion discounts. This value will be indicated on the Ozon storefront
1839+
MarketingPrice string `json:"marketing_price"`
1840+
1841+
// Product price with seller's promotions applied
1842+
MarketingSellerPrice string `json:"marketing_seller_price"`
1843+
1844+
// Minimum price for similar products on Ozon
1845+
MinOzonPrice string `json:"min_ozon_price"`
1846+
1847+
// Minimum product price with all promotions applied
1848+
MinPrice string `json:"min_price"`
1849+
1850+
// Price before discounts. Displayed strikethrough on the product description page
1851+
OldPrice string `json:"old_price"`
1852+
1853+
// Price for customers with an Ozon Premium subscription
1854+
PremiumPrice string `json:"premium_price"`
1855+
1856+
// Product price including discounts. This value is shown on the product description page
1857+
Price string `json:"price"`
1858+
1859+
// Product price suggested by the system based on similar offers
1860+
RecommendedPrice string `json:"recommended_price"`
1861+
1862+
// Retailer price
1863+
RetailPrice string `json:"retail_price"`
1864+
1865+
// Product VAT rate
1866+
VAT string `json:"vat"`
1867+
} `json:"price"`
1868+
1869+
// Price index
1870+
PriceIndex string `json:"price_index"`
1871+
1872+
// Product identifier
1873+
ProductId int64 `json:"product_id"`
1874+
1875+
// Product volume weight
1876+
VolumeWeight float64 `json:"volume_weight"`
1877+
} `json:"items"`
1878+
1879+
// Identifier of the last value on page. Leave this field blank in the first request.
1880+
//
1881+
// To get the next values, specify last_id from the response of the previous request
1882+
LastId string `json:"last_id"`
1883+
1884+
// Products number in the list
1885+
Total int32 `json:"total"`
1886+
} `json:"result"`
1887+
}
1888+
1889+
// You can specify up to 1000 products in the request
1890+
func (c Products) GetProductPriceInfo(params *GetProductPriceInfoParams) (*GetProductPriceInfoResponse, error) {
1891+
url := "/v4/product/info/prices"
1892+
1893+
resp := &GetProductPriceInfoResponse{}
1894+
1895+
response, err := c.client.Request(http.MethodPost, url, params, resp)
1896+
if err != nil {
1897+
return nil, err
1898+
}
1899+
response.CopyCommonResponse(&resp.CommonResponse)
1900+
1901+
return resp, nil
1902+
}
1903+
1904+
type GetMarkdownInfoParams struct {
1905+
// Markdown products SKUs list
1906+
DiscountedSKUs []string `json:"discounted_skus"`
1907+
}
1908+
1909+
type GetMarkdownInfoResponse struct {
1910+
core.CommonResponse
1911+
1912+
// Information about the markdown and the main product
1913+
Items []struct{
1914+
// Comment on the damage reason
1915+
CommentReasonDamaged string `json:"comment_reason_damaged"`
1916+
1917+
// Product condition: new or used
1918+
Condition string `json:"condition"`
1919+
1920+
// Product condition on a 1 to 7 scale.
1921+
// - 1 — satisfactory,
1922+
// - 2 — good,
1923+
// - 3 — very good,
1924+
// - 4 — excellent,
1925+
// - 5–7 — like new
1926+
ConditionEstimate string `json:"condition_estimate"`
1927+
1928+
// Product defects
1929+
Defects string `json:"defects"`
1930+
1931+
// Markdown product SKU
1932+
DiscountedSKU int64 `json:"discounted_sku"`
1933+
1934+
// Mechanical damage description
1935+
MechanicalDamage string `json:"mechanical_damage"`
1936+
1937+
// Packaging damage description
1938+
PackageDamage string `json:"package_damage"`
1939+
1940+
// Indication of package integrity damage
1941+
PackagingViolation string `json:"packaging_violation"`
1942+
1943+
// Damage reason
1944+
ReasonDamaged string `json:"reason_damaged"`
1945+
1946+
// Indication of repaired product
1947+
Repair string `json:"repair"`
1948+
1949+
// Indication that the product is incomplete
1950+
Shortage string `json:"shortage"`
1951+
1952+
// Main products SKU
1953+
SKU int64 `json:"sku"`
1954+
1955+
// Indication that the product has a valid warranty
1956+
WarrantyType string `json:"warranty_type"`
1957+
} `json:"items"`
1958+
}
1959+
1960+
// Get information about the markdown and the main product by the markdown product SKU
1961+
//
1962+
// A method for getting information about the condition and defects of a markdown product by its SKU.
1963+
// The method also returns the SKU of the main product
1964+
func (c Products) GetMarkdownInfo(params *GetMarkdownInfoParams) (*GetMarkdownInfoResponse, error) {
1965+
url := "/v1/product/info/discounted"
1966+
1967+
resp := &GetMarkdownInfoResponse{}
1968+
1969+
response, err := c.client.Request(http.MethodPost, url, params, resp)
1970+
if err != nil {
1971+
return nil, err
1972+
}
1973+
response.CopyCommonResponse(&resp.CommonResponse)
1974+
1975+
return resp, nil
1976+
}
1977+
1978+
type SetDiscountOnMarkdownProductParams struct{
1979+
// Discount amount: from 3 to 99 percents
1980+
Discount int32 `json:"discount"`
1981+
1982+
// Product identifier
1983+
ProductId int64 `json:"product_id"`
1984+
}
1985+
1986+
type SetDiscountOnMarkdownProductResponse struct{
1987+
core.CommonResponse
1988+
1989+
// Method result. true if the query was executed without errors
1990+
Result bool `json:"result"`
1991+
}
1992+
1993+
// A method for setting the discount percentage on markdown products sold under the FBS scheme
1994+
func (c Products) SetDiscountOnMarkdownProduct(params *SetDiscountOnMarkdownProductParams) (*SetDiscountOnMarkdownProductResponse, error) {
1995+
url := "/v1/product/update/discount"
1996+
1997+
resp := &SetDiscountOnMarkdownProductResponse{}
1998+
1999+
response, err := c.client.Request(http.MethodPost, url, params, resp)
2000+
if err != nil {
2001+
return nil, err
2002+
}
2003+
response.CopyCommonResponse(&resp.CommonResponse)
2004+
2005+
return resp, nil
2006+
}

0 commit comments

Comments
 (0)