schon/payments/signals.py
Egor fureunoir Gorbunov 76d490f2e2 Refactor translation command and improve order model.
Enhanced the `deepl_translate` management command with improved placeholder handling, error messages, and support for missing translations. Added `human_readable_id` and `is_business` attributes to the `Order` model, updating associated admin configurations to reflect these changes.
2025-05-06 03:28:06 +03:00

21 lines
644 B
Python

from django.db.models.signals import post_save
from django.dispatch import receiver
from payments.models import Balance, Transaction
from vibes_auth.models import User
@receiver(post_save, sender=User)
def create_balance_on_user_creation_signal(instance, created, **kwargs):
if created:
Balance.objects.create(user=instance)
@receiver(post_save, sender=Transaction)
def process_transaction_changes(instance, created, **kwargs):
if created:
try:
gateway = object()
gateway.process_transaction(instance)
except Exception: # noqa:
instance.process = {"status": "NOGATEWAY"}