From cb964610739fa60f9820c8cd5b2af8e485b06cd7 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Sat, 21 Nov 2026 17:22:38 -0500 Subject: [PATCH] fix(CR-17): omit zoom_start_url from unauthenticated GET appointment lookup - Set zoom_start_url to None in GET /api/appointments/ while keeping it in POST /pay - Update index.html Screen 3 to show host link only when present and explain host-auth requirement on GET - Add TDD test verifying GET omits zoom_start_url while POST /pay returns it --- app/__init__.py | 4 +++- app/templates/index.html | 8 +++++--- tests/test_app.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 1470a02..9483e8a 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -122,7 +122,9 @@ def create_app(test_config: dict | None = None) -> Flask: row, err = _resolve_appointment(lookup_id, db_path) if err: return err - return jsonify(AppointmentResponse.model_validate(row).model_dump()), 200 + payload = AppointmentResponse.model_validate(row).model_dump() + payload["zoom_start_url"] = None + return jsonify(payload), 200 @app.post("/api/appointments//pay") @limiter.limit("10 per minute") diff --git a/app/templates/index.html b/app/templates/index.html index d75a404..bcc0a13 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -283,9 +283,11 @@ const joinLinkHtml = safeJoinUrl ? `${escapeHtml(safeJoinUrl)}` : `${escapeHtml(appt.zoom_join_url || "No disponible")}`; - const startLinkHtml = safeStartUrl - ? `Abrir como anfitriona (privado)` - : `Enlace no válido`; + const startLinkHtml = !appt.zoom_start_url + ? `Disponible solo al confirmar el pago (requiere credenciales de anfitriona)` + : safeStartUrl + ? `Abrir como anfitriona (privado)` + : `Enlace no válido`; extraHtml = `
  • Zoom Meeting ID: ${escapeHtml(appt.zoom_meeting_id)}
  • diff --git a/tests/test_app.py b/tests/test_app.py index 05a1305..0486202 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -843,3 +843,32 @@ def test_get_appointment_lookup_id_length_boundaries(client, lookup_id, expected test_client, _ = client resp = test_client.get(f"/api/appointments/{lookup_id}") assert resp.status_code == expected_status + + +def test_get_appointment_omits_zoom_start_url_while_pay_returns_it(client, monkeypatch): + test_client, _ = client + _mock_zoom_happy_path(monkeypatch) + + c_resp = test_client.post( + "/api/appointments", + json={ + "credentials": SAMPLE_CREDS, + "client_name": "María Perez", + "start_time_local": "2026-11-25T15:00", + }, + ) + assert c_resp.status_code == 201 + sid = c_resp.get_json()["session_id"] + + p_resp = test_client.post( + f"/api/appointments/{sid}/pay", + json={"credentials": SAMPLE_CREDS}, + ) + assert p_resp.status_code == 200 + assert p_resp.get_json()["zoom_start_url"] == "https://zoom.us/s/987654321?zak=abc" + + g_resp = test_client.get(f"/api/appointments/{sid}") + assert g_resp.status_code == 200 + fetched = g_resp.get_json() + assert fetched["zoom_start_url"] is None + assert fetched["zoom_join_url"] == "https://zoom.us/j/987654321"