Skip to content

Commit 8da2c5b

Browse files
merge magento/2.3-develop into magento-honey-badgers/MC-15967-paypal-express
2 parents decedae + 19fab05 commit 8da2c5b

File tree

197 files changed

+3111
-3564
lines changed

Some content is hidden

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

197 files changed

+3111
-3564
lines changed

app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@
2727
}
2828
}
2929
}
30-
</script>
30+
</script>

app/code/Magento/AdvancedSearch/view/adminhtml/templates/system/config/testconnection.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
// @codingStandardsIgnoreFile
77
?>
88
<button class="scalable" type="button" id="<?= $block->getHtmlId() ?>" data-mage-init='{"testConnection":{
9-
"url": "<?= /* @escapeNotVerified */ $block->getAjaxUrl() ?>",
9+
"url": "<?= $block->escapeUrl($block->getAjaxUrl()) ?>",
1010
"elementId": "<?= $block->getHtmlId() ?>",
11-
"successText": "<?= /* @escapeNotVerified */ __('Successful! Test again?') ?>",
12-
"failedText": "<?= /* @escapeNotVerified */ __('Connection failed! Test again?') ?>",
13-
"fieldMapping": "<?= /* @escapeNotVerified */ $block->getFieldMapping() ?>"}, "validation": {}}'>
11+
"successText": "<?= $block->escapeHtmlAttr(__('Successful! Test again?')) ?>",
12+
"failedText": "<?= $block->escapeHtmlAttr(__('Connection failed! Test again?')) ?>",
13+
"fieldMapping": "<?= /* @noEscape */ $block->getFieldMapping() ?>"}, "validation": {}}'>
1414
<span><span><span id="<?= $block->getHtmlId() ?>_result"><?= $block->escapeHtml($block->getButtonLabel()) ?></span></span></span>
1515
</button>

app/code/Magento/AdvancedSearch/view/frontend/templates/search_data.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
$data = $block->getItems();
1414
if (count($data)):?>
1515
<dl class="block">
16-
<dt class="title"><?= /* @escapeNotVerified */ __($block->getTitle()) ?></dt>
16+
<dt class="title"><?= $block->escapeHtml(__($block->getTitle())) ?></dt>
1717
<?php foreach ($data as $additionalInfo) : ?>
1818
<dd class="item">
19-
<a href="<?= /* @escapeNotVerified */ $block->getLink($additionalInfo->getQueryText()) ?>"
19+
<a href="<?= $block->escapeUrl($block->getLink($additionalInfo->getQueryText())) ?>"
2020
><?= $block->escapeHtml($additionalInfo->getQueryText()) ?></a>
2121
<?php if ($block->isShowResultsCount()): ?>
22-
<span class="count"><?= /* @escapeNotVerified */ $additionalInfo->getResultsCount() ?></span>
22+
<span class="count"><?= /* @noEscape */ (int)$additionalInfo->getResultsCount() ?></span>
2323
<?php endif; ?>
2424
</dd>
2525
<?php endforeach; ?>

app/code/Magento/Braintree/Block/Paypal/Button.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
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\Block\Paypal;
79

810
use Magento\Braintree\Gateway\Config\PayPal\Config;
@@ -49,8 +51,6 @@ class Button extends Template implements ShortcutInterface
4951
private $payment;
5052

5153
/**
52-
* Constructor
53-
*
5454
* @param Context $context
5555
* @param ResolverInterface $localeResolver
5656
* @param Session $checkoutSession
@@ -98,6 +98,8 @@ public function getAlias()
9898
}
9999

100100
/**
101+
* Returns container id.
102+
*
101103
* @return string
102104
*/
103105
public function getContainerId()
@@ -106,6 +108,8 @@ public function getContainerId()
106108
}
107109

108110
/**
111+
* Returns locale.
112+
*
109113
* @return string
110114
*/
111115
public function getLocale()
@@ -114,6 +118,8 @@ public function getLocale()
114118
}
115119

116120
/**
121+
* Returns currency.
122+
*
117123
* @return string
118124
*/
119125
public function getCurrency()
@@ -122,6 +128,8 @@ public function getCurrency()
122128
}
123129

124130
/**
131+
* Returns amount.
132+
*
125133
* @return float
126134
*/
127135
public function getAmount()
@@ -130,6 +138,8 @@ public function getAmount()
130138
}
131139

132140
/**
141+
* Returns if is active.
142+
*
133143
* @return bool
134144
*/
135145
public function isActive()
@@ -139,6 +149,8 @@ public function isActive()
139149
}
140150

141151
/**
152+
* Returns merchant name.
153+
*
142154
* @return string
143155
*/
144156
public function getMerchantName()
@@ -147,6 +159,8 @@ public function getMerchantName()
147159
}
148160

149161
/**
162+
* Returns client token.
163+
*
150164
* @return string|null
151165
*/
152166
public function getClientToken()
@@ -155,10 +169,22 @@ public function getClientToken()
155169
}
156170

