diff --git a/main.py b/main.py index a6009fe..f25388f 100644 --- a/main.py +++ b/main.py @@ -12,8 +12,9 @@ app = FastAPI() templates = Jinja2Templates(directory="resources") public_url = os.environ.get("PUBLIC_URL", "http://localhost:8000").rstrip("/") +mollie_apikey = os.environ.get("MOLLIE_API_KEY", "test_test") mollie_client = Client() -mollie_client.set_api_key(os.environ.get("MOLLIE_API_KEY", "test_test")) +mollie_client.set_api_key(mollie_apikey) @app.get("/", response_class=HTMLResponse) @@ -93,6 +94,10 @@ async def rb_backend(request: Request): payment.id, {"metadata": {"revbank_status": "pending"}}, ) + + if mollie_apikey.startswith("test_"): + return ok(amount="0.00", test_amount=payment.amount["value"]) + return ok(amount=payment.amount["value"]) # Called when a pending Revbank transaction is aborted by the user.