OpenXE/classes/Modules/Postat/SOAP/Method/GetAllowedServicesForCountry.php

60 lines
1.4 KiB
PHP
Raw Normal View History

2021-05-21 08:49:41 +02:00
<?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,
];
}
}