Files
FragmentAPI/pyfragment/domains/purchases/service.py
T
bohd4nx 9f11ccb3ee Refactor pyfragment structure: Move models to domain-specific modules
- Moved PaymentMethod and other enums from models to enums.py for better organization.
- Refactored imports in various files to reflect the new structure.
- Created new model files for ads, anonymous numbers, giveaways, marketplace, purchases, and tonapi.
- Removed the old models.py file to clean up the codebase.
- Updated all relevant imports in the codebase to use the new model locations.
2026-06-16 01:02:28 +03:00

32 lines
1.0 KiB
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.enums import PaymentMethod
from pyfragment.domains.purchases.models 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 = PaymentMethod.GRAM,
) -> 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 = PaymentMethod.GRAM,
) -> PremiumResult:
return await purchase_premium(self._client, username, months, show_sender=show_sender, payment_method=payment_method)