Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
autoconfigure: true
bind:
$proxyHostIp: '%env(PROXY_HOST_IP)%'
$proxyPort: '%env(PROXY_HOST_PORT)%'
$proxyHostPort: '%env(PROXY_HOST_PORT)%'
$allegroEndpoint: '%env(ALLEGRO_ENDPOINT)%'
$allegroOnbekendeSchuldeiser: '%env(ALLEGRO_ONBEKENDE_SCHULDEISER)%'
string $azureAuthorityHost: '%env(AZURE_AUTHORITY_HOST)%'
Expand Down
34 changes: 17 additions & 17 deletions src/Allegro/AllegroHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ class AllegroHelper
/**
* Creates a SOAP options array with optional proxy settings.
*
* @param string|null $proxyHost The proxy host (IP or domain).
* @param string|null $proxyPort The proxy port.
* @param string|null $proxyHostIp The proxy IP address.
* @param string|null $proxyHostPort The proxy port.
* @return array The SOAP options array.
*/
public static function createSoapOptionsArray(
?string $proxyHost = null,
?string $proxyPort = null
?string $proxyHostIp = null,
?string $proxyHostPort = null
): array
{
$soapOptionsArray = [];

if (isset($proxyHost, $proxyPort)) {
if (isset($proxyHostIp, $proxyHostPort)) {
$streamContext = stream_context_create([
'http' => [
'proxy' => 'tcp://' . $proxyHost . ':' . $proxyPort,
'proxy' => 'tcp://' . $proxyHostIp . ':' . $proxyHostPort,
'request_fulluri' => true,
],
]);
Expand All @@ -40,19 +40,19 @@ public static function createSoapOptionsArray(
/**
* Creates a SOAP client configuration array with optional proxy settings.
*
* @param string|null $proxyHost The proxy host (IP or domain).
* @param string|null $proxyPort The proxy port.
* @param string|null $proxyHostIp The proxy IP address.
* @param string|null $proxyHostPort The proxy port.
* @return array The SOAP client configuration array.
*/
public static function createSoapClientConfig(
?string $proxyHost = null,
?string $proxyPort = null
?string $proxyHostIp = null,
?string $proxyHostPort = null
): array
{
$config = ['headers' => ['User-Agent' => 'fixxx-schuldhulp/1.0']];

if (isset($proxyHost, $proxyPort)) {
$config['proxy'] = 'http://' . $proxyHost . ':' . $proxyPort;
if (isset($proxyHostIp, $proxyHostPort)) {
$config['proxy'] = 'http://' . $proxyHostIp . ':' . $proxyHostPort;
}

return $config;
Expand All @@ -62,17 +62,17 @@ public static function createSoapClientConfig(
* Creates a SOAP client handler with optional proxy and session middleware.
*
* @param Organisatie|null $organisatie The organization for session middleware.
* @param string|null $proxyHost The proxy host (IP or domain).
* @param string|null $proxyPort The proxy port.
* @param string|null $proxyHostIp The proxy IP address.
* @param string|null $proxyHostPort The proxy port.
* @return HandlerInterface The configured SOAP client handler.
*/
public static function createSoapClientHandler(
?Organisatie $organisatie = null,
?string $proxyHost = null,
?string $proxyPort = null
?string $proxyHostIp = null,
?string $proxyHostPort = null
) : HandlerInterface
{
$config = AllegroHelper::createSoapClientConfig($proxyHost, $proxyPort);
$config = AllegroHelper::createSoapClientConfig($proxyHostIp, $proxyHostPort);

$handler = HttPlugHandle::createForClient(
Client::createWithConfig($config)
Expand Down
8 changes: 4 additions & 4 deletions src/Allegro/LoginClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class LoginClientFactory
public static function factory(
string $wsdl,
?Organisatie $organisatie = null,
?string $proxyHost = null,
?string $proxyPort = null
?string $proxyHostIp = null,
?string $proxyHostPort = null
): AllegroLoginClient {
$extSoapOptionsArray = AllegroHelper::createSoapOptionsArray($proxyHost, $proxyPort);
$extSoapOptionsArray = AllegroHelper::createSoapOptionsArray($proxyHostIp, $proxyHostPort);

$handler = AllegroHelper::createSoapClientHandler($organisatie, $proxyHost, $proxyPort);
$handler = AllegroHelper::createSoapClientHandler($organisatie, $proxyHostIp, $proxyHostPort);

$engine = ExtSoapEngineFactory::fromOptionsWithHandler(
ExtSoapOptions::defaults($wsdl, $extSoapOptionsArray)->withClassMap(
Expand Down
8 changes: 4 additions & 4 deletions src/Allegro/SchuldHulpClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class SchuldHulpClientFactory
public static function factory(
string $wsdl,
Organisatie $organisatie,
?string $proxyHost = null,
?string $proxyPort = null
?string $proxyHostIp = null,
?string $proxyHostPort = null
): AllegroSchuldHulpClient
{
$handler = AllegroHelper::createSoapClientHandler($organisatie, $proxyHost, $proxyPort);
$handler = AllegroHelper::createSoapClientHandler($organisatie, $proxyHostIp, $proxyHostPort);

$extSoapOptions = AllegroHelper::createSoapOptionsArray($proxyHost, $proxyPort);
$extSoapOptions = AllegroHelper::createSoapOptionsArray($proxyHostIp, $proxyHostPort);

$engine = ExtSoapEngineFactory::fromOptionsWithHandler(
ExtSoapOptions::defaults($wsdl, $extSoapOptions)->withClassMap(AllegroSchuldHulpClassmap::getCollection()),
Expand Down
36 changes: 18 additions & 18 deletions src/Service/AllegroService.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class AllegroService
/**
* @var ?string
*/
private $proxyPort;
private $proxyHostPort;


public function __construct(
Expand All @@ -128,7 +128,7 @@ public function __construct(
Security $security,
$allegroOnbekendeSchuldeiser,
?string $proxyHostIp = null,
?string $proxyPort = null,
?string $proxyHostPort = null,
) {
$this->loginWsdl = sprintf('%s?service=LoginService', $allegroEndpoint);
$this->schuldHulpWsdl = sprintf('%s?service=SchuldHulpService', $allegroEndpoint);
Expand All @@ -139,7 +139,7 @@ public function __construct(
$this->em = $em;
$this->onbekendeSchuldeiser = (string)$allegroOnbekendeSchuldeiser;
$this->proxyHostIp = $proxyHostIp;
$this->proxyPort = $proxyPort;
$this->proxyHostPort = $proxyHostPort;
}

/**
Expand All @@ -157,7 +157,7 @@ public function login(Organisatie $organisatie, $force = false)
) >= $oldestAllowedSession) {
return $organisatie;
}
$response = $this->getLoginService(null, $this->proxyHostIp, $this->proxyPort)->allegroWebLogin(
$response = $this->getLoginService(null, $this->proxyHostIp, $this->proxyHostPort)->allegroWebLogin(
(new LoginServiceAllegroWebLogin(
$organisatie->getAllegroUsername(),
$organisatie->getAllegroPassword()
Expand Down Expand Up @@ -185,7 +185,7 @@ public function login(Organisatie $organisatie, $force = false)
public function getSRVAanvraagHeader(Organisatie $organisatie, string $relatieCode): ?TSRVAanvraagHeader
{
$organisatie = $this->login($organisatie);
$schuldhulpService = $this->getSchuldHulpService($organisatie, $this->proxyHostIp, $this->proxyPort);
$schuldhulpService = $this->getSchuldHulpService($organisatie, $this->proxyHostIp, $this->proxyHostPort);
$response = $schuldhulpService->getSRVOverzicht(
(new SchuldHulpServiceGetSRVOverzicht($relatieCode))
);
Expand All @@ -202,7 +202,7 @@ public function getSRVAanvraagHeader(Organisatie $organisatie, string $relatieCo
public function getSRVAanvraag(Organisatie $organisatie, TSRVAanvraagHeader $header): ?TSRVAanvraag
{
$organisatie = $this->login($organisatie);
$schuldhulpService = $this->getSchuldHulpService($organisatie, $this->proxyHostIp, $this->proxyPort);
$schuldhulpService = $this->getSchuldHulpService($organisatie, $this->proxyHostIp, $this->proxyHostPort);
$response = $schuldhulpService->getSRVAanvraag(
(new SchuldHulpServiceGetSRVAanvraag($header))
);
Expand Down Expand Up @@ -496,15 +496,15 @@ private function mapSchulden(Dossier $dossier): SchuldArray

private function getSchuldHulpService(
Organisatie $organisatie,
?string $proxyHost = null,
?string $proxyPort = null
?string $proxyHostIp = null,
?string $proxyHostPort = null
): AllegroSchuldHulpClient
{
return SchuldHulpClientFactory::factory(
$this->schuldHulpWsdl,
$this->schuldHulpWsdl,
$organisatie,
$proxyHost,
$proxyPort
$proxyHostIp,
$proxyHostPort
);
}

Expand All @@ -523,14 +523,14 @@ public function updateDossier(Dossier $dossier)

private function getLoginService(
?Organisatie $organisatie = null,
?string $proxyHost = null,
?string $proxyPort = null
?string $proxyHostIp = null,
?string $proxyHostPort = null
): AllegroLoginClient {
return LoginClientFactory::factory(
$this->loginWsdl,
$organisatie,
$proxyHost,
$proxyPort
$proxyHostIp,
$proxyHostPort
);
}

Expand All @@ -540,8 +540,8 @@ private function getLoginService(
*/
public function getSRVEisers(Dossier $dossier, TSRVAanvraagHeader $header): ?TSRVEisers
{
$schuldhulpService = $this->getSchuldHulpService($dossier->getOrganisatie(), $this->proxyHostIp, $this->proxyPort);
$schuldhulpService = $this->getSchuldHulpService($dossier->getOrganisatie(), $this->proxyHostIp, $this->proxyHostPort);

return $schuldhulpService->getSRVEisers(
(new SchuldHulpServiceGetSRVEisers(
(new TSRVAanvraagHeader(
Expand Down Expand Up @@ -634,7 +634,7 @@ public function syncSchuldeisers(Organisatie $organisatie, $searchString = ''):
{
$organisatie = $this->login($organisatie);
$parameters = new SchuldHulpServiceGetLijstSchuldeisers($searchString);
$schuldhulpService = $this->getSchuldHulpService($organisatie, $this->proxyHostIp, $this->proxyPort);
$schuldhulpService = $this->getSchuldHulpService($organisatie, $this->proxyHostIp, $this->proxyHostPort);
$response = $schuldhulpService->getLijstSchuldeisers($parameters);
$statistics = ['created' => 0, 'updated' => 0];

Expand Down