Skip to content

Commit

Permalink
Merge pull request #574 from magento-tango/happy_merchant
Browse files Browse the repository at this point in the history
[Tango] S59 - Merchant Beta Bug Fixes
  • Loading branch information
Kovsher, Iurii(ikovsher) committed Sep 3, 2015
2 parents 8654518 + 1c5010a commit d6f4ef1
Show file tree
Hide file tree
Showing 9 changed files with 402 additions and 30 deletions.
25 changes: 14 additions & 11 deletions app/code/Magento/Authorizenet/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,45 +44,48 @@
<field id="cgi_url" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Gateway URL</label>
</field>
<field id="currency" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="cgi_url_td" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Transaction Details Url</label>
</field>
<field id="currency" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Accepted Currency</label>
<source_model>Magento\Config\Model\Config\Source\Locale\Currency</source_model>
</field>
<field id="debug" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="debug" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Debug</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="email_customer" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="email_customer" translate="label" type="select" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Email Customer</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="merchant_email" translate="label" type="text" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="merchant_email" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant's Email</label>
<validate>validate-email</validate>
</field>
<field id="cctypes" translate="label" type="multiselect" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="cctypes" translate="label" type="multiselect" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Credit Card Types</label>
<source_model>Magento\Authorizenet\Model\Source\Cctype</source_model>
</field>
<field id="useccv" translate="label" type="select" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="useccv" translate="label" type="select" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Credit Card Verification</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="170" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="170" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="specificcountry" translate="label" type="multiselect" sortOrder="180" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
</field>
<field id="min_order_total" translate="label" type="text" sortOrder="180" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="min_order_total" translate="label" type="text" sortOrder="190" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Minimum Order Total</label>
</field>
<field id="max_order_total" translate="label" type="text" sortOrder="190" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="max_order_total" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Maximum Order Total</label>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0">
<field id="sort_order" translate="label" type="text" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
</field>
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Authorizenet/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<place_order_url>authorizenet/directpost_payment/place</place_order_url>
<cgi_url_test_mode>https://test.authorize.net/gateway/transact.dll</cgi_url_test_mode>
<cgi_url>https://secure.authorize.net/gateway/transact.dll</cgi_url>
<cgi_url_td_test_mode>https://apitest.authorize.net/xml/v1/request.api</cgi_url_td_test_mode>
<cgi_url_td>https://api2.authorize.net/xml/v1/request.api</cgi_url_td>
</authorizenet_directpost>
</payment>
</default>
Expand Down
13 changes: 13 additions & 0 deletions app/code/Magento/Backend/Block/Store/Switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,4 +558,17 @@ public function getHintHtml()
}
return $html;
}

/**
* Get whether iframe is being used
*
* @return bool
*/
public function isUsingIframe()
{
if ($this->hasData('is_using_iframe')) {
return (bool)$this->getData('is_using_iframe');
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
class="admin__action-dropdown"
data-mage-init='{"dropdown":{}}'
data-toggle="dropdown"
aria-haspopup="true">
aria-haspopup="true"
id="store-change-button">
<?php echo $block->getCurrentSelectionName() ?>
</button>
<ul class="dropdown-menu" data-role="stores-list">
Expand Down Expand Up @@ -168,15 +169,35 @@ require(['jquery'], function(jQuery){
};
scopeSwitcherHandler(switcherParams);
} else {
var url = '<?php echo $block->getSwitchUrl() ?>' + scopeParams;

<?php if ($block->getUseConfirm()): ?>
if (confirm("<?php echo __('Please confirm scope switching. All data that hasn\'t been saved will be lost.') ?>")) {
setLocation(url);
reload();
} else {
obj.value = '<?php echo $block->getStoreId() ?>';
}
<?php else: ?>
reload();
<?php endif; ?>
}

function reload() {
<?php if (!$block->isUsingIframe()): ?>
var url = '<?php echo $block->getSwitchUrl() ?>' + scopeParams;
setLocation(url);
<?php else: ?>
jQuery('#preview_selected_store').val(scopeId);
jQuery('#preview_form').submit();

jQuery('.store-switcher .dropdown-menu li a').each(function() {
var $this = jQuery(this);

if ($this.data('role') === 'store-view-id' && $this.data('value') == scopeId) {
jQuery('#store-change-button').html($this.text());
}
});

jQuery('#store-change-button').click();
<?php endif; ?>
}
}
Expand Down
15 changes: 13 additions & 2 deletions app/code/Magento/Widget/Model/Template/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ public function __construct(
}

/**
* Generate widget
* General method for generate widget
*
* @param string[] $construction
* @return string
*/
public function widgetDirective($construction)
public function generateWidget($construction)
{
$params = $this->getParameters($construction[2]);

Expand Down Expand Up @@ -114,6 +114,17 @@ public function widgetDirective($construction)
return $widget->toHtml();
}

/**
* Generate widget
*
* @param string[] $construction
* @return string
*/
public function widgetDirective($construction)
{
return $this->generateWidget($construction);
}

/**
* Retrieve media file URL directive
*
Expand Down
20 changes: 20 additions & 0 deletions app/code/Magento/Widget/Model/Template/FilterEmulate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Widget\Model\Template;

class FilterEmulate extends Filter
{
/**
* Generate widget with emulation frontend area
*
* @param string[] $construction
* @return string
*/
public function widgetDirective($construction)
{
return $this->_appState->emulateAreaCode('frontend', [$this, 'generateWidget'], [$construction]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Widget\Test\Unit\Model\Template;

use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;

class FilterEmulateTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ObjectManagerHelper
*/
protected $objectManagerHelper;

/**
* @var \Magento\Widget\Model\Template\FilterEmulate
*/
protected $filterEmulate;

/**
* @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject
*/
protected $appStateMock;

/**
* @return void
*/
protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->appStateMock = $this->getMock('Magento\Framework\App\State', [], [], '', false);

$this->filterEmulate = $this->objectManagerHelper->getObject(
'Magento\Widget\Model\Template\FilterEmulate',
['appState' => $this->appStateMock]
);
}

/**
* @return void
*/
public function testWidgetDirective()
{
$result = 'some text';
$construction = [
'{{widget type="Widget\\Link" anchor_text="Test" template="block.phtml" id_path="p/1"}}',
'widget',
' type="" anchor_text="Test" template="block.phtml" id_path="p/1"'
];

$this->appStateMock->expects($this->once())
->method('emulateAreaCode')
->with('frontend', [$this->filterEmulate, 'generateWidget'], [$construction])
->willReturn($result);
$this->assertSame($result, $this->filterEmulate->widgetDirective($construction));
}
}
Loading

0 comments on commit d6f4ef1

Please sign in to comment.