15Loc::loadMessages(__FILE__);
60 public function getByOgrn($ogrn, $showTerminated =
false)
62 return $this->
call(static::METHOD_COMMON_GET_BY_OGRN,
array(
'ogrn' => $ogrn,
'showTerminated'=> $showTerminated));
70 public function getByInn($inn, $showTerminated =
false)
72 return $this->
call(static::METHOD_COMMON_GET_BY_INN,
array(
'inn' => $inn,
'showTerminated' => $showTerminated));
84 return $this->
call(static::METHOD_ORGANIZATION_SEARCH_BY_NAME,
array(
102 return $this->
call(static::METHOD_IP_SEARCH_BY_NAME,
array(
104 'second_name' => $secondName,
105 'last_name' => $lastName,
118 return $this->
call(static::METHOD_UA_GET_BY_EDRPOU,
array(
'edrpou' => $edrpou));
128 return $this->
call(static::METHOD_UA_GET_UO_BY_ID,
array(
'id' => $id));
138 return $this->
call(static::METHOD_UA_GET_FO_BY_ID,
array(
'id' => $id));
150 return $this->
call(static::METHOD_UA_SEARCH_UO_BY_NAME,
array(
166 return $this->
call(static::METHOD_UA_SEARCH_FO_BY_NAME,
array(
183 return $this->
call(static::METHOD_UA_SEARCH_BY_NAME,
array(
192 return $this->
call(static::METHOD_COMMON_GET_BY_BIC, [
'bic' => $bic]);
201 return $this->
call(static::METHOD_IS_SERVICE_ONLINE);
212 protected function call($methodName, $additionalParams =
null, $licenseCheck =
false, $clearAccessSettings =
false)
214 $this->errorCollection->clear();
216 if($clearAccessSettings)
219 if(is_null($this->accessSettings))
222 if($this->accessSettings ===
false)
225 if(!is_array($additionalParams))
227 $additionalParams =
array();
230 $additionalParams[
'client_id'] = $this->accessSettings[
'client_id'];
231 $additionalParams[
'client_secret'] = $this->accessSettings[
'client_secret'];
233 $additionalParams[
'key'] = static::getLicenseHash();
237 static::SERVICE_HOST.static::REST_URI.$methodName,
243 $httpErrors = $http->getError();
244 foreach ($httpErrors as $errorCode => $errorText)
246 $this->errorCollection->add(
array(
new Error($errorText, $errorCode)));
253 if(!is_array($answer) ||
count($answer) == 0)
255 $this->errorCollection->add(
array(
new Error(
'Malformed answer from service: '.$http->getStatus().
' '.
$result, static::ERROR_SERVICE_UNAVAILABLE)));
259 if(array_key_exists(
'error', $answer))
261 if($answer[
'error'] ===
'verification_needed' && !$licenseCheck)
263 return $this->
call($methodName, $additionalParams,
true);
265 else if(($answer[
'error'] ===
'ACCESS_DENIED' || $answer[
'error'] ===
'Invalid client')
266 && !$clearAccessSettings)
268 return $this->
call($methodName, $additionalParams,
true,
true);
271 $this->errorCollection->add(
array(
new Error($answer[
'error_description'], $answer[
'error'])));
275 if($answer[
'result'] ==
false)
277 $this->errorCollection->add(
array(
new Error(Loc::getMessage(
'SALE_PROPERTIES_ERROR_NOTHING_FOUND'), static::ERROR_NOTHING_FOUND)));
280 return $answer[
'result'];
304 protected function register()
308 $queryParams =
array(
309 "key" => static::getLicenseHash(),
310 "scope" => static::SCOPE,
311 "redirect_uri" => static::getRedirectUri(),
314 $result = $httpClient->post(static::SERVICE_HOST.static::REGISTER_URI, $queryParams);
318 $this->errorCollection->add(
array(
new Error(
$result[
"error"], static::ERROR_SERVICE_UNAVAILABLE)));
325 $this->errorCollection->add(
array(
new Error(
$result[
"error"], static::ERROR_WRONG_LICENSE)));
341 Option::set(
'sale', static::SERVICE_ACCESS_OPTION, serialize(
$params));
376 Option::set(
'sale', static::SERVICE_ACCESS_OPTION,
null);
385 $request = Context::getCurrent()->getRequest();
390 return ($isHttps ?
'https' :
'http').
'://'.
$host.
"/";
399 return $this->errorCollection->toArray();
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
uaSearchByName($name, $limit, $offset=0)
const ERROR_NOTHING_FOUND
getByInn($inn, $showTerminated=false)
const METHOD_COMMON_GET_BY_INN
const METHOD_IP_SEARCH_BY_NAME
const SERVICE_ACCESS_OPTION
const METHOD_COMMON_GET_BY_OGRN
static setAccessSettings(array $params)
const ERROR_WRONG_LICENSE
const METHOD_ORGANIZATION_SEARCH_BY_NAME
const METHOD_UA_GET_FO_BY_ID
const METHOD_UA_GET_BY_EDRPOU
const ERROR_SERVICE_UNAVAILABLE
const METHOD_UA_SEARCH_FO_BY_NAME
searchOrganizationByName($name, $limit, $offset=0)
const METHOD_IS_SERVICE_ONLINE
const METHOD_UA_GET_UO_BY_ID
const METHOD_UA_SEARCH_BY_NAME
call($methodName, $additionalParams=null, $licenseCheck=false, $clearAccessSettings=false)
searchIpByName($name, $secondName, $lastName, $limit, $offset=0)
getByOgrn($ogrn, $showTerminated=false)
uaSearchUoByName($name, $limit, $offset=0)
uaSearchFoByName($name, $limit, $offset=0)
const METHOD_UA_SEARCH_UO_BY_NAME
const METHOD_COMMON_GET_BY_BIC
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
const LICENSE_KEY($show_sql_stat=='Y')
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']