Skip to content

Commit f77f96b

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
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
2 parents 6478d2b + feac5fa commit f77f96b

File tree

26 files changed

+154
-39
lines changed

26 files changed

+154
-39
lines changed

app/code/Magento/Authorizenet/view/frontend/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
var config = {
77
map: {
88
'*': {
9-
transparent: 'Magento_Payment/js/transparent'
9+
transparent: 'Magento_Payment/js/transparent',
10+
'Magento_Payment/transparent': 'Magento_Payment/js/transparent'
1011
}
1112
}
1213
};

app/code/Magento/Backend/view/adminhtml/templates/system/cache/additional.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ $permissions = $block->getData('permissions');
1111
?>
1212
<?php if ($permissions && $permissions->hasAccessToAdditionalActions()): ?>
1313
<div class="additional-cache-management">
14+
<h2>
15+
<span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
16+
</h2>
1417
<?php if ($permissions->hasAccessToFlushCatalogImages()): ?>
15-
<h2>
16-
<span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
17-
</h2>
1818
<p>
1919
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanImagesUrl()); ?>')" type="button">
2020
<?= $block->escapeHtml(__('Flush Catalog Images Cache')); ?>

app/code/Magento/Captcha/view/frontend/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
var config = {
77
map: {
88
'*': {
9-
captcha: 'Magento_Captcha/js/captcha'
9+
captcha: 'Magento_Captcha/js/captcha',
10+
'Magento_Captcha/captcha': 'Magento_Captcha/js/captcha'
1011
}
1112
}
1213
};

app/code/Magento/Customer/view/frontend/requirejs-config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ var config = {
1111
changeEmailPassword: 'Magento_Customer/js/change-email-password',
1212
passwordStrengthIndicator: 'Magento_Customer/js/password-strength-indicator',
1313
zxcvbn: 'Magento_Customer/js/zxcvbn',
14-
addressValidation: 'Magento_Customer/js/addressValidation'
14+
addressValidation: 'Magento_Customer/js/addressValidation',
15+
'Magento_Customer/address': 'Magento_Customer/js/address',
16+
'Magento_Customer/change-email-password': 'Magento_Customer/js/change-email-password'
1517
}
1618
}
1719
};

app/code/Magento/Downloadable/view/frontend/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
var config = {
77
map: {
88
'*': {
9-
downloadable: 'Magento_Downloadable/js/downloadable'
9+
downloadable: 'Magento_Downloadable/js/downloadable',
10+
'Magento_Downloadable/downloadable': 'Magento_Downloadable/js/downloadable'
1011
}
1112
}
1213
};

app/code/Magento/GiftMessage/view/frontend/requirejs-config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ var config = {
77
map: {
88
'*': {
99
giftOptions: 'Magento_GiftMessage/js/gift-options',
10-
extraOptions: 'Magento_GiftMessage/js/extra-options'
10+
extraOptions: 'Magento_GiftMessage/js/extra-options',
11+
'Magento_GiftMessage/gift-options': 'Magento_GiftMessage/js/gift-options',
12+
'Magento_GiftMessage/extra-options': 'Magento_GiftMessage/js/extra-options'
1113
}
1214
}
1315
};

