Добавлена обработка уведомлений через ручку
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user