Skip to content

Commit

Permalink
Merge pull request #400 from magento-api/develop
Browse files Browse the repository at this point in the history
[API] Sprint51
  • Loading branch information
vpelipenko committed Jul 2, 2015
2 parents 16274ed + 16ac771 commit 41156cc
Show file tree
Hide file tree
Showing 17 changed files with 1,232 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ protected function _prepareLayout()
* Get header
*
* @return \Magento\Framework\Phrase
* @codeCoverageIgnore
*/
public function getHeader()
{
Expand All @@ -70,6 +71,7 @@ public function getHeader()
* Get save button html
*
* @return string
* @codeCoverageIgnore
*/
public function getSaveButtonHtml()
{
Expand All @@ -80,6 +82,7 @@ public function getSaveButtonHtml()
* Get reset button html
*
* @return string
* @codeCoverageIgnore
*/
public function getResetButtonHtml()
{
Expand All @@ -90,6 +93,7 @@ public function getResetButtonHtml()
* Get import button html
*
* @return string
* @codeCoverageIgnore
*/
public function getImportButtonHtml()
{
Expand All @@ -100,6 +104,7 @@ public function getImportButtonHtml()
* Get services html
*
* @return string
* @codeCoverageIgnore
*/
public function getServicesHtml()
{
Expand All @@ -110,6 +115,7 @@ public function getServicesHtml()
* Get rates matrix html
*
* @return string
* @codeCoverageIgnore
*/
public function getRatesMatrixHtml()
{
Expand All @@ -120,6 +126,7 @@ public function getRatesMatrixHtml()
* Get import form action url
*
* @return string
* @codeCoverageIgnore
*/
public function getImportFormAction()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ protected function _prepareLayout()
* Get rates form action
*
* @return string
* @codeCoverageIgnore
*/
public function getRatesFormAction()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ protected function _prepareLayout()
* Returns page header
*
* @return \Magento\Framework\Phrase
* @codeCoverageIgnore
*/
public function getHeader()
{
Expand All @@ -87,6 +88,7 @@ public function getHeader()
* Returns URL for save action
*
* @return string
* @codeCoverageIgnore
*/
public function getFormActionUrl()
{
Expand All @@ -97,6 +99,7 @@ public function getFormActionUrl()
* Returns website id
*
* @return int
* @codeCoverageIgnore
*/
public function getWebsiteId()
{
Expand All @@ -107,6 +110,7 @@ public function getWebsiteId()
* Returns store id
*
* @return int
* @codeCoverageIgnore
*/
public function getStoreId()
{
Expand All @@ -130,6 +134,7 @@ public function getCurrencySymbolsData()
* Returns inheritance text
*
* @return \Magento\Framework\Phrase
* @codeCoverageIgnore
*/
public function getInheritText()
{
Expand Down
56 changes: 0 additions & 56 deletions app/code/Magento/CurrencySymbol/Helper/Data.php

This file was deleted.

41 changes: 29 additions & 12 deletions app/code/Magento/CurrencySymbol/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\CurrencySymbol\Model;

use Magento\Framework\Locale\Currency;

/**
* Currency Symbol Observer
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\CurrencySymbol\Model;

class Observer
{
/**
* Currency symbol data
*
* @var \Magento\CurrencySymbol\Helper\Data
* @var \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory
*/
protected $_currencySymbolData = null;
protected $symbolFactory;

/**
* @param \Magento\CurrencySymbol\Helper\Data $currencySymbolData
* @param \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolFactory
*/
public function __construct(\Magento\CurrencySymbol\Helper\Data $currencySymbolData)
public function __construct(\Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolFactory)
{
$this->_currencySymbolData = $currencySymbolData;
$this->symbolFactory = $symbolFactory;
}

/**
Expand All @@ -38,8 +35,28 @@ public function currencyDisplayOptions(\Magento\Framework\Event\Observer $observ
{
$baseCode = $observer->getEvent()->getBaseCode();
$currencyOptions = $observer->getEvent()->getCurrencyOptions();
$currencyOptions->setData($this->_currencySymbolData->getCurrencyOptions($baseCode));
$currencyOptions->setData($this->getCurrencyOptions($baseCode));

return $this;
}

/**
* Get currency display options
*
* @param string $baseCode
* @return array
*/
protected function getCurrencyOptions($baseCode)
{
$currencyOptions = [];
if ($baseCode) {
$customCurrencySymbol = $this->symbolFactory->create()->getCurrencySymbol($baseCode);
if ($customCurrencySymbol) {
$currencyOptions[Currency::CURRENCY_OPTION_SYMBOL] = $customCurrencySymbol;
$currencyOptions[Currency::CURRENCY_OPTION_DISPLAY] = \Magento\Framework\Currency::USE_SYMBOL;
}
}

return $currencyOptions;
}
}
Loading

0 comments on commit 41156cc

Please sign in to comment.