wahnsinn vibe
This commit is contained in:
34
backend/apps/payment/__init__.py
Normal file
34
backend/apps/payment/__init__.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""Dummy payment provider — always approves."""
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from core.di import register_service
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
class PaymentProvider:
|
||||
name = "DummyPayment"
|
||||
|
||||
def charge(self, amount: float, currency: str, method: str = "dummy") -> dict:
|
||||
return {
|
||||
"status": "paid",
|
||||
"transaction_id": f"DUM-{uuid.uuid4().hex[:12]}",
|
||||
"amount": amount,
|
||||
"currency": currency,
|
||||
"method": method,
|
||||
}
|
||||
|
||||
|
||||
def on_load() -> None:
|
||||
register_service("PaymentProvider", PaymentProvider())
|
||||
|
||||
|
||||
@router.get("/methods")
|
||||
def available_methods():
|
||||
return [
|
||||
{"id": "dummy", "label_de": "Testzahlung", "label_en": "Test payment"},
|
||||
]
|
||||
6
backend/apps/payment/manifest.yaml
Normal file
6
backend/apps/payment/manifest.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
name: payment
|
||||
version: 0.1.0
|
||||
depends_on: [core]
|
||||
conflicts_with: []
|
||||
required: true
|
||||
provides: [PaymentProvider]
|
||||
Reference in New Issue
Block a user