Parametros faltantes

This commit is contained in:
Juan Pablo Vial
2025-05-27 19:30:08 -04:00
parent 026474c63c
commit 6e0e1fc75e
3 changed files with 21 additions and 3 deletions

View File

@ -7,12 +7,19 @@ use Incoviba\Common\Alias\Command;
#[Console\Attribute\AsCommand(name: 'external:toku:reset')]
class Reset extends Command
{
protected function configure(): void
{
$this->addOption('venta_ids', 'vid', Console\Input\InputOption::VALUE_OPTIONAL, 'Venta IDs separated by |', '');
}
protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output): int
{
$this->logger->debug("Running {$this->getName()}");
$uri = '/api/external/toku/reset';
$output->writeln("GET {$uri}");
$response = $this->client->get($uri);
$output->writeln("DELETE {$uri}");
$body = ['venta_ids' => explode('|', $input->getArgument('venta_ids'))];
$options = count($body) > 0 ? ['json' => $body] : [];
$response = $this->client->delete($uri, $options);
$output->writeln("Response Code: {$response->getStatusCode()}");
return self::SUCCESS;