Add Django backend, 1C integration, deploy config and API docs
Backend (Django 4.2 + DRF): - accounts: phone OTP login, JWT, profile, addresses - catalog: categories, products, images, filters, search, hits/new/related - orders: creation with Idempotency-Key, stock reservation, status history, cancel - loyalty: bonus accounts, promo codes, gift certificates - payments: payment records and YooKassa webhook handling - content: static pages, banners, site settings - integration: 1C exchange (catalog sync, order push via outbox, statuses, bonuses) - common: error envelope, pagination, request-id, integration auth, admin dashboard Infrastructure: Dockerfile, docker-compose (Postgres, Redis, Celery worker/beat, Nginx), requirements split by environment, OpenAPI contracts for site and 1C, architecture doc. Tests: 22 pytest cases covering catalog, orders, idempotency, OTP, integration.
This commit is contained in:
1 parent
5f8d37357d
commit
756f40353b
130 files changed
+10066
No files matched your search
@@ -0,0 +1,33 @@
|
||||
from apps.orders.models import Order
|
||||
|
||||
# 1C statuses are configurable per configuration (УТ/ERP/УНФ), so the mapping
|
||||
# is intentionally explicit and easy to extend. Keys are normalized to lower
|
||||
# case and stripped before lookup.
|
||||
ONEC_STATUS_MAP: dict[str, str] = {
|
||||
# English codes
|
||||
"new": Order.Status.NEW,
|
||||
"processing": Order.Status.PROCESSING,
|
||||
"delivering": Order.Status.DELIVERING,
|
||||
"completed": Order.Status.COMPLETED,
|
||||
"cancelled": Order.Status.CANCELLED,
|
||||
"canceled": Order.Status.CANCELLED,
|
||||
# Russian names
|
||||
"новый": Order.Status.NEW,
|
||||
"в обработке": Order.Status.PROCESSING,
|
||||
"подтвержден": Order.Status.PROCESSING,
|
||||
"подтверждён": Order.Status.PROCESSING,
|
||||
"собирается": Order.Status.PROCESSING,
|
||||
"передан в доставку": Order.Status.DELIVERING,
|
||||
"доставляется": Order.Status.DELIVERING,
|
||||
"в пути": Order.Status.DELIVERING,
|
||||
"выполнен": Order.Status.COMPLETED,
|
||||
"закрыт": Order.Status.COMPLETED,
|
||||
"отменен": Order.Status.CANCELLED,
|
||||
"отменён": Order.Status.CANCELLED,
|
||||
}
|
||||
|
||||
|
||||
def map_1c_status(raw_status: str | None) -> str | None:
|
||||
if not raw_status:
|
||||
return None
|
||||
return ONEC_STATUS_MAP.get(raw_status.strip().lower())
|
||||
Reference in new issue
Block a user