Skip to content

Commit

Permalink
feat: Добавил обновление статуса заказа.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonVagabond committed Feb 12, 2024
1 parent a5515c7 commit f4a0c9b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions payments/services/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand All @@ -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()

0 comments on commit f4a0c9b

Please sign in to comment.