This commit is contained in:
Juan Pablo Vial
2025-05-19 14:02:55 -04:00
parent ce75ec1548
commit f34ed03b84
3 changed files with 28 additions and 3 deletions

View File

@ -47,15 +47,20 @@ class Toku extends Controller
ResponseFactoryInterface $responseFactory,
Service\Venta\MediosPago\Toku $tokuService): ResponseInterface
{
$body = $request->getBody();
$input = json_decode($body->getContents(), true);
$body = $request->getBody()->getContents();
$input = json_decode($body, true);
try {
if ($tokuService->successEvent($input)) {
return $responseFactory->createResponse(200);
}
$this->logger->warning("Could not update payment", ['input' => $input]);
return $responseFactory->createResponse(409, 'Payment could not be updated');
} catch (InvalidResult $exception) {
$this->logger->warning($exception);
$this->logger->warning($exception, [
'uri' => $request->getUri()->getPath(),
'body' => $body,
'input' => $input
]);
if (str_contains($exception->getMessage(), 'Customer')) {
$message = 'Customer not found';
} elseif (str_contains($exception->getMessage(), 'Invoice')) {