Spaces:
Sleeping
Sleeping
Download src/utils/payments/base.py from hashir-qt/keyvault-api: direct link, hf CLI and curl.
- Browser
- Download file 990 Bytes
-
https://huggingface.co/spaces/hashir-qt/keyvault-api/resolve/main/src/utils/payments/base.py
- Command line
-
hf download hf://spaces/hashir-qt/keyvault-api/src/utils/payments/base.py
-
curl -L -o base.py https://huggingface.co/spaces/hashir-qt/keyvault-api/resolve/main/src/utils/payments/base.py
990 Bytes
| from abc import ABC, abstractmethod | |
| from dataclasses import dataclass | |
| class PaymentCharge: | |
| """Unified payment charge object.""" | |
| id: str | |
| amount: float | |
| currency: str | |
| status: str # pending, confirmed, failed, etc. | |
| checkout_url: str = "" | |
| metadata: dict = None | |
| def __post_init__(self): | |
| if self.metadata is None: | |
| self.metadata = {} | |
| class PaymentProcessor(ABC): | |
| """Abstract base for all payment processors.""" | |
| async def create_charge( | |
| self, amount: float, currency: str, metadata: dict | |
| ) -> PaymentCharge: | |
| """Create a payment charge.""" | |
| pass | |
| async def verify_payment(self, charge_id: str) -> PaymentCharge: | |
| """Verify payment status.""" | |
| pass | |
| def parse_webhook(self, payload: dict, signature: str) -> PaymentCharge: | |
| """Parse a webhook callback.""" | |
| pass | |