20 lines
569 B
Python
20 lines
569 B
Python
"""Pure rules for TBank payment notification handling."""
|
|
|
|
from enum import Enum
|
|
|
|
|
|
class TBankPaymentNotificationAction(str, Enum):
|
|
ACKNOWLEDGE_ONLY = "acknowledge_only"
|
|
REGISTER_CDEK_ORDER = "register_cdek_order"
|
|
|
|
|
|
def resolve_tbank_payment_notification_action(
|
|
*,
|
|
status: str,
|
|
success: bool,
|
|
error_code: str,
|
|
) -> TBankPaymentNotificationAction:
|
|
if status == "CONFIRMED" and success is True and error_code == "0":
|
|
return TBankPaymentNotificationAction.REGISTER_CDEK_ORDER
|
|
return TBankPaymentNotificationAction.ACKNOWLEDGE_ONLY
|