Files
portal/app/resources/views/emails/zero_balance_paused.blade.php
T
Дмитрий ce87936f44 feat(billing): Plan 4 Task 6 — auto-pause flow + ZeroBalancePausedMail + 1/hour rate-limit
При InsufficientBalanceException в LedgerService::chargeForDelivery:
- DB::transaction откатывается (Deal/charge/balance не тронуты).
- Outer catch в createDealCopyForProject вызывает handleInsufficientBalance:
  * UPDATE projects.is_active=false через pgsql_supplier (BYPASSRLS).
  * Email ZeroBalancePausedMail через NotificationService::notifyZeroBalancePaused.
  * Rate-limit 1/час/tenant через Redis SETNX (Cache::add).
  * Log::warning с tenant_id/project_id/balance details.
- Возвращаем false (не rethrow), чтобы handle()-loop продолжал routing остальным tenant'ам.

5 тестов: project paused / email sent / rate-limit 1/h / 2nd email after 65min /
sharing-flow isolation (A paused, B receives).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 10:43:51 +03:00

16 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="ru">
<head><meta charset="UTF-8"><title>Проект приостановлен</title></head>
<body style="font-family: 'Inter', Arial, sans-serif; color: #012019;">
<p>Здравствуйте!</p>
<p>Проект <strong>«{{ $project->name }}»</strong> приостановлен недостаточно средств для приёма следующего лида.</p>
<ul>
<li>Баланс в лидах: <strong>{{ $tenant->balance_leads }}</strong></li>
<li>Баланс в рублях: <strong>{{ number_format((float) $tenant->balance_rub, 2, ',', ' ') }} </strong></li>
<li>Цена за следующий лид: <strong>{{ number_format($requiredPriceKopecks / 100, 2, ',', ' ') }} </strong></li>
</ul>
<p>Пополните баланс на странице <a href="https://{{ $tenant->subdomain }}.liderra.ru/billing">«Баланс и тарифы»</a>, чтобы возобновить приём лидов.</p>
<p>С уважением, команда Лидерра.</p>
</body>
</html>