Logs de diagnostic et rapprochement SumUp ↔ bénévole
- Une ligne de log par requête (route modèle, statut, durée, code d'erreur, compte), identifiant X-Request-ID repris dans chaque log et affiché à l'utilisateur sous une erreur, exceptions non gérées tracées (500 JSON) - Journal d'accès d'uvicorn coupé : il exposait le jeton du formulaire public - Logs métier : paiement SumUp, connexion, import, plannings, solveur - Nom du bénévole dans la description du checkout SumUp - Code et identifiant de transaction SumUp enregistrés au paiement (migration 0023), affichés sur la fiche et dans l'export Excel Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d722a81a87
commit
d0fa1e109c
@@ -716,6 +716,56 @@ def test_paying_promotes_the_pending_submission_to_a_volunteer(
|
||||
assert fiche["willing_to_pay_fee"] is True
|
||||
|
||||
|
||||
def test_checkout_description_names_the_volunteer(raw_client, client, edition, monkeypatch):
|
||||
# Pas de champ de métadonnées libre à la création d'un checkout SumUp :
|
||||
# c'est la description (visible dans le tableau de bord SumUp) qui porte
|
||||
# le nom, pour rapprocher la transaction du bénévole.
|
||||
option_id = _configure_sumup(client, edition)
|
||||
calls = []
|
||||
monkeypatch.setattr(
|
||||
"app.api.forms.create_checkout",
|
||||
lambda **kw: calls.append(kw)
|
||||
or SumUpCheckout(id="co_1", status="PENDING", hosted_checkout_url="https://x"),
|
||||
)
|
||||
_submit(
|
||||
raw_client, edition,
|
||||
first_name="alex", last_name="martin", hcaptcha_token="x",
|
||||
payment_option_id=option_id,
|
||||
)
|
||||
assert calls[0]["description"] == (
|
||||
f"Alex Martin — Cotisation classique — édition {edition.year}"
|
||||
)
|
||||
|
||||
|
||||
def test_promotion_records_the_sumup_transaction(raw_client, client, edition, monkeypatch):
|
||||
option_id = _configure_sumup(client, edition)
|
||||
monkeypatch.setattr(
|
||||
"app.api.forms.create_checkout",
|
||||
lambda **kw: SumUpCheckout(id="co_1", status="PENDING", hosted_checkout_url="https://x"),
|
||||
)
|
||||
token = _submit(
|
||||
raw_client, edition,
|
||||
first_name="Alex", last_name="Martin", hcaptcha_token="x",
|
||||
payment_option_id=option_id,
|
||||
).json()["pending_token"]
|
||||
monkeypatch.setattr(
|
||||
"app.api.forms.get_checkout",
|
||||
lambda **kw: SumUpCheckout(
|
||||
id="co_1",
|
||||
status="PAID",
|
||||
hosted_checkout_url=None,
|
||||
transaction_code="TEENSK4W2K",
|
||||
transaction_id="tx-uuid-1",
|
||||
),
|
||||
)
|
||||
|
||||
volunteer_id = _pending_status(raw_client, edition, token)["volunteer_id"]
|
||||
|
||||
fiche = client.get(f"/editions/{edition.id}/volunteers/{volunteer_id}").json()
|
||||
assert fiche["fee_transaction_code"] == "TEENSK4W2K"
|
||||
assert fiche["fee_transaction_id"] == "tx-uuid-1"
|
||||
|
||||
|
||||
def test_payment_confirmation_sends_an_email_on_promotion(
|
||||
raw_client, client, edition, monkeypatch, outbox
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user