app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ public function __construct(
8080
protected function validateEmailAvailable($email)
8181
{
8282
$websiteId = $this->_storeManager->getStore()->getWebsiteId();
83-
if ($this->_customerSession->getCustomerDataObject()->getEmail() !== $email
84-
&& !$this->customerAccountManagement->isEmailAvailable($email, $websiteId)
83+
if ($this->_customerSession->isLoggedIn()
84+
&& ($this->_customerSession->getCustomerDataObject()->getEmail() !== $email
85+
&& !$this->customerAccountManagement->isEmailAvailable($email, $websiteId))
8586
) {
8687
throw new LocalizedException(
8788
__('This email address is already assigned to another user.')

app/code/Magento/Payment/Observer/SalesOrderBeforeSaveObserver.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,29 @@
88

99
use Magento\Framework\Event\ObserverInterface;
1010

11+
/**
12+
* Verify order payment observer
13+
*/
1114
class SalesOrderBeforeSaveObserver implements ObserverInterface
1215
{
1316
/**
1417
* Set forced canCreditmemo flag
1518
*
1619
* @param \Magento\Framework\Event\Observer $observer
1720
* @return $this
21+
* @throws \Magento\Framework\Exception\LocalizedException in case order has no payment specified.
1822
*/
1923
public function execute(\Magento\Framework\Event\Observer $observer)
2024
{
2125
/** @var \Magento\Sales\Model\Order $order */
2226
$order = $observer->getEvent()->getOrder();
2327

28+
if (!$order->getPayment()) {
29+
throw new \Magento\Framework\Exception\LocalizedException(
30+
__('Please provide payment for the order.')
31+
);
32+
}
33+
2434
if ($order->getPayment()->getMethodInstance()->getCode() != 'free') {
2535
return $this;
2636
}

app/code/Magento/Payment/Test/Unit/Observer/SalesOrderBeforeSaveObserverTest.php

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testSalesOrderBeforeSaveCantUnhold()
6161
$paymentMock = $this->getMockBuilder(
6262
\Magento\Sales\Model\Order\Payment::class
6363
)->disableOriginalConstructor()->setMethods([])->getMock();
64-
$order->expects($this->once())->method('getPayment')->will($this->returnValue($paymentMock));
64+
$order->method('getPayment')->will($this->returnValue($paymentMock));
6565
$methodInstance = $this->getMockBuilder(
6666
\Magento\Payment\Model\MethodInterface::class
6767
)->getMockForAbstractClass();
@@ -86,7 +86,7 @@ public function testSalesOrderBeforeSaveIsCanceled()
8686
$paymentMock = $this->getMockBuilder(
8787
\Magento\Sales\Model\Order\Payment::class
8888
)->disableOriginalConstructor()->setMethods([])->getMock();
89-
$order->expects($this->once())->method('getPayment')->will($this->returnValue($paymentMock));
89+
$order->method('getPayment')->will($this->returnValue($paymentMock));
9090
$methodInstance = $this->getMockBuilder(
9191
\Magento\Payment\Model\MethodInterface::class
9292
)->getMockForAbstractClass();
@@ -114,7 +114,7 @@ public function testSalesOrderBeforeSaveIsClosed()
114114
$paymentMock = $this->getMockBuilder(
115115
\Magento\Sales\Model\Order\Payment::class
116116
)->disableOriginalConstructor()->setMethods([])->getMock();
117-
$order->expects($this->once())->method('getPayment')->will($this->returnValue($paymentMock));
117+
$order->method('getPayment')->will($this->returnValue($paymentMock));
118118
$methodInstance = $this->getMockBuilder(
119119
\Magento\Payment\Model\MethodInterface::class
120120
)->getMockForAbstractClass();
@@ -156,6 +156,29 @@ public function testSalesOrderBeforeSaveSetForced()
156156
$this->salesOrderBeforeSaveObserver->execute($this->observerMock);
157157
}
158158

159+
/**
160+
* The method should check that the payment is available, as this is not always the case.
161+
*
162+
* @expectedException \Magento\Framework\Exception\LocalizedException
163+
* @exceptedExceptionMessage Please provide payment for the order.
164+
*/
165+
public function testDoesNothingWhenNoPaymentIsAvailable()
166+
{
167+
$this->_prepareEventMockWithMethods(['getOrder']);
168+
169+
$order = $this->getMockBuilder(\Magento\Sales\Model\Order::class)->disableOriginalConstructor()->setMethods(
170+
array_merge(['__wakeup', 'getPayment'])
171+
)->getMock();
172+
173+
$this->eventMock->expects($this->once())->method('getOrder')->will(
174+
$this->returnValue($order)
175+
);
176+
177+
$order->expects($this->exactly(1))->method('getPayment')->willReturn(null);
178+
179+
$this->salesOrderBeforeSaveObserver->execute($this->observerMock);
180+
}
181+
159182
/**
160183
* Prepares EventMock with set of methods
161184
*
@@ -184,7 +207,7 @@ private function _getPreparedOrderMethod($methodCode, $orderMethods = [])
184207
$paymentMock = $this->getMockBuilder(
185208
\Magento\Sales\Model\Order\Payment::class
186209
)->disableOriginalConstructor()->setMethods([])->getMock();
187-
$order->expects($this->once())->method('getPayment')->will($this->returnValue($paymentMock));
210+
$order->method('getPayment')->will($this->returnValue($paymentMock));
188211
$methodInstance = $this->getMockBuilder(
189212
\Magento\Payment\Model\MethodInterface::class
190213
)->getMockForAbstractClass();

app/code/Magento/Payment/view/frontend/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
var config = {
77
map: {
88
'*': {
9-
creditCardType: 'Magento_Payment/js/cc-type'
9+
creditCardType: 'Magento_Payment/js/cc-type',
10+
'Magento_Payment/cc-type': 'Magento_Payment/js/cc-type'
1011
}
1112
}
1213
};

app/code/Magento/Paypal/Model/Payflowpro.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
420420
$request->setTrxtype(self::TRXTYPE_SALE);
421421
$request->setOrigid($payment->getAdditionalInformation(self::PNREF));
422422
$payment->unsAdditionalInformation(self::PNREF);
423+
$request->setData('currency', $payment->getOrder()->getBaseCurrencyCode());
423424
} elseif ($payment->getParentTransactionId()) {
424425
$request = $this->buildBasicRequest();
425426
$request->setOrigid($payment->getParentTransactionId());
@@ -472,6 +473,7 @@ public function void(\Magento\Payment\Model\InfoInterface $payment)
472473

473474
/**
474475
* Check void availability
476+
*
475477
* @return bool
476478
* @throws \Magento\Framework\Exception\LocalizedException
477479
*/
@@ -584,7 +586,7 @@ public function getConfig()
584586
}
585587

586588
/**
587-
* {inheritdoc}
589+
* @inheritdoc
588590
*/
589591
public function postRequest(DataObject $request, ConfigInterface $config)
590592
{
@@ -719,6 +721,8 @@ public function reviewPayment(InfoInterface $payment, $action)
719721
}
720722

721723
/**
724+
* Set billing address
725+
*
722726
* @param DataObject $request
723727
* @param DataObject $billing
724728
*
@@ -745,6 +749,8 @@ public function setBilling(DataObject $request, $billing)
745749
}
746750

747751
/**
752+
* Set shipping address
753+
*
748754
* @param DataObject $request
749755
* @param DataObject $shipping
750756
*
@@ -815,6 +821,8 @@ public function mapGatewayResponse(array $postData, DataObject $response)
815821
}
816822

817823
/**
824+
* Set transaction status
825+
*
818826
* @param DataObject $payment
819827
* @param DataObject $response
820828
*
@@ -848,6 +856,8 @@ public function setTransStatus($payment, $response)
848856
}
849857

850858
/**
859+
* Fill customer contacts
860+
*
851861
* @param DataObject $order
852862
* @param DataObject $request
853863
* @return DataObject
@@ -869,6 +879,7 @@ public function fillCustomerContacts(DataObject $order, DataObject $request)
869879

870880
/**
871881
* Add order details to payment request
882+
*
872883
* @param DataObject $request
873884
* @param Order $order
874885
* @return void
@@ -917,6 +928,8 @@ public function assignData(DataObject $data)
917928
}
918929

919930
/**
931+
* Make a transaction Inquiry Request
932+
*
920933
* @param InfoInterface $payment
921934
* @param string $transactionId
922935
* @return DataObject

app/code/Magento/Paypal/Plugin/OrderCanInvoice.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public function __construct(Express $express)
4040
*/
4141
public function afterCanInvoice(Order $order, bool $result): bool
4242
{
43+
if (!$order->getPayment()) {
44+
return false;
45+
}
46+
4347
if ($this->express->isOrderAuthorizationAllowed($order->getPayment())) {
4448
return false;
4549
}

app/code/Magento/Paypal/view/base/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
var config = {
77
map: {
88
'*': {
9-
transparent: 'Magento_Payment/js/transparent'
9+
transparent: 'Magento_Payment/js/transparent',
10+
'Magento_Payment/transparent': 'Magento_Payment/js/transparent'
1011
}
1112
}
1213
};

app/code/Magento/Paypal/view/frontend/requirejs-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var config = {
77
map: {
88
'*': {
99
orderReview: 'Magento_Paypal/js/order-review',
10+
'Magento_Paypal/order-review': 'Magento_Paypal/js/order-review',
1011
paypalCheckout: 'Magento_Paypal/js/paypal-checkout'
1112
}
1213
},

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class QuoteManagement implements \Magento\Quote\Api\CartManagementInterface
159159
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
160160
* @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
161161
* @param \Magento\Customer\Model\CustomerFactory $customerModelFactory
162-
* @param \Magento\Quote\Model\Quote\AddressFactory $quoteAddressFactory,
162+
* @param \Magento\Quote\Model\Quote\AddressFactory $quoteAddressFactory
163163
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
164164
* @param StoreManagerInterface $storeManager
165165
* @param \Magento\Checkout\Model\Session $checkoutSession
@@ -221,7 +221,7 @@ public function __construct(
221221
}
222222

223223
/**
224-
* {@inheritdoc}
224+
* @inheritdoc
225225
*/
226226
public function createEmptyCart()
227227
{
@@ -241,7 +241,7 @@ public function createEmptyCart()
241241
}
242242

243243
/**
244-
* {@inheritdoc}
244+
* @inheritdoc
245245
*/
246246
public function createEmptyCartForCustomer($customerId)
247247
{
@@ -257,7 +257,7 @@ public function createEmptyCartForCustomer($customerId)
257257
}
258258

259259
/**
260-
* {@inheritdoc}
260+
* @inheritdoc
261261
*/
262262
public function assignCustomer($cartId, $customerId, $storeId)
263263
{
@@ -332,7 +332,7 @@ protected function createCustomerCart($customerId, $storeId)
332332
}
333333

334334
/**
335-
* {@inheritdoc}
335+
* @inheritdoc
336336
*/
337337
public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
338338
{
@@ -349,6 +349,8 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
349349

350350
$data = $paymentMethod->getData();
351351
$quote->getPayment()->importData($data);
352+
} else {
353+
$quote->collectTotals();
352354
}
353355

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

381383
/**
382-
* {@inheritdoc}
384+
* @inheritdoc
383385
*/
384386
public function getCartForCustomer($customerId)
385387
{
@@ -406,6 +408,8 @@ public function submit(QuoteEntity $quote, $orderData = [])
406408
}
407409

408410
/**
411+
* Convert quote items to order items for quote
412+
*
409413
* @param Quote $quote
410414
* @return array
411415
*/

app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ protected function setUp()
188188
'setCustomerGroupId',
189189
'assignCustomer',
190190
'getPayment',
191+
'collectTotals'
191192
]);
192193

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

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

691693
$orderMock->expects($this->atLeastOnce())->method('getId')->willReturn($orderId);
692694
$orderMock->expects($this->atLeastOnce())->method('getIncrementId')->willReturn($orderIncrementId);

0 commit comments

Comments
 (0)