Skip to content

Commit

Permalink
added new methods, fix iplocateAddress (#9)
Browse files Browse the repository at this point in the history
* fix iplocateAddress
* added new methods
  • Loading branch information
Velhron authored Feb 28, 2021
1 parent 1085a12 commit 228d7e0
Show file tree
Hide file tree
Showing 21 changed files with 637 additions and 127 deletions.
9 changes: 9 additions & 0 deletions src/Model/Request/Find/CountryRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace Velhron\DadataBundle\Model\Request\Find;

class CountryRequest extends FindRequest
{
}
13 changes: 13 additions & 0 deletions src/Model/Request/Find/FnsUnitRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Velhron\DadataBundle\Model\Request\Find;

class FnsUnitRequest extends FindRequest
{
/**
* @var array Фильтрация
*/
public $filters;
}
9 changes: 9 additions & 0 deletions src/Model/Request/Find/FtsUnitRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace Velhron\DadataBundle\Model\Request\Find;

class FtsUnitRequest extends FindRequest
{
}
13 changes: 13 additions & 0 deletions src/Model/Request/Find/RegionCourtRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Velhron\DadataBundle\Model\Request\Find;

class RegionCourtRequest extends FindRequest
{
/**
* @var array Фильтрация
*/
protected $filters;
}
12 changes: 12 additions & 0 deletions src/Model/Request/Iplocate/AddressRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@

namespace Velhron\DadataBundle\Model\Request\Iplocate;

use Velhron\DadataBundle\Model\Request\AbstractRequest;
use Velhron\DadataBundle\Model\Request\Suggest\SuggestRequest;

class AddressRequest extends SuggestRequest
{
/**
* @var string IP-адрес
*/
protected $ip;

public function setQuery(string $ip): AbstractRequest
{
$this->ip = $ip;

return $this;
}
}
9 changes: 9 additions & 0 deletions src/Model/Request/Suggest/FtsUnitRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace Velhron\DadataBundle\Model\Request\Suggest;

class FtsUnitRequest extends SuggestRequest
{
}
5 changes: 5 additions & 0 deletions src/Model/Response/Suggest/FnsUnitResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class FnsUnitResponse extends SuggestResponse
*/
public $bankBik;

/**
* @var string Корсчет банка получателя
*/
public $bankCorrespondentAccount;

/**
* @var string Номер счёта получателя
*/
Expand Down
63 changes: 63 additions & 0 deletions src/Model/Response/Suggest/FtsUnitResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

declare(strict_types=1);

namespace Velhron\DadataBundle\Model\Response\Suggest;

class FtsUnitResponse extends SuggestResponse
{
/**
* @var string Код таможни
*/
public $code;

/**
* @var string Полное название
*/
public $name;

/**
* @var string Краткое название
*/
public $nameShort;

/**
* @var string ИНН
*/
public $inn;

/**
* @var string ОГРН
*/
public $ogrn;

/**
* @var string Код ОКПО
*/
public $okpo;

/**
* @var string Код организационно-структурной формы
*/
public $osf;

/**
* @var string Адрес
*/
public $address;

/**
* @var string Телефон
*/
public $phone;

/**
* @var string Факс
*/
public $fax;

/**
* @var string Адрес эл. почты
*/
public $email;
}
25 changes: 25 additions & 0 deletions src/Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ services:
response: Velhron\DadataBundle\Model\Response\Suggest\FnsUnitResponse
url: '%velhron_dadata.base_suggestions_url%/suggest/fns_unit'

- name: 'suggestFtsUnit'
request: Velhron\DadataBundle\Model\Request\Suggest\FtsUnitRequest
response: Velhron\DadataBundle\Model\Response\Suggest\FtsUnitResponse
url: '%velhron_dadata.base_suggestions_url%/suggest/fts_unit'

- name: 'suggestRegionCourt'
request: Velhron\DadataBundle\Model\Request\Suggest\RegionCourtRequest
response: Velhron\DadataBundle\Model\Response\Suggest\RegionCourtResponse
Expand Down Expand Up @@ -162,6 +167,26 @@ services:
response: Velhron\DadataBundle\Model\Response\Suggest\OktmoResponse
url: '%velhron_dadata.base_suggestions_url%/findById/oktmo'

- name: 'findFnsUnit'
request: Velhron\DadataBundle\Model\Request\Find\FnsUnitRequest
response: Velhron\DadataBundle\Model\Response\Suggest\FnsUnitResponse
url: '%velhron_dadata.base_suggestions_url%/findById/fns_unit'

- name: 'findFtsUnit'
request: Velhron\DadataBundle\Model\Request\Find\FtsUnitRequest
response: Velhron\DadataBundle\Model\Response\Suggest\FtsUnitResponse
url: '%velhron_dadata.base_suggestions_url%/findById/fts_unit'

- name: 'findCountry'
request: Velhron\DadataBundle\Model\Request\Find\CountryRequest
response: Velhron\DadataBundle\Model\Response\Suggest\CountryResponse
url: '%velhron_dadata.base_suggestions_url%/findById/country'

- name: 'findRegionCourt'
request: Velhron\DadataBundle\Model\Request\Find\RegionCourtRequest
response: Velhron\DadataBundle\Model\Response\Suggest\RegionCourtResponse
url: '%velhron_dadata.base_suggestions_url%/findById/region_court'

- name: 'geolocateAddress'
request: Velhron\DadataBundle\Model\Request\Geolocate\AddressRequest
response: Velhron\DadataBundle\Model\Response\Suggest\AddressResponse
Expand Down
6 changes: 3 additions & 3 deletions src/Service/DadataIplocate.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ protected function query(AbstractRequest $request): array
* - Поддерживает как IPv4, так и IPv6 адреса
* - Возвращает детальную информацию о городе, в том числе почтовый индекс
*
* @param string $ip - ip-адрес
* @param array $options - дополнительные параметры запроса
* @param string $ip IP-адрес
* @param array $options Дополнительные параметры запроса
*
* @return AddressResponse|null - ответ
* @return AddressResponse|null Ответ
*
* @throws DadataException|InvalidConfigException
*/
Expand Down
87 changes: 86 additions & 1 deletion src/Service/DadataSuggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Velhron\DadataBundle\Model\Response\Suggest\FioResponse;
use Velhron\DadataBundle\Model\Response\Suggest\FmsUnitResponse;
use Velhron\DadataBundle\Model\Response\Suggest\FnsUnitResponse;
use Velhron\DadataBundle\Model\Response\Suggest\FtsUnitResponse;
use Velhron\DadataBundle\Model\Response\Suggest\MetroResponse;
use Velhron\DadataBundle\Model\Response\Suggest\Okpd2Response;
use Velhron\DadataBundle\Model\Response\Suggest\OktmoResponse;
Expand Down Expand Up @@ -219,6 +220,7 @@ public function suggestPostalUnit(string $query, array $options = []): array
* Подсказки по справочнику "Налоговые инспекции".
*
* Справочник инспекций Налоговой службы.
* Поиск работает по полям: code, name_short, address.
*
* @param string $query Текст запроса
* @param array $options Дополнительные параметры запроса
Expand All @@ -232,6 +234,21 @@ public function suggestFnsUnit(string $query, array $options = []): array
return $this->handle('suggestFnsUnit', $query, $options);
}

