1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Controller\Oauth\iFood; |
4
|
|
|
|
5
|
|
|
use ControleOnline\Controller\Oauth\DefaultClientController; |
6
|
|
|
use ControleOnline\Service\DomainService; |
|
|
|
|
7
|
|
|
use ControleOnline\Service\UserService; |
8
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
|
|
9
|
|
|
use League\OAuth2\Client\Provider\GenericProvider; |
|
|
|
|
10
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
|
|
|
11
|
|
|
use Symfony\Component\Routing\Attribute\Route; |
|
|
|
|
12
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse; |
|
|
|
|
13
|
|
|
|
14
|
|
|
class iFoodConnectController extends DefaultClientController |
15
|
|
|
{ |
16
|
|
|
public function __construct( |
17
|
|
|
protected EntityManagerInterface $manager, |
18
|
|
|
protected UserService $userService, |
19
|
|
|
private DomainService $domainService |
20
|
|
|
) { |
21
|
|
|
$this->clientId = $_ENV['OAUTH_IFOOD_CLIENT_ID']; |
22
|
|
|
$this->clientSecret = $_ENV['OAUTH_IFOOD_CLIENT_SECRET']; |
23
|
|
|
|
24
|
|
|
$this->provider = new GenericProvider([ |
25
|
|
|
'clientId' => $this->clientId, |
26
|
|
|
'clientSecret' => $this->clientSecret, |
27
|
|
|
'redirectUri' => 'https://' . $this->domainService->getMainDomain() . '/oauth/ifood/return', |
28
|
|
|
'urlAuthorize' => 'https://merchant-api.ifood.com.br/authentication/v1.0/oauth/authorize', |
29
|
|
|
'urlAccessToken' => 'https://merchant-api.ifood.com.br/authentication/v1.0/oauth/token', |
30
|
|
|
'urlResourceOwnerDetails' => '', |
31
|
|
|
'scopes' => 'merchant order catalog financial review logistics shipping item picking promotion events' |
32
|
|
|
]); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
#[Route('/oauth/ifood/connect', name: 'ifood_connect', methods: ['GET'])] |
36
|
|
|
public function connectAction() |
37
|
|
|
{ |
38
|
|
|
return parent::connectAction(); |
|
|
|
|
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
#[Route('/oauth/ifood/return', name: 'ifood_return', methods: ['GET', 'POST'])] |
42
|
|
|
public function returnAction(Request $request): JsonResponse |
43
|
|
|
{ |
44
|
|
|
return parent::returnAction($request); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths