Skip to content

Commit 96264cb

Browse files
committed
Merge branch 'MC-17462' of https://github.com/magento-mpi/magento2ce into MPI_PR_2019_06_21
2 parents f770e75 + da08b65 commit 96264cb

File tree

148 files changed

+8213
-2256
lines changed

Some content is hidden

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

148 files changed

+8213
-2256
lines changed

app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99

1010
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;
1111
use Magento\Framework\Stdlib\ArrayManager;
12-
use Magento\Framework\GraphQL\DataObjectConverter;
1312

1413
/**
1514
* DataProvider Model for Authorizenet
1615
*/
1716
class AuthorizenetDataProvider implements AdditionalDataProviderInterface
1817
{
19-
private const PATH_ADDITIONAL_DATA = 'input/payment_method/additional_data/authorizenet_acceptjs';
18+
private const PATH_ADDITIONAL_DATA = 'authorizenet_acceptjs';
2019

2120
/**
2221
* @var ArrayManager
@@ -36,12 +35,12 @@ public function __construct(
3635
/**
3736
* Return additional data
3837
*
39-
* @param array $args
38+
* @param array $data
4039
* @return array
4140
*/
42-
public function getData(array $args): array
41+
public function getData(array $data): array
4342
{
44-
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $args) ?? [];
43+
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $data) ?? [];
4544
foreach ($additionalData as $key => $value) {
4645
$additionalData[$this->snakeCaseToCamelCase($key)] = $value;
4746
unset($additionalData[$key]);

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define([
1212
'Magento_Ui/js/model/messageList',
1313
'mage/translate',
1414
'Magento_Checkout/js/model/full-screen-loader',
15-
'Magento_Checkout/js/action/set-payment-information',
15+
'Magento_Checkout/js/action/set-payment-information-extended',
1616
'Magento_Checkout/js/model/payment/additional-validators',
1717
'Magento_Braintree/js/view/payment/validator-handler'
1818
], function (
@@ -22,7 +22,7 @@ define([
2222
messageList,
2323
$t,
2424
fullScreenLoader,
25-
setPaymentInformationAction,
25+
setPaymentInformationExtended,
2626
additionalValidators,
2727
validatorManager
2828
) {
@@ -51,9 +51,10 @@ define([
5151
if (additionalValidators.validate()) {
5252
fullScreenLoader.startLoader();
5353
$.when(
54-
setPaymentInformationAction(
54+
setPaymentInformationExtended(
5555
this.messageContainer,
56-
this.getData()
56+
this.getData(),
57+
true
5758
)
5859
).done(this.done.bind(this))
5960
.fail(this.fail.bind(this));

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/multishipping/paypal.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ define([
88
'jquery',
99
'underscore',
1010
'Magento_Braintree/js/view/payment/method-renderer/paypal',
11-
'Magento_Checkout/js/action/set-payment-information',
11+
'Magento_Checkout/js/action/set-payment-information-extended',
1212
'Magento_Checkout/js/model/payment/additional-validators',
1313
'Magento_Checkout/js/model/full-screen-loader'
1414
], function (
1515
$,
1616
_,
1717
Component,
18-
setPaymentInformationAction,
18+
setPaymentInformationExtended,
1919
additionalValidators,
2020
fullScreenLoader
2121
) {
@@ -131,9 +131,10 @@ define([
131131
placeOrder: function () {
132132
fullScreenLoader.startLoader();
133133
$.when(
134-
setPaymentInformationAction(
134+
setPaymentInformationExtended(
135135
this.messageContainer,
136-
this.getData()
136+
this.getData(),
137+
true
137138
)
138139
).done(this.done.bind(this))
139140
.fail(this.fail.bind(this));

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Framework\App\ResourceConnection;
1111
use Magento\Catalog\Model\Product\Attribute\Source\Status;
12+
use Magento\Framework\EntityManager\MetadataPool;
1213
use Magento\Store\Model\Store;
1314

1415
/**
@@ -31,19 +32,28 @@ class Eraser
3132
*/
3233
protected $storeManager;
3334

35+
/**
36+
* @var MetadataPool
37+
*/
38+
private $metadataPool;
39+
3440
/**
3541
* @param \Magento\Framework\App\ResourceConnection $resource
3642
* @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper
3743
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
44+
* @param MetadataPool|null $metadataPool
3845
*/
3946
public function __construct(
4047
\Magento\Framework\App\ResourceConnection $resource,
4148
\Magento\Catalog\Helper\Product\Flat\Indexer $productHelper,
42-
\Magento\Store\Model\StoreManagerInterface $storeManager
49+
\Magento\Store\Model\StoreManagerInterface $storeManager,
50+
MetadataPool $metadataPool = null
4351
) {
4452
$this->productIndexerHelper = $productHelper;
4553
$this->connection = $resource->getConnection();
4654
$this->storeManager = $storeManager;
55+
$this->metadataPool = $metadataPool ?:
56+
\Magento\Framework\App\ObjectManager::getInstance()->get(MetadataPool::class);
4757
}
4858

4959
/**
@@ -81,17 +91,24 @@ public function removeDisabledProducts(array &$ids, $storeId)
8191
/* @var $statusAttribute \Magento\Eav\Model\Entity\Attribute */
8292
$statusAttribute = $this->productIndexerHelper->getAttribute('status');
8393

94+
/** @var \Magento\Framework\EntityManager\EntityMetadataInterface $metadata */
95+
$metadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
96+
8497
$select = $this->getSelectForProducts($ids);
8598
$select->joinLeft(
8699
['status_global_attr' => $statusAttribute->getBackendTable()],
87100
' status_global_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
88-
. ' AND status_global_attr.store_id = ' . Store::DEFAULT_STORE_ID,
101+
. ' AND status_global_attr.store_id = ' . Store::DEFAULT_STORE_ID
102+
. ' AND status_global_attr.' . $statusAttribute->getEntityIdField() . '='
103+
. 'product_table.' . $metadata->getLinkField(),
89104
[]
90105
);
91106
$select->joinLeft(
92107
['status_attr' => $statusAttribute->getBackendTable()],
93108
' status_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
94-
. ' AND status_attr.store_id = ' . $storeId,
109+
. ' AND status_attr.store_id = ' . $storeId
110+
. ' AND status_attr.' . $statusAttribute->getEntityIdField() . '='
111+
. 'product_table.' . $metadata->getLinkField(),
95112
[]
96113
);
97114
$select->where('IFNULL(status_attr.value, status_global_attr.value) = ?', Status::STATUS_DISABLED);

app/code/Magento/Catalog/Model/ResourceModel/Product/Image.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ private function getUsedImagesSelect(): Select
158158
'value as filepath'
159159
)->joinInner(
160160
['image_value' => $this->resourceConnection->getTableName(Gallery::GALLERY_VALUE_TABLE)],
161-
'images.value_id = image_value.value_id'
161+
'images.value_id = image_value.value_id',
162+
[]
162163
)->where(
163164
'images.disabled = 0 AND image_value.disabled = 0'
164165
);
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/**
7+
* @api
8+
*/
9+
define([
10+
'Magento_Checkout/js/model/quote',
11+
'Magento_Checkout/js/model/url-builder',
12+
'mage/storage',
13+
'Magento_Checkout/js/model/error-processor',
14+
'Magento_Customer/js/model/customer',
15+
'Magento_Checkout/js/action/get-totals',
16+
'Magento_Checkout/js/model/full-screen-loader'
17+
], function (quote, urlBuilder, storage, errorProcessor, customer, getTotalsAction, fullScreenLoader) {
18+
'use strict';
19+
20+
return function (messageContainer, paymentData, skipBilling) {
21+
var serviceUrl,
22+
payload;
23+
24+
skipBilling = skipBilling || false;
25+
payload = {
26+
cartId: quote.getQuoteId(),
27+
paymentMethod: paymentData
28+
};
29+
30+
/**
31+
* Checkout for guest and registered customer.
32+
*/
33+
if (!customer.isLoggedIn()) {
34+
serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', {
35+
cartId: quote.getQuoteId()
36+
});
37+
payload.email = quote.guestEmail;
38+
} else {
39+
serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {});
40+
}
41+
42+
if (skipBilling === false) {
43+
payload.billingAddress = quote.billingAddress();
44+
}
45+
46+
fullScreenLoader.startLoader();
47+
48+
return storage.post(
49+
serviceUrl, JSON.stringify(payload)
50+
).fail(
51+
function (response) {
52+
errorProcessor.process(response, messageContainer);
53+
}
54+
).always(
55+
function () {
56+
fullScreenLoader.stopLoader();
57+
}
58+
);
59+
};
60+
});

app/code/Magento/Checkout/view/frontend/web/js/action/set-payment-information.js

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,13 @@
77
* @api
88
*/
99
define([
10-
'Magento_Checkout/js/model/quote',
11-
'Magento_Checkout/js/model/url-builder',
12-
'mage/storage',
13-
'Magento_Checkout/js/model/error-processor',
14-
'Magento_Customer/js/model/customer',
15-
'Magento_Checkout/js/action/get-totals',
16-
'Magento_Checkout/js/model/full-screen-loader'
17-
], function (quote, urlBuilder, storage, errorProcessor, customer, getTotalsAction, fullScreenLoader) {
10+
'Magento_Checkout/js/action/set-payment-information-extended'
11+
12+
], function (setPaymentInformationExtended) {
1813
'use strict';
1914

2015
return function (messageContainer, paymentData) {
21-
var serviceUrl,
22-
payload;
23-
24-
/**
25-
* Checkout for guest and registered customer.
26-
*/
27-
if (!customer.isLoggedIn()) {
28-
serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', {
29-
cartId: quote.getQuoteId()
30-
});
31-
payload = {
32-
cartId: quote.getQuoteId(),
33-
email: quote.guestEmail,
34-
paymentMethod: paymentData,
35-
billingAddress: quote.billingAddress()
36-
};
37-
} else {
38-
serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {});
39-
payload = {
40-
cartId: quote.getQuoteId(),
41-
paymentMethod: paymentData,
42-
billingAddress: quote.billingAddress()
43-
};
44-
}
45-
46-
fullScreenLoader.startLoader();
4716

48-
return storage.post(
49-
serviceUrl, JSON.stringify(payload)
50-
).fail(
51-
function (response) {
52-
errorProcessor.process(response, messageContainer);
53-
}
54-
).always(
55-
function () {
56-
fullScreenLoader.stopLoader();
57-
}
58-
);
17+
return setPaymentInformationExtended(messageContainer, paymentData, false);
5918
};
6019
});

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/paging/sizes.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ define([
99

1010
return Sizes.extend({
1111
defaults: {
12-
excludedOptions: ['100', '200']
13-
},
14-
15-
/**
16-
* @override
17-
*/
18-
initialize: function () {
19-
this._super();
20-
21-
this.excludedOptions.forEach(function (excludedOption) {
22-
delete this.options[excludedOption];
23-
}, this);
24-
this.updateArray();
25-
26-
return this;
12+
options: {
13+
'20': {
14+
value: 20,
15+
label: 20
16+
},
17+
'30': {
18+
value: 30,
19+
label: 30
20+
},
21+
'50': {
22+
value: 50,
23+
label: 50
24+
}
25+
},
26+
value: 20
2727
}
2828
});
2929
});

app/code/Magento/CustomerGraphQl/Model/Context/AddUserInfoToContext.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,27 @@ public function execute(ContextParametersInterface $contextParameters): ContextP
3939
if (null !== $currentUserId) {
4040
$currentUserId = (int)$currentUserId;
4141
}
42+
$contextParameters->setUserId($currentUserId);
4243

4344
$currentUserType = $this->userContext->getUserType();
4445
if (null !== $currentUserType) {
4546
$currentUserType = (int)$currentUserType;
4647
}
47-
48-
$contextParameters->setUserId($currentUserId);
4948
$contextParameters->setUserType($currentUserType);
49+
50+
$contextParameters->addExtensionAttribute('is_customer', $this->isCustomer($currentUserId, $currentUserType));
5051
return $contextParameters;
5152
}
53+
54+
/**
55+
* Checking if current user is logged
56+
*
57+
* @param int|null $customerId
58+
* @param int|null $customerType
59+
* @return bool
60+
*/
61+
private function isCustomer(?int $customerId, ?int $customerType): bool
62+
{
63+
return !empty($customerId) && !empty($customerType) && $customerType !== UserContextInterface::USER_TYPE_GUEST;
64+
}
5265
}

0 commit comments

Comments
 (0)