|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of gpupo/adyen-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\AdyenSdk\Client; |
|
16
|
|
|
|
|
17
|
|
|
use Gpupo\CommonSdk\Client\ClientAbstract; |
|
18
|
|
|
use Gpupo\CommonSdk\Client\ClientInterface; |
|
19
|
|
|
|
|
20
|
|
|
class Client extends ClientAbstract implements ClientInterface |
|
21
|
|
|
{ |
|
22
|
1 |
|
public function getDefaultOptions() |
|
23
|
|
|
{ |
|
24
|
|
|
return [ |
|
25
|
1 |
|
'client_user' => false, |
|
26
|
|
|
'client_password' => false, |
|
27
|
|
|
'base_url' => '{PROTOCOL}://{VERSION}/pal/servlet/Payment/v12', |
|
28
|
|
|
'protocol' => 'https', |
|
29
|
|
|
'version' => 'pal-test.adyen.com', |
|
30
|
|
|
'verbose' => false, |
|
31
|
|
|
'sslVersion' => 'SecureTransport', |
|
32
|
|
|
'cacheTTL' => 3600, |
|
33
|
|
|
'sslVerifyPeer' => true, |
|
34
|
|
|
]; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
protected function renderAuthorization() |
|
38
|
|
|
{ |
|
39
|
|
|
foreach (['client_user', 'client_password'] as $key) { |
|
40
|
|
|
$value = $this->getOptions()->get($key); |
|
41
|
|
|
if (empty($value)) { |
|
42
|
|
|
throw new \InvalidArgumentException('['.$key.'] ausente!'); |
|
43
|
|
|
} |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
return 'Authorization: Basic ' |
|
47
|
|
|
.base64_encode($this->getOptions()->get('client_user').':' |
|
48
|
|
|
.$this->getOptions()->get('client_password')); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|