Parametros faltantes
This commit is contained in:
2
app/resources/routes/api/external/toku.php
vendored
2
app/resources/routes/api/external/toku.php
vendored
@ -5,4 +5,6 @@ $app->group('/toku', function($app) {
|
|||||||
$app->post('/cuotas/{venta_id}[/]', [Toku::class, 'cuotas']);
|
$app->post('/cuotas/{venta_id}[/]', [Toku::class, 'cuotas']);
|
||||||
$app->post('/success[/]', [Toku::class, 'success']);
|
$app->post('/success[/]', [Toku::class, 'success']);
|
||||||
$app->get('/test[/]', [Toku::class, 'test']);
|
$app->get('/test[/]', [Toku::class, 'test']);
|
||||||
|
$app->delete('/reset[/]', [Toku::class, 'reset']);
|
||||||
|
$app->post('/enqueue[/]', [Toku::class, 'enqueue']);
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Incoviba\Controller\API\Ventas\MediosPago;
|
namespace Incoviba\Controller\API\Ventas\MediosPago;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Psr\Http\Message\ResponseFactoryInterface;
|
use Psr\Http\Message\ResponseFactoryInterface;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
@ -108,7 +109,15 @@ class Toku extends Controller
|
|||||||
if (!isset($_ENV['TOKU_ENV']) or strtolower($_ENV['TOKU_ENV']) !== 'sandbox') {
|
if (!isset($_ENV['TOKU_ENV']) or strtolower($_ENV['TOKU_ENV']) !== 'sandbox') {
|
||||||
return $this->withJson($response);
|
return $this->withJson($response);
|
||||||
}
|
}
|
||||||
$output = $tokuService->reset();
|
$input = $request->getParsedBody();
|
||||||
|
$output = [
|
||||||
|
'input' => $input,
|
||||||
|
'success' => false
|
||||||
|
];
|
||||||
|
try {
|
||||||
|
$tokuService->reset($input['skips'] ?? []);
|
||||||
|
$output['success'] = true;
|
||||||
|
} catch (Exception $exception) {}
|
||||||
return $this->withJson($response, $output);
|
return $this->withJson($response, $output);
|
||||||
}
|
}
|
||||||
public function enqueue(ServerRequestInterface $request, ResponseInterface $response,
|
public function enqueue(ServerRequestInterface $request, ResponseInterface $response,
|
||||||
|
@ -7,12 +7,19 @@ use Incoviba\Common\Alias\Command;
|
|||||||
#[Console\Attribute\AsCommand(name: 'external:toku:reset')]
|
#[Console\Attribute\AsCommand(name: 'external:toku:reset')]
|
||||||
class Reset extends Command
|
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
|
protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$this->logger->debug("Running {$this->getName()}");
|
$this->logger->debug("Running {$this->getName()}");
|
||||||
$uri = '/api/external/toku/reset';
|
$uri = '/api/external/toku/reset';
|
||||||
$output->writeln("GET {$uri}");
|
$output->writeln("DELETE {$uri}");
|
||||||
$response = $this->client->get($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()}");
|
$output->writeln("Response Code: {$response->getStatusCode()}");
|
||||||
|
|
||||||
return self::SUCCESS;
|
return self::SUCCESS;
|
||||||
|
Reference in New Issue
Block a user