Initial Ladill Hosting app with Gitea deploy pipeline.
Deploy Ladill Hosting / deploy (push) Failing after 17s
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>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?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)),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user