Rinat 50dc046369
Some checks failed
deploy / deploy (push) Failing after 2s
test / test (push) Failing after 1s
v2.0: massive test data (104 products, 41 postings, 20 returns, 20 payouts, 25 txs, 3 companies)
- 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
2026-07-17 14:38:53 +03:00
2026-07-15 16:19:24 +03:00
2026-07-15 16:19:24 +03:00
2026-07-15 16:19:24 +03:00

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 prices
  • GET /v1/product/list - List products
  • POST /v3/product/info/list - Get product info
  • POST /v3/product/info/stocks - Get product stocks
  • POST /v4/product/info/prices - Get product prices

Postings

  • POST /v2/posting/fbs/list - List FBS postings
  • POST /v2/posting/fbs/get - Get posting details
  • POST /v1/posting/fbs/cancel - Cancel posting

Finance

  • POST /v1/finance/transaction/list - List transactions
  • POST /v1/finance/payout/list - List payouts

Returns

  • POST /v1/returns/list - List returns

Analytics

  • POST /v1/analytics/data - Analytics data
  • POST /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 - delivered
  • TEST-POST-002 - delivered
  • TEST-POST-003 - awaiting_deliver
  • TEST-POST-004 - cancelled

Deployment

# Build
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ozon-mock ./cmd/server

# Run
./ozon-mock
Description
No description provided
Readme 60 KiB
Languages
Go 99.2%
Makefile 0.5%
Dockerfile 0.3%