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>
This commit is contained in:
40
myproject/integrations/models/marketplaces/woocommerce.py
Normal file
40
myproject/integrations/models/marketplaces/woocommerce.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from django.db import models
|
||||
from .base import MarketplaceIntegration
|
||||
|
||||
|
||||
class WooCommerceIntegration(MarketplaceIntegration):
|
||||
"""Интеграция с WooCommerce"""
|
||||
|
||||
# WooCommerce-specific credentials
|
||||
consumer_key = models.CharField(
|
||||
max_length=255,
|
||||
blank=True,
|
||||
verbose_name="Consumer Key"
|
||||
)
|
||||
|
||||
consumer_secret = models.CharField(
|
||||
max_length=255,
|
||||
blank=True,
|
||||
verbose_name="Consumer Secret"
|
||||
)
|
||||
|
||||
# API версия (WooCommerce REST API v1, v2, v3)
|
||||
api_version = models.CharField(
|
||||
max_length=10,
|
||||
default='v3',
|
||||
blank=True,
|
||||
verbose_name="Версия API"
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "WooCommerce"
|
||||
verbose_name_plural = "WooCommerce"
|
||||
managed = False # Пока заготовка - без создания таблицы
|
||||
|
||||
def __str__(self):
|
||||
return f"WooCommerce: {self.name or self.store_url}"
|
||||
|
||||
@property
|
||||
def is_configured(self) -> bool:
|
||||
"""WooCommerce требует consumer_key и consumer_secret"""
|
||||
return bool(self.consumer_key and self.consumer_secret)
|
||||
Reference in New Issue
Block a user