/**
* Подсказки по справочнику таможенных органов и постов.
*
* @param string $query Текст запроса
* @param array $options Дополнительные параметры запроса
*
* @return FtsUnitResponse[] Массив подсказок
*
* @throws DadataException|InvalidConfigException
*/
public function suggestFtsUnit(string $query, array $options = []): array
{
return $this->handle('suggestFtsUnit', $query, $options);
}

/**
* Подсказки по справочнику "Мировые суды".
*
Expand Down Expand Up @@ -499,12 +516,80 @@ public function findAffiliatedParty(string $query, array $options = []): array
* @param string $query Текст запроса
* @param array $options Дополнительные параметры запроса
*
* @return OktmoResponse[]
* @return OktmoResponse[] Массив подсказок
*
* @throws DadataException|InvalidConfigException
*/
public function findOktmo(string $query, array $options = []): array
{
return $this->handle('findOktmo', $query, $options);
}

/**
* Налоговые инспекции по идентификатору.
*
* Выборка работает по полям: code, inn.
*
* @param string $query Текст запроса
* @param array $options Дополнительные параметры запроса
*
* @return FnsUnitResponse[] Массив подсказок
*
* @throws DadataException|InvalidConfigException
*/
public function findFnsUnit(string $query, array $options = []): array
{
return $this->handle('findFnsUnit', $query, $options);
}

/**
* Таможни по идентификатору.
*
* Выборка работает по полям: code.
*
* @param string $query Текст запроса
* @param array $options Дополнительные параметры запроса
*
* @return FnsUnitResponse[] Массив подсказок
*
* @throws DadataException|InvalidConfigException
*/
public function findFtsUnit(string $query, array $options = []): array
{
return $this->handle('findFtsUnit', $query, $options);
}

/**
* Страны по идентификатору.
*
* Выборка работает по полям: code, alfa2, alfa3.
*
* @param string $query Текст запроса
* @param array $options Дополнительные параметры запроса
*
* @return CountryResponse[] Массив подсказок
*
* @throws DadataException|InvalidConfigException
*/
public function findCountry(string $query, array $options = []): array
{
return $this->handle('findCountry', $query, $options);
}

/**
* Мировые суды по справочнику.
*
* Выборка работает по полям: code.
*
* @param string $query Текст запроса
* @param array $options Дополнительные параметры запроса
*
* @return RegionCourtResponse[] Массив подсказок
*
* @throws DadataException|InvalidConfigException
*/
public function findRegionCourt(string $query, array $options = []): array
{
return $this->handle('findRegionCourt', $query, $options);
}
}
Loading

0 comments on commit 228d7e0

Please sign in to comment.