mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-08-13 14:53:05 +00:00
ae164d4fe7
- Added MarketplaceService for searching usernames, numbers, and gifts. - Introduced PurchasesService for purchasing stars and premium subscriptions. - Created WalletService for wallet operations including balance checks and top-ups. - Developed transaction handling for TON and USDT transfers. - Added models for payments, marketplace results, and wallet information. - Implemented error handling for various operations including wallet and transaction errors. - Established domain structure for purchases, marketplace, and wallet functionalities.
22 lines
770 B
Python
22 lines
770 B
Python
"""Unit tests for init payment amount parsing."""
|
|
|
|
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
|