コード例 #1
0
ファイル: SearchRequest.php プロジェクト: oneso/ckonto
 /**
  * @param BankCode $bankCode
  * @param Location $location
  * @param Name $name
  * @param Zip $zip
  * @param Max $max
  * @return SearchResponse
  * @throws SearchException
  */
 public static function request(BankCode $bankCode, Location $location, Name $name, Zip $zip, Max $max)
 {
     $client = new Client();
     try {
         $query = ['key' => Ckonto::getKey(), 'search' => 1, 'zip' => $zip->getValue(), 'bankleitzahl' => $bankCode->getValue(), 'name' => $name->getValue(), 'location' => $location->getCity()];
         if ($max->getValue() > 0) {
             $query['max'] = $max->getValue();
         }
         $response = $client->get(Ckonto::$url, ['query' => $query]);
         return new SearchResponse($response);
     } catch (RequestException $e) {
         throw new SearchException('SearchRequest error: ' . $e->getMessage());
     }
 }
コード例 #2
0
ファイル: SearchRequestTest.php プロジェクト: oneso/ckonto
 /**
  * @param string $bankCode
  * @param string $city
  * @param string $name
  * @param string $zip
  * @param int $max
  * @return \Oneso\Ckonto\Webservice\Search\SearchResponse
  * @throws \Oneso\Ckonto\Webservice\Search\SearchException
  */
 private function createRequest($bankCode = '12345678', $city = 'Berlin', $name = '', $zip = '', $max = 0)
 {
     return \Oneso\Ckonto\Webservice\Search\SearchRequest::request(\Oneso\Ckonto\Webservice\Objects\BankCode::fromCode($bankCode), \Oneso\Ckonto\Webservice\Objects\Location::fromCity($city), \Oneso\Ckonto\Webservice\Objects\Name::fromName($name), \Oneso\Ckonto\Webservice\Objects\Zip::fromZip($zip), \Oneso\Ckonto\Webservice\Objects\Max::fromValue($max));
 }
コード例 #3
0
ファイル: CkontoTest.php プロジェクト: oneso/ckonto
 /** @test */
 public function it_returns_a_search_object()
 {
     $search = \Oneso\Ckonto\Webservice\Ckonto::search(\Oneso\Ckonto\Webservice\Objects\BankCode::fromCode('123456789'), \Oneso\Ckonto\Webservice\Objects\Location::fromCity('Berlin'), \Oneso\Ckonto\Webservice\Objects\Name::fromName(''), \Oneso\Ckonto\Webservice\Objects\Zip::fromZip(''), \Oneso\Ckonto\Webservice\Objects\Max::fromValue(0));
     $this->assertTrue($search instanceof \Oneso\Ckonto\Webservice\Search\Search);
 }