Skip to content

Commit b2d140d

Browse files
author
Magento CICD
authored
merge magento/2.3-develop into magento-pangolin/reece-pr
2 parents 2822cff + ec5fcb5 commit b2d140d

File tree

128 files changed

+2292
-566
lines changed

Some content is hidden

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

128 files changed

+2292
-566
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.
77

88
## Magento system requirements
9-
[Magento system requirements](http://devdocs.magento.com/guides/v2.3/install-gde/system-requirements2.html).
9+
[Magento system requirements](https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements2.html).
1010

1111
## Install Magento
1212

13-
* [Installation guide](http://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).
13+
* [Installation guide](https://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).
1414

1515
<h2>Contributing to the Magento 2 code base</h2>
1616
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.
@@ -21,10 +21,10 @@ To learn about issues, click [here][2]. To open an issue, click [here][3].
2121

2222
To suggest documentation improvements, click [here][4].
2323

24-
[1]: <http://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html>
25-
[2]: <http://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#report>
24+
[1]: <https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html>
25+
[2]: <https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#report>
2626
[3]: <https://github.com/magento/magento2/issues>
27-
[4]: <http://devdocs.magento.com>
27+
[4]: <https://devdocs.magento.com>
2828

2929
<h3>Community Maintainers</h3>
3030
The members of this team have been recognized for their outstanding commitment to maintaining and improving Magento. Magento has granted them permission to accept, merge, and reject pull requests, as well as review issues, and thanks these Community Maintainers for their valuable contributions.
@@ -53,9 +53,9 @@ Stay up-to-date on the latest security news and patches for Magento by signing u
5353

5454
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license.
5555

56-
http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
57-
Please see LICENSE.txt for the full text of the OSL 3.0 license or contact license@magentocommerce.com for a copy.
56+
[Open Software License (OSL 3.0)](https://opensource.org/licenses/osl-3.0.php).
57+
Please see [LICENSE.txt](https://github.com/magento/magento2/blob/2.3-develop/LICENSE.txt) for the full text of the OSL 3.0 license or contact license@magentocommerce.com for a copy.
5858

5959
Subject to Licensee's payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file.
60-
Please see LICENSE_EE.txt for the full text of the MEE License or visit http://magento.com/legal/terms/enterprise.
60+
Please see LICENSE_EE.txt for the full text of the MEE License or visit https://magento.com/legal/terms/enterprise.
6161

app/code/Magento/AdminNotification/Block/Window.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
namespace Magento\AdminNotification\Block;
99

1010
/**
11+
* Admin notification window block
12+
*
1113
* @api
1214
* @since 100.0.2
1315
*/
@@ -40,7 +42,7 @@ class Window extends \Magento\Backend\Block\Template
4042
protected $_criticalCollection;
4143

4244
/**
43-
* @var \Magento\Adminnotification\Model\Inbox
45+
* @var \Magento\AdminNotification\Model\Inbox
4446
*/
4547
protected $_latestItem;
4648

@@ -92,7 +94,7 @@ protected function _toHtml()
9294
/**
9395
* Retrieve latest critical item
9496
*
95-
* @return bool|\Magento\Adminnotification\Model\Inbox
97+
* @return bool|\Magento\AdminNotification\Model\Inbox
9698
*/
9799
protected function _getLatestItem()
98100
{

app/code/Magento/Analytics/etc/adminhtml/system.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
<source_model>Magento\Analytics\Model\Config\Source\Vertical</source_model>
3737
<backend_model>Magento\Analytics\Model\Config\Backend\Vertical</backend_model>
3838
<frontend_model>Magento\Analytics\Block\Adminhtml\System\Config\Vertical</frontend_model>
39+
<depends>
40+
<field id="analytics/general/enabled">1</field>
41+
</depends>
3942
</field>
4043
<field id="additional_comment" translate="label comment" type="label" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
4144
<label><![CDATA[<strong>Get more insights from Magento Business Intelligence</strong>]]></label>

app/code/Magento/Braintree/Controller/Paypal/Review.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
use Magento\Braintree\Gateway\Config\PayPal\Config;
1313
use Magento\Braintree\Model\Paypal\Helper\QuoteUpdater;
1414
use Magento\Framework\Exception\LocalizedException;
15+
use Magento\Framework\App\Action\HttpPostActionInterface;
1516

1617
/**
1718
* Class Review
1819
*/
19-
class Review extends AbstractAction
20+
class Review extends AbstractAction implements HttpPostActionInterface
2021
{
2122
/**
2223
* @var QuoteUpdater
@@ -60,7 +61,7 @@ public function execute()
6061
try {
6162
$this->validateQuote($quote);
6263

63-
if ($this->validateRequestData($requestData)) {
64+
if ($requestData && $this->validateRequestData($requestData)) {
6465
$this->quoteUpdater->execute(
6566
$requestData['nonce'],
6667
$requestData['details'],
@@ -91,6 +92,8 @@ public function execute()
9192
}
9293

9394
/**
95+
* Validate request data
96+
*
9497
* @param array $requestData
9598
* @return boolean
9699
*/

app/code/Magento/Braintree/Gateway/Request/PayPal/VaultDataBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public function build(array $buildSubject)
4949

5050
$payment = $paymentDO->getPayment();
5151
$data = $payment->getAdditionalInformation();
52+
// the payment token could be stored only if a customer checks the Vault flow on storefront
53+
// see https://developers.braintreepayments.com/guides/paypal/vault/javascript/v2#invoking-the-vault-flow
5254
if (!empty($data[VaultConfigProvider::IS_ACTIVE_CODE])) {
5355
$result[self::$optionsKey] = [
5456
self::$storeInVaultOnSuccess => true

app/code/Magento/Braintree/Gateway/Request/VaultCaptureDataBuilder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Braintree\Gateway\Request;
77

88
use Magento\Braintree\Gateway\SubjectReader;
9+
use Magento\Framework\Exception\LocalizedException;
10+
use Magento\Payment\Gateway\Command\CommandException;
911
use Magento\Payment\Gateway\Request\BuilderInterface;
1012
use Magento\Payment\Helper\Formatter;
1113

@@ -41,6 +43,9 @@ public function build(array $buildSubject)
4143
$payment = $paymentDO->getPayment();
4244
$extensionAttributes = $payment->getExtensionAttributes();
4345
$paymentToken = $extensionAttributes->getVaultPaymentToken();
46+
if ($paymentToken === null) {
47+
throw new CommandException(__('The Payment Token is not available to perform the request.'));
48+
}
4449
return [
4550
'amount' => $this->formatPrice($this->subjectReader->readAmount($buildSubject)),
4651
'paymentMethodToken' => $paymentToken->getGatewayToken()

app/code/Magento/Braintree/Model/Paypal/Helper/QuoteUpdater.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private function updateBillingAddress(Quote $quote, array $details)
148148
{
149149
$billingAddress = $quote->getBillingAddress();
150150

151-
if ($this->config->isRequiredBillingAddress()) {
151+
if ($this->config->isRequiredBillingAddress() && !empty($details['billingAddress'])) {
152152
$this->updateAddressData($billingAddress, $details['billingAddress']);
153153
} else {
154154
$this->updateAddressData($billingAddress, $details['shippingAddress']);

app/code/Magento/Braintree/Test/Unit/Gateway/Request/VaultCaptureDataBuilderTest.php

Lines changed: 64 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Braintree\Test\Unit\Gateway\Request;
79

8-
use Magento\Braintree\Gateway\SubjectReader;
910
use Magento\Braintree\Gateway\Request\VaultCaptureDataBuilder;
11+
use Magento\Braintree\Gateway\SubjectReader;
1012
use Magento\Payment\Gateway\Data\PaymentDataObjectInterface;
1113
use Magento\Sales\Api\Data\OrderPaymentExtension;
1214
use Magento\Sales\Model\Order\Payment;
@@ -26,47 +28,46 @@ class VaultCaptureDataBuilderTest extends \PHPUnit\Framework\TestCase
2628
/**
2729
* @var PaymentDataObjectInterface|MockObject
2830
*/
29-
private $paymentDOMock;
31+
private $paymentDO;
3032

3133
/**
3234
* @var Payment|MockObject
3335
*/
34-
private $paymentMock;
36+
private $payment;
3537

3638
/**
37-
* @var SubjectReader|\PHPUnit_Framework_MockObject_MockObject
39+
* @var SubjectReader|MockObject
3840
*/
39-
private $subjectReaderMock;
41+
private $subjectReader;
4042

4143
/**
4244
* @inheritdoc
4345
*/
44-
protected function setUp()
46+
protected function setUp(): void
4547
{
46-
$this->paymentDOMock = $this->createMock(PaymentDataObjectInterface::class);
47-
$this->paymentMock = $this->getMockBuilder(Payment::class)
48+
$this->paymentDO = $this->createMock(PaymentDataObjectInterface::class);
49+
$this->payment = $this->getMockBuilder(Payment::class)
4850
->disableOriginalConstructor()
4951
->getMock();
50-
$this->paymentDOMock->expects(static::once())
51-
->method('getPayment')
52-
->willReturn($this->paymentMock);
52+
$this->paymentDO->method('getPayment')
53+
->willReturn($this->payment);
5354

54-
$this->subjectReaderMock = $this->getMockBuilder(SubjectReader::class)
55+
$this->subjectReader = $this->getMockBuilder(SubjectReader::class)
5556
->disableOriginalConstructor()
5657
->getMock();
5758

58-
$this->builder = new VaultCaptureDataBuilder($this->subjectReaderMock);
59+
$this->builder = new VaultCaptureDataBuilder($this->subjectReader);
5960
}
6061

6162
/**
62-
* \Magento\Braintree\Gateway\Request\VaultCaptureDataBuilder::build
63+
* Checks the result after builder execution.
6364
*/
64-
public function testBuild()
65+
public function testBuild(): void
6566
{
6667
$amount = 30.00;
6768
$token = '5tfm4c';
6869
$buildSubject = [
69-
'payment' => $this->paymentDOMock,
70+
'payment' => $this->paymentDO,
7071
'amount' => $amount,
7172
];
7273

@@ -75,36 +76,68 @@ public function testBuild()
7576
'paymentMethodToken' => $token,
7677
];
7778

78-
$this->subjectReaderMock->expects(self::once())
79-
->method('readPayment')
79+
$this->subjectReader->method('readPayment')
8080
->with($buildSubject)
81-
->willReturn($this->paymentDOMock);
82-
$this->subjectReaderMock->expects(self::once())
83-
->method('readAmount')
81+
->willReturn($this->paymentDO);
82+
$this->subjectReader->method('readAmount')
8483
->with($buildSubject)
8584
->willReturn($amount);
8685

87-
$paymentExtensionMock = $this->getMockBuilder(OrderPaymentExtension::class)
86+
/** @var OrderPaymentExtension|MockObject $paymentExtension */
87+
$paymentExtension = $this->getMockBuilder(OrderPaymentExtension::class)
8888
->setMethods(['getVaultPaymentToken'])
8989
->disableOriginalConstructor()
9090
->getMockForAbstractClass();
9191

92-
$paymentTokenMock = $this->getMockBuilder(PaymentToken::class)
92+
/** @var PaymentToken|MockObject $paymentToken */
93+
$paymentToken = $this->getMockBuilder(PaymentToken::class)
9394
->disableOriginalConstructor()
9495
->getMock();
9596

96-
$paymentExtensionMock->expects(static::once())
97-
->method('getVaultPaymentToken')
98-
->willReturn($paymentTokenMock);
99-
$this->paymentMock->expects(static::once())
100-
->method('getExtensionAttributes')
101-
->willReturn($paymentExtensionMock);
97+
$paymentExtension->method('getVaultPaymentToken')
98+
->willReturn($paymentToken);
99+
$this->payment->method('getExtensionAttributes')
100+
->willReturn($paymentExtension);
102101

103-
$paymentTokenMock->expects(static::once())
104-
->method('getGatewayToken')
102+
$paymentToken->method('getGatewayToken')
105103
->willReturn($token);
106104

107105
$result = $this->builder->build($buildSubject);
108106
self::assertEquals($expected, $result);
109107
}
108+
109+
/**
110+
* Checks a builder execution if Payment Token doesn't exist.
111+
*
112+
* @expectedException \Magento\Payment\Gateway\Command\CommandException
113+
* @expectedExceptionMessage The Payment Token is not available to perform the request.
114+
*/
115+
public function testBuildWithoutPaymentToken(): void
116+
{
117+
$amount = 30.00;
118+
$buildSubject = [
119+
'payment' => $this->paymentDO,
120+
'amount' => $amount,
121+
];
122+
123+
$this->subjectReader->method('readPayment')
124+
->with($buildSubject)
125+
->willReturn($this->paymentDO);
126+
$this->subjectReader->method('readAmount')
127+
->with($buildSubject)
128+
->willReturn($amount);
129+
130+
/** @var OrderPaymentExtension|MockObject $paymentExtension */
131+
$paymentExtension = $this->getMockBuilder(OrderPaymentExtension::class)
132+
->setMethods(['getVaultPaymentToken'])
133+
->disableOriginalConstructor()
134+
->getMockForAbstractClass();
135+
136+
$this->payment->method('getExtensionAttributes')
137+
->willReturn($paymentExtension);
138+
$paymentExtension->method('getVaultPaymentToken')
139+
->willReturn(null);
140+
141+
$this->builder->build($buildSubject);
142+
}
110143
}

0 commit comments

Comments
 (0)