mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-25 06:14:29 +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.
32 lines
1021 B
Python
32 lines
1021 B
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from pyfragment.domains.base import BaseService
|
|
from pyfragment.domains.purchases.purchase import purchase_premium, purchase_stars
|
|
from pyfragment.models.enums import PaymentMethod
|
|
from pyfragment.models.payments import PremiumResult, StarsResult
|
|
|
|
if TYPE_CHECKING:
|
|
pass
|
|
|
|
|
|
class PurchasesService(BaseService):
|
|
async def purchase_stars(
|
|
self,
|
|
username: str,
|
|
amount: int,
|
|
show_sender: bool = True,
|
|
payment_method: PaymentMethod = "ton",
|
|
) -> StarsResult:
|
|
return await purchase_stars(self._client, username, amount, show_sender=show_sender, payment_method=payment_method)
|
|
|
|
async def purchase_premium(
|
|
self,
|
|
username: str,
|
|
months: int,
|
|
show_sender: bool = True,
|
|
payment_method: PaymentMethod = "ton",
|
|
) -> PremiumResult:
|
|
return await purchase_premium(self._client, username, months, show_sender=show_sender, payment_method=payment_method)
|