mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-25 06:14:29 +00:00
feat: update payment method defaults to use PaymentMethod enum; refactor related validation checks
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user