/**
  * Creates a SEPAAccount model from array.
  *
  * @param array $array
  * @return SEPAAccount
  */
 protected function createModelFromArray(array $array)
 {
     $account = new SEPAAccount();
     $account->setIban($array[1]);
     $account->setBic($array[2]);
     $account->setAccountNumber($array[3]);
     $account->setSubAccount($array[4]);
     $account->setBlz($array[6]);
     return $account;
 }
Esempio n. 2
0
 /**
  * Gets the saldo of given SEPAAccount.
  *
  * @param SEPAAccount $account
  * @return Model\Saldo|null
  * @throws Adapter\Exception\AdapterException
  * @throws Adapter\Exception\CurlException
  * @throws \Exception
  */
 public function getSaldo(SEPAAccount $account)
 {
     $dialog = $this->getDialog();
     $dialog->syncDialog();
     $dialog->initDialog();
     switch ((int) $dialog->getHksalMaxVersion()) {
         case 4:
         case 5:
             $hksalAccount = new Deg($account->getAccountNumber(), $account->getSubAccount(), static::DEFAULT_COUNTRY_CODE, $account->getBlz());
             $hksalAccount->addDataElement($account->getAccountNumber());
             $hksalAccount->addDataElement($account->getSubAccount());
             $hksalAccount->addDataElement(static::DEFAULT_COUNTRY_CODE);
             $hksalAccount->addDataElement($account->getBlz());
             break;
         case 6:
             $hksalAccount = new Ktv($account->getAccountNumber(), $account->getSubAccount(), new Kik(280, $account->getBlz()));
             break;
         case 7:
             $hksalAccount = new Kti($account->getIban(), $account->getBic(), $account->getAccountNumber(), $account->getSubAccount(), new Kik(280, $account->getBlz()));
             break;
         default:
             throw new \Exception('Unsupported HKSAL version: ' . $dialog->getHksalMaxVersion());
     }
     $message = new Message($this->bankCode, $this->username, $this->pin, $dialog->getSystemId(), $dialog->getDialogId(), $dialog->getMessageNumber(), array(new HKSAL($dialog->getHksalMaxVersion(), 3, $hksalAccount, HKSAL::ALL_ACCOUNTS_N)), array(AbstractMessage::OPT_PINTAN_MECH => $dialog->getSupportedPinTanMechanisms()));
     $response = $dialog->sendMessage($message);
     $response = new GetSaldo($response->rawResponse);
     return $response->getSaldo();
 }
 public function test_getter_and_setter()
 {
     $obj = new SEPAAccount();
     $this->assertNull($obj->getAccountNumber());
     $this->assertNull($obj->getBic());
     $this->assertNull($obj->getBlz());
     $this->assertNull($obj->getIban());
     $this->assertNull($obj->getSubAccount());
     $this->assertSame('123456789', $obj->setAccountNumber('123456789')->getAccountNumber());
     $this->assertSame('123456789', $obj->setBic('123456789')->getBic());
     $this->assertSame('123456789', $obj->setIban('123456789')->getIban());
     $this->assertSame('123456789', $obj->setBlz('123456789')->getBlz());
     $this->assertSame('123456789', $obj->setSubAccount('123456789')->getSubAccount());
 }