Deploy Ladill Hosting / deploy (push) Failing after 17s
Shared web hosting extracted from the platform monolith, with CI deploy to /var/www/ladill-hosting matching Bird/Domains/Email. Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Services\Currency\CurrencyConverterService;
|
|
|
|
class ExchangeRateService
|
|
{
|
|
public function __construct(
|
|
private CurrencyConverterService $currency,
|
|
) {}
|
|
|
|
public function getUsdToGhs(): float
|
|
{
|
|
return $this->currency->getUsdToGhsRate();
|
|
}
|
|
|
|
public function getEurToGhs(): float
|
|
{
|
|
return $this->currency->getEurToGhsRate();
|
|
}
|
|
|
|
public function fetchLiveRate(): float
|
|
{
|
|
return $this->currency->refreshRate();
|
|
}
|
|
|
|
public function refreshRate(): float
|
|
{
|
|
return $this->currency->refreshRate();
|
|
}
|
|
|
|
public function getCachedRate(): ?float
|
|
{
|
|
$info = $this->currency->getRateInfo();
|
|
|
|
return ($info['cached'] ?? false)
|
|
? (float) ($info['rate'] ?? 0)
|
|
: null;
|
|
}
|
|
|
|
public function getRateInfo(): array
|
|
{
|
|
$info = $this->currency->getRateInfo();
|
|
|
|
return [
|
|
'rate' => (float) ($info['rate'] ?? 0),
|
|
'is_cached' => (bool) ($info['cached'] ?? false),
|
|
'fallback_rate' => (float) ($info['fallback'] ?? config('hosting.pricing.fallback_usd_to_ghs_rate', 15.50)),
|
|
];
|
|
}
|
|
}
|