157171
/**
172+
* Returns action success.
173+
*
158174
* @return string
159175
*/
160176
public function getActionSuccess()
161177
{
162178
return $this->getUrl(ConfigProvider::CODE . '/paypal/review', ['_secure' => true]);
163179
}
180+
181+
/**
182+
* Gets environment value.
183+
*
184+
* @return string
185+
*/
186+
public function getEnvironment(): string
187+
{
188+
return $this->configProvider->getConfig()['payment'][ConfigProvider::CODE]['environment'];
189+
}
164190
}

app/code/Magento/Braintree/Gateway/Config/Config.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class Config extends \Magento\Payment\Gateway\Config\Config
3030
const KEY_VERIFY_SPECIFIC = 'verify_specific_countries';
3131
const VALUE_3DSECURE_ALL = 0;
3232
const CODE_3DSECURE = 'three_d_secure';
33-
const KEY_KOUNT_MERCHANT_ID = 'kount_id';
3433
const FRAUD_PROTECTION = 'fraudprotection';
3534

3635
/**
@@ -173,6 +172,7 @@ public function get3DSecureSpecificCountries($storeId = null)
173172

174173
/**
175174
* Gets value of configured environment.
175+
*
176176
* Possible values: production or sandbox.
177177
*
178178
* @param int|null $storeId
@@ -183,17 +183,6 @@ public function getEnvironment($storeId = null)
183183
return $this->getValue(Config::KEY_ENVIRONMENT, $storeId);
184184
}
185185

186-
/**
187-
* Gets Kount merchant ID.
188-
*
189-
* @param int|null $storeId
190-
* @return string
191-
*/
192-
public function getKountMerchantId($storeId = null)
193-
{
194-
return $this->getValue(Config::KEY_KOUNT_MERCHANT_ID, $storeId);
195-
}
196-
197186
/**
198187
* Gets merchant ID.
199188
*
@@ -217,13 +206,25 @@ public function getMerchantAccountId($storeId = null)
217206
}
218207

219208
/**
209+
* Returns SDK url.
210+
*
220211
* @return string
221212
*/
222213
public function getSdkUrl()
223214
{
224215
return $this->getValue(Config::KEY_SDK_URL);
225216
}
226217

218+
/**
219+
* Gets Hosted Fields SDK Url
220+
*
221+
* @return string
222+
*/
223+
public function getHostedFieldsSdkUrl(): string
224+
{
225+
return $this->getValue('hosted_fields_sdk_url');
226+
}
227+
227228
/**
228229
* Checks if fraud protection is enabled.
229230
*
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Gateway\Request;
7+
8+
use Magento\Braintree\Gateway\SubjectReader;
9+
use Magento\Payment\Gateway\Request\BuilderInterface;
10+
11+
/**
12+
* Since we can't validate 3Dsecure for sequence multishipping orders based on vault tokens,
13+
* we skip 3D secure verification for vault transactions.
14+
* For common vault transaction original 3d secure verification builder is called.
15+
*/
16+
class VaultThreeDSecureDataBuilder implements BuilderInterface
17+
{
18+
/**
19+
* @var ThreeDSecureDataBuilder
20+
*/
21+
private $threeDSecureDataBuilder;
22+
23+
/**
24+
* @var SubjectReader
25+
*/
26+
private $subjectReader;
27+
28+
/**
29+
* Constructor
30+
*
31+
* @param ThreeDSecureDataBuilder $threeDSecureDataBuilder
32+
* @param SubjectReader $subjectReader
33+
*/
34+
public function __construct(
35+
ThreeDSecureDataBuilder $threeDSecureDataBuilder,
36+
SubjectReader $subjectReader
37+
) {
38+
$this->threeDSecureDataBuilder = $threeDSecureDataBuilder;
39+
$this->subjectReader = $subjectReader;
40+
}
41+
42+
/**
43+
* @inheritdoc
44+
*/
45+
public function build(array $buildSubject)
46+
{
47+
$paymentDO = $this->subjectReader->readPayment($buildSubject);
48+
$payment = $paymentDO->getPayment();
49+
if ($payment->getAdditionalInformation('is_multishipping')) {
50+
return [];
51+
}
52+
53+
return $this->threeDSecureDataBuilder->build($buildSubject);
54+
}
55+
}

app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Braintree\Model\Multishipping;
99

1010
use Magento\Braintree\Gateway\Command\GetPaymentNonceCommand;
11+
use Magento\Braintree\Gateway\Config\Config;
1112
use Magento\Braintree\Model\Ui\ConfigProvider;
1213
use Magento\Braintree\Observer\DataAssignObserver;
1314
use Magento\Braintree\Model\Ui\PayPal\ConfigProvider as PaypalConfigProvider;
@@ -118,6 +119,10 @@ private function setVaultPayment(OrderPaymentInterface $orderPayment, PaymentTok
118119
PaymentTokenInterface::CUSTOMER_ID,
119120
$customerId
120121
);
122+
$orderPayment->setAdditionalInformation(
123+
'is_multishipping',
124+
1
125+
);
121126
}
122127

