mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-25 14:24:31 +00:00
01a5befd87
- Removed wallet transaction and transfer logic from the wallet domain. - Introduced a new tonapi module to handle transactions and balance checks. - Updated tests to reflect the new structure and ensure functionality remains intact. - Added functionality for sending TON and USDT transfers through the tonapi module. - Improved error handling and validation for payment balances. - Cleaned up and organized imports across the codebase.
22 lines
808 B
Python
22 lines
808 B
Python
"""Parse Fragment init responses to the payment amount the transaction should cover."""
|
|
|
|
from pyfragment.domains.payments import parse_required_payment_amount
|
|
|
|
|
|
def test_parse_required_payment_amount_ton_uses_amount() -> None:
|
|
init_response = {"amount": "0.326"}
|
|
assert parse_required_payment_amount(init_response) == 0.326
|
|
|
|
|
|
def test_parse_required_payment_amount_usdt_uses_amount() -> None:
|
|
init_response = {
|
|
"amount": "0.00075",
|
|
"content": '<span class="icon-before icon-usd">0.75</span>',
|
|
}
|
|
assert parse_required_payment_amount(init_response) == 0.00075
|
|
|
|
|
|
def test_parse_required_payment_amount_usdt_falls_back_to_amount() -> None:
|
|
init_response = {"amount": "1.25", "content": "<p>no usd icon</p>"}
|
|
assert parse_required_payment_amount(init_response) == 1.25
|