Informe Tesoreria

This commit is contained in:
Juan Pablo Vial
2024-02-13 01:16:17 -03:00
parent 19333bc338
commit e44ab30665
23 changed files with 896 additions and 40 deletions

View File

@ -7,9 +7,12 @@ use DateInterval;
use Incoviba\Common\Define\Money\Provider;
use Incoviba\Common\Implement\Exception\EmptyResponse;
use Incoviba\Service\Money\MiIndicador;
use Psr\Log\LoggerInterface;
class Money
{
public function __construct(protected LoggerInterface $logger) {}
protected array $providers;
public function register(string $name, Provider $provider): Money
{
@ -49,4 +52,13 @@ class Money
return 0;
}
}
public function getUSD(DateTimeInterface $dateTime): float
{
try {
return $this->getProvider('usd')->get(MiIndicador::USD, $dateTime);
} catch (EmptyResponse $exception) {
$this->logger->critical($exception);
return 0;
}
}
}