From 81247bde52788c000d73ca49ff5e9398bcb2bbd8 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Wed, 13 Aug 2025 20:50:07 +0300 Subject: [PATCH] Features: 1) Deduct `buy_price` from user's payment balance upon order product creation. Fixes: None; Extra: None; --- core/signals.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/signals.py b/core/signals.py index 5fbf7b49..c58c20d6 100644 --- a/core/signals.py +++ b/core/signals.py @@ -103,6 +103,8 @@ def process_order_changes(instance, created, **_kwargs): download = DigitalAssetDownload.objects.create(order_product=order_product) order_product.download = download order_product.save() + order_product.order.user.payments_balance.amount -= order_product.buy_price + order_product.order.user.payments_balance.save() continue try: logger.debug("Trying to buy: %s", str(order_product.uuid))