Files
octopus/myproject/integrations/models/marketplaces/recommerce.py
Andrey Smakotin 4629369823 feat(integrations): добавлена заготовка интеграции Recommerce
- Создана структура marketplaces/ для маркетплейсов
- Модели: MarketplaceIntegration, WooCommerceIntegration, RecommerceIntegration
- Сервисы: MarketplaceService, WooCommerceService, RecommerceService
- RecommerceService содержит методы для работы с API:
  - test_connection(), sync(), fetch_products()
  - push_product(), update_stock(), update_price()
- IntegrationConfig обновлён с новой интеграцией

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 23:19:42 +03:00

60 lines
2.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from django.db import models
from .base import MarketplaceIntegration
class RecommerceIntegration(MarketplaceIntegration):
"""
Интеграция с Recommerce.
Recommerce - сервис для управления товарами на маркетплейсах.
"""
# API endpoint (может отличаться от store_url)
api_endpoint = models.URLField(
blank=True,
verbose_name="API Endpoint",
help_text="URL API Recommerce (если отличается от URL магазина)"
)
# API токен (основной метод авторизации)
api_token = models.CharField(
max_length=500,
blank=True,
verbose_name="API Токен",
help_text="Токен авторизации Recommerce API"
)
# ID магазина в системе Recommerce
merchant_id = models.CharField(
max_length=100,
blank=True,
verbose_name="ID магазина",
help_text="Идентификатор магазина в Recommerce"
)
# Синхронизация цен
sync_prices = models.BooleanField(
default=True,
verbose_name="Синхронизировать цены",
help_text="Обновлять цены на маркетплейсе"
)
# Синхронизация остатков
sync_stock = models.BooleanField(
default=True,
verbose_name="Синхронизировать остатки",
help_text="Обновлять остатки на маркетплейсе"
)
class Meta:
verbose_name = "Recommerce"
verbose_name_plural = "Recommerce"
managed = False # Пока заготовка - без создания таблицы
def __str__(self):
return f"Recommerce: {self.name or self.merchant_id}"
@property
def is_configured(self) -> bool:
"""Recommerce требует api_token"""
return bool(self.api_token)