Skip to content

Commit 363fa13

Browse files
author
Bohdan Korablov
committed
Merge remote-tracking branch 'mainlinec/develop' into new_pr_bugs
2 parents a12ab62 + 0e5d78e commit 363fa13

File tree

114 files changed

+1901
-323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1901
-323
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd">
10+
<action name="authorizenet/directpost_payment/place">
11+
<section name="cart"/>
12+
<section name="checkout-data"/>
13+
</action>
14+
</config>

app/code/Magento/Authorizenet/view/frontend/web/js/view/payment/method-renderer/authorizenet-directpost.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
* Copyright © 2015 Magento. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5-
/*browser:true*/
6-
/*global define*/
75
define(
86
[
97
'jquery',
108
'Magento_Payment/js/view/payment/iframe',
119
'Magento_Checkout/js/action/set-payment-information',
12-
'Magento_Checkout/js/model/payment/additional-validators'
10+
'Magento_Checkout/js/model/payment/additional-validators',
11+
'Magento_Checkout/js/model/full-screen-loader'
1312
],
14-
function ($, Component, setPaymentInformationAction, additionalValidators) {
13+
function ($, Component, setPaymentInformationAction, additionalValidators, fullScreenLoader) {
1514
'use strict';
15+
1616
return Component.extend({
1717
defaults: {
1818
template: 'Magento_Authorizenet/payment/authorizenet-directpost'
@@ -44,13 +44,24 @@ define(
4444
return true;
4545
},
4646

47-
placeOrder: function() {
47+
/**
48+
* @override
49+
*/
50+
placeOrder: function () {
4851
var self = this;
52+
53+
fullScreenLoader.startLoader();
54+
4955
if (this.validateHandler() && additionalValidators.validate()) {
5056
this.isPlaceOrderActionAllowed(false);
51-
$.when(setPaymentInformationAction(this.messageContainer, {'method': self.getCode()})).done(function() {
52-
self.placeOrderHandler();
53-
}).fail(function() {
57+
$.when(setPaymentInformationAction(this.messageContainer, {
58+
'method': self.getCode()
59+
})).done(function () {
60+
self.placeOrderHandler().fail(function () {
61+
fullScreenLoader.stopLoader();
62+
});
63+
}).fail(function () {
64+
fullScreenLoader.stopLoader();
5465
self.isPlaceOrderActionAllowed(true);
5566
});
5667
}

app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ define(
2828
this._super();
2929
captchaConfig = window[this.configSource]['captcha'];
3030

31-
$.each(captchaConfig, function(formId, captchaData) {
32-
captchaData.formId = formId;
33-
captchaList.add(Captcha(captchaData));
34-
});
31+
if (captchaConfig) {
32+
$.each(captchaConfig, function(formId, captchaData) {
33+
captchaData.formId = formId;
34+
captchaList.add(Captcha(captchaData));
35+
});
36+
}
3537
},
3638
getIsLoading: function() {
37-
return this.currentCaptcha.isLoading
39+
return this.currentCaptcha !== null ? this.currentCaptcha.isLoading : false;
3840
},
3941
getCurrentCaptcha: function() {
4042
return this.currentCaptcha;
@@ -43,25 +45,25 @@ define(
4345
this.currentCaptcha = captcha;
4446
},
4547
getFormId: function() {
46-
return this.currentCaptcha.getFormId();
48+
return this.currentCaptcha !== null ? this.currentCaptcha.getFormId() : null;
4749
},
4850
getIsVisible: function() {
49-
return this.currentCaptcha.getIsVisible();
51+
return this.currentCaptcha !== null ? this.currentCaptcha.getIsVisible() : false;
5052
},
5153
setIsVisible: function(flag) {
5254
this.currentCaptcha.setIsVisible(flag);
5355
},
5456
isRequired: function() {
55-
return this.currentCaptcha.getIsRequired();
57+
return this.currentCaptcha !== null ? this.currentCaptcha.getIsRequired() : false;
5658
},
5759
isCaseSensitive: function() {
58-
return this.currentCaptcha.getIsCaseSensitive();
60+
return this.currentCaptcha !== null ? this.currentCaptcha.getIsCaseSensitive() : false;
5961
},
6062
imageHeight: function() {
61-
return this.currentCaptcha.getImageHeight();
63+
return this.currentCaptcha !== null ? this.currentCaptcha.getImageHeight() : null;
6264
},
6365
getImageSource: function () {
64-
return this.currentCaptcha.getImageSource();
66+
return this.currentCaptcha !== null ? this.currentCaptcha.getImageSource() : null;
6567
},
6668
refresh: function() {
6769
this.currentCaptcha.refresh();

app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<div class="actions-primary">
6464
<?php if ($_item->isSaleable()): ?>
6565
<form data-role="tocart-form" action="<?php /* @escapeNotVerified */ echo $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToCartUrl($_item); ?>" method="post">
66+
<?php echo $block->getBlockHtml('formkey')?>
6667
<button type="submit" class="action tocart primary">
6768
<span><?php /* @escapeNotVerified */ echo __('Add to Cart'); ?></span>
6869
</button>

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
8181
<form data-role="tocart-form" action="<?php /* @escapeNotVerified */ echo $postParams['action']; ?>" method="post">
8282
<input type="hidden" name="product" value="<?php /* @escapeNotVerified */ echo $postParams['data']['product']; ?>">
8383
<input type="hidden" name="<?php /* @escapeNotVerified */ echo Action::PARAM_NAME_URL_ENCODED; ?>" value="<?php /* @escapeNotVerified */ echo $postParams['data'][Action::PARAM_NAME_URL_ENCODED]; ?>">
84+
<?php echo $block->getBlockHtml('formkey')?>
8485
<button type="submit"
8586
title="<?php echo $block->escapeHtml(__('Add to Cart')); ?>"
8687
class="action tocart primary">

app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<input type="hidden" name="product" value="<?php /* @escapeNotVerified */ echo $_product->getId() ?>" />
2222
<input type="hidden" name="selected_configurable_option" value="" />
2323
<input type="hidden" name="related_product" id="related-products-field" value="" />
24+
<?php echo $block->getBlockHtml('formkey')?>
2425
<?php echo $block->getChildHtml('form_top'); ?>
2526
<?php if (!$block->hasOptions()):?>
2627
<?php echo $block->getChildHtml('product_info_form_content'); ?>

app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ protected function getFieldConfig(
193193

194194
if (isset($attributeConfig['value']) && $attributeConfig['value'] != null) {
195195
$element['value'] = $attributeConfig['value'];
196+
} elseif (isset($attributeConfig['default']) && $attributeConfig['default'] != null) {
197+
$element['value'] = $attributeConfig['default'];
196198
} else {
197199
$defaultValue = $this->getDefaultValue($attributeCode);
198200
if (null !== $defaultValue) {
@@ -254,7 +256,7 @@ protected function getMultilineFieldConfig($attributeCode, array $attributeConfi
254256
unset($attributeConfig['validation']['required-entry']);
255257
for ($lineIndex = 0; $lineIndex < (int)$attributeConfig['size']; $lineIndex++) {
256258
$isFirstLine = $lineIndex === 0;
257-
$lines[] = [
259+
$line = [
258260
'component' => 'Magento_Ui/js/form/element/abstract',
259261
'config' => [
260262
// customScope is used to group elements within a single form e.g. they can be validated separately
@@ -271,7 +273,12 @@ protected function getMultilineFieldConfig($attributeCode, array $attributeConfi
271273
)
272274
: $attributeConfig['validation'],
273275
'additionalClasses' => $isFirstLine ? : 'additional'
276+
274277
];
278+
if ($isFirstLine && isset($attributeConfig['default']) && $attributeConfig['default'] != null) {
279+
$line['value'] = $attributeConfig['default'];
280+
}
281+
$lines[] = $line;
275282
}
276283
return [
277284
'component' => 'Magento_Ui/js/form/components/group',

app/code/Magento/Checkout/Controller/Cart/Add.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ protected function _initProduct()
7777
*/
7878
public function execute()
7979
{
80+
if (!$this->_formKeyValidator->validate($this->getRequest())) {
81+
return $this->resultRedirectFactory->create()->setPath('*/*/');
82+
}
83+
8084
$params = $this->getRequest()->getParams();
8185
try {
8286
if (isset($params['qty'])) {

app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@
261261
<item name="component" xsi:type="string">uiComponent</item>
262262
<item name="children" xsi:type="array">
263263
<!-- merge payment validators here -->
264+
<item name="email-validator" xsi:type="array">
265+
<item name="component" xsi:type="string">Magento_Checkout/js/view/payment/email-validator</item>
266+
</item>
264267
</item>
265268
</item>
266269
<item name="customer-email" xsi:type="array">
@@ -341,7 +344,7 @@
341344
</item>
342345
<item name="children" xsi:type="array">
343346
<item name="totals" xsi:type="array">
344-
<item name="component" xsi:type="string">uiComponent</item>
347+
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/totals</item>
345348
<item name="displayArea" xsi:type="string">totals</item>
346349
<item name="config" xsi:type="array">
347350
<item name="template" xsi:type="string">Magento_Checkout/summary/totals</item>

app/code/Magento/Checkout/view/frontend/web/js/action/place-order.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ define(
4242
}
4343

4444
fullScreenLoader.startLoader();
45+
4546
return storage.post(
46-
serviceUrl, JSON.stringify(payload), false
47+
serviceUrl, JSON.stringify(payload)
4748
).done(
4849
function () {
4950
if (redirectOnSuccess) {

0 commit comments

Comments
 (0)