function it_returns_only_channels_enabled_currencies_as_available_ones(ChannelContextInterface $channelContext, ChannelInterface $channel, CurrencyInterface $currency) { $channelContext->getChannel()->willReturn($channel); $channel->getCurrencies()->willReturn(new ArrayCollection([$currency->getWrappedObject()])); $currency->getCode()->willReturn('BTC'); $this->getAvailableCurrenciesCodes()->shouldReturn(['BTC']); }
/** * {@inheritdoc} */ public function specifyPriceForChannelAndCurrency($price, ChannelInterface $channel, CurrencyInterface $currency) { $calculatorElement = $this->getElement('calculator'); $calculatorElement->waitFor(5, function () use($channel, $currency) { return $this->getElement('calculator')->hasField(sprintf('%s %s', $channel->getName(), $currency->getCode())); }); $calculatorElement->fillField(sprintf('%s %s', $channel->getName(), $currency->getCode()), $price); }
/** * @param CurrencyInterface $currency * @param string $status * * @return bool * * @throws \InvalidArgumentException */ private function checkCurrencyStatus(CurrencyInterface $currency, $status) { $tableAccessor = $this->getTableAccessor(); $table = $this->getElement('table'); $row = $tableAccessor->getRowWithFields($table, ['code' => $currency->getCode()]); $enabledField = $tableAccessor->getFieldFromRow($table, $row, 'enabled'); return $enabledField->getText() === $status; }
function it_updates_orders_exchange_rate(RepositoryInterface $currencyRepository, OrderInterface $order, CurrencyInterface $currency) { $order->getCurrencyCode()->willReturn('USD'); $currency->getCode()->willReturn('USD'); $currency->getExchangeRate()->willReturn(2); $currencyRepository->findOneBy(['code' => 'USD'])->willReturn($currency); $order->setExchangeRate(2)->shouldBeCalled(); $this->update($order); }
/** * {@inheritdoc} */ public function getPricingConfigurationForChannelAndCurrencyCalculator(ChannelInterface $channel, CurrencyInterface $currency) { $priceConfigurationElement = $this->getElement('pricing_configuration'); $priceElement = $priceConfigurationElement->find('css', sprintf('label:contains("%s %s")', $channel->getCode(), $currency->getCode()))->getParent(); return $priceElement->find('css', 'input')->getValue(); }
/** * @Then /^(this currency) should still have exchange rate equal to ([0-9\.]+)$/ */ public function theCurrencyShouldStillHaveExchangeRateEquals(CurrencyInterface $currency, $exchangeRate) { $this->updatePage->open(['id' => $currency->getId()]); Assert::eq($exchangeRate, $this->updatePage->getExchangeRateValue(), sprintf('Currency exchange rate should be equal %s, but was %s.', $exchangeRate, $this->updatePage->getExchangeRateValue())); }
function it_returns_all_enabled_currencies(RepositoryInterface $currencyRepository, CurrencyInterface $currency) { $currencyRepository->findBy(['enabled' => true])->willReturn([$currency]); $currency->getCode()->willReturn('PLN'); $this->getAvailableCurrenciesCodes()->shouldReturn(['PLN']); }
/** * @Given /^the exchange rate for (currency "[^"]+") was changed to ([0-9\.]+)$/ * @Given /^the ("[^"]+" currency) has an exchange rate of ([0-9\.]+)$/ */ public function theExchangeRateForWasChangedTo(CurrencyInterface $currency, $exchangeRate) { $currency->setExchangeRate($exchangeRate); $this->saveCurrency($currency); }
/** * @param CurrencyInterface $baseCurrency * @param CurrencyInterface $targetCurrency * * @return bool */ private function isCurrencyPairUnique(CurrencyInterface $baseCurrency, CurrencyInterface $targetCurrency) { $exchangeRate = $this->exchangeRateRepository->findOneWithCurrencyPair($baseCurrency->getCode(), $targetCurrency->getCode()); return null === $exchangeRate; }