@@ -179,6 +179,7 @@ class CSEClient:
|
||||
"cse_request_server_error",
|
||||
operation=operation,
|
||||
status_code=response.status_code,
|
||||
response_excerpt=_response_excerpt(response.text),
|
||||
)
|
||||
raise CSEClientError(
|
||||
f"CSE {operation} request failed with status "
|
||||
@@ -233,6 +234,10 @@ class CSEClient:
|
||||
return self._retry_backoff_seconds * (2**attempt)
|
||||
|
||||
|
||||
def _response_excerpt(text: str, *, limit: int = 1000) -> str:
|
||||
return " ".join(text.split())[:limit]
|
||||
|
||||
|
||||
class CSEProvider(DeliveryProvider):
|
||||
name = CSE_PROVIDER_NAME
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from enum import Enum
|
||||
|
||||
class TBankPaymentNotificationAction(str, Enum):
|
||||
ACKNOWLEDGE_ONLY = "acknowledge_only"
|
||||
REGISTER_CDEK_ORDER = "register_cdek_order"
|
||||
REGISTER_PROVIDER_ORDER = "register_provider_order"
|
||||
|
||||
|
||||
def resolve_tbank_payment_notification_action(
|
||||
@@ -15,7 +15,7 @@ def resolve_tbank_payment_notification_action(
|
||||
error_code: str,
|
||||
) -> TBankPaymentNotificationAction:
|
||||
if status == "CONFIRMED" and success is True and error_code == "0":
|
||||
return TBankPaymentNotificationAction.REGISTER_CDEK_ORDER
|
||||
return TBankPaymentNotificationAction.REGISTER_PROVIDER_ORDER
|
||||
return TBankPaymentNotificationAction.ACKNOWLEDGE_ONLY
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user