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.
41 lines
2.1 KiB
Python
41 lines
2.1 KiB
Python
# Generated by Django 4.2.16 on 2026-11-06 13:26
|
|
|
|
from decimal import Decimal
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('orders', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Payment',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('method', models.CharField(choices=[('card', 'Банковская карта'), ('sbp', 'СБП'), ('mir_pay', 'МИР Pay'), ('cash', 'Наличные при получении'), ('installment', 'Рассрочка'), ('split', 'Оплата частями')], max_length=20)),
|
|
('status', models.CharField(choices=[('pending', 'Ожидает'), ('succeeded', 'Успешно'), ('failed', 'Ошибка'), ('refunded', 'Возвращён'), ('cancelled', 'Отменён')], default='pending', max_length=20)),
|
|
('amount', models.DecimalField(decimal_places=2, default=Decimal('0'), max_digits=12)),
|
|
('provider', models.CharField(default='yookassa', max_length=32)),
|
|
('provider_payment_id', models.CharField(blank=True, db_index=True, max_length=128)),
|
|
('idempotency_key', models.CharField(blank=True, max_length=128, null=True, unique=True)),
|
|
('payload', models.JSONField(blank=True, default=dict)),
|
|
('paid_at', models.DateTimeField(blank=True, null=True)),
|
|
('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payments', to='orders.order')),
|
|
],
|
|
options={
|
|
'verbose_name': 'платёж',
|
|
'verbose_name_plural': 'платежи',
|
|
'db_table': 'payments_payment',
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
]
|