whisper-money/tests/Feature/Jobs/Drip
Víctor Falcón ce6bfc9c56
feat(drip): email users stuck on the paywall a day after onboarding (#562)
## What

Sends an automated follow-up email the day after a user finishes
onboarding but stays stuck on the paywall, asking why they didn't
continue and inviting a direct reply.

## Why

Users who connect a bank account during onboarding but never pick a plan
are permanently redirected to the paywall by `EnsureUserIsSubscribed` —
they finish onboarding and then can't access the app. This reaches out
to understand the friction and recover them.

## Who gets the email (the genuinely stuck cohort)

- `onboarded_at` is calendar-yesterday (`whereDate('onboarded_at',
today()->subDay())`)
- Has an active banking connection (`bankingConnections()->exists()`)
- No Pro plan (`hasProPlan()` is false)
- Hasn't already received this email (idempotent via `UserMailLog`)

Users **without** a bank connection are excluded: they fall through to
free access after seeing the paywall once, so they aren't stuck.

## How

- New `email:paywall-follow-up` command scans the cohort daily and
queues the job — scheduled `dailyAt('10:00')` Europe/Madrid in
`routes/console.php`.
- New `DripEmailType::PaywallFollowUp` (`paywall_follow_up`) +
idempotent send job following the existing drip pattern.
- Short, human Markdown email with an explicit `replyTo`
(`hi@whisper.money`) so replies reach a real inbox.
- Spanish copy added to `lang/es.json`.

## Tests

10 new tests (correct cohort matched; wrong day / no bank / Pro plan
excluded; no double-send; no-op when drip disabled). `pint` clean.

## Note

There was no existing user-scanning drip command (current drips dispatch
with `delay()` on `Registered`). Since "stuck on paywall" state isn't
known at registration time, a daily scanning command is the right fit.
2026-06-19 14:11:12 +00:00
..
SendFeedbackEmailJobTest.php feat(queue): Implement queueable email jobs with rate limiting 2025-12-30 07:22:18 +01:00
SendImportHelpEmailJobTest.php feat(queue): Implement queueable email jobs with rate limiting 2025-12-30 07:22:18 +01:00
SendOnboardingReminderEmailJobTest.php feat(queue): Implement queueable email jobs with rate limiting 2025-12-30 07:22:18 +01:00
SendPaywallFollowUpEmailJobTest.php feat(drip): email users stuck on the paywall a day after onboarding (#562) 2026-06-19 14:11:12 +00:00
SendPromoCodeEmailJobTest.php feat(queue): Implement queueable email jobs with rate limiting 2025-12-30 07:22:18 +01:00
SendSubscriptionCancelledEmailJobTest.php Add subscription cancellation email with manual trigger command (#47) 2025-12-30 20:32:44 +01:00
SendWelcomeEmailJobTest.php Support soft-deleted users with reusable emails (#316) 2026-04-22 11:41:41 +01:00