|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | /**
|
3 | 4 | * Impact: Partnership Cloud for Magento
|
4 | 5 | *
|
|
7 | 8 | */
|
8 | 9 |
|
9 | 10 | namespace Impact\Integration\Controller\Adminhtml\System\Config;
|
10 |
| - |
| 11 | + |
11 | 12 | use Impact\Integration\Service\ImpactApiService;
|
12 | 13 | use Magento\Integration\Api\IntegrationServiceInterface;
|
13 | 14 | use Magento\Integration\Api\OauthServiceInterface;
|
|
17 | 18 | use Magento\Backend\App\Action;
|
18 | 19 |
|
19 | 20 | /**
|
20 |
| - * Class Button |
| 21 | + * Class Button - Button controller |
21 | 22 | *
|
22 |
| - * @package Impact\Integration\Controller\Adminhtml\System\Config |
23 | 23 | */
|
24 | 24 | class Button extends Action
|
25 | 25 | {
|
26 | 26 | /**
|
27 | 27 | * API request endpoint integration
|
28 | 28 | */
|
29 |
| - const API_ENDPOINT_UNINSTALL = 'https://saasler-magento-impact.herokuapp.com/uninstall'; |
| 29 | + protected const API_ENDPOINT_UNINSTALL = 'https://saasler-magento-impact.herokuapp.com/uninstall'; |
30 | 30 |
|
31 | 31 | /**
|
32 |
| - * Integration service |
33 | 32 | *
|
34 | 33 | * @var \Magento\Integration\Api\IntegrationServiceInterface
|
35 | 34 | */
|
@@ -57,7 +56,7 @@ class Button extends Action
|
57 | 56 | /**
|
58 | 57 | * Button constructor.
|
59 | 58 | *
|
60 |
| - * @param Context $context, |
| 59 | + * @param Context $context |
61 | 60 | * @param LoggerInterface $logger
|
62 | 61 | * @param IntegrationServiceInterface $integrationService
|
63 | 62 | * @param OauthServiceInterface $oauthService
|
@@ -92,9 +91,14 @@ public function execute()
|
92 | 91 | // Get accesstoken from integration
|
93 | 92 | $token = $this->oauthService->getAccessToken($integration->getConsumerId());
|
94 | 93 | $accessToken = $token->getToken();
|
95 |
| - |
| 94 | + |
96 | 95 | // Send request uninstall in saasler
|
97 |
| - $impactApiService = new ImpactApiService($accessToken, static::API_ENDPOINT_UNINSTALL, 'DELETE', json_encode(['Deleted'=>'yes'])); |
| 96 | + $impactApiService = new ImpactApiService( |
| 97 | + $accessToken, |
| 98 | + static::API_ENDPOINT_UNINSTALL, |
| 99 | + 'DELETE', |
| 100 | + json_encode(['Deleted' => 'yes']) |
| 101 | + ); |
98 | 102 | $response = $impactApiService->execute();
|
99 | 103 |
|
100 | 104 | // Delete integration record
|
|
0 commit comments