/** * @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 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)); }
/** @test */ public function it_returns_a_bank_check_object() { $bankCheck = \Oneso\Ckonto\Webservice\Ckonto::checkBank(\Oneso\Ckonto\Webservice\Objects\AccountNumber::fromNumber('123456789'), \Oneso\Ckonto\Webservice\Objects\BankCode::fromCode('123123123'), \Oneso\Ckonto\Webservice\Objects\Sepa::fromValue(false)); $this->assertTrue($bankCheck instanceof \Oneso\Ckonto\Webservice\BankCheck\BankCheck); }