Skip to content

Commit d1906d8

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop Minor Fixes
Accepted Public Pull Requests: - #22132: Error on design configuration save with imageUploader form element po� (by @yvechirko) - #22405: [Fixed] Checkout Section: Shipping step is getting skipped when customer hitting direct payment step URL (by @niravkrish) - #22399: Fix the invalid currency error in credit card payment of PayPal Payflow Pro or Payments Pro (by @Hailong) - #22149: Fix #12802 - allow to override preference over CartInterface and return correct object from QuoteRepository (by @Bartlomiejsz) - #19913: [#19908] locale in rest calls is always default locale (by @jwundrak) - #21856: 21842: don't cache absolute file paths in validator factory (by @david-fuehr) Fixed GitHub Issues: - #21032: Error on design configuration save with imageUploader form element populated from gallery (reported by @sivaschenko) has been fixed in #22132 by @yvechirko in 2.3-develop branch Related commits: 1. 2022307 2. ad544fb - #21596: Checkout: it is possible to leave blank Shipping Details section and get to Payment Details section by URL (reported by @hiren0241) has been fixed in #22405 by @niravkrish in 2.3-develop branch Related commits: 1. 3beb15a 2. e78592a - #12802: QuoteRepository get methods won't return CartInterface but Quote model (reported by @msieprawski) has been fixed in #22149 by @Bartlomiejsz in 2.3-develop branch Related commits: 1. 865d7df 2. 6e079a3 3. fa5cf90 - #19908: REST-API locale is always default scope (reported by @jwundrak) has been fixed in #19913 by @jwundrak in 2.3-develop branch Related commits: 1. 5abd330 2. ef724a6 3. 29b4b39 4. 13ca4a2 5. 1cb3488 - #21842: Checkout error for registered customer with cache_id_prefix on multi server setup (reported by @david-fuehr) has been fixed in #21856 by @david-fuehr in 2.3-develop branch Related commits: 1. 1106542 2. eb989e2 3. 7d0d01e 4. e266d9a 5. 83b34b8 6. f3d4d96 7. b77d8d0 8. 875fa4c
2 parents 913f875 + 1cc3e7d commit d1906d8

File tree

15 files changed

+315
-258
lines changed

15 files changed

+315
-258
lines changed

