50dc0463697dc375ebb1d00c744f34f9e3f148a3
- Remove unused gin dependency from go.mod - Remove credential logging from startup - Remove dead parseOfferIDs function - Add method check to GET /v1/product/list - Complete all filter implementations (since, to, status, product_id, return_id, dir, analytics, page) - CancelPosting now validates posting existence (404 for unknown) - Implement MOCK_STOCKS_JSON file loading - Add Phase 2 endpoints: v3/product/import, v1/product/info/description, v1/product/info/attributes, v2/category/tree, v3/category/attribute, v3/category/attribute/values - Generate 104 products/stocks/prices across 3 companies: TechGiant (TG-0001..TG-0035), FashionLine (FL-0001..FL-0035), HomeStyle (HS-0001..HS-0034) - 41 postings, 20 returns, 20 payouts, 25 transactions - 31 tests (all PASS with race detector) - Add Makefile
Ozon Mock API Server
Mock-сервер для тестирования интеграции с Ozon Seller API.
Быстрый старт
# Запуск
go run ./cmd/server
# Или с переменными окружения
OZON_CLIENT_ID=test-client OZON_API_KEY=test-key PORT=8080 go run ./cmd/server
Тестовые запросы
# Stocks
curl -X POST http://localhost:8080/v3/product/info/stocks \
-H "Client-Id: test-client" \
-H "Api-Key: test-key" \
-H "Content-Type: application/json" \
-d '{"filter": {"offer_id": ["TEST-SKU-001"]}, "limit": 100}'
# Postings list
curl -X POST http://localhost:8080/v2/posting/fbs/list \
-H "Client-Id: test-client" \
-H "Api-Key: test-key" \
-H "Content-Type: application/json" \
-d '{"dir": "desc", "limit": 100}'
# Posting details
curl -X POST http://localhost:8080/v2/posting/fbs/get \
-H "Client-Id: test-client" \
-H "Api-Key: test-key" \
-H "Content-Type: application/json" \
-d '{"posting_number": "TEST-POST-001"}'
# Import prices
curl -X POST http://localhost:8080/v1/product/import/prices \
-H "Client-Id: test-client" \
-H "Api-Key: test-key" \
-H "Content-Type: application/json" \
-d '{"items": [{"offer_id": "TEST-SKU-001", "price": 1990.00}]}'
Переменные окружения
| Переменная | Обязательна | По умолчанию | Описание |
|---|---|---|---|
PORT |
Нет | 8080 | Порт |
OZON_CLIENT_ID |
Нет | (пусто) | Ожидаемый Client-ID. Если пусто - не проверяется |
OZON_API_KEY |
Нет | (пусто) | Ожидаемый API-Key. Если пусто - не проверяется |
Эндпоинты
Products
POST /v1/product/import/prices- Import pricesGET /v1/product/list- List productsPOST /v3/product/info/list- Get product infoPOST /v3/product/info/stocks- Get product stocksPOST /v4/product/info/prices- Get product prices
Postings
POST /v2/posting/fbs/list- List FBS postingsPOST /v2/posting/fbs/get- Get posting detailsPOST /v1/posting/fbs/cancel- Cancel posting
Finance
POST /v1/finance/transaction/list- List transactionsPOST /v1/finance/payout/list- List payouts
Returns
POST /v1/returns/list- List returns
Analytics
POST /v1/analytics/data- Analytics dataPOST /v1/analytics/turnover/stocks- Stock turnover
Health
GET /health- Health check
Тестовые данные
Offer IDs
TEST-SKU-001- Тестовый товар 1 (price: 1990, stock: 150)TEST-SKU-002- Тестовый товар 2 (price: 990, stock: 75)TEST-SKU-003- Тестовый товар 3 (price: 3990, stock: 200)TEST-SKU-004- Тестовый товар 4 (price: 590, stock: 0)TEST-SKU-005- Тестовый товар 5 (price: 1590, stock: 50)
Posting Numbers
TEST-POST-001- deliveredTEST-POST-002- deliveredTEST-POST-003- awaiting_deliverTEST-POST-004- cancelled
Deployment
# Build
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ozon-mock ./cmd/server
# Run
./ozon-mock
Description
Languages
Go
99.2%
Makefile
0.5%
Dockerfile
0.3%