Mas logging

This commit is contained in:
Juan Pablo Vial
2025-06-09 12:44:42 -04:00
parent f1ed9668fc
commit abb1ce7299
8 changed files with 140 additions and 30 deletions

View File

@ -49,8 +49,11 @@ class Toku extends Controller
ResponseFactoryInterface $responseFactory,
Service\Venta\MediosPago\Toku $tokuService): ResponseInterface
{
$body = $request->getBody()->getContents();
$input = json_decode($body, true);
$input = $request->getParsedBody();
if ($input === null) {
$body = $request->getBody()->getContents();
$input = json_decode($body, true);
}
$this->logger->info('Toku payment success', ['input' => $input]);
try {
if ($tokuService->successEvent($input)) {
@ -111,6 +114,7 @@ class Toku extends Controller
if (!$container->has('TOKU_ENV') or strtolower($container->get('TOKU_ENV')) !== 'sandbox') {
return $this->withJson($response, ['success' => false], 409);
}
$this->logger->info('Toku reset');
$input = $request->getParsedBody();
$output = [
'input' => $input,
@ -119,7 +123,9 @@ class Toku extends Controller
try {
$tokuService->reset($input['skips'] ?? []);
$output['success'] = true;
} catch (Exception $exception) {}
} catch (Exception $exception) {
$this->logger->error($exception);
}
return $this->withJson($response, $output);
}
public function enqueue(ServerRequestInterface $request, ResponseInterface $response,