1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PagaMasTarde\OrdersApiClient\Model; |
4
|
|
|
|
5
|
|
|
use PagaMasTarde\OrdersApiClient\Exception\ClientException; |
6
|
|
|
use PagaMasTarde\OrdersApiClient\Model\Order\Configuration\Urls; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class ApiConfiguration |
10
|
|
|
* @package PagaMasTarde\OrdersApiClient\Model |
11
|
|
|
*/ |
12
|
|
|
class ApiConfiguration extends AbstractModel |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Base Production URL for API calls |
16
|
|
|
*/ |
17
|
|
|
const BASE_URI = 'https://api.pagamastarde.com/v2'; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Base Sandbox URL for API calls |
21
|
|
|
*/ |
22
|
|
|
const SANDBOX_BASE_URI = 'https://api-stg.pagamastarde.com/v2'; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Private key for API calls |
26
|
|
|
* |
27
|
|
|
* @var string $privateKey |
28
|
|
|
*/ |
29
|
|
|
protected $privateKey; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Public key for API calls |
33
|
|
|
* |
34
|
|
|
* @var string $publicKey |
35
|
|
|
*/ |
36
|
|
|
protected $publicKey; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* SandBox url should be specified here |
40
|
|
|
* |
41
|
|
|
* @var string $baseUri |
42
|
|
|
*/ |
43
|
|
|
protected $baseUri; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return string |
47
|
|
|
*/ |
48
|
|
|
public function getPrivateKey() |
49
|
|
|
{ |
50
|
|
|
return $this->privateKey; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param string $privateKey |
55
|
|
|
* |
56
|
|
|
* @return ApiConfiguration |
57
|
|
|
*/ |
58
|
|
|
public function setPrivateKey($privateKey) |
59
|
|
|
{ |
60
|
|
|
$this->privateKey = $privateKey; |
61
|
|
|
|
62
|
|
|
return $this; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return string |
67
|
|
|
*/ |
68
|
|
|
public function getPublicKey() |
69
|
|
|
{ |
70
|
|
|
return $this->publicKey; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param string $publicKey |
75
|
|
|
* |
76
|
|
|
* @return ApiConfiguration |
77
|
|
|
*/ |
78
|
|
|
public function setPublicKey($publicKey) |
79
|
|
|
{ |
80
|
|
|
$this->publicKey = $publicKey; |
81
|
|
|
|
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
|
|
public function getBaseUri() |
89
|
|
|
{ |
90
|
|
|
return $this->baseUri; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param $baseUri |
95
|
|
|
* |
96
|
|
|
* @return $this |
97
|
|
|
* @throws ClientException |
98
|
|
|
*/ |
99
|
|
|
public function setBaseUri($baseUri) |
100
|
|
|
{ |
101
|
|
|
if (Urls::urlValidate($baseUri)) { |
102
|
|
|
$this->baseUri = $baseUri; |
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
throw new ClientException('Invalid base URL on the ApiConfiguration setter'); |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|