Fix ETTN creation on live Checkbox

- prepayment as DISCOUNT: live API rejects PRE_PAYMENT with 400 third_party.generic
- normalize lowercase ETTN statuses returned by the live API
- show Checkbox error code instead of bare 'Internal Server Error'
- page size 50 for ETTN list, 429 rate limit is retryable, pause polling on it
- phone in 380XXXXXXXXX format like portal receipts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-24 13:49:50 +03:00
co-authored by Claude Opus 5.5
parent 912a37c00c
commit 3a6ad85d11
7 changed files with 73 additions and 26 deletions
+8 -1
View File
@@ -7,7 +7,7 @@
from __future__ import annotations
from pydantic import BaseModel, ConfigDict, Field
from pydantic import BaseModel, ConfigDict, Field, field_validator
class EttnStatus:
@@ -30,3 +30,10 @@ class EttnOut(BaseModel):
total_sum: int | None = Field(default=None, alias="totalSum")
receipt_id: str | None = Field(default=None, alias="receiptId")
raw_error: str | None = Field(default=None, alias="rawError")
# В OpenAPI статусы заглавные, а боевой API отдаёт строчные (`"done"`,
# `"created"`) — приводим к одному регистру, иначе статусы не сопоставятся.
@field_validator("status", mode="before")
@classmethod
def _upper_status(cls, value: object) -> object:
return value.upper() if isinstance(value, str) else value