Enqueue ventas para enviar a Toku

This commit is contained in:
Juan Pablo Vial
2025-05-27 19:24:23 -04:00
parent f32204df97
commit 026474c63c
5 changed files with 74 additions and 2 deletions

View File

@ -17,6 +17,7 @@ return [
'queue' => Incoviba\Command\Queue::class,
'external:services' => Incoviba\Command\ExternalServices::class,
'external:toku:reset' => Incoviba\Command\Ventas\MedioPagos\Toku\Reset::class,
'external:toku:enqueue' => Incoviba\Command\Ventas\MedioPagos\Toku\Enqueue::class
];
}
];

View File

@ -0,0 +1,24 @@
<?php
namespace Incoviba\Command\Ventas\MedioPagos\Toku;
use Symfony\Component\Console;
use Incoviba\Common\Alias\Command;
#[Console\Attribute\AsCommand(name: 'external:toku:enqueue')]
class Enqueue extends Command
{
protected function configure(): void
{
$this->addArgument('venta_ids', Console\Input\InputArgument::REQUIRED, '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/enqueue';
$output->writeln("POST {$uri}");
$body = ['venta_ids' => explode('|', $input->getArgument('venta_ids'))];
$response = $this->client->post($uri, ['json' => $body]);
$output->writeln("Response Code: {$response->getStatusCode()}");
return Console\Command\Command::SUCCESS;
}
}