Exemple #1
0
 /**
  * @param AccountNumber $accountNumber
  * @param BankCode $bankCode
  * @param Sepa $sepa
  * @throws BankCheckException
  * @return BankCheckResponse
  */
 public static function request(AccountNumber $accountNumber, BankCode $bankCode, Sepa $sepa)
 {
     $client = new Client();
     try {
         $response = $client->get(Ckonto::$url, ['query' => ['key' => Ckonto::getKey(), 'kontonummer' => $accountNumber->getValue(), 'bankleitzahl' => $bankCode->getValue(), 'sepa' => $sepa->isEnabled() ? 1 : 0]]);
         return new BankCheckResponse($response);
     } catch (RequestException $e) {
         throw new BankCheckException('BankCheckRequest error occurred');
     }
 }
Exemple #2
0
 /**
  * @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());
     }
 }
 /**
  * @param string $accountNumber
  * @param string $bankCode
  * @param bool|false $sepa
  * @return \Oneso\Ckonto\Webservice\BankCheck\BankCheckResponse
  * @throws \Oneso\Ckonto\Webservice\BankCheck\BankCheckException
  */
 private function createRequest($accountNumber = '123456789', $bankCode = '', $sepa = false)
 {
     return \Oneso\Ckonto\Webservice\BankCheck\BankCheckRequest::request(\Oneso\Ckonto\Webservice\Objects\AccountNumber::fromNumber($accountNumber), \Oneso\Ckonto\Webservice\Objects\BankCode::fromCode($bankCode), \Oneso\Ckonto\Webservice\Objects\Sepa::fromValue($sepa));
 }
Exemple #4
0
 /**
  * @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));
 }
Exemple #5
0
 /** @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);
 }