CLI
This commit is contained in:
25
cli/src/Command/Comunas.php
Normal file
25
cli/src/Command/Comunas.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'comunas'
|
||||
)]
|
||||
class Comunas extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/direcciones/region/13/comunas';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
35
cli/src/Command/Money/IPC.php
Normal file
35
cli/src/Command/Money/IPC.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Money;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use DateInterval;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'money:ipc'
|
||||
)]
|
||||
class IPC extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$lastMonth = (new DateTimeImmutable())->sub(new DateInterval('P1M'));
|
||||
$uri = '/api/money';
|
||||
$data = [
|
||||
'provider' => 'ipc',
|
||||
'fecha' => $lastMonth->format('Y-m-1')
|
||||
];
|
||||
$output->writeln("POST {$uri}");
|
||||
$response = $this->client->post($uri, [
|
||||
'body' => http_build_query($data),
|
||||
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
|
||||
]);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
34
cli/src/Command/Money/UF.php
Normal file
34
cli/src/Command/Money/UF.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Money;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'money:uf'
|
||||
)]
|
||||
class UF extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$now = new DateTimeImmutable();
|
||||
$uri = '/api/money';
|
||||
$data = [
|
||||
'provider' => 'uf',
|
||||
'fecha' => $now->format('Y-m-d')
|
||||
];
|
||||
$output->writeln("POST {$uri}");
|
||||
$response = $this->client->post($uri, [
|
||||
'body' => http_build_query($data),
|
||||
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
|
||||
]);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Proyectos/Activos.php
Normal file
25
cli/src/Command/Proyectos/Activos.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Proyectos;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'proyectos:activos'
|
||||
)]
|
||||
class Activos extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/proyectos';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Ventas/Cierres/Vigentes.php
Normal file
25
cli/src/Command/Ventas/Cierres/Vigentes.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Ventas\Cierres;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'ventas:cierres:vigentes'
|
||||
)]
|
||||
class Vigentes extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/ventas/cierres/vigentes';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Ventas/Cuotas/Hoy.php
Normal file
25
cli/src/Command/Ventas/Cuotas/Hoy.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Ventas\Cuotas;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'ventas:cuotas:hoy'
|
||||
)]
|
||||
class Hoy extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/ventas/cuotas/hoy';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Ventas/Cuotas/Pendientes.php
Normal file
25
cli/src/Command/Ventas/Cuotas/Pendientes.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Ventas\Cuotas;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'ventas:cuotas:pendientes'
|
||||
)]
|
||||
class Pendientes extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/ventas/cuotas/pendientes';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
25
cli/src/Command/Ventas/Cuotas/PorVencer.php
Normal file
25
cli/src/Command/Ventas/Cuotas/PorVencer.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Command\Ventas\Cuotas;
|
||||
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console;
|
||||
|
||||
#[Console\Attribute\AsCommand(
|
||||
name: 'ventas:cuotas:vencer'
|
||||
)]
|
||||
class PorVencer extends Console\Command\Command
|
||||
{
|
||||
public function __construct(protected ClientInterface $client, string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
||||
{
|
||||
$uri = '/api/ventas/cuotas/vencer';
|
||||
$output->writeln("GET {$uri}");
|
||||
$response = $this->client->get($uri);
|
||||
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||
return Console\Command\Command::SUCCESS;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user