Add test_amount responses

This commit is contained in:
polyfloyd 2025-04-12 20:39:59 +02:00
parent 00dcf85e2b
commit 30e40a1d66

View file

@ -12,8 +12,9 @@ app = FastAPI()
templates = Jinja2Templates(directory="resources") templates = Jinja2Templates(directory="resources")
public_url = os.environ.get("PUBLIC_URL", "http://localhost:8000").rstrip("/") 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 = 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) @app.get("/", response_class=HTMLResponse)
@ -93,6 +94,10 @@ async def rb_backend(request: Request):
payment.id, payment.id,
{"metadata": {"revbank_status": "pending"}}, {"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"]) return ok(amount=payment.amount["value"])
# Called when a pending Revbank transaction is aborted by the user. # Called when a pending Revbank transaction is aborted by the user.