/** * @param ExchangeCurrencyCommand $command * @throws BankAccountNotFoundException */ public function exchange(ExchangeCurrencyCommand $command) { $data = $command->getPayload(); //ToDo 3.50 zamienic na mechaznim ktory wyciaga wartosc waluty $exchangeRate = new ExchangeRate(new Currency($data['currency_code']), new Amount(3.5)); $bankAccountTransactionSource = $this->_accountRepo->byId($data['id_account_in']); if (is_null($bankAccountTransactionSource)) { throw new BankAccountNotFoundException('Nie znaleziono numeru konto o id ' . $data['id_account_in']); } $bankAccountTransactionTarget = $this->_accountRepo->byId($data['id_account_return']); if (is_null($bankAccountTransactionTarget)) { throw new BankAccountNotFoundException('Nie znaleziono numeru konto o id ' . $data['id_account_return']); } $exchangeRateSummary = new ExchangeSummary($exchangeRate, $data['quantity']); $exchangeRateSummary->confirm($bankAccountTransactionSource, $bankAccountTransactionTarget); $this->_exchangeSummaryRepo->confirm($exchangeRateSummary); }
/** * @Then /^potwierdzam zlecenie$/ */ public function potwierdzamZlecenie() { $this->exchangeRateSummary->confirm($this->_bankAccountTransactionSource, $this->_bankAccountTransactionTarget); }