Skip to content

Commit

Permalink
Merge pull request #567 from magento-mpi/sprint70_mb
Browse files Browse the repository at this point in the history
[Merchant Beta] [MPI] [Sparta] Sprint70_merchant_beta
  • Loading branch information
vpelipenko committed Sep 2, 2015
2 parents 5202113 + 2a8568e commit 8654518
Show file tree
Hide file tree
Showing 13 changed files with 343 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,25 @@ $numColumns = sizeof($block->getColumns());
</div>
<?php if ($block->canDisplayContainer()): ?>
<script>
var deps = ['mage/adminhtml/grid'];
var deps = [];

<?php if ($block->getDependencyJsObject()): ?>
deps.push('uiRegistry');
<?php endif; ?>

<?php if (strpos($block->getRowClickCallback(), 'order.') !== false): ?>
deps.push('Magento_Sales/order/create/form')
deps.push('Magento_Sales/order/create/form');
<?php endif; ?>

require(deps, function(){
deps.push('mage/adminhtml/grid');

require(deps, function(<?php echo ($block->getDependencyJsObject() ? 'registry' : '') ?>){
<?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?>

<?php if ($block->getDependencyJsObject()): ?>
registry.get('<?php echo $block->getDependencyJsObject() ?>', function (<?php echo $block->getDependencyJsObject() ?>) {
<?php endif; ?>

<?php echo $block->getJsObjectName() ?> = new varienGrid('<?php echo $block->getId() ?>', '<?php echo $block->getGridUrl() ?>', '<?php echo $block->getVarNamePage() ?>', '<?php echo $block->getVarNameSort() ?>', '<?php echo $block->getVarNameDir() ?>', '<?php echo $block->getVarNameFilter() ?>');
<?php echo $block->getJsObjectName() ?>.useAjax = '<?php echo $block->getUseAjax() ?>';
<?php if ($block->getRowClickCallback()): ?>
Expand All @@ -74,6 +84,10 @@ require(deps, function(){
<?php echo $block->getMassactionBlock()->getJavaScript() ?>
<?php endif ?>

<?php if ($block->getDependencyJsObject()): ?>
});
<?php endif; ?>

});
</script>
<?php endif; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,25 @@ $numColumns = sizeof($block->getColumns());
<?php if ($block->canDisplayContainer()): ?>
</div>
<script>
var deps = ['mage/adminhtml/grid'];
var deps = [];

<?php if ($block->getDependencyJsObject()): ?>
deps.push('uiRegistry');
<?php endif; ?>

<?php if (strpos($block->getRowClickCallback(), 'order.') !== false): ?>
deps.push('Magento_Sales/order/create/form');
deps.push('Magento_Sales/order/create/form')
<?php endif; ?>

require(deps, function(){
deps.push('mage/adminhtml/grid');

require(deps, function(<?php echo ($block->getDependencyJsObject() ? 'registry' : '') ?>){
<?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?>

<?php if ($block->getDependencyJsObject()): ?>
registry.get('<?php echo $block->getDependencyJsObject() ?>', function (<?php echo $block->getDependencyJsObject() ?>) {
<?php endif; ?>

<?php echo $block->getJsObjectName() ?> = new varienGrid('<?php echo $block->getId() ?>', '<?php echo $block->getGridUrl() ?>', '<?php echo $block->getVarNamePage() ?>', '<?php echo $block->getVarNameSort() ?>', '<?php echo $block->getVarNameDir() ?>', '<?php echo $block->getVarNameFilter() ?>');
<?php echo $block->getJsObjectName() ?>.useAjax = <?php echo $block->getUseAjax() ? 'true' : 'false' ?>;
<?php if ($block->getRowClickCallback()): ?>
Expand All @@ -171,6 +181,10 @@ $numColumns = sizeof($block->getColumns());
<?php echo $block->getChildBlock('grid.massaction')->getJavaScript() ?>
<?php endif ?>
<?php echo $block->getAdditionalJavaScript(); ?>

<?php if ($block->getDependencyJsObject()): ?>
});
<?php endif; ?>
});
</script>
<?php endif; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,26 @@ $numColumns = sizeof($block->getColumns());
<?php if ($block->canDisplayContainer()): ?>
</div>
<script>
var deps = ['mage/adminhtml/grid'];
var deps = [];

<?php if ($block->getDependencyJsObject()): ?>
deps.push('uiRegistry');
<?php endif; ?>

<?php if (strpos($block->getRowClickCallback(), 'order.') !== false): ?>
deps.push('Magento_Sales/order/create/form')
<?php endif; ?>

require(deps, function(){
deps.push('mage/adminhtml/grid');

require(deps, function(<?php echo ($block->getDependencyJsObject() ? 'registry' : '') ?>){
<?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?>

//<![CDATA[
<?php if ($block->getDependencyJsObject()): ?>
registry.get('<?php echo $block->getDependencyJsObject() ?>', function (<?php echo $block->getDependencyJsObject() ?>) {
<?php endif; ?>

<?php echo $block->getJsObjectName() ?> = new varienGrid('<?php echo $block->getId() ?>', '<?php echo $block->getGridUrl() ?>', '<?php echo $block->getVarNamePage() ?>', '<?php echo $block->getVarNameSort() ?>', '<?php echo $block->getVarNameDir() ?>', '<?php echo $block->getVarNameFilter() ?>');
<?php echo $block->getJsObjectName() ?>.useAjax = '<?php echo $block->getUseAjax() ?>';
<?php if ($block->getRowClickCallback()): ?>
Expand All @@ -269,6 +279,10 @@ $numColumns = sizeof($block->getColumns());
<?php echo $block->getMassactionBlock()->getJavaScript() ?>
<?php endif ?>
<?php echo $block->getAdditionalJavaScript(); ?>

<?php if ($block->getDependencyJsObject()): ?>
});
<?php endif; ?>
//]]>

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ define(
'use strict';
return Component.extend({
redirectAfterPlaceOrder: true,
/**
* After place order callback
*/
afterPlaceOrder: function () {
//
},
isPlaceOrderActionAllowed: ko.observable(quote.billingAddress() != null),
/**
* Initialize view.
Expand Down Expand Up @@ -63,7 +69,7 @@ define(

$.when(placeOrder).fail(function(){
self.isPlaceOrderActionAllowed(true);
});
}).done(this.afterPlaceOrder);
return true;
}
return false;
Expand Down
4 changes: 1 addition & 3 deletions app/code/Magento/Payment/view/frontend/web/transparent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
define([
"jquery",
"mage/template",
"Magento_Checkout/js/action/set-payment-information",
"jquery/ui",
"Magento_Payment/js/model/credit-card-validation/validator"
], function($, mageTemplate, setPaymentInformationAction){
], function($, mageTemplate){
'use strict';

$.widget('mage.transparent', {
Expand Down Expand Up @@ -74,7 +73,6 @@ define([
* @private
*/
_orderSave: function() {
setPaymentInformationAction();
var postData = $(this.options.paymentFormSelector).serialize();
if ($(this.options.reviewAgreementForm).length) {
postData += '&' + $(this.options.reviewAgreementForm).serialize();
Expand Down
10 changes: 6 additions & 4 deletions app/code/Magento/Paypal/Controller/Payflow/Form.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<?php
/**
*
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Paypal\Controller\Payflow;

class Form extends \Magento\Paypal\Controller\Payflow
use Magento\Paypal\Controller\Payflow;

/**
* Class Form
*/
class Form extends Payflow
{
/**
* Submit transaction to Payflow getaway into iframe
*
* @return void
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
public function execute()
{
$this->getResponse()->setHeader('P3P', 'CP="CAO PSA OUR"');
$this->_view->loadLayout(false)->renderLayout();
$layout = $this->_view->getLayout();
}
}
22 changes: 18 additions & 4 deletions app/code/Magento/Paypal/Helper/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
namespace Magento\Paypal\Helper;

use Magento\Framework\App\Config\ScopeConfigInterface;

/**
* Paypal Backend helper
*/
Expand All @@ -18,21 +20,29 @@ class Backend extends \Magento\Framework\App\Helper\AbstractHelper
/**
* @var \Magento\Config\Model\Config
*/
protected $_backendConfig;
protected $backendConfig;

/**
* @var \Magento\Config\Model\Config\ScopeDefiner
*/
protected $scopeDefiner;

/**
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Directory\Helper\Data $directoryHelper
* @param \Magento\Config\Model\Config $backendConfig
* @param \Magento\Config\Model\Config\ScopeDefiner $scopeDefiner
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Directory\Helper\Data $directoryHelper,
\Magento\Config\Model\Config $backendConfig
\Magento\Config\Model\Config $backendConfig,
\Magento\Config\Model\Config\ScopeDefiner $scopeDefiner
) {
parent::__construct($context);
$this->directoryHelper = $directoryHelper;
$this->_backendConfig = $backendConfig;
$this->backendConfig = $backendConfig;
$this->scopeDefiner = $scopeDefiner;
}

/**
Expand All @@ -44,7 +54,11 @@ public function getConfigurationCountryCode()
{
$countryCode = $this->_request->getParam(\Magento\Paypal\Model\Config\StructurePlugin::REQUEST_PARAM_COUNTRY);
if ($countryCode === null || preg_match('/^[a-zA-Z]{2}$/', $countryCode) == 0) {
$countryCode = $this->_backendConfig->getConfigDataValue(
$scope = $this->scopeDefiner->getScope();
if ($scope != ScopeConfigInterface::SCOPE_TYPE_DEFAULT) {
$this->backendConfig->setData($scope, $this->_request->getParam($scope));
}
$countryCode = $this->backendConfig->getConfigDataValue(
\Magento\Paypal\Block\Adminhtml\System\Config\Field\Country::FIELD_CONFIG_PATH
);
}
Expand Down
6 changes: 5 additions & 1 deletion app/code/Magento/Paypal/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,11 @@ public function getSupportedBuyerCountryCodes()
*/
public function getMerchantCountry()
{
$countryCode = $this->_scopeConfig->getValue($this->_mapGeneralFieldset('merchant_country'));
$countryCode = $this->_scopeConfig->getValue(
$this->_mapGeneralFieldset('merchant_country'),
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$this->_storeId
);
if (!$countryCode) {
$countryCode = $this->directoryHelper->getDefaultCountry($this->_storeId);
}
Expand Down
Loading

0 comments on commit 8654518

Please sign in to comment.