|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of gpupo/cnova-sdk |
|
5
|
|
|
* Created by Gilmar Pupo <[email protected]> |
|
6
|
|
|
* For the information of copyright and license you should read the file |
|
7
|
|
|
* LICENSE which is distributed with this source code. |
|
8
|
|
|
* Para a informação dos direitos autorais e de licença você deve ler o arquivo |
|
9
|
|
|
* LICENSE que é distribuído com este código-fonte. |
|
10
|
|
|
* Para obtener la información de los derechos de autor y la licencia debe leer |
|
11
|
|
|
* el archivo LICENSE que se distribuye con el código fuente. |
|
12
|
|
|
* For more information, see <https://opensource.gpupo.com/>. |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace Gpupo\CnovaSdk\Console; |
|
16
|
|
|
|
|
17
|
|
|
use Gpupo\CnovaSdk\Factory; |
|
18
|
|
|
use Gpupo\CommonSdk\Console\AbstractApplication; |
|
19
|
|
|
|
|
20
|
|
|
class Application extends AbstractApplication |
|
21
|
|
|
{ |
|
22
|
|
|
protected $commonParameters = [ |
|
23
|
|
|
[ |
|
24
|
|
|
'key' => 'client_id', |
|
25
|
|
|
], |
|
26
|
|
|
[ |
|
27
|
|
|
'key' => 'access_token', |
|
28
|
|
|
], |
|
29
|
|
|
[ |
|
30
|
|
|
'key' => 'env', |
|
31
|
|
|
'options' => ['sandbox', 'api'], |
|
32
|
|
|
'default' => 'sandbox', |
|
33
|
|
|
'name' => 'Version', |
|
34
|
|
|
], |
|
35
|
|
|
[ |
|
36
|
|
|
'key' => 'sslVersion', |
|
37
|
|
|
'options' => ['SecureTransport', 'TLS'], |
|
38
|
|
|
'default' => 'SecureTransport', |
|
39
|
|
|
'name' => 'SSL Version', |
|
40
|
|
|
], |
|
41
|
|
|
[ |
|
42
|
|
|
'key' => 'registerPath', |
|
43
|
|
|
'default' => false, |
|
44
|
|
|
], |
|
45
|
|
|
]; |
|
46
|
|
|
|
|
47
|
|
|
public function factorySdk(array $options) |
|
48
|
|
|
{ |
|
49
|
|
|
$options['version'] = $options['env']; |
|
50
|
|
|
|
|
51
|
|
|
return Factory::getInstance()->setup($options, $this->factoryLogger()); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function appendCommand($name, $description, array $definition = []) |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->register($name) |
|
57
|
|
|
->setDescription($description) |
|
58
|
|
|
->setDefinition($this->factoryDefinition($definition)); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|