Files
mercadodevida/spec/acceptance.md
2026-08-22 07:09:03 +02:00

38 lines
1.7 KiB
Markdown

# F-152 — Acceptance Criteria
- Feature ID: F-152
## Account creation → welcome email
- Escenario: customer registers with a new email.
- Given SMTP is configured and `POST /auth/register` is called with valid email+password
- When registration succeeds
- Then a welcome email (`account_created`) is sent to that email
- And the response is still 200 with the user payload
- And evidence: SMTP sendmail called once with recipient == input email and template account_created
- Escenario: SMTP is not configured.
- Given SMTP is not configured and `POST /auth/register` is called
- When registration succeeds
- Then the response is still 200 (registration never fails due to email)
- And a warning is logged
## Order confirmation on payment success
- Escenario: customer pays and Stripe reports PaymentSucceeded.
- Given an order in AWAITING_PAYMENT and a valid `PaymentSucceeded` webhook
- When the webhook is processed
- Then the order moves to PAID
- And a confirmation email (`state: PAID`) is sent to the order's customer email via sendOrderStatusEmail
- And the webhook returns 2xx
- Escenario: duplicate webhook.
- Given the same PaymentSucceeded webhook delivered twice
- When the second is processed
- Then only one confirmation email is sent (idempotency from payment dedup / outcome.kind == duplicate skipped)
- Escenario: SMTP not configured.
- Given SMTP not configured and a PaymentSucceeded webhook arrives
- When processed
- Then the order still moves to PAID, webhook returns 2xx, and an email failure is logged (not thrown)
## Regression
- verify.sh is green
- No existing order admin-transition email behavior changed
- Password-reset email flow unchanged