Compare commits
2 Commits
1.18.1
...
update-feb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcf366d7d4 | ||
|
|
f5d2d0197b |
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
A Ozon Seller API client written in Golang
|
A Ozon Seller API client written in Golang
|
||||||
|
|
||||||
[](https://coveralls.io/github/diPhantxm/ozon-api-client)
|
[](https://coveralls.io/github/diPhantxm/ozon-api-client)
|
||||||

|

|
||||||
|
|
||||||
[Ozon](https://ozon.ru) is a marketplace for small and medium enterprises to launch and grow their businesses in Russia.
|
[Ozon](https://ozon.ru) is a marketplace for small and medium enterprises to launch and grow their businesses in Russia.
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ Get Client-Id and Api-Key in your seller profile [here](https://seller.ozon.ru/a
|
|||||||
|
|
||||||
Just add dependency to your project and you're ready to go.
|
Just add dependency to your project and you're ready to go.
|
||||||
```bash
|
```bash
|
||||||
go get git.denco.store/fakz9/ozon-api-client
|
go get github.com/diphantxm/ozon-api-client
|
||||||
```
|
```
|
||||||
A simple example on how to use this library:
|
A simple example on how to use this library:
|
||||||
```Golang
|
```Golang
|
||||||
@@ -26,7 +26,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.denco.store/fakz9/ozon-api-client/ozon"
|
"github.com/diphantxm/ozon-api-client/ozon"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -65,7 +65,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"git.denco.store/fakz9/ozon-api-client/ozon/notifications"
|
"github.com/diphantxm/ozon-api-client/ozon/notifications"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module git.denco.store/fakz9/ozon-api-client
|
module github.com/diphantxm/ozon-api-client
|
||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Analytics struct {
|
type Analytics struct {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetAnalyticsData(t *testing.T) {
|
func TestGetAnalyticsData(t *testing.T) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Barcodes struct {
|
type Barcodes struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGenerateBarcodes(t *testing.T) {
|
func TestGenerateBarcodes(t *testing.T) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Brands struct {
|
type Brands struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListCertifiedBrands(t *testing.T) {
|
func TestListCertifiedBrands(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cancellations struct {
|
type Cancellations struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetCancellationInfo(t *testing.T) {
|
func TestGetCancellationInfo(t *testing.T) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Categories struct {
|
type Categories struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetProductTree(t *testing.T) {
|
func TestGetProductTree(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Certificates struct {
|
type Certificates struct {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListOfAccordanceTypes(t *testing.T) {
|
func TestListOfAccordanceTypes(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Chats struct {
|
type Chats struct {
|
||||||
@@ -164,8 +164,6 @@ type ChatHistoryParams struct {
|
|||||||
// The default value is `Backward`. You can set the number of messages in the limit parameter
|
// The default value is `Backward`. You can set the number of messages in the limit parameter
|
||||||
Direction string `json:"direction" default:"Backward"`
|
Direction string `json:"direction" default:"Backward"`
|
||||||
|
|
||||||
Filter *ChatHistoryFilter `json:"filter,omitempty"`
|
|
||||||
|
|
||||||
// Identifier of the message from which the chat history will be displayed.
|
// Identifier of the message from which the chat history will be displayed.
|
||||||
// Default value is the last visible message
|
// Default value is the last visible message
|
||||||
FromMessageId string `json:"from_message_id"`
|
FromMessageId string `json:"from_message_id"`
|
||||||
@@ -174,10 +172,6 @@ type ChatHistoryParams struct {
|
|||||||
Limit int64 `json:"limit" default:"50"`
|
Limit int64 `json:"limit" default:"50"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChatHistoryFilter struct {
|
|
||||||
MessageIds []string `json:"message_ids"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ChatHistoryResponse struct {
|
type ChatHistoryResponse struct {
|
||||||
core.CommonResponse
|
core.CommonResponse
|
||||||
|
|
||||||
@@ -189,33 +183,22 @@ type ChatHistoryResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ChatHistoryMessage struct {
|
type ChatHistoryMessage struct {
|
||||||
Context *ChatHistoryContext `json:"context,omitempty"`
|
|
||||||
|
|
||||||
// Message creation date
|
// Message creation date
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
|
||||||
// Array with message content in Markdown format
|
// Array with message content in Markdown format
|
||||||
Data []string `json:"data"`
|
Data []string `json:"data"`
|
||||||
|
|
||||||
IsImage bool `json:"is_image"`
|
|
||||||
|
|
||||||
// Indication of the read message
|
// Indication of the read message
|
||||||
IsRead bool `json:"is_read"`
|
IsRead bool `json:"is_read"`
|
||||||
|
|
||||||
// Message identifier
|
// Message identifier
|
||||||
MessageId string `json:"message_id"`
|
MessageId string `json:"message_id"`
|
||||||
|
|
||||||
ModarateImageStatus string `json:"moderate_image_status"`
|
|
||||||
|
|
||||||
// Chat participant identifier
|
// Chat participant identifier
|
||||||
User ChatHistoryMessageUser `json:"user"`
|
User ChatHistoryMessageUser `json:"user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChatHistoryContext struct {
|
|
||||||
OrderNumber string `json:"order_number"`
|
|
||||||
SKU string `json:"sku"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ChatHistoryMessageUser struct {
|
type ChatHistoryMessageUser struct {
|
||||||
// Chat participant identifier
|
// Chat participant identifier
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
@@ -231,7 +214,7 @@ type ChatHistoryMessageUser struct {
|
|||||||
|
|
||||||
// Returns the history of chat messages. By default messages are shown from newest to oldest.
|
// Returns the history of chat messages. By default messages are shown from newest to oldest.
|
||||||
func (c Chats) History(ctx context.Context, params *ChatHistoryParams) (*ChatHistoryResponse, error) {
|
func (c Chats) History(ctx context.Context, params *ChatHistoryParams) (*ChatHistoryResponse, error) {
|
||||||
url := "/v3/chat/history"
|
url := "/v2/chat/history"
|
||||||
|
|
||||||
resp := &ChatHistoryResponse{}
|
resp := &ChatHistoryResponse{}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListChats(t *testing.T) {
|
func TestListChats(t *testing.T) {
|
||||||
@@ -212,22 +212,16 @@ func TestChatHistory(t *testing.T) {
|
|||||||
"has_next": true,
|
"has_next": true,
|
||||||
"messages": [
|
"messages": [
|
||||||
{
|
{
|
||||||
"context": {
|
|
||||||
"order_number": "123456789",
|
|
||||||
"sku": "987654321"
|
|
||||||
},
|
|
||||||
"created_at": "2019-08-24T14:15:22Z",
|
|
||||||
"data": [
|
|
||||||
"Здравствуйте, у меня вопрос по вашему товару \"Стекло защитное для смартфонов\", артикул 11223. Подойдет ли он на данную [ модель ](https://www.ozon.ru/product/smartfon-samsung-galaxy-a03s-4-64-gb-chernyy) телефона?"
|
|
||||||
],
|
|
||||||
"is_image": true,
|
|
||||||
"is_read": true,
|
|
||||||
"message_id": "3000000000817031942",
|
"message_id": "3000000000817031942",
|
||||||
"moderate_image_status": "SUCCESS",
|
|
||||||
"user": {
|
"user": {
|
||||||
"id": "115568",
|
"id": "115568",
|
||||||
"type": "Сustomer"
|
"type": "Сustomer"
|
||||||
}
|
},
|
||||||
|
"created_at": "2022-07-18T20:58:04.528Z",
|
||||||
|
"is_read": true,
|
||||||
|
"data": [
|
||||||
|
"Здравствуйте, у меня вопрос по вашему товару \"Стекло защитное для смартфонов\", артикул 11223. Подойдет ли он на данную [ модель ](https://www.ozon.ru/product/smartfon-samsung-galaxy-a03s-4-64-gb-chernyy) телефона?"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}`,
|
}`,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Clusters struct {
|
type Clusters struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListClusters(t *testing.T) {
|
func TestListClusters(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FBO struct {
|
type FBO struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetFBOShipmentsList(t *testing.T) {
|
func TestGetFBOShipmentsList(t *testing.T) {
|
||||||
|
|||||||
28
ozon/fbs.go
28
ozon/fbs.go
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FBS struct {
|
type FBS struct {
|
||||||
@@ -195,14 +195,6 @@ type FBSPosting struct {
|
|||||||
|
|
||||||
// Economy product identifier
|
// Economy product identifier
|
||||||
QuantumId int64 `json:"quantum_id"`
|
QuantumId int64 `json:"quantum_id"`
|
||||||
|
|
||||||
// List of products with additional characteristics
|
|
||||||
Optional FBSPostingOptional `json:"optional"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FBSPostingOptional struct {
|
|
||||||
// List of products with optional labeling
|
|
||||||
ProductsWithPossibleMandatoryMark []int `json:"products_with_possible_mandatory_mark"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type FBSPostingTariffication struct {
|
type FBSPostingTariffication struct {
|
||||||
@@ -248,7 +240,7 @@ type FBSPostingAddressee struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FBSPostingAnalyticsData struct {
|
type FBSPostingAnalyticsData struct {
|
||||||
// Delivery city. Only for rFBS shipments and sellers from CIS countries
|
// Delivery city. Only for rFBS shipments
|
||||||
City string `json:"city"`
|
City string `json:"city"`
|
||||||
|
|
||||||
// Delivery start date and time
|
// Delivery start date and time
|
||||||
@@ -381,6 +373,9 @@ type FBSRequirements struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PostingProduct struct {
|
type PostingProduct struct {
|
||||||
|
// Mandatory product labeling
|
||||||
|
MandatoryMark []string `json:"mandatory_mark"`
|
||||||
|
|
||||||
// Product name
|
// Product name
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
||||||
@@ -398,9 +393,6 @@ type PostingProduct struct {
|
|||||||
|
|
||||||
// Product identifier in the Ozon system, SKU
|
// Product identifier in the Ozon system, SKU
|
||||||
SKU int64 `json:"sku"`
|
SKU int64 `json:"sku"`
|
||||||
|
|
||||||
// Product traceability attribute
|
|
||||||
IsBLRTraceable bool `json:"is_blr_traceable"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type FBSCustomer struct {
|
type FBSCustomer struct {
|
||||||
@@ -1051,9 +1043,6 @@ type GetShipmentDataByIdentifierResult struct {
|
|||||||
// Number of the parent shipment which split resulted in the current shipment
|
// Number of the parent shipment which split resulted in the current shipment
|
||||||
ParentPostingNumber string `json:"parent_posting_number"`
|
ParentPostingNumber string `json:"parent_posting_number"`
|
||||||
|
|
||||||
// List of products with additional characteristics
|
|
||||||
Optional GetShipmentDataByIdentifierOptional `json:"optional"`
|
|
||||||
|
|
||||||
// Shipment number
|
// Shipment number
|
||||||
PostingNumber string `json:"posting_number"`
|
PostingNumber string `json:"posting_number"`
|
||||||
|
|
||||||
@@ -1105,11 +1094,6 @@ type GetShipmentDataByIdentifierResult struct {
|
|||||||
Tariffication []FBSPostingTariffication `json:"tariffication"`
|
Tariffication []FBSPostingTariffication `json:"tariffication"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetShipmentDataByIdentifierOptional struct {
|
|
||||||
// List of products with optional labeling
|
|
||||||
ProductsWithPossibleMandatoryMark []int `json:"products_with_possible_mandatory_mark"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetShipmentDataByIdentifierResultAdditionalData struct {
|
type GetShipmentDataByIdentifierResultAdditionalData struct {
|
||||||
// Key
|
// Key
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
@@ -1129,7 +1113,7 @@ type GetShipmentDataByIdentifierResultAddressee struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetShipmentDataByIdentifierResultAnalyticsData struct {
|
type GetShipmentDataByIdentifierResultAnalyticsData struct {
|
||||||
// Delivery city. Only for rFBS shipments and sellers from CIS countries
|
// Delivery city. Only for rFBS shipments
|
||||||
City string `json:"city"`
|
City string `json:"city"`
|
||||||
|
|
||||||
// Delivery start date and time
|
// Delivery start date and time
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListUnprocessedShipments(t *testing.T) {
|
func TestListUnprocessedShipments(t *testing.T) {
|
||||||
@@ -58,11 +58,6 @@ func TestListUnprocessedShipments(t *testing.T) {
|
|||||||
"in_process_at": "2021-08-25T10:48:38Z",
|
"in_process_at": "2021-08-25T10:48:38Z",
|
||||||
"shipment_date": "2021-08-26T10:00:00Z",
|
"shipment_date": "2021-08-26T10:00:00Z",
|
||||||
"delivering_date": null,
|
"delivering_date": null,
|
||||||
"optional": {
|
|
||||||
"products_with_possible_mandatory_mark": [
|
|
||||||
0
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"cancellation": {
|
"cancellation": {
|
||||||
"cancel_reason_id": 0,
|
"cancel_reason_id": 0,
|
||||||
"cancel_reason": "",
|
"cancel_reason": "",
|
||||||
@@ -76,12 +71,12 @@ func TestListUnprocessedShipments(t *testing.T) {
|
|||||||
"products": [
|
"products": [
|
||||||
{
|
{
|
||||||
"currency_code": "RUB",
|
"currency_code": "RUB",
|
||||||
"is_blr_traceable": true,
|
|
||||||
"price": "1259",
|
"price": "1259",
|
||||||
"offer_id": "УТ-0001365",
|
"offer_id": "УТ-0001365",
|
||||||
"name": "Мяч, цвет: черный, 5 кг",
|
"name": "Мяч, цвет: черный, 5 кг",
|
||||||
"sku": 140048123,
|
"sku": 140048123,
|
||||||
"quantity": 1
|
"quantity": 1,
|
||||||
|
"mandatory_mark": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"addressee": null,
|
"addressee": null,
|
||||||
@@ -260,11 +255,6 @@ func TestGetFBSShipmentsList(t *testing.T) {
|
|||||||
"in_process_at": "2022-05-13T07:07:32Z",
|
"in_process_at": "2022-05-13T07:07:32Z",
|
||||||
"shipment_date": "2022-05-13T10:00:00Z",
|
"shipment_date": "2022-05-13T10:00:00Z",
|
||||||
"delivering_date": null,
|
"delivering_date": null,
|
||||||
"optional": {
|
|
||||||
"products_with_possible_mandatory_mark": [
|
|
||||||
0
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"cancellation": {
|
"cancellation": {
|
||||||
"cancel_reason_id": 0,
|
"cancel_reason_id": 0,
|
||||||
"cancel_reason": "",
|
"cancel_reason": "",
|
||||||
@@ -277,12 +267,12 @@ func TestGetFBSShipmentsList(t *testing.T) {
|
|||||||
"products": [
|
"products": [
|
||||||
{
|
{
|
||||||
"currency_code": "RUB",
|
"currency_code": "RUB",
|
||||||
"is_blr_traceable": true,
|
|
||||||
"price": "1390.000000",
|
"price": "1390.000000",
|
||||||
"offer_id": "205953",
|
"offer_id": "205953",
|
||||||
"name": " Электронный конструктор PinLab Позитроник",
|
"name": " Электронный конструктор PinLab Позитроник",
|
||||||
"sku": 358924380,
|
"sku": 358924380,
|
||||||
"quantity": 1
|
"quantity": 1,
|
||||||
|
"mandatory_mark": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"addressee": null,
|
"addressee": null,
|
||||||
@@ -313,7 +303,7 @@ func TestGetFBSShipmentsList(t *testing.T) {
|
|||||||
],
|
],
|
||||||
"has_next": true
|
"has_next": true
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
// Test No Client-Id or Api-Key
|
// Test No Client-Id or Api-Key
|
||||||
{
|
{
|
||||||
@@ -541,7 +531,8 @@ func TestGetShipmentDataByBarcode(t *testing.T) {
|
|||||||
"offer_id": "250-7898-1",
|
"offer_id": "250-7898-1",
|
||||||
"name": "Кофе ароматизированный \"Шоколадный апельсин\" 250 гр",
|
"name": "Кофе ароматизированный \"Шоколадный апельсин\" 250 гр",
|
||||||
"sku": 180550365,
|
"sku": 180550365,
|
||||||
"quantity": 1
|
"quantity": 1,
|
||||||
|
"mandatory_mark": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"barcodes": null,
|
"barcodes": null,
|
||||||
@@ -630,11 +621,6 @@ func TestGetShipmentDataByIdentifier(t *testing.T) {
|
|||||||
"delivering_date": null,
|
"delivering_date": null,
|
||||||
"provider_status": "",
|
"provider_status": "",
|
||||||
"delivery_price": "",
|
"delivery_price": "",
|
||||||
"optional": {
|
|
||||||
"products_with_possible_mandatory_mark": [
|
|
||||||
0
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"cancellation": {
|
"cancellation": {
|
||||||
"cancel_reason_id": 0,
|
"cancel_reason_id": 0,
|
||||||
"cancel_reason": "",
|
"cancel_reason": "",
|
||||||
@@ -648,12 +634,12 @@ func TestGetShipmentDataByIdentifier(t *testing.T) {
|
|||||||
"products": [
|
"products": [
|
||||||
{
|
{
|
||||||
"currency_code": "RUB",
|
"currency_code": "RUB",
|
||||||
"is_blr_traceable": true,
|
|
||||||
"price": "279.0000",
|
"price": "279.0000",
|
||||||
"offer_id": "250-7898-1",
|
"offer_id": "250-7898-1",
|
||||||
"name": "Кофе ароматизированный \"Шоколадный апельсин\" 250 гр",
|
"name": "Кофе ароматизированный \"Шоколадный апельсин\" 250 гр",
|
||||||
"sku": 180550365,
|
"sku": 180550365,
|
||||||
"quantity": 1,
|
"quantity": 1,
|
||||||
|
"mandatory_mark": [],
|
||||||
"dimensions": {
|
"dimensions": {
|
||||||
"height": "40.00",
|
"height": "40.00",
|
||||||
"length": "240.00",
|
"length": "240.00",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Finance struct {
|
type Finance struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestReportOnSoldProducts(t *testing.T) {
|
func TestReportOnSoldProducts(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Invoices struct {
|
type Invoices struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateUpdateProformaLink(t *testing.T) {
|
func TestCreateUpdateProformaLink(t *testing.T) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testData struct {
|
type testData struct {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package ozon
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Passes struct {
|
type Passes struct {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListPasses(t *testing.T) {
|
func TestListPasses(t *testing.T) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Polygons struct {
|
type Polygons struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateDeliveryPolygon(t *testing.T) {
|
func TestCreateDeliveryPolygon(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Products struct {
|
type Products struct {
|
||||||
@@ -758,9 +758,6 @@ type UpdatePricesPrice struct {
|
|||||||
// Minimum product price with all promotions applied
|
// Minimum product price with all promotions applied
|
||||||
MinPrice string `json:"min_price"`
|
MinPrice string `json:"min_price"`
|
||||||
|
|
||||||
// Product cost price
|
|
||||||
NetPrice string `json:"net_price"`
|
|
||||||
|
|
||||||
// Product identifier in the seller's system
|
// Product identifier in the seller's system
|
||||||
OfferId string `json:"offer_id"`
|
OfferId string `json:"offer_id"`
|
||||||
|
|
||||||
@@ -1595,10 +1592,7 @@ type GetDescriptionOfProductResult struct {
|
|||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
|
|
||||||
// Array of links to product images
|
// Array of links to product images
|
||||||
Images []string `json:"images"`
|
Images []GetDescriptionOfProductResultImage `json:"images"`
|
||||||
|
|
||||||
// Model Information
|
|
||||||
ModelInfo GetDescriptionOfProductModelInfo `json:"model_info"`
|
|
||||||
|
|
||||||
// Array of 360 images
|
// Array of 360 images
|
||||||
Images360 []GetDescriptionOfProductResultImage360 `json:"images360"`
|
Images360 []GetDescriptionOfProductResultImage360 `json:"images360"`
|
||||||
@@ -1631,17 +1625,9 @@ type GetDescriptionOfProductResult struct {
|
|||||||
Width int32 `json:"width"`
|
Width int32 `json:"width"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetDescriptionOfProductModelInfo struct {
|
|
||||||
// Model Identifier
|
|
||||||
ModelId int64 `json:"model_id"`
|
|
||||||
|
|
||||||
// Quantity of combined model products
|
|
||||||
Count int64 `json:"count"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetDescriptionOfProductResultAttr struct {
|
type GetDescriptionOfProductResultAttr struct {
|
||||||
// Characteristic identifier
|
// Characteristic identifier
|
||||||
AttributeId int64 `json:"id"`
|
AttributeId int64 `json:"attribute_id"`
|
||||||
|
|
||||||
// Identifier of the characteristic that supports nested properties.
|
// Identifier of the characteristic that supports nested properties.
|
||||||
// For example, the "Processor" characteristic has nested characteristics "Manufacturer" and "L2 Cache".
|
// For example, the "Processor" characteristic has nested characteristics "Manufacturer" and "L2 Cache".
|
||||||
@@ -1686,6 +1672,12 @@ type GetDescriptionOfProductResultComplexAttrValue struct {
|
|||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetDescriptionOfProductResultImage struct {
|
||||||
|
Default bool `json:"default"`
|
||||||
|
FileName string `json:"file_name"`
|
||||||
|
Index int64 `json:"index"`
|
||||||
|
}
|
||||||
|
|
||||||
type GetDescriptionOfProductResultImage360 struct {
|
type GetDescriptionOfProductResultImage360 struct {
|
||||||
FileName string `json:"file_name"`
|
FileName string `json:"file_name"`
|
||||||
Index int64 `json:"index"`
|
Index int64 `json:"index"`
|
||||||
@@ -2130,6 +2122,10 @@ type GetProductPriceInfoFilter struct {
|
|||||||
type GetProductPriceInfoResponse struct {
|
type GetProductPriceInfoResponse struct {
|
||||||
core.CommonResponse
|
core.CommonResponse
|
||||||
|
|
||||||
|
Result GetProductPriceInfoResult `json:"result"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetProductPriceInfoResult struct {
|
||||||
// Products list
|
// Products list
|
||||||
Items []GetProductPriceInfoResultItem `json:"items"`
|
Items []GetProductPriceInfoResultItem `json:"items"`
|
||||||
|
|
||||||
@@ -2142,7 +2138,7 @@ type GetProductPriceInfoResponse struct {
|
|||||||
|
|
||||||
type GetProductPriceInfoResultItem struct {
|
type GetProductPriceInfoResultItem struct {
|
||||||
// Maximum acquiring fee
|
// Maximum acquiring fee
|
||||||
Acquiring float64 `json:"acquiring"`
|
Acquiring int32 `json:"acquiring"`
|
||||||
|
|
||||||
// Commissions information
|
// Commissions information
|
||||||
Commissions GetProductPriceInfoResultItemCommission `json:"commissions"`
|
Commissions GetProductPriceInfoResultItemCommission `json:"commissions"`
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetStocksInfo(t *testing.T) {
|
func TestGetStocksInfo(t *testing.T) {
|
||||||
@@ -2155,72 +2155,74 @@ func TestGetProductPriceInfo(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
`{
|
`{
|
||||||
"cursor": "string",
|
"result": {
|
||||||
"items": [
|
"cursor": "string",
|
||||||
{
|
"items": [
|
||||||
"acquiring": 0.5,
|
{
|
||||||
"commissions": {
|
"acquiring": 0,
|
||||||
"fbo_deliv_to_customer_amount": 14.75,
|
"commissions": {
|
||||||
"fbo_direct_flow_trans_max_amount": 46.5,
|
"fbo_deliv_to_customer_amount": 14.75,
|
||||||
"fbo_direct_flow_trans_min_amount": 31,
|
"fbo_direct_flow_trans_max_amount": 46.5,
|
||||||
"fbo_return_flow_amount": 50,
|
"fbo_direct_flow_trans_min_amount": 31,
|
||||||
"fbs_deliv_to_customer_amount": 60,
|
"fbo_return_flow_amount": 50,
|
||||||
"fbs_direct_flow_trans_max_amount": 61.5,
|
"fbs_deliv_to_customer_amount": 60,
|
||||||
"fbs_direct_flow_trans_min_amount": 41,
|
"fbs_direct_flow_trans_max_amount": 61.5,
|
||||||
"fbs_first_mile_max_amount": 25,
|
"fbs_direct_flow_trans_min_amount": 41,
|
||||||
"fbs_first_mile_min_amount": 0,
|
"fbs_first_mile_max_amount": 25,
|
||||||
"fbs_return_flow_amount": 40,
|
"fbs_first_mile_min_amount": 0,
|
||||||
"sales_percent_fbo": 15,
|
"fbs_return_flow_amount": 40,
|
||||||
"sales_percent_fbs": 0
|
"sales_percent_fbo": 15,
|
||||||
},
|
"sales_percent_fbs": 0
|
||||||
"marketing_actions": {
|
},
|
||||||
"actions": [
|
"marketing_actions": {
|
||||||
{
|
"actions": [
|
||||||
"date_from": "2024-12-13T06:49:37.591Z",
|
{
|
||||||
"date_to": "2024-12-13T06:49:37.591Z",
|
"date_from": "2024-12-13T06:49:37.591Z",
|
||||||
"title": "string",
|
"date_to": "2024-12-13T06:49:37.591Z",
|
||||||
"value": 0
|
"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",
|
||||||
|
"price": {
|
||||||
|
"auto_action_enabled": true,
|
||||||
|
"currency_code": "RUB",
|
||||||
|
"marketing_price": 0,
|
||||||
|
"marketing_seller_price": 0,
|
||||||
|
"min_price": 0,
|
||||||
|
"old_price": 579,
|
||||||
|
"price": 499,
|
||||||
|
"retail_price": 0,
|
||||||
|
"vat": 0.2
|
||||||
|
},
|
||||||
|
"price_indexes": {
|
||||||
|
"color_index": "WITHOUT_INDEX",
|
||||||
|
"external_index_data": {
|
||||||
|
"min_price": 0,
|
||||||
|
"min_price_currency": "string",
|
||||||
|
"price_index_value": 0
|
||||||
|
},
|
||||||
|
"ozon_index_data": {
|
||||||
|
"min_price": 0,
|
||||||
|
"min_price_currency": "string",
|
||||||
|
"price_index_value": 0
|
||||||
|
},
|
||||||
|
"self_marketplaces_index_data": {
|
||||||
|
"min_price": 0,
|
||||||
|
"min_price_currency": "string",
|
||||||
|
"price_index_value": 0
|
||||||
}
|
}
|
||||||
],
|
},
|
||||||
"current_period_from": "2024-12-13T06:49:37.591Z",
|
"product_id": 243686911,
|
||||||
"current_period_to": "2024-12-13T06:49:37.591Z",
|
"volume_weight": 0
|
||||||
"ozon_actions_exist": true
|
|
||||||
},
|
|
||||||
"offer_id": "356792",
|
|
||||||
"price": {
|
|
||||||
"auto_action_enabled": true,
|
|
||||||
"currency_code": "RUB",
|
|
||||||
"marketing_price": 0,
|
|
||||||
"marketing_seller_price": 0,
|
|
||||||
"min_price": 0,
|
|
||||||
"old_price": 579,
|
|
||||||
"price": 499,
|
|
||||||
"retail_price": 0,
|
|
||||||
"vat": 0.2
|
|
||||||
},
|
|
||||||
"price_indexes": {
|
|
||||||
"color_index": "WITHOUT_INDEX",
|
|
||||||
"external_index_data": {
|
|
||||||
"min_price": 0,
|
|
||||||
"min_price_currency": "string",
|
|
||||||
"price_index_value": 0
|
|
||||||
},
|
|
||||||
"ozon_index_data": {
|
|
||||||
"min_price": 0,
|
|
||||||
"min_price_currency": "string",
|
|
||||||
"price_index_value": 0
|
|
||||||
},
|
|
||||||
"self_marketplaces_index_data": {
|
|
||||||
"min_price": 0,
|
|
||||||
"min_price_currency": "string",
|
|
||||||
"price_index_value": 0
|
|
||||||
}
|
}
|
||||||
},
|
],
|
||||||
"product_id": 243686911,
|
"total": 0
|
||||||
"volume_weight": 0
|
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"total": 0
|
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
// Test No Client-Id or Api-Key
|
// Test No Client-Id or Api-Key
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Promotions struct {
|
type Promotions struct {
|
||||||
@@ -297,6 +297,196 @@ func (c Promotions) RemoveProduct(ctx context.Context, params *RemoveProductFrom
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ListHotSalePromotionsResponse struct {
|
||||||
|
core.CommonResponse
|
||||||
|
|
||||||
|
// Method result
|
||||||
|
Result []ListHotSalePromotionsResult `json:"result"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListHotSalePromotionsResult struct {
|
||||||
|
// Promotion end date
|
||||||
|
DateEnd string `json:"date_end"`
|
||||||
|
|
||||||
|
// Promotion start date
|
||||||
|
DateStart string `json:"date_start"`
|
||||||
|
|
||||||
|
// Promotion description
|
||||||
|
Description string `json:"description"`
|
||||||
|
|
||||||
|
// Promotion freeze date.
|
||||||
|
//
|
||||||
|
// If the field is filled, the seller can't increase prices, change the list of products,
|
||||||
|
// or decrease the number of product units in the promotion.
|
||||||
|
//
|
||||||
|
// The seller can lower prices and increase the product units number in the promotion
|
||||||
|
FreezeDate string `json:"freeze_date"`
|
||||||
|
|
||||||
|
// Hot Sale promotion identifier
|
||||||
|
HotsaleId float64 `json:"hotsale_id"`
|
||||||
|
|
||||||
|
// Indication that you participate in this promotion
|
||||||
|
IsParticipating bool `json:"is_participating"`
|
||||||
|
|
||||||
|
// Promotion name
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of available Hot Sale promotions
|
||||||
|
func (c Promotions) ListHotSalePromotions(ctx context.Context) (*ListHotSalePromotionsResponse, error) {
|
||||||
|
url := "/v1/actions/hotsales/list"
|
||||||
|
|
||||||
|
resp := &ListHotSalePromotionsResponse{}
|
||||||
|
|
||||||
|
response, err := c.client.Request(ctx, http.MethodPost, url, nil, resp, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
response.CopyCommonResponse(&resp.CommonResponse)
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductsAvailableForHotSalePromotionParams struct {
|
||||||
|
// Hot Sale promotion identifier
|
||||||
|
HotSaleId float64 `json:"hotsale_id"`
|
||||||
|
|
||||||
|
// Number of elements in the response. Default value is 100
|
||||||
|
Limit float64 `json:"limit"`
|
||||||
|
|
||||||
|
// Number of elements that will be skipped in the response. For example, if offset=10, the response will start with the 11th element found
|
||||||
|
Offset float64 `json:"offset,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductsAvailableForHotSalePromotionResponse struct {
|
||||||
|
core.CommonResponse
|
||||||
|
|
||||||
|
// Method result
|
||||||
|
Result ProductsAvailableForHotSalePromotionResult `json:"result"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductsAvailableForHotSalePromotionResult struct {
|
||||||
|
// Products list
|
||||||
|
Products []ProductsAvailableForHotSalePromotionResultProduct `json:"products"`
|
||||||
|
|
||||||
|
// Total number of products that are available for the promotion
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductsAvailableForHotSalePromotionResultProduct struct {
|
||||||
|
// Promotional product price
|
||||||
|
ActionPrice float64 `json:"action_price"`
|
||||||
|
|
||||||
|
// Date when the product participates in the promotion in the YYYY-MM-DD format
|
||||||
|
DateDayPromo string `json:"date_day_promo"`
|
||||||
|
|
||||||
|
// Product identifier
|
||||||
|
Id float64 `json:"id"`
|
||||||
|
|
||||||
|
// Indication that product participates in the promotion
|
||||||
|
IsActive bool `json:"is_active"`
|
||||||
|
|
||||||
|
// Maximum possible promotional price of the product
|
||||||
|
MaxActionPrice float64 `json:"max_action_price"`
|
||||||
|
|
||||||
|
// Minimum number of product units in a stock discount type promotion
|
||||||
|
MinStock float64 `json:"min_stock"`
|
||||||
|
|
||||||
|
// Number of product units in a stock discount type promotion
|
||||||
|
Stock float64 `json:"stock"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Method for getting a list of products that can participate or are already participating in the Hot Sale promotion
|
||||||
|
func (c Promotions) ProductsAvailableForHotSalePromotion(ctx context.Context, params *ProductsAvailableForHotSalePromotionParams) (*ProductsAvailableForHotSalePromotionResponse, error) {
|
||||||
|
url := "/v1/actions/hotsales/products"
|
||||||
|
|
||||||
|
resp := &ProductsAvailableForHotSalePromotionResponse{}
|
||||||
|
|
||||||
|
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 AddProductsToHotSaleParams struct {
|
||||||
|
// Hot Sale promotion identifier
|
||||||
|
HotSaleId float64 `json:"hotsale_id"`
|
||||||
|
|
||||||
|
// Products to be added to the promotion. The maximum number in one request is 100
|
||||||
|
Products []AddProductsToHotSaleProduct `json:"products"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AddProductsToHotSaleProduct struct {
|
||||||
|
// Promotional product price
|
||||||
|
ActionPrice float64 `json:"action_price"`
|
||||||
|
|
||||||
|
// Product identifier
|
||||||
|
ProductId float64 `json:"product_id"`
|
||||||
|
|
||||||
|
// Number of product units in a stock discount type promotion
|
||||||
|
Stock float64 `json:"stock"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductsToHotSaleResponse struct {
|
||||||
|
core.CommonResponse
|
||||||
|
|
||||||
|
// Method result
|
||||||
|
Result ProductsToHotSaleResult `json:"result"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductsToHotSaleResult struct {
|
||||||
|
// List of products that haven't been added to the promotion
|
||||||
|
Rejected []ProductsToHotSaleResultRejected `json:"rejected"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductsToHotSaleResultRejected struct {
|
||||||
|
//Product identifier
|
||||||
|
ProductId float64 `json:"product_id"`
|
||||||
|
|
||||||
|
// Reason why the product hasn't been added to the promotion
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c Promotions) AddProductsToHotSale(ctx context.Context, params *AddProductsToHotSaleParams) (*ProductsToHotSaleResponse, error) {
|
||||||
|
url := "/v1/actions/hotsales/activate"
|
||||||
|
|
||||||
|
resp := &ProductsToHotSaleResponse{}
|
||||||
|
|
||||||
|
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 RemoveProductsToHotSaleParams struct {
|
||||||
|
// Hot Sale promotion identifier
|
||||||
|
HotSaleId float64 `json:"hotsale_id"`
|
||||||
|
|
||||||
|
// List of products identifiers. Maximum number of values in one request is 100
|
||||||
|
ProductIds []float64 `json:"product_ids"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove product from the Hot Sale promotion
|
||||||
|
func (c Promotions) RemoveProductsToHotSale(ctx context.Context, params *RemoveProductsToHotSaleParams) (*ProductsToHotSaleResponse, error) {
|
||||||
|
url := "/v1/actions/hotsales/activate"
|
||||||
|
|
||||||
|
resp := &ProductsToHotSaleResponse{}
|
||||||
|
|
||||||
|
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 ListDiscountRequestsParams struct {
|
type ListDiscountRequestsParams struct {
|
||||||
// Discount request status
|
// Discount request status
|
||||||
Status ListDiscountRequestsStatus `json:"status" default:"UNKNOWN"`
|
Status ListDiscountRequestsStatus `json:"status" default:"UNKNOWN"`
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetAvailablePromotions(t *testing.T) {
|
func TestGetAvailablePromotions(t *testing.T) {
|
||||||
@@ -354,6 +354,248 @@ func TestRemoveProduct(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestListHotSalePromotions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
statusCode int
|
||||||
|
headers map[string]string
|
||||||
|
response string
|
||||||
|
}{
|
||||||
|
// Test Ok
|
||||||
|
{
|
||||||
|
http.StatusOK,
|
||||||
|
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||||
|
`{
|
||||||
|
"result": [
|
||||||
|
{
|
||||||
|
"date_end": "string",
|
||||||
|
"date_start": "string",
|
||||||
|
"description": "string",
|
||||||
|
"freeze_date": "string",
|
||||||
|
"hotsale_id": 0,
|
||||||
|
"is_participating": true,
|
||||||
|
"title": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
// Test No Client-Id or Api-Key
|
||||||
|
{
|
||||||
|
http.StatusUnauthorized,
|
||||||
|
map[string]string{},
|
||||||
|
`{
|
||||||
|
"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.Promotions().ListHotSalePromotions(ctx)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
compareJsonResponse(t, test.response, &ListHotSalePromotionsResponse{})
|
||||||
|
|
||||||
|
if resp.StatusCode != test.statusCode {
|
||||||
|
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProductsAvailableForHotSalePromotion(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
statusCode int
|
||||||
|
headers map[string]string
|
||||||
|
params *ProductsAvailableForHotSalePromotionParams
|
||||||
|
response string
|
||||||
|
}{
|
||||||
|
// Test Ok
|
||||||
|
{
|
||||||
|
http.StatusOK,
|
||||||
|
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||||
|
&ProductsAvailableForHotSalePromotionParams{
|
||||||
|
HotSaleId: 0,
|
||||||
|
Limit: 0,
|
||||||
|
Offset: 0,
|
||||||
|
},
|
||||||
|
`{
|
||||||
|
"result": {
|
||||||
|
"products": [
|
||||||
|
{
|
||||||
|
"action_price": 0,
|
||||||
|
"date_day_promo": "string",
|
||||||
|
"id": 0,
|
||||||
|
"is_active": true,
|
||||||
|
"max_action_price": 0,
|
||||||
|
"min_stock": 0,
|
||||||
|
"stock": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"total": 0
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
// Test No Client-Id or Api-Key
|
||||||
|
{
|
||||||
|
http.StatusUnauthorized,
|
||||||
|
map[string]string{},
|
||||||
|
&ProductsAvailableForHotSalePromotionParams{},
|
||||||
|
`{
|
||||||
|
"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.Promotions().ProductsAvailableForHotSalePromotion(ctx, test.params)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
compareJsonResponse(t, test.response, &ProductsAvailableForHotSalePromotionResponse{})
|
||||||
|
|
||||||
|
if resp.StatusCode != test.statusCode {
|
||||||
|
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAddProductsToHotSale(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
statusCode int
|
||||||
|
headers map[string]string
|
||||||
|
params *AddProductsToHotSaleParams
|
||||||
|
response string
|
||||||
|
}{
|
||||||
|
// Test Ok
|
||||||
|
{
|
||||||
|
http.StatusOK,
|
||||||
|
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||||
|
&AddProductsToHotSaleParams{
|
||||||
|
HotSaleId: 1234,
|
||||||
|
Products: []AddProductsToHotSaleProduct{
|
||||||
|
{
|
||||||
|
ActionPrice: 12,
|
||||||
|
ProductId: 111,
|
||||||
|
Stock: 45,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
`{
|
||||||
|
"result": {
|
||||||
|
"rejected": [
|
||||||
|
{
|
||||||
|
"product_id": 0,
|
||||||
|
"reason": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
// Test No Client-Id or Api-Key
|
||||||
|
{
|
||||||
|
http.StatusUnauthorized,
|
||||||
|
map[string]string{},
|
||||||
|
&AddProductsToHotSaleParams{},
|
||||||
|
`{
|
||||||
|
"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.Promotions().AddProductsToHotSale(ctx, test.params)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
compareJsonResponse(t, test.response, &ProductsToHotSaleResponse{})
|
||||||
|
|
||||||
|
if resp.StatusCode != test.statusCode {
|
||||||
|
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRemoveProductsToHotSale(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
statusCode int
|
||||||
|
headers map[string]string
|
||||||
|
params *RemoveProductsToHotSaleParams
|
||||||
|
response string
|
||||||
|
}{
|
||||||
|
// Test Ok
|
||||||
|
{
|
||||||
|
http.StatusOK,
|
||||||
|
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
|
||||||
|
&RemoveProductsToHotSaleParams{
|
||||||
|
HotSaleId: 12345,
|
||||||
|
ProductIds: []float64{111},
|
||||||
|
},
|
||||||
|
`{
|
||||||
|
"result": {
|
||||||
|
"rejected": [
|
||||||
|
{
|
||||||
|
"product_id": 0,
|
||||||
|
"reason": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
// Test No Client-Id or Api-Key
|
||||||
|
{
|
||||||
|
http.StatusUnauthorized,
|
||||||
|
map[string]string{},
|
||||||
|
&RemoveProductsToHotSaleParams{},
|
||||||
|
`{
|
||||||
|
"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.Promotions().RemoveProductsToHotSale(ctx, test.params)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
compareJsonResponse(t, test.response, &ProductsToHotSaleResponse{})
|
||||||
|
|
||||||
|
if resp.StatusCode != test.statusCode {
|
||||||
|
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestListDiscountRequests(t *testing.T) {
|
func TestListDiscountRequests(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Quants struct {
|
type Quants struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListQuants(t *testing.T) {
|
func TestListQuants(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Rating struct {
|
type Rating struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetCurrentRatingInfo(t *testing.T) {
|
func TestGetCurrentRatingInfo(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Reports struct {
|
type Reports struct {
|
||||||
@@ -480,10 +480,6 @@ type GetReturnsReportsFilter struct {
|
|||||||
type GetReturnsReportResponse struct {
|
type GetReturnsReportResponse struct {
|
||||||
core.CommonResponse
|
core.CommonResponse
|
||||||
|
|
||||||
Result GetReturnsReportResult `json:"result"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetReturnsReportResult struct {
|
|
||||||
// Unique report identifier. The report is available for downloading within 3 days after making a request.
|
// Unique report identifier. The report is available for downloading within 3 days after making a request.
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetList(t *testing.T) {
|
func TestGetList(t *testing.T) {
|
||||||
@@ -380,9 +380,7 @@ func TestGetReturnsReport(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
`{
|
`{
|
||||||
"result": {
|
"code": "REPORT_seller_products_924336_1720170405_a9ea2f27-a473-4b13-99f9-d0cfcb5b1a69"
|
||||||
"code": "REPORT_seller_products_924336_1720170405_a9ea2f27-a473-4b13-99f9-d0cfcb5b1a69"
|
|
||||||
}
|
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
// Test No Client-Id or Api-Key
|
// Test No Client-Id or Api-Key
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Returns struct {
|
type Returns struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetRFBSReturns(t *testing.T) {
|
func TestGetRFBSReturns(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Reviews struct {
|
type Reviews struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLeaveComment(t *testing.T) {
|
func TestLeaveComment(t *testing.T) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Strategies struct {
|
type Strategies struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListCompetitors(t *testing.T) {
|
func TestListCompetitors(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Warehouses struct {
|
type Warehouses struct {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
core "git.denco.store/fakz9/ozon-api-client"
|
core "github.com/diphantxm/ozon-api-client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetListOfWarehouses(t *testing.T) {
|
func TestGetListOfWarehouses(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user