/** * @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'); } }
/** * @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'); } }