Добавлена обработка уведомлений через ручку

This commit is contained in:
Раис Юсупалиев
2026-04-18 21:27:15 +03:00
parent 78e9ad4fa9
commit 6b66af5eb3
38 changed files with 1519 additions and 32 deletions
@@ -0,0 +1,55 @@
from app.domain.payment_notifications import (
TBankPaymentNotificationAction,
resolve_tbank_payment_notification_action,
)
def test_confirmed_success_zero_error_code_registers_cdek_order() -> None:
result = resolve_tbank_payment_notification_action(
status="CONFIRMED",
success=True,
error_code="0",
)
assert result is TBankPaymentNotificationAction.REGISTER_CDEK_ORDER
def test_confirmed_without_success_acknowledges_only() -> None:
result = resolve_tbank_payment_notification_action(
status="CONFIRMED",
success=False,
error_code="0",
)
assert result is TBankPaymentNotificationAction.ACKNOWLEDGE_ONLY
def test_confirmed_with_non_zero_error_code_acknowledges_only() -> None:
result = resolve_tbank_payment_notification_action(
status="CONFIRMED",
success=True,
error_code="101",
)
assert result is TBankPaymentNotificationAction.ACKNOWLEDGE_ONLY
def test_known_non_confirmed_statuses_acknowledge_only() -> None:
for status in ("AUTHORIZED", "REJECTED", "CANCELED", "DEADLINE_EXPIRED"):
result = resolve_tbank_payment_notification_action(
status=status,
success=True,
error_code="0",
)
assert result is TBankPaymentNotificationAction.ACKNOWLEDGE_ONLY
def test_unknown_status_acknowledges_only() -> None:
result = resolve_tbank_payment_notification_action(
status="UNKNOWN_STATUS",
success=True,
error_code="0",
)
assert result is TBankPaymentNotificationAction.ACKNOWLEDGE_ONLY