Fix join 500, wallet dropdown balance, and launcher Meet entry.
Deploy Ladill Meet / deploy (push) Successful in 1m35s
Deploy Ladill Meet / deploy (push) Successful in 1m35s
Handle billing API failures gracefully on session start, add wallet.balance JSON endpoint, and sync Meet into the app launcher. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -83,8 +83,14 @@ class MeetBillingService
|
||||
max(1, (int) config('meet.billing.minimum_streaming_hours', 1))
|
||||
);
|
||||
|
||||
$affordable = $this->canAffordSafely($organization->owner_ref, $amountMinor);
|
||||
|
||||
if ($affordable === null) {
|
||||
abort(503, 'Billing is temporarily unavailable. Please try again shortly.');
|
||||
}
|
||||
|
||||
abort_unless(
|
||||
$this->billing->canAfford($organization->owner_ref, $amountMinor),
|
||||
$affordable,
|
||||
402,
|
||||
sprintf(
|
||||
'Insufficient wallet balance. Meetings are billed at GHS %.2f per hour — top up your Ladill wallet to start.',
|
||||
@@ -198,7 +204,7 @@ class MeetBillingService
|
||||
$periodEnd = $this->nextPeriodEnd($base);
|
||||
$reference = sprintf('meet-%s-renewal:%s:through:%s', $type, $uuid, $periodEnd->format('Y-m-d'));
|
||||
|
||||
if (! $this->billing->canAfford($organization->owner_ref, $amountMinor)) {
|
||||
if (! ($this->canAffordSafely($organization->owner_ref, $amountMinor) ?? false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -301,7 +307,7 @@ class MeetBillingService
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! $this->billing->canAfford($organization->owner_ref, $amountMinor)) {
|
||||
if (! ($this->canAffordSafely($organization->owner_ref, $amountMinor) ?? false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -357,6 +363,22 @@ class MeetBillingService
|
||||
]);
|
||||
}
|
||||
|
||||
/** @return bool|null null when the billing API is unreachable */
|
||||
protected function canAffordSafely(string $ownerRef, int $amountMinor): ?bool
|
||||
{
|
||||
try {
|
||||
return $this->billing->canAfford($ownerRef, $amountMinor);
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('Meet billing can-afford check failed', [
|
||||
'owner_ref' => $ownerRef,
|
||||
'amount_minor' => $amountMinor,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected function debit(
|
||||
string $ownerRef,
|
||||
int $amountMinor,
|
||||
|
||||
Reference in New Issue
Block a user