<?php
  namespace Api\Middlewares;
  
  use Pecee\Http\Middleware\IMiddleware;
  use Pecee\Http\Request;
  
  class BirFaturaMiddleware implements IMiddleware {
    
    public function handle(Request $request): void
    {
      if (!isset($_SERVER["HTTP_TOKEN"]) || $_SERVER["HTTP_TOKEN"] != moduleSettings('birfatura', 'token'))
        api()->unauthorized("INVALID_TOKEN", "Invalid Token!");
    }
  }