Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop Minor Fixes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
magento-engcom-team authored Apr 29, 2019
2 parents 913f875 + 1cc3e7d commit d1906d8
Show file tree
Hide file tree
Showing 15 changed files with 315 additions and 258 deletions.
18 changes: 15 additions & 3 deletions app/code/Magento/Checkout/view/frontend/web/js/view/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,21 @@ define([
navigate: function () {
var self = this;

getPaymentInformation().done(function () {
self.isVisible(true);
});
if (!self.hasShippingMethod()) {
this.isVisible(false);
stepNavigator.setHash('shipping');
} else {
getPaymentInformation().done(function () {
self.isVisible(true);
});
}
},

/**
* @return {Boolean}
*/
hasShippingMethod: function () {
return window.checkoutConfig.selectedShippingMethod !== null;
},

/**
Expand Down
64 changes: 55 additions & 9 deletions app/code/Magento/Config/Model/Config/Source/Locale/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
* See COPYING.txt for license details.
*/

/**
* Locale currency source
*/
namespace Magento\Config\Model\Config\Source\Locale;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Locale\ListsInterface;

/**
* Locale currency source.
*
* @api
* @since 100.0.2
*/
Expand All @@ -21,27 +24,70 @@ class Currency implements \Magento\Framework\Option\ArrayInterface
protected $_options;

/**
* @var \Magento\Framework\Locale\ListsInterface
* @var ListsInterface
*/
protected $_localeLists;

/**
* @param \Magento\Framework\Locale\ListsInterface $localeLists
* @var ScopeConfigInterface
*/
public function __construct(\Magento\Framework\Locale\ListsInterface $localeLists)
{
private $config;

/**
* @var array
*/
private $installedCurrencies;

/**
* @param ListsInterface $localeLists
* @param ScopeConfigInterface $config
*/
public function __construct(
ListsInterface $localeLists,
ScopeConfigInterface $config = null
) {
$this->_localeLists = $localeLists;
$this->config = $config ?: ObjectManager::getInstance()->get(ScopeConfigInterface::class);
}

/**
* @return array
* @inheritdoc
*/
public function toOptionArray()
{
if (!$this->_options) {
$this->_options = $this->_localeLists->getOptionCurrencies();
}
$options = $this->_options;

$selected = array_flip($this->getInstalledCurrencies());

$options = array_filter(
$this->_options,
function ($option) use ($selected) {
return isset($selected[$option['value']]);
}
);

return $options;
}

/**
* Retrieve Installed Currencies.
*
* @return array
*/
private function getInstalledCurrencies()
{
if (!$this->installedCurrencies) {
$this->installedCurrencies = explode(
',',
$this->config->getValue(
'system/currency/installed',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
}

return $this->installedCurrencies;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class DataProviderWithDefaultAddresses extends \Magento\Ui\DataProvider\Abstract
private static $forbiddenCustomerFields = [
'password_hash',
'rp_token',
'confirmation',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ public function testGetData(): void
'default_shipping' => 2,
'password_hash' => 'password_hash',
'rp_token' => 'rp_token',
'confirmation' => 'confirmation',
];

$address = $this->getMockBuilder(\Magento\Customer\Model\Address::class)
Expand Down
11 changes: 11 additions & 0 deletions app/code/Magento/Customer/view/base/ui_component/customer_form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@
<visible>false</visible>
</settings>
</field>
<field name="confirmation" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">customer</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<visible>false</visible>
</settings>
</field>
<field name="created_in" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function requestToken(Quote $quote)
$request->setTrxtype(Payflowpro::TRXTYPE_AUTH_ONLY);
$request->setVerbosity('HIGH');
$request->setAmt(0);
$request->setCurrency($quote->getBaseCurrencyCode());
$request->setCreatesecuretoken('Y');
$request->setSecuretokenid($this->mathRandom->getUniqueHash());
$request->setReturnurl($this->url->getUrl('paypal/transparent/response'));
Expand Down
90 changes: 54 additions & 36 deletions app/code/Magento/Quote/Model/QuoteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Quote\Model;

use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\Framework\Api\Search\FilterGroup;
use Magento\Framework\Api\SearchCriteria\CollectionProcessor;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Api\SortOrder;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Api\Data\CartInterface;
use Magento\Quote\Model\Quote;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\Api\Search\FilterGroup;
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\Quote\Api\Data\CartInterfaceFactory;
use Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory;
use Magento\Quote\Model\QuoteRepository\SaveHandler;
use Magento\Quote\Model\QuoteRepository\LoadHandler;
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
use Magento\Store\Model\StoreManagerInterface;

/**
* Quote repository.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
class QuoteRepository implements CartRepositoryInterface
{
/**
* @var Quote[]
Expand All @@ -37,6 +43,7 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface

/**
* @var QuoteFactory
* @deprecated
*/
protected $quoteFactory;

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

/**
* @var \Magento\Quote\Model\ResourceModel\Quote\Collection
* @var QuoteCollection
* @deprecated 100.2.0
*/
protected $quoteCollection;

/**
* @var \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory
* @var CartSearchResultsInterfaceFactory
*/
protected $searchResultsDataFactory;

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

/**
* @var \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory
* @var QuoteCollectionFactory
*/
private $quoteCollectionFactory;

/**
* @var CartInterfaceFactory
*/
private $cartFactory;

/**
* Constructor
*
* @param QuoteFactory $quoteFactory
* @param StoreManagerInterface $storeManager
* @param \Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection
* @param \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory
* @param QuoteCollection $quoteCollection
* @param CartSearchResultsInterfaceFactory $searchResultsDataFactory
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
* @param CollectionProcessorInterface|null $collectionProcessor
* @param \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory|null $quoteCollectionFactory
* @param QuoteCollectionFactory|null $quoteCollectionFactory
* @param CartInterfaceFactory|null $cartFactory
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(
QuoteFactory $quoteFactory,
StoreManagerInterface $storeManager,
\Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection,
\Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory,
QuoteCollection $quoteCollection,
CartSearchResultsInterfaceFactory $searchResultsDataFactory,
JoinProcessorInterface $extensionAttributesJoinProcessor,
CollectionProcessorInterface $collectionProcessor = null,
\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory $quoteCollectionFactory = null
QuoteCollectionFactory $quoteCollectionFactory = null,
CartInterfaceFactory $cartFactory = null
) {
$this->quoteFactory = $quoteFactory;
$this->storeManager = $storeManager;
$this->searchResultsDataFactory = $searchResultsDataFactory;
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
$this->collectionProcessor = $collectionProcessor ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Api\SearchCriteria\CollectionProcessor::class);
$this->quoteCollectionFactory = $quoteCollectionFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory::class);
$this->collectionProcessor = $collectionProcessor ?: ObjectManager::getInstance()
->get(CollectionProcessor::class);
$this->quoteCollectionFactory = $quoteCollectionFactory ?: ObjectManager::getInstance()
->get(QuoteCollectionFactory::class);
$this->cartFactory = $cartFactory ?: ObjectManager::getInstance()->get(CartInterfaceFactory::class);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function get($cartId, array $sharedStoreIds = [])
{
Expand All @@ -126,7 +141,7 @@ public function get($cartId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getForCustomer($customerId, array $sharedStoreIds = [])
{
Expand All @@ -140,7 +155,7 @@ public function getForCustomer($customerId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getActive($cartId, array $sharedStoreIds = [])
{
Expand All @@ -152,7 +167,7 @@ public function getActive($cartId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
{
Expand All @@ -164,9 +179,9 @@ public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function save(\Magento\Quote\Api\Data\CartInterface $quote)
public function save(CartInterface $quote)
{
if ($quote->getId()) {
$currentQuote = $this->get($quote->getId(), [$quote->getStoreId()]);
Expand All @@ -184,9 +199,9 @@ public function save(\Magento\Quote\Api\Data\CartInterface $quote)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
public function delete(CartInterface $quote)
{
$quoteId = $quote->getId();
$customerId = $quote->getCustomerId();
Expand All @@ -203,13 +218,13 @@ public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
* @param int $identifier
* @param int[] $sharedStoreIds
* @throws NoSuchEntityException
* @return Quote
* @return CartInterface
*/
protected function loadQuote($loadMethod, $loadField, $identifier, array $sharedStoreIds = [])
{
/** @var Quote $quote */
$quote = $this->quoteFactory->create();
if ($sharedStoreIds) {
/** @var CartInterface $quote */
$quote = $this->cartFactory->create();
if ($sharedStoreIds && method_exists($quote, 'setSharedStoreIds')) {
$quote->setSharedStoreIds($sharedStoreIds);
}
$quote->setStoreId($this->storeManager->getStore()->getId())->$loadMethod($identifier);
Expand All @@ -220,9 +235,9 @@ protected function loadQuote($loadMethod, $loadField, $identifier, array $shared
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
public function getList(SearchCriteriaInterface $searchCriteria)
{
$this->quoteCollection = $this->quoteCollectionFactory->create();
/** @var \Magento\Quote\Api\Data\CartSearchResultsInterface $searchData */
Expand Down Expand Up @@ -265,6 +280,7 @@ protected function addFilterGroupToCollection(FilterGroup $filterGroup, QuoteCol

/**
* Get new SaveHandler dependency for application code.
*
* @return SaveHandler
* @deprecated 100.1.0
*/
Expand All @@ -277,6 +293,8 @@ private function getSaveHandler()
}

/**
* Get load handler instance.
*
* @return LoadHandler
* @deprecated 100.1.0
*/
Expand Down
Loading

0 comments on commit d1906d8

Please sign in to comment.