2023-11-25 00:56:18 -03:00
|
|
|
<?php
|
|
|
|
namespace Incoviba\Command\Money;
|
|
|
|
|
|
|
|
use DateTimeImmutable;
|
|
|
|
use Symfony\Component\Console;
|
2023-11-25 21:38:00 -03:00
|
|
|
use Incoviba\Common\Alias\Command;
|
2023-11-25 00:56:18 -03:00
|
|
|
|
|
|
|
#[Console\Attribute\AsCommand(
|
|
|
|
name: 'money:uf'
|
|
|
|
)]
|
2023-11-25 21:38:00 -03:00
|
|
|
class UF extends Command
|
2023-11-25 00:56:18 -03:00
|
|
|
{
|
|
|
|
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
|
|
|
|
{
|
2023-11-25 21:38:00 -03:00
|
|
|
$this->logger->debug("Running {$this->getName()}");
|
2023-11-25 00:56:18 -03:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
}
|