123128
/**

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ private function updateBillingAddress(Quote $quote, array $details)
173173
*/
174174
private function updateAddressData(Address $address, array $addressData)
175175
{
176-
$extendedAddress = isset($addressData['extendedAddress'])
177-
? $addressData['extendedAddress']
176+
$extendedAddress = isset($addressData['line2'])
177+
? $addressData['line2']
178178
: null;
179179

180-
$address->setStreet([$addressData['streetAddress'], $extendedAddress]);
181-
$address->setCity($addressData['locality']);
182-
$address->setRegionCode($addressData['region']);
183-
$address->setCountryId($addressData['countryCodeAlpha2']);
180+
$address->setStreet([$addressData['line1'], $extendedAddress]);
181+
$address->setCity($addressData['city']);
182+
$address->setRegionCode($addressData['state']);
183+
$address->setCountryId($addressData['countryCode']);
184184
$address->setPostcode($addressData['postalCode']);
185185

186186
// PayPal's address supposes not saving against customer account

app/code/Magento/Braintree/Model/Ui/ConfigProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
/**
1515
* Class ConfigProvider
16+
*
17+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1618
*/
1719
class ConfigProvider implements ConfigProviderInterface
1820
{
@@ -72,11 +74,11 @@ public function getConfig()
7274
'clientToken' => $this->getClientToken(),
7375
'ccTypesMapper' => $this->config->getCcTypesMapper(),
7476
'sdkUrl' => $this->config->getSdkUrl(),
77+
'hostedFieldsSdkUrl' => $this->config->getHostedFieldsSdkUrl(),
7578
'countrySpecificCardTypes' => $this->config->getCountrySpecificCardTypeConfig($storeId),
7679
'availableCardTypes' => $this->config->getAvailableCardTypes($storeId),
7780
'useCvv' => $this->config->isCvvEnabled($storeId),
7881
'environment' => $this->config->getEnvironment($storeId),
79-
'kountMerchantId' => $this->config->getKountMerchantId($storeId),
8082
'hasFraudProtection' => $this->config->hasFraudProtection($storeId),
8183
'merchantId' => $this->config->getMerchantId($storeId),
8284
'ccVaultCode' => self::CC_VAULT_CODE,
@@ -92,6 +94,7 @@ public function getConfig()
9294

9395
/**
9496
* Generate a new client token if necessary
97+
*
9598
* @return string
9699
*/
97100
public function getClientToken()

app/code/Magento/Braintree/Test/Unit/Model/Paypal/Helper/QuoteUpdaterTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,21 @@ private function getDetails(): array
159159
'phone' => '312-123-4567',
160160
'countryCode' => 'US',
161161
'shippingAddress' => [
162-
'streetAddress' => '123 Division Street',
163-
'extendedAddress' => 'Apt. #1',
164-
'locality' => 'Chicago',
165-
'region' => 'IL',
162+
'line1' => '123 Division Street',
163+
'line2' => 'Apt. #1',
164+
'city' => 'Chicago',
165+
'state' => 'IL',
166166
'postalCode' => '60618',
167-
'countryCodeAlpha2' => 'US',
167+
'countryCode' => 'US',
168168
'recipientName' => 'Jane Smith',
169169
],
170170
'billingAddress' => [
171-
'streetAddress' => '123 Billing Street',
172-
'extendedAddress' => 'Apt. #1',
173-
'locality' => 'Chicago',
174-
'region' => 'IL',
171+
'line1' => '123 Billing Street',
172+
'line2' => 'Apt. #1',
173+
'city' => 'Chicago',
174+
'state' => 'IL',
175175
'postalCode' => '60618',
176-
'countryCodeAlpha2' => 'US',
176+
'countryCode' => 'US',
177177
],
178178
];
179179
}
@@ -206,13 +206,13 @@ private function updateShippingAddressStep(array $details): void
206206
private function updateAddressDataStep(MockObject $address, array $addressData): void
207207
{
208208
$address->method('setStreet')
209-
->with([$addressData['streetAddress'], $addressData['extendedAddress']]);
209+
->with([$addressData['line1'], $addressData['line2']]);
210210
$address->method('setCity')
211-
->with($addressData['locality']);
211+
->with($addressData['city']);
212212
$address->method('setRegionCode')
213-
->with($addressData['region']);
213+
->with($addressData['state']);
214214
$address->method('setCountryId')
215-
->with($addressData['countryCodeAlpha2']);
215+
->with($addressData['countryCode']);
216216
$address->method('setPostcode')
217217
->with($addressData['postalCode']);
218218
}

0 commit comments

Comments
 (0)