app/code/Magento/Checkout/view/frontend/web/js/view/payment.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,21 @@ define([
6666
navigate: function () {
6767
var self = this;
6868

69-
getPaymentInformation().done(function () {
70-
self.isVisible(true);
71-
});
69+
if (!self.hasShippingMethod()) {
70+
this.isVisible(false);
71+
stepNavigator.setHash('shipping');
72+
} else {
73+
getPaymentInformation().done(function () {
74+
self.isVisible(true);
75+
});
76+
}
77+
},
78+
79+
/**
80+
* @return {Boolean}
81+
*/
82+
hasShippingMethod: function () {
83+
return window.checkoutConfig.selectedShippingMethod !== null;
7284
},
7385

7486
/**

app/code/Magento/Config/Model/Config/Source/Locale/Currency.php

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Locale currency source
9-
*/
107
namespace Magento\Config\Model\Config\Source\Locale;
118

9+
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\Locale\ListsInterface;
12+
1213
/**
14+
* Locale currency source.
15+
*
1316
* @api
1417
* @since 100.0.2
1518
*/
@@ -21,27 +24,70 @@ class Currency implements \Magento\Framework\Option\ArrayInterface
2124
protected $_options;
2225

2326
/**
24-
* @var \Magento\Framework\Locale\ListsInterface
27+
* @var ListsInterface
2528
*/
2629
protected $_localeLists;
2730

2831
/**
29-
* @param \Magento\Framework\Locale\ListsInterface $localeLists
32+
* @var ScopeConfigInterface
3033
*/
31-
public function __construct(\Magento\Framework\Locale\ListsInterface $localeLists)
32-
{
34+
private $config;
35+
36+
/**
37+
* @var array
38+
*/
39+
private $installedCurrencies;
40+
41+
/**
42+
* @param ListsInterface $localeLists
43+
* @param ScopeConfigInterface $config
44+
*/
45+
public function __construct(
46+
ListsInterface $localeLists,
47+
ScopeConfigInterface $config = null
48+
) {
3349
$this->_localeLists = $localeLists;
50+
$this->config = $config ?: ObjectManager::getInstance()->get(ScopeConfigInterface::class);
3451
}
3552

3653
/**
37-
* @return array
54+
* @inheritdoc
3855
*/
3956
public function toOptionArray()
4057
{
4158
if (!$this->_options) {
4259
$this->_options = $this->_localeLists->getOptionCurrencies();
4360
}
44-
$options = $this->_options;
61+
62+
$selected = array_flip($this->getInstalledCurrencies());
63+
64+
$options = array_filter(
65+
$this->_options,
66+
function ($option) use ($selected) {
67+
return isset($selected[$option['value']]);
68+
}
69+
);
70+
4571
return $options;
4672
}
73+
74+
/**
75+
* Retrieve Installed Currencies.
76+
*
77+
* @return array
78+
*/
79+
private function getInstalledCurrencies()
80+
{
81+
if (!$this->installedCurrencies) {
82+
$this->installedCurrencies = explode(
83+
',',
84+
$this->config->getValue(
85+
'system/currency/installed',
86+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
87+
)
88+
);
89+
}
90+
91+
return $this->installedCurrencies;
92+
}
4793
}

app/code/Magento/Customer/Model/Customer/DataProviderWithDefaultAddresses.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class DataProviderWithDefaultAddresses extends \Magento\Ui\DataProvider\Abstract
3939
private static $forbiddenCustomerFields = [
4040
'password_hash',
4141
'rp_token',
42-
'confirmation',
4342
];
4443

4544
/**

app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderWithDefaultAddressesTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ public function testGetData(): void
339339
'default_shipping' => 2,
340340
'password_hash' => 'password_hash',
341341
'rp_token' => 'rp_token',
342-
'confirmation' => 'confirmation',
343342
];
344343

345344
$address = $this->getMockBuilder(\Magento\Customer\Model\Address::class)

app/code/Magento/Customer/view/base/ui_component/customer_form.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@
7474
<visible>false</visible>
7575
</settings>
7676
</field>
77+
<field name="confirmation" formElement="input">
78+
<argument name="data" xsi:type="array">
79+
<item name="config" xsi:type="array">
80+
<item name="source" xsi:type="string">customer</item>
81+
</item>
82+
</argument>
83+
<settings>
84+
<dataType>text</dataType>
85+
<visible>false</visible>
86+
</settings>
87+
</field>
7788
<field name="created_in" formElement="input">
7889
<argument name="data" xsi:type="array">
7990
<item name="config" xsi:type="array">

app/code/Magento/Paypal/Model/Payflow/Service/Request/SecureToken.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function requestToken(Quote $quote)
6464
$request->setTrxtype(Payflowpro::TRXTYPE_AUTH_ONLY);
6565
$request->setVerbosity('HIGH');
6666
$request->setAmt(0);
67+
$request->setCurrency($quote->getBaseCurrencyCode());
6768
$request->setCreatesecuretoken('Y');
6869
$request->setSecuretokenid($this->mathRandom->getUniqueHash());
6970
$request->setReturnurl($this->url->getUrl('paypal/transparent/response'));

app/code/Magento/Quote/Model/QuoteRepository.php

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,33 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Quote\Model;
78

9+
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
10+
use Magento\Framework\Api\Search\FilterGroup;
11+
use Magento\Framework\Api\SearchCriteria\CollectionProcessor;
812
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
13+
use Magento\Framework\Api\SearchCriteriaInterface;
914
use Magento\Framework\App\ObjectManager;
10-
use Magento\Framework\Api\SortOrder;
15+
use Magento\Framework\Exception\InputException;
1116
use Magento\Framework\Exception\NoSuchEntityException;
17+
use Magento\Quote\Api\CartRepositoryInterface;
1218
use Magento\Quote\Api\Data\CartInterface;
13-
use Magento\Quote\Model\Quote;
14-
use Magento\Store\Model\StoreManagerInterface;
15-
use Magento\Framework\Api\Search\FilterGroup;
16-
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
17-
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
18-
use Magento\Framework\Exception\InputException;
19-
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
19+
use Magento\Quote\Api\Data\CartInterfaceFactory;
20+
use Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory;
2021
use Magento\Quote\Model\QuoteRepository\SaveHandler;
2122
use Magento\Quote\Model\QuoteRepository\LoadHandler;
23+
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
24+
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
25+
use Magento\Store\Model\StoreManagerInterface;
2226

2327
/**
28+
* Quote repository.
29+
*
2430
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2531
*/
26-
class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
32+
class QuoteRepository implements CartRepositoryInterface
2733
{
2834
/**
2935
* @var Quote[]
@@ -37,6 +43,7 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
3743

3844
/**
3945
* @var QuoteFactory
46+
* @deprecated
4047
*/
4148
protected $quoteFactory;
4249

@@ -46,13 +53,13 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
4653
protected $storeManager;
4754

4855
/**
49-
* @var \Magento\Quote\Model\ResourceModel\Quote\Collection
56+
* @var QuoteCollection
5057
* @deprecated 100.2.0
5158
*/
5259
protected $quoteCollection;
5360

5461
/**
55-
* @var \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory
62+
* @var CartSearchResultsInterfaceFactory
5663
*/
5764
protected $searchResultsDataFactory;
5865

@@ -77,43 +84,51 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
7784
private $collectionProcessor;
7885

7986
/**
80-
* @var \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory
87+
* @var QuoteCollectionFactory
8188
*/
8289
private $quoteCollectionFactory;
8390

91+
/**
92+
* @var CartInterfaceFactory
93+
*/
94+
private $cartFactory;
95+
8496
/**
8597
* Constructor
8698
*
8799
* @param QuoteFactory $quoteFactory
88100
* @param StoreManagerInterface $storeManager
89-
* @param \Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection
90-
* @param \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory
101+
* @param QuoteCollection $quoteCollection
102+
* @param CartSearchResultsInterfaceFactory $searchResultsDataFactory
91103
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
92104
* @param CollectionProcessorInterface|null $collectionProcessor
93-
* @param \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory|null $quoteCollectionFactory
105+
* @param QuoteCollectionFactory|null $quoteCollectionFactory
106+
* @param CartInterfaceFactory|null $cartFactory
94107
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
95108
*/
96109
public function __construct(
97110
QuoteFactory $quoteFactory,
98111
StoreManagerInterface $storeManager,
99-
\Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection,
100-
\Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory,
112+
QuoteCollection $quoteCollection,
113+
CartSearchResultsInterfaceFactory $searchResultsDataFactory,
101114
JoinProcessorInterface $extensionAttributesJoinProcessor,
102115
CollectionProcessorInterface $collectionProcessor = null,
103-
\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory $quoteCollectionFactory = null
116+
QuoteCollectionFactory $quoteCollectionFactory = null,
117+
CartInterfaceFactory $cartFactory = null
104118
) {
105119
$this->quoteFactory = $quoteFactory;
106120
$this->storeManager = $storeManager;
107121
$this->searchResultsDataFactory = $searchResultsDataFactory;
108122
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
109-
$this->collectionProcessor = $collectionProcessor ?: \Magento\Framework\App\ObjectManager::getInstance()
110-
->get(\Magento\Framework\Api\SearchCriteria\CollectionProcessor::class);
111-
$this->quoteCollectionFactory = $quoteCollectionFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
112-
->get(\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory::class);
123+
$this->collectionProcessor = $collectionProcessor ?: ObjectManager::getInstance()
124+
->get(CollectionProcessor::class);
125+
$this->quoteCollectionFactory = $quoteCollectionFactory ?: ObjectManager::getInstance()
126+
->get(QuoteCollectionFactory::class);
127+
$this->cartFactory = $cartFactory ?: ObjectManager::getInstance()->get(CartInterfaceFactory::class);
113128
}
114129

115130
/**
116-
* {@inheritdoc}
131+
* @inheritdoc
117132
*/
118133
public function get($cartId, array $sharedStoreIds = [])
119134
{
@@ -126,7 +141,7 @@ public function get($cartId, array $sharedStoreIds = [])
126141
}
127142

128143
/**
129-
* {@inheritdoc}
144+
* @inheritdoc
130145
*/
131146
public function getForCustomer($customerId, array $sharedStoreIds = [])
132147
{
@@ -140,7 +155,7 @@ public function getForCustomer($customerId, array $sharedStoreIds = [])
140155
}
141156

142157
/**
143-
* {@inheritdoc}
158+
* @inheritdoc
144159
*/
145160
public function getActive($cartId, array $sharedStoreIds = [])
146161
{
@@ -152,7 +167,7 @@ public function getActive($cartId, array $sharedStoreIds = [])
152167
}
153168

154169
/**
155-
* {@inheritdoc}
170+
* @inheritdoc
156171
*/
157172
public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
158173
{
@@ -164,9 +179,9 @@ public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
164179
}
165180

166181
/**
167-
* {@inheritdoc}
182+
* @inheritdoc
168183
*/
169-
public function save(\Magento\Quote\Api\Data\CartInterface $quote)
184+
public function save(CartInterface $quote)
170185
{
171186
if ($quote->getId()) {
172187
$currentQuote = $this->get($quote->getId(), [$quote->getStoreId()]);
@@ -184,9 +199,9 @@ public function save(\Magento\Quote\Api\Data\CartInterface $quote)
184199
}
185200

186201
/**
187-
* {@inheritdoc}
202+
* @inheritdoc
188203
*/
189-
public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
204+
public function delete(CartInterface $quote)
190205
{
191206
$quoteId = $quote->getId();
192207
$customerId = $quote->getCustomerId();
@@ -203,13 +218,13 @@ public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
203218
* @param int $identifier
204219
* @param int[] $sharedStoreIds
205220
* @throws NoSuchEntityException
206-
* @return Quote
221+
* @return CartInterface
207222
*/
208223
protected function loadQuote($loadMethod, $loadField, $identifier, array $sharedStoreIds = [])
209224
{
210-
/** @var Quote $quote */
211-
$quote = $this->quoteFactory->create();
212-
if ($sharedStoreIds) {
225+
/** @var CartInterface $quote */
226+
$quote = $this->cartFactory->create();
227+
if ($sharedStoreIds && method_exists($quote, 'setSharedStoreIds')) {
213228
$quote->setSharedStoreIds($sharedStoreIds);
214229
}
215230
$quote->setStoreId($this->storeManager->getStore()->getId())->$loadMethod($identifier);
@@ -220,9 +235,9 @@ protected function loadQuote($loadMethod, $loadField, $identifier, array $shared
220235
}
221236

222237
/**
223-
* {@inheritdoc}
238+
* @inheritdoc
224239
*/
225-
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
240+
public function getList(SearchCriteriaInterface $searchCriteria)
226241
{
227242
$this->quoteCollection = $this->quoteCollectionFactory->create();
228243
/** @var \Magento\Quote\Api\Data\CartSearchResultsInterface $searchData */
@@ -265,6 +280,7 @@ protected function addFilterGroupToCollection(FilterGroup $filterGroup, QuoteCol
265280

266281
/**
267282
* Get new SaveHandler dependency for application code.
283+
*
268284
* @return SaveHandler
269285
* @deprecated 100.1.0
270286
*/
@@ -277,6 +293,8 @@ private function getSaveHandler()
277293
}
278294

279295
/**
296+
* Get load handler instance.
297+
*
280298
* @return LoadHandler
281299
* @deprecated 100.1.0
282300
*/

0 commit comments

Comments
 (0)