Files
portal/app/app/Exceptions/Billing/InsufficientBalanceException.php
T

37 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.
<?php
declare(strict_types=1);
namespace App\Exceptions\Billing;
use RuntimeException;
use Throwable;
/**
* Выбрасывается LedgerService::chargeForDelivery, когда у tenant нет
* рублей под текущую tier-цену (balance_rub * 100 < priceKopecks).
*
* Ловится в RouteSupplierLeadJob::createDealCopyForProject — инициирует
* auto-pause flow (см. spec §4.2).
*
* Billing v2 Spec A: prepaid-лиды убраны, поэтому balance_leads больше не отражается
* в сообщении/полях; источник — единый ₽-баланс.
*/
final class InsufficientBalanceException extends RuntimeException
{
public function __construct(
public readonly int $priceKopecks,
public readonly string $balanceRub,
?Throwable $previous = null,
) {
parent::__construct(
sprintf(
'Insufficient balance: price_kopecks=%d, balance_rub=%s',
$priceKopecks,
$balanceRub,
),
previous: $previous,
);
}
}