Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #19659: Fix issue #19657- Select Option Space issue into backend (by @speedy008)
 - #19617: Additional Cache Management title (by @thomas-blackbird)
 - #19583: MAGETWO-96618: JS files relocation BC in 2.3 too (by @rbayet)
 - #19569: Fixed issue with Base Currency for website is CND when PayPal Payflow� (by @jignesh-baldha)
 - #19249: fix php 7.2 error : Countable interface not implemented (by @gmachure)
 - #19164: Fixed subscribe to newsletter if you already have an account issue #8952 -2.3 develop (by @ravi-chandra3197)
 - #18832: Cancel expired orders using OrderManagementInterface (by @JeroenVanLeusden)
 - #18768: Collect totals in placeOrder when no paymentMethod provided (by @pmclain)
 - #18521: [Forwardport] Added checks to see if the payment is available (by @gelanivishal)


Fixed GitHub Issues:
 - #19657: Select Option Space issue into backend (reported by @speedy008) has been fixed in #19659 by @speedy008 in 2.3-develop branch
   Related commits:
     1. 29f6be1

 - #16302: JS files located outside the web/js directory (reported by @BenSpace48) has been fixed in #19583 by @rbayet in 2.3-develop branch
   Related commits:
     1. f38f09f

 - #19291: JS files relocation inside the web/js directory not BC in 2.3.x (reported by @rbayet) has been fixed in #19583 by @rbayet in 2.3-develop branch
   Related commits:
     1. f38f09f

 - #19247: Magento 2 : fix php 7.2 error : Countable interface not implemented (reported by @gmachure) has been fixed in #19249 by @gmachure in 2.3-develop branch
   Related commits:
     1. f1e7e3f
     2. a7b9122

 - #8952: You can't subscribe to newsletter if you already have an account (reported by @loomdecor) has been fixed in #19164 by @ravi-chandra3197 in 2.3-develop branch
   Related commits:
     1. 78b694f
     2. ebfffe4
     3. b8941a8

 - #16050: Authorize.net  (reported by @milenavasic) has been fixed in #18768 by @pmclain in 2.3-develop branch
   Related commits:
     1. 7bc9c31
     2. 389a16b

 - #15652: REST API create order POST /V1/orders (reported by @bibiseb) has been fixed in #18521 by @gelanivishal in 2.3-develop branch
   Related commits:
     1. 14b3eaf
     2. 3eb6c3e
  • Loading branch information
