Refactor frontend components and backend migrations

- Removed TradingGraph component from frontend/src/components/trading.
- Updated home page to import Services component and TradingGraph from new path.
- Modified PortfolioPage to return null instead of PortfolioGrid.
- Added initial migrations for account, advertisement, commerce, configuration, downloader, gopay, stripe, trading212, and zasilkovna apps in the backend.
- Created Services component with subcomponents for Kinematografie, Drone Service, and Website Service.
- Implemented TradingGraph component with dynamic data generation and canvas rendering.
- Updated DonationShop component to display donation tiers with icons and descriptions.
This commit is contained in:
2025-12-14 03:49:16 +01:00
parent 564418501c
commit 1751badb90
40 changed files with 796 additions and 165 deletions

View File

@@ -0,0 +1,26 @@
# Generated by Django 5.2.9 on 2025-12-14 02:23
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='StripeModel',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.CharField(choices=[('pending', 'cz#Čeká se na platbu'), ('paid', 'cz#Zaplaceno'), ('failed', 'cz#Neúspěšné'), ('cancelled', 'cz#Zrušeno'), ('refunding', 'cz#Platba se vrací'), ('refunded', 'cz#Platba úspěšně vrácena')], default='pending', max_length=20)),
('stripe_session_id', models.CharField(blank=True, max_length=255, null=True)),
('stripe_payment_intent', models.CharField(blank=True, max_length=255, null=True)),
('stripe_session_url', models.URLField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True, null=True)),
],
),
]

View File

View File

@@ -1,6 +1,6 @@
from django.urls import path
from .views import CreateCheckoutSessionView
from .views import StripeWebhook
urlpatterns = [
path("orders/create-checkout/", CreateCheckoutSessionView.as_view(), name="create-checkout"),
path("stripe-webhook/", StripeWebhook.as_view(), name="stripe-webhook"),
]

View File

@@ -9,7 +9,7 @@ from drf_spectacular.utils import extend_schema
import os
import logging
from .models import StripeTransaction
from .models import StripeModel
from commerce.models import Order, Payment
logger = logging.getLogger(__name__)
@@ -48,7 +48,7 @@ class StripeWebhook(APIView):
# ZAPLACENO
if event['type'] == 'checkout.session.completed':
stripe_transaction = StripeTransaction.objects.get(stripe_session_id=session.id)
stripe_transaction = StripeModel.objects.get(stripe_session_id=session.id)
if stripe_transaction:
stripe_transaction.paid()
@@ -60,7 +60,7 @@ class StripeWebhook(APIView):
# EXPIRACE (zrušení objednávky) uživatel nezaplatil do 24 hodin!
elif event['type'] == 'checkout.session.expired':
order = Order.objects.get(payment=Payment.objects.get(stripe=StripeTransaction.objects.get(stripe_session_id=session.id)))
order = Order.objects.get(payment=Payment.objects.get(stripe=StripeModel.objects.get(stripe_session_id=session.id)))
order.status = Order.STATUS_CHOICES.CANCELLED
order.save()
@@ -71,7 +71,7 @@ class StripeWebhook(APIView):
# REFUND POTVRZEN
elif event['type'] == 'payment_intent.refunded':
session = event['data']['object']
stripe_transaction = StripeTransaction.objects.get(stripe_payment_intent=session.id)
stripe_transaction = StripeModel.objects.get(stripe_payment_intent=session.id)
if stripe_transaction:
stripe_transaction.refund_confirmed()