|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright © Getnet. All rights reserved. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Bruno Elisei <[email protected]> |
|
6
|
|
|
* See LICENSE for license details. |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
declare(strict_types=1); |
|
10
|
|
|
|
|
11
|
|
|
namespace Getnet\SubSellerMagento\Console\Command\Synchronize; |
|
12
|
|
|
|
|
13
|
|
|
use Getnet\SubSellerMagento\Model\Console\Command\Synchronize\Update as ModelUpdate; |
|
14
|
|
|
use Magento\Framework\App\State; |
|
15
|
|
|
use Symfony\Component\Console\Command\Command; |
|
16
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
|
17
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
18
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Update seller data with Getnet. |
|
22
|
|
|
*/ |
|
23
|
|
|
class Update extends Command |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @const string. |
|
27
|
|
|
*/ |
|
28
|
|
|
public const SUB_SELLER_ID = 'sub_seller_id'; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var ModelUpdate |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $update; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var State |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $state; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param State $state |
|
42
|
|
|
* @param ModelUpdate $update |
|
43
|
|
|
*/ |
|
44
|
|
|
public function __construct( |
|
45
|
|
|
State $state, |
|
46
|
|
|
ModelUpdate $update |
|
47
|
|
|
) { |
|
48
|
|
|
$this->state = $state; |
|
49
|
|
|
$this->update = $update; |
|
50
|
|
|
parent::__construct(); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Execute. |
|
55
|
|
|
* |
|
56
|
|
|
* @param InputInterface $input |
|
57
|
|
|
* @param OutputInterface $output |
|
58
|
|
|
*/ |
|
59
|
|
|
protected function execute( |
|
60
|
|
|
InputInterface $input, |
|
61
|
|
|
OutputInterface $output |
|
62
|
|
|
) { |
|
63
|
|
|
$this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML); |
|
64
|
|
|
$this->update->setOutput($output); |
|
65
|
|
|
|
|
66
|
|
|
$subSellerId = (int) $input->getArgument(self::SUB_SELLER_ID); |
|
67
|
|
|
$this->update->update($subSellerId); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Configure. |
|
72
|
|
|
* |
|
73
|
|
|
* @return void |
|
74
|
|
|
*/ |
|
75
|
|
|
protected function configure() |
|
76
|
|
|
{ |
|
77
|
|
|
$this->setName('getnet:sub_seller:update'); |
|
78
|
|
|
$this->setDescription('Update Sub Seller on Getnet'); |
|
79
|
|
|
$this->setDefinition( |
|
80
|
|
|
[new InputArgument(self::SUB_SELLER_ID, InputArgument::REQUIRED, 'Seller Id')] |
|
81
|
|
|
); |
|
82
|
|
|
parent::configure(); |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|