Skip to content

Commit c478ec2

Browse files
committed
MAGETWO-55620: Merge branch '2.1' of github.com:magento/magento2ce into MAGETWO-55620
2 parents 98661de + aaff5c0 commit c478ec2

File tree

91 files changed

+2129
-697
lines changed

Some content is hidden

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

91 files changed

+2129
-697
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2.1.1
2+
=============
3+
To get detailed information about changes in Magento 2.1.1, please visit [Magento Community Edition (CE) Release Notes](http://devdocs.magento.com/guides/v2.1/release-notes/ReleaseNotes2.1.1CE.html "Magento Community Edition (CE) Release Notes")
4+
15
2.1.0
26
=============
37
To get detailed information about changes in Magento 2.1.0, please visit [Magento Community Edition (CE) Release Notes](http://devdocs.magento.com/guides/v2.1/release-notes/ReleaseNotes2.1.0CE.html "Magento Community Edition (CE) Release Notes")

app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ protected function placeCheckoutOrder()
127127
);
128128
} catch (\Exception $exception) {
129129
$result->setData('error', true);
130-
$result->setData('error_messages', __('Unable to place order. Please try again later.'));
130+
$result->setData(
131+
'error_messages',
132+
__('An error occurred on the server. Please try to place the order again.')
133+
);
131134
}
132135
if ($response instanceof Http) {
133136
$response->representJson($this->jsonHelper->jsonEncode($result));

app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ public function textExecuteFailedPlaceOrderDataProvider()
280280
{
281281
$objectFailed = new \Magento\Framework\DataObject();
282282
$objectFailed->setData('error', true);
283-
$objectFailed->setData('error_messages', __('Unable to place order. Please try again later.'));
283+
$objectFailed->setData(
284+
'error_messages',
285+
__('An error occurred on the server. Please try to place the order again.')
286+
);
284287

285288
return [
286289
[

app/code/Magento/Authorizenet/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"Order saving error: %1","Order saving error: %1"
33
"Please choose a payment method.","Please choose a payment method."
44
"We can\'t process your order right now. Please try again later.","We can\'t process your order right now. Please try again later."
5-
"Unable to place order. Please try again later.","Unable to place order. Please try again later."
5+
"An error occurred on the server. Please try to place the order again.","An error occurred on the server. Please try to place the order again."
66
"Credit Card: xxxx-%1","Credit Card: xxxx-%1"
77
"amount %1","amount %1"
88
failed.,failed.

app/code/Magento/Braintree/Model/Ui/ConfigProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public function getConfig()
7979
'payment' => [
8080
self::CODE => [
8181
'isActive' => $this->config->isActive(),
82-
'isSingleUse' => !$isPayPalActive,
8382
'clientToken' => $this->getClientToken(),
8483
'ccTypesMapper' => $this->config->getCctypesMapper(),
8584
'sdkUrl' => $this->config->getSdkUrl(),

app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ public function getConfigDataProvider()
154154
'payment' => [
155155
ConfigProvider::CODE => [
156156
'isActive' => true,
157-
'isSingleUse' => false,
158157
'clientToken' => self::CLIENT_TOKEN,
159158
'ccTypesMapper' => ['visa' => 'VI', 'american-express' => 'AE'],
160159
'sdkUrl' => self::SDK_URL,

app/code/Magento/Braintree/view/frontend/web/js/view/payment/braintree.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,19 @@
77
define(
88
[
99
'uiComponent',
10-
'uiRegistry',
11-
'Magento_Braintree/js/view/payment/adapter',
1210
'Magento_Checkout/js/model/payment/renderer-list'
1311
],
1412
function (
1513
Component,
16-
Registry,
17-
Braintree,
1814
rendererList
1915
) {
2016
'use strict';
2117

2218
var config = window.checkoutConfig.payment,
2319
braintreeType = 'braintree',
24-
payPalType = 'braintree_paypal',
25-
path = 'checkout.steps.billing-step.payment.payments-list.',
26-
components = [];
20+
payPalType = 'braintree_paypal';
2721

2822
if (config[braintreeType].isActive) {
29-
components.push(path + braintreeType);
3023
rendererList.push(
3124
{
3225
type: braintreeType,
@@ -44,13 +37,6 @@ define(
4437
);
4538
}
4639

47-
// setup Braintree SDK with merged configuration from all related components
48-
if (components.length) {
49-
Registry.get(components, function () {
50-
Braintree.setup();
51-
});
52-
}
53-
5440
/** Add view logic here if needed */
5541
return Component.extend({});
5642
}

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,22 @@ define(
6161
this.beforePlaceOrder(response);
6262
},
6363

64+
/**
65+
* Device data initialization
66+
*
67+
* @param {Object} checkout
68+
*/
69+
onReady: function (checkout) {
70+
braintree.checkout = checkout;
71+
},
72+
6473
/**
6574
* Triggers on any Braintree error
75+
* @param {Object} response
6676
*/
67-
onError: function () {
68-
this.paymentMethodNonce = null;
77+
onError: function (response) {
78+
braintree.showError($t('Payment ' + this.getTitle() + ' can\'t be initialized'));
79+
throw response.message;
6980
},
7081

7182
/**
@@ -90,7 +101,7 @@ define(
90101
this._super()
91102
.observe(['active']);
92103
this.validatorManager.initialize();
93-
this.initBraintree();
104+
this.initClientConfig();
94105

95106
return this;
96107
},
@@ -122,11 +133,11 @@ define(
122133
* @param {Boolean} isActive
123134
*/
124135
onActiveChange: function (isActive) {
125-
if (!isActive || this.isSingleUse()) {
136+
if (!isActive) {
126137
return;
127138
}
128139

129-
this.reInitBraintree();
140+
this.initBraintree();
130141
},
131142

132143
/**
@@ -146,17 +157,9 @@ define(
146157
},
147158

148159
/**
149-
* Create Braintree configuration
160+
* Init Braintree configuration
150161
*/
151162
initBraintree: function () {
152-
this.initClientConfig();
153-
braintree.config = _.extend(braintree.config, this.clientConfig);
154-
},
155-
156-
/**
157-
* Re-init Braintree configuration
158-
*/
159-
reInitBraintree: function () {
160163
var intervalId = setInterval(function () {
161164
// stop loader when frame will be loaded
162165
if ($('#braintree-hosted-field-number').length) {
@@ -165,6 +168,12 @@ define(
165168
}
166169
}, 500);
167170

171+
if (braintree.checkout) {
172+
braintree.checkout.teardown(function () {
173+
braintree.checkout = null;
174+
});
175+
}
176+
168177
fullScreenLoader.startLoader();
169178
braintree.setConfig(this.clientConfig);
170179
braintree.setup();
@@ -309,14 +318,6 @@ define(
309318
});
310319

311320
return false;
312-
},
313-
314-
/**
315-
* Check if Braintree configured without PayPal
316-
* @returns {Boolean}
317-
*/
318-
isSingleUse: function () {
319-
return window.checkoutConfig.payment[this.getCode()].isSingleUse;
320321
}
321322
});
322323
}

app/code/Magento/Catalog/Model/Product/Gallery/ReadHandler.php

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Catalog\Model\Product\Gallery;
77

88
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
9+
use Magento\Catalog\Model\Product;
910

1011
/**
1112
* Read handler for catalog product gallery.
@@ -40,7 +41,7 @@ public function __construct(
4041
}
4142

4243
/**
43-
* @param object $entity
44+
* @param Product $entity
4445
* @param array $arguments
4546
* @return object
4647
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -50,29 +51,57 @@ public function execute($entity, $arguments = [])
5051
$value = [];
5152
$value['images'] = [];
5253

53-
$localAttributes = ['label', 'position', 'disabled'];
54-
5554
$mediaEntries = $this->resourceModel->loadProductGalleryByAttributeId(
5655
$entity,
5756
$this->getAttribute()->getAttributeId()
5857
);
5958

60-
foreach ($mediaEntries as $mediaEntry) {
61-
foreach ($localAttributes as $localAttribute) {
62-
if ($mediaEntry[$localAttribute] === null) {
63-
$mediaEntry[$localAttribute] = $this->findDefaultValue($localAttribute, $mediaEntry);
64-
}
65-
}
59+
$this->addMediaDataToProduct(
60+
$entity,
61+
$mediaEntries
62+
);
63+
64+
return $entity;
65+
}
66+
67+
/**
68+
* @param Product $product
69+
* @param array $mediaEntries
70+
* @return void
71+
*/
72+
public function addMediaDataToProduct(Product $product, array $mediaEntries)
73+
{
74+
$attrCode = $this->getAttribute()->getAttributeCode();
75+
$value = [];
76+
$value['images'] = [];
77+
$value['values'] = [];
6678

67-
$value['images'][$mediaEntry['value_id']] = $mediaEntry;
79+
foreach ($mediaEntries as $mediaEntry) {
80+
$mediaEntry = $this->substituteNullsWithDefaultValues($mediaEntry);
81+
$value['images'][] = $mediaEntry;
6882
}
83+
$product->setData($attrCode, $value);
84+
}
6985

70-
$entity->setData(
71-
$this->getAttribute()->getAttributeCode(),
72-
$value
73-
);
86+
/**
87+
* @param array $rawData
88+
* @return array
89+
*/
90+
private function substituteNullsWithDefaultValues(array $rawData)
91+
{
92+
$processedData = [];
93+
foreach ($rawData as $key => $rawValue) {
94+
if (null !== $rawValue) {
95+
$processedValue = $rawValue;
96+
} elseif (isset($rawData[$key . '_default'])) {
97+
$processedValue = $rawData[$key . '_default'];
98+
} else {
99+
$processedValue = null;
100+
}
101+
$processedData[$key] = $processedValue;
102+
}
74103

75-
return $entity;
104+
return $processedData;
76105
}
77106

78107
/**
@@ -93,6 +122,7 @@ public function getAttribute()
93122
* @param string $key
94123
* @param string[] &$image
95124
* @return string
125+
* @deprecated
96126
*/
97127
protected function findDefaultValue($key, &$image)
98128
{

app/code/Magento/Catalog/Model/Product/Link.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class Link extends \Magento\Framework\Model\AbstractModel
5757

5858
/**
5959
* @var \Magento\CatalogInventory\Helper\Stock
60+
* @deprecated
6061
*/
6162
protected $stockHelper;
6263

0 commit comments

Comments
 (0)