/** * @param Iban $iban * @param Bic $bic * @param Sepa $sepa * @return IbanCheckResponse * @throws IbanCheckException */ public static function request(Iban $iban, Bic $bic, Sepa $sepa) { $client = new Client(); try { $response = $client->get(Ckonto::$url, ['query' => ['key' => Ckonto::getKey(), 'iban' => $iban->getValue(), 'bic' => $bic->getValue(), 'sepa' => $sepa->isEnabled() ? 1 : 0]]); return new IbanCheckResponse($response); } catch (RequestException $e) { throw new IbanCheckException('IbanCheckRequest error occurred'); } }
/** * @param string $iban * @param string $bic * @param bool|false $sepa * @return \Oneso\Ckonto\Webservice\IbanCheck\IbanCheckResponse * @throws \Oneso\Ckonto\Webservice\IbanCheck\IbanCheckException */ private function createRequest($iban = 'DE134567', $bic = '', $sepa = false) { return \Oneso\Ckonto\Webservice\IbanCheck\IbanCheckRequest::request(\Oneso\Ckonto\Webservice\Objects\Iban::fromIban($iban), \Oneso\Ckonto\Webservice\Objects\Bic::fromBic($bic), \Oneso\Ckonto\Webservice\Objects\Sepa::fromValue($sepa)); }
/** @test */ public function it_returns_a_iban_check_object() { $ibanCheck = \Oneso\Ckonto\Webservice\Ckonto::checkIban(\Oneso\Ckonto\Webservice\Objects\Iban::fromIban('DE123456789'), \Oneso\Ckonto\Webservice\Objects\Bic::fromBic('FDX13456'), \Oneso\Ckonto\Webservice\Objects\Sepa::fromValue(false)); $this->assertTrue($ibanCheck instanceof \Oneso\Ckonto\Webservice\IbanCheck\IbanCheck); }