From 30e40a1d667834250afeee1aa2fedd2f3f7800c1 Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Sat, 12 Apr 2025 20:39:59 +0200 Subject: [PATCH] Add test_amount responses --- main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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.