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

@ -4,20 +4,25 @@ namespace Incoviba\Service\Contabilidad;
use DateTimeInterface;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Log\LoggerInterface;
use Incoviba\Common\Implement\Exception;
use Incoviba\Repository;
use Incoviba\Service;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use function Symfony\Component\Translation\t;
use Incoviba\Common\Ideal;
class Nubox
class Nubox extends Ideal\Service
{
public function __construct(protected Repository\Nubox $nuboxRepository,
public function __construct(protected LoggerInterface $logger,
protected Repository\Nubox $nuboxRepository,
protected Service\Redis $redisService,
protected ClientInterface $client,
protected RequestFactoryInterface $requestFactory,
protected string $api_url) {}
protected string $api_url)
{
parent::__construct($logger);
}
protected array $tokens;
public function getToken(int $inmobiliaria_rut): string
@ -120,7 +125,7 @@ class Nubox
$uri = 'contabilidad/libro-diario?' . http_build_query($query);
$response = $this->send($uri, $inmobiliaria_rut);
if ($response->getStatusCode() !== 200) {
error_log(var_export($uri,true).PHP_EOL,3,'/logs/debug');
$this->logger->debug($uri);
throw new Exception\HttpResponse($response->getReasonPhrase(), $response->getStatusCode());
}
return json_decode($response->getBody()->getContents(), JSON_OBJECT_AS_ARRAY);