mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-27 07:00:29 +01:00
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Xentral\Modules\Postat\SOAP\Method;
|
|
|
|
use Xentral\Modules\Postat\SOAP\MethodInterface;
|
|
use Xentral\Modules\Postat\SOAP\ParameterInterface;
|
|
use Xentral\Modules\Postat\SOAP\PostAtClient;
|
|
use Xentral\Modules\Postat\SOAP\PostAtException;
|
|
use Xentral\Modules\Postat\SOAP\Result\AllowedServicesResult;
|
|
|
|
class GetAllowedServicesForCountry implements MethodInterface
|
|
{
|
|
/** @var PostAtClient */
|
|
private $postAtClient;
|
|
|
|
/** @var array Array of ISO 3166 ALPHA-2 country codes. */
|
|
private $countries;
|
|
|
|
/**
|
|
* AllowedServicesForCountry constructor.
|
|
*
|
|
* @param PostAtClient $postAtClient
|
|
*/
|
|
public function __construct(PostAtClient $postAtClient)
|
|
{
|
|
$this->postAtClient = $postAtClient;
|
|
}
|
|
|
|
/**
|
|
* Call the API endpoint.
|
|
*
|
|
* @param ParameterInterface $countries
|
|
*
|
|
* @return AllowedServicesResult
|
|
* @throws PostAtException
|
|
*/
|
|
public function call(ParameterInterface $countries)
|
|
{
|
|
$this->countries = $countries->getData();
|
|
|
|
$response = $this->postAtClient->call($this);
|
|
|
|
return new AllowedServicesResult($response);
|
|
}
|
|
|
|
/**
|
|
* Get content for the SOAP body element.
|
|
*
|
|
* @return array[]
|
|
*/
|
|
public function getBody(): array
|
|
{
|
|
return [
|
|
'countryList' => $this->countries,
|
|
];
|
|
}
|
|
}
|