import base64
import json
from app.core.config import settings


def generate_payme_checkout_url(order_id: int, amount: str):
    data = {
        "m": settings.PAYME_MERCHANT_ID,
        "ac.order": str(order_id),
        "a": int(float(amount) * 100),
    }

    encoded = base64.b64encode(json.dumps(data).encode()).decode()

    return f"https://checkout.paycom.uz/{encoded}"