/** * @param string $sid - session id returned by Zaloguj() method * @param array $settings - search params array('Nip' => null, 'Regon' => null, 'Krs' => 'null'} * @param bool $extended - get extended information * @return array * @throws \Exception */ public function daneSzukajDzialalnosc($sid, $settings, $extended = false) { $headers = ['sid' => $sid]; $params = ['pParametryWyszukiwania' => ["Regon" => null, "Krs" => null, "Nip" => null]]; if (isset($settings['Nip'])) { $params['pParametryWyszukiwania']['Nip'] = $settings['Nip']; } if (isset($settings['Regon'])) { $params['pParametryWyszukiwania']['Regon'] = $settings['Regon']; } if (isset($settings['Krs'])) { $params['pParametryWyszukiwania']['Krs'] = $settings['Krs']; } $result = $this->transport->call('daneSzukaj', 'post', $params, $headers); if (!isset($result['d'])) { return false; } if (empty($result['d'])) { $this->error = $this->DaneKomunikat($sid); return false; } $response = json_decode($result['d'], true); if (!$response) { return false; } $response = array_shift($response); if ($extended) { $eparams = ['pNazwaRaportu' => null, 'pRegon' => str_pad($response['Regon'], 14, "0"), 'pSilosID' => 1]; switch ($response['Typ']) { case 'F': $eparams['pNazwaRaportu'] = 'DaneRaportDzialalnosciFizycznejPubl'; break; case 'P': $eparams['pNazwaRaportu'] = 'DaneRaportDzialalnosciPrawnejPubl'; break; default: throw new \Exception("Unknown type!"); } $result = $this->transport->call('DanePobierzPelnyRaport', 'post', $eparams, $headers); if (!isset($result['d'])) { return false; } if (empty($result['d'])) { $this->error = $this->DaneKomunikat($sid); return false; } $data = json_decode($result['d'], true); $data = ['ListaDzialalnosci' => $data]; return array_merge($response, $data); } return $response; }
/** * @return array */ public function request() { return $this->transport->call($this->module, $this->method, $this->paramList); }