Validate with service
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
namespace Incoviba\Service\Venta\MediosPago;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Incoviba\Service\Venta\MediosPago\Toku\{Customer,Subscription,Invoice};
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResponse;
|
||||
@ -393,4 +394,10 @@ class Toku extends Ideal\Service
|
||||
$data['date'] = $data['transaction_date'];
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function validateToken(ServerRequestInterface $request, string $token): bool
|
||||
{
|
||||
$tokenHeader = json_decode($request->getHeaderLine('token'));
|
||||
return strtolower($tokenHeader->header) === 'x-api-key' and $tokenHeader->token === $token;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user