feat: update payment method defaults to use PaymentMethod enum; refactor related validation checks

This commit is contained in:
bohd4nx
2026-05-29 22:31:30 +03:00
parent 5124af17ef
commit 6aa7037380
13 changed files with 49 additions and 38 deletions
+3 -2
View File
@@ -9,6 +9,7 @@ from tonutils.exceptions import ProviderResponseError
from pyfragment import TransactionError, WalletError
from pyfragment.domains.tonapi.transaction import process_transaction
from pyfragment.models.enums import PaymentMethod
from tests.shared import VALID_SEED
@@ -145,7 +146,7 @@ async def test_usdt_payment_requires_min_ton_gas_reserve() -> None:
wallet = _make_wallet(balance_nanotons=10_000_000) # 0.01 TON below MIN_TON_BALANCE
with _patch_wallet(wallet), patch("pyfragment.domains.tonapi.account.get_usdt_balance", AsyncMock(return_value=100.0)):
with pytest.raises(WalletError, match="Insufficient TON balance"):
await process_transaction(_make_client(), TRANSACTION_DATA, payment_method="usdt_ton")
await process_transaction(_make_client(), TRANSACTION_DATA, payment_method=PaymentMethod.USDT_TON)
@pytest.mark.asyncio
@@ -173,6 +174,6 @@ async def test_usdt_payment_checks_usdt_balance() -> None:
await process_transaction(
_make_client(),
transaction,
payment_method="usdt_ton",
payment_method=PaymentMethod.USDT_TON,
required_payment_amount=12.5,
)