1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* Gateway Client Class |
6
|
|
|
* @category Ticaje |
7
|
|
|
* @package Ticaje_Connector |
8
|
|
|
* @author Hector Luis Barrientos <[email protected]> |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Ticaje\Connector\Gateway\Client; |
12
|
|
|
|
13
|
|
|
use Ticaje\Base\Application\Factory\FactoryInterface; |
14
|
|
|
use Ticaje\Connector\Interfaces\Protocol\SoapClientInterface; |
15
|
|
|
use Ticaje\Connector\Interfaces\Provider\Authentication\AuthenticatorInterface; |
16
|
|
|
use Ticaje\Contract\Patterns\Interfaces\Decorator\ResponderInterface; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class Soap |
20
|
|
|
* @package Ticaje\Connector\Gateway\Client |
21
|
|
|
*/ |
22
|
|
|
class Soap extends Base implements SoapClientInterface |
23
|
|
|
{ |
24
|
|
|
protected $authenticator; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Soap constructor. |
28
|
|
|
* @param ResponderInterface $responder |
29
|
|
|
* @param FactoryInterface $clientFactory |
30
|
|
|
* @param AuthenticatorInterface $authenticator |
31
|
|
|
* Pending the Virtual Type on DC definition to create recipe for dependencies of this module |
32
|
|
|
* In a temporary basis we're gonna leave the implementation for this driver empty since it's not likely that we end up using it |
33
|
|
|
*/ |
34
|
|
|
public function __construct( |
35
|
|
|
ResponderInterface $responder, |
36
|
|
|
FactoryInterface $clientFactory, |
37
|
|
|
AuthenticatorInterface $authenticator |
38
|
|
|
) { |
39
|
|
|
$this->authenticator = $authenticator; |
40
|
|
|
parent::__construct($responder, $clientFactory); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @inheritDoc |
45
|
|
|
*/ |
46
|
|
|
public function generateClient($credentials) |
47
|
|
|
{ |
48
|
|
|
$config = ['options' => $this->authenticator->authenticate($credentials), 'wsdl' => $credentials['wsdl']]; |
49
|
|
|
$this->client = $this->clientFactory->create($config); |
50
|
|
|
return $this->client; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @inheritDoc |
55
|
|
|
*/ |
56
|
|
|
public function request($operation, array $params = []) |
57
|
|
|
{ |
58
|
|
|
// TODO: Implement request() method. |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|