예제 #1
0
 public function test_can_add_new_element()
 {
     $deg = new Deg();
     $deg->addDataElement('foobar');
     $this->assertEquals('foobar', $deg->toString());
     $deg->addDataElement('baz');
     $this->assertEquals('foobar:baz', $deg->toString());
     $this->assertEquals('foobar:baz', (string) $deg);
 }
예제 #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();
 }