magento-engcom-team authored Dec 10, 2018
2 parents 6478d2b + feac5fa commit f77f96b
Show file tree
Hide file tree
Showing 26 changed files with 154 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
var config = {
map: {
'*': {
transparent: 'Magento_Payment/js/transparent'
transparent: 'Magento_Payment/js/transparent',
'Magento_Payment/transparent': 'Magento_Payment/js/transparent'
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ $permissions = $block->getData('permissions');
?>
<?php if ($permissions && $permissions->hasAccessToAdditionalActions()): ?>
<div class="additional-cache-management">
<h2>
<span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
</h2>
<?php if ($permissions->hasAccessToFlushCatalogImages()): ?>
<h2>
<span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
</h2>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanImagesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Catalog Images Cache')); ?>
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Captcha/view/frontend/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
var config = {
map: {
'*': {
captcha: 'Magento_Captcha/js/captcha'
captcha: 'Magento_Captcha/js/captcha',
'Magento_Captcha/captcha': 'Magento_Captcha/js/captcha'
}
}
};
4 changes: 3 additions & 1 deletion app/code/Magento/Customer/view/frontend/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ var config = {
changeEmailPassword: 'Magento_Customer/js/change-email-password',
passwordStrengthIndicator: 'Magento_Customer/js/password-strength-indicator',
zxcvbn: 'Magento_Customer/js/zxcvbn',
addressValidation: 'Magento_Customer/js/addressValidation'
addressValidation: 'Magento_Customer/js/addressValidation',
'Magento_Customer/address': 'Magento_Customer/js/address',
'Magento_Customer/change-email-password': 'Magento_Customer/js/change-email-password'
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
var config = {
map: {
'*': {
downloadable: 'Magento_Downloadable/js/downloadable'
downloadable: 'Magento_Downloadable/js/downloadable',
'Magento_Downloadable/downloadable': 'Magento_Downloadable/js/downloadable'
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ var config = {
map: {
'*': {
giftOptions: 'Magento_GiftMessage/js/gift-options',
extraOptions: 'Magento_GiftMessage/js/extra-options'
extraOptions: 'Magento_GiftMessage/js/extra-options',
'Magento_GiftMessage/gift-options': 'Magento_GiftMessage/js/gift-options',
'Magento_GiftMessage/extra-options': 'Magento_GiftMessage/js/extra-options'
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ public function __construct(
protected function validateEmailAvailable($email)
{
$websiteId = $this->_storeManager->getStore()->getWebsiteId();
if ($this->_customerSession->getCustomerDataObject()->getEmail() !== $email
&& !$this->customerAccountManagement->isEmailAvailable($email, $websiteId)
if ($this->_customerSession->isLoggedIn()
&& ($this->_customerSession->getCustomerDataObject()->getEmail() !== $email
&& !$this->customerAccountManagement->isEmailAvailable($email, $websiteId))
) {
throw new LocalizedException(
__('This email address is already assigned to another user.')
Expand Down
10 changes: 10 additions & 0 deletions app/code/Magento/Payment/Observer/SalesOrderBeforeSaveObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,29 @@

use Magento\Framework\Event\ObserverInterface;

/**
* Verify order payment observer
*/
class SalesOrderBeforeSaveObserver implements ObserverInterface
{
/**
* Set forced canCreditmemo flag
*
* @param \Magento\Framework\Event\Observer $observer
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException in case order has no payment specified.
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
/** @var \Magento\Sales\Model\Order $order */
$order = $observer->getEvent()->getOrder();

if (!$order->getPayment()) {
throw new \Magento\Framework\Exception\LocalizedException(
__('Please provide payment for the order.')
);
}

if ($order->getPayment()->getMethodInstance()->getCode() != 'free') {
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testSalesOrderBeforeSaveCantUnhold()
$paymentMock = $this->getMockBuilder(
\Magento\Sales\Model\Order\Payment::class
)->disableOriginalConstructor()->setMethods([])->getMock();
$order->expects($this->once())->method('getPayment')->will($this->returnValue($paymentMock));
$order->method('getPayment')->will($this->returnValue($paymentMock));
$methodInstance = $this->getMockBuilder(
\Magento\Payment\Model\MethodInterface::class
)->getMockForAbstractClass();
Expand All @@ -86,7 +86,7 @@ public function testSalesOrderBeforeSaveIsCanceled()
$paymentMock = $this->getMockBuilder(
\Magento\Sales\Model\Order\Payment::class
)->disableOriginalConstructor()->setMethods([])->getMock();
$order->expects($this->once())->method('getPayment')->will($this->returnValue($paymentMock));
$order->method('getPayment')->will($this->returnValue($paymentMock));
$methodInstance = $this->getMockBuilder(
\Magento\Payment\Model\MethodInterface::class
)->getMockForAbstractClass();
Expand Down Expand Up @@ -114,7 +114,7 @@ public function testSalesOrderBeforeSaveIsClosed()
$paymentMock = $this->getMockBuilder(
\Magento\Sales\Model\Order\Payment::class
)->disableOriginalConstructor()->setMethods([])->getMock();
$order->expects($this->once())->method('getPayment')->will($this->returnValue($paymentMock));
$order->method('getPayment')->will($this->returnValue($paymentMock));
$methodInstance = $this->getMockBuilder(
\Magento\Payment\Model\MethodInterface::class
)->getMockForAbstractClass();
Expand Down Expand Up @@ -156,6 +156,29 @@ public function testSalesOrderBeforeSaveSetForced()
$this->salesOrderBeforeSaveObserver->execute($this->observerMock);
}

/**
* The method should check that the payment is available, as this is not always the case.
*
* @expectedException \Magento\Framework\Exception\LocalizedException
* @exceptedExceptionMessage Please provide payment for the order.
*/
public function testDoesNothingWhenNoPaymentIsAvailable()
{
$this->_prepareEventMockWithMethods(['getOrder']);

$order = $this->getMockBuilder(\Magento\Sales\Model\Order::class)->disableOriginalConstructor()->setMethods(
array_merge(['__wakeup', 'getPayment'])
)->getMock();

$this->eventMock->expects($this->once())->method('getOrder')->will(
$this->returnValue($order)
);

$order->expects($this->exactly(1))->method('getPayment')->willReturn(null);

$this->salesOrderBeforeSaveObserver->execute($this->observerMock);
}

/**
* Prepares EventMock with set of methods
*
Expand Down Expand Up @@ -184,7 +207,7 @@ private function _getPreparedOrderMethod($methodCode, $orderMethods = [])
$paymentMock = $this->getMockBuilder(
\Magento\Sales\Model\Order\Payment::class
)->disableOriginalConstructor()->setMethods([])->getMock();
$order->expects($this->once())->method('getPayment')->will($this->returnValue($paymentMock));
$order->method('getPayment')->will($this->returnValue($paymentMock));
$methodInstance = $this->getMockBuilder(
\Magento\Payment\Model\MethodInterface::class
)->getMockForAbstractClass();
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Payment/view/frontend/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
var config = {
map: {
'*': {
creditCardType: 'Magento_Payment/js/cc-type'
creditCardType: 'Magento_Payment/js/cc-type',
'Magento_Payment/cc-type': 'Magento_Payment/js/cc-type'
}
}
};
15 changes: 14 additions & 1 deletion app/code/Magento/Paypal/Model/Payflowpro.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
$request->setTrxtype(self::TRXTYPE_SALE);
$request->setOrigid($payment->getAdditionalInformation(self::PNREF));
$payment->unsAdditionalInformation(self::PNREF);
$request->setData('currency', $payment->getOrder()->getBaseCurrencyCode());
} elseif ($payment->getParentTransactionId()) {
$request = $this->buildBasicRequest();
$request->setOrigid($payment->getParentTransactionId());
Expand Down Expand Up @@ -472,6 +473,7 @@ public function void(\Magento\Payment\Model\InfoInterface $payment)

/**
* Check void availability
*
* @return bool
* @throws \Magento\Framework\Exception\LocalizedException
*/
Expand Down Expand Up @@ -584,7 +586,7 @@ public function getConfig()
}

/**
* {inheritdoc}
* @inheritdoc
*/
public function postRequest(DataObject $request, ConfigInterface $config)
{
Expand Down Expand Up @@ -719,6 +721,8 @@ public function reviewPayment(InfoInterface $payment, $action)
}

/**
* Set billing address
*
* @param DataObject $request
* @param DataObject $billing
*
Expand All @@ -745,6 +749,8 @@ public function setBilling(DataObject $request, $billing)
}

/**
* Set shipping address
*
* @param DataObject $request
* @param DataObject $shipping
*
Expand Down Expand Up @@ -815,6 +821,8 @@ public function mapGatewayResponse(array $postData, DataObject $response)
}

/**
* Set transaction status
*
* @param DataObject $payment
* @param DataObject $response
*
Expand Down Expand Up @@ -848,6 +856,8 @@ public function setTransStatus($payment, $response)
}

/**
* Fill customer contacts
*
* @param DataObject $order
* @param DataObject $request
* @return DataObject
Expand All @@ -869,6 +879,7 @@ public function fillCustomerContacts(DataObject $order, DataObject $request)

/**
* Add order details to payment request
*
* @param DataObject $request
* @param Order $order
* @return void
Expand Down Expand Up @@ -917,6 +928,8 @@ public function assignData(DataObject $data)
}

/**
* Make a transaction Inquiry Request
*
* @param InfoInterface $payment
* @param string $transactionId
* @return DataObject
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Paypal/Plugin/OrderCanInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public function __construct(Express $express)
*/
public function afterCanInvoice(Order $order, bool $result): bool
{
if (!$order->getPayment()) {
return false;
}

if ($this->express->isOrderAuthorizationAllowed($order->getPayment())) {
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Paypal/view/base/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
var config = {
map: {
'*': {
transparent: 'Magento_Payment/js/transparent'
transparent: 'Magento_Payment/js/transparent',
'Magento_Payment/transparent': 'Magento_Payment/js/transparent'
}
}
};
1 change: 1 addition & 0 deletions app/code/Magento/Paypal/view/frontend/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var config = {
map: {
'*': {
orderReview: 'Magento_Paypal/js/order-review',
'Magento_Paypal/order-review': 'Magento_Paypal/js/order-review',
paypalCheckout: 'Magento_Paypal/js/paypal-checkout'
}
},
Expand Down
16 changes: 10 additions & 6 deletions app/code/Magento/Quote/Model/QuoteManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class QuoteManagement implements \Magento\Quote\Api\CartManagementInterface
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
* @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
* @param \Magento\Customer\Model\CustomerFactory $customerModelFactory
* @param \Magento\Quote\Model\Quote\AddressFactory $quoteAddressFactory,
* @param \Magento\Quote\Model\Quote\AddressFactory $quoteAddressFactory
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
* @param StoreManagerInterface $storeManager
* @param \Magento\Checkout\Model\Session $checkoutSession
Expand Down Expand Up @@ -221,7 +221,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function createEmptyCart()
{
Expand All @@ -241,7 +241,7 @@ public function createEmptyCart()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function createEmptyCartForCustomer($customerId)
{
Expand All @@ -257,7 +257,7 @@ public function createEmptyCartForCustomer($customerId)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function assignCustomer($cartId, $customerId, $storeId)
{
Expand Down Expand Up @@ -332,7 +332,7 @@ protected function createCustomerCart($customerId, $storeId)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
{
Expand All @@ -349,6 +349,8 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)

$data = $paymentMethod->getData();
$quote->getPayment()->importData($data);
} else {
$quote->collectTotals();
}

if ($quote->getCheckoutMethod() === self::METHOD_GUEST) {
Expand Down Expand Up @@ -379,7 +381,7 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getCartForCustomer($customerId)
{
Expand All @@ -406,6 +408,8 @@ public function submit(QuoteEntity $quote, $orderData = [])
}

/**
* Convert quote items to order items for quote
*
* @param Quote $quote
* @return array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ protected function setUp()
'setCustomerGroupId',
'assignCustomer',
'getPayment',
'collectTotals'
]);

$this->quoteAddressFactory = $this->createPartialMock(
Expand Down Expand Up @@ -687,6 +688,7 @@ public function testPlaceOrderIfCustomerIsGuest()
$service->expects($this->once())->method('submit')->willReturn($orderMock);

$this->quoteMock->expects($this->atLeastOnce())->method('getId')->willReturn($cartId);
$this->quoteMock->expects($this->once())->method('collectTotals')->willReturnSelf();

$orderMock->expects($this->atLeastOnce())->method('getId')->willReturn($orderId);
$orderMock->expects($this->atLeastOnce())->method('getIncrementId')->willReturn($orderIncrementId);
Expand Down
Loading

0 comments on commit f77f96b

Please sign in to comment.