From f4a0c9be72ecb8694ca39dc6365075b4538d487f Mon Sep 17 00:00:00 2001 From: Anton Akuev Date: Mon, 12 Feb 2024 17:33:34 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=B0=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- payments/services/webhooks.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/payments/services/webhooks.py b/payments/services/webhooks.py index ca3ffc3f..52044581 100644 --- a/payments/services/webhooks.py +++ b/payments/services/webhooks.py @@ -10,6 +10,7 @@ from yookassa import Payment from yookassa.domain.notification import PaymentWebhookNotification +from orders.models.orders import Order from .payments import _PaymentBaseService from ..models.payments import OrderPayment @@ -112,6 +113,12 @@ def __update_status_payment(self) -> None: is_paid=OrderPayment.Status.PAID, ) + def __update_status_order(self) -> None: + """Обновить статус заказа.""" + Order.objects.filter(id=self._order_payment.pk).update( + order_status=Order.Status.WORK, + ) + def execute(self) -> None: """Выполнить обработку webhook-а.""" self._setting_an_account() @@ -124,3 +131,4 @@ def execute(self) -> None: self.__check_payment_status_with_get_request() self.__is_status_succeeded() self.__update_status_payment() + self.__update_status_order()