Skip to content

Commit 44996c2

Browse files
author
Oleksii Korshenko
committed
Merge remote-tracking branch 'mainline/2.2-develop' into MAGETWO-81841-PR-11407
2 parents d582277 + 0483421 commit 44996c2

File tree

199 files changed

+5743
-437
lines changed

Some content is hidden

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

199 files changed

+5743
-437
lines changed

.htaccess

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
############################################
3737
## adjust memory limit
3838

39-
php_value memory_limit 768M
39+
php_value memory_limit 756M
4040
php_value max_execution_time 18000
4141

4242
############################################
@@ -59,7 +59,7 @@
5959
############################################
6060
## adjust memory limit
6161

62-
php_value memory_limit 768M
62+
php_value memory_limit 756M
6363
php_value max_execution_time 18000
6464

6565
############################################

.htaccess.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
############################################
3636
## adjust memory limit
3737

38-
php_value memory_limit 768M
38+
php_value memory_limit 756M
3939
php_value max_execution_time 18000
4040

4141
############################################

.user.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
memory_limit = 768M
1+
memory_limit = 756M
22
max_execution_time = 18000
33
session.auto_start = off
44
suhosin.session.cryptua = off

app/code/Magento/Backend/Block/Dashboard/Graph.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ public function getChartUrl($directUrl = true)
421421
$tmpstring = implode('|', $this->_axisLabels[$idx]);
422422

423423
$valueBuffer[] = $indexid . ":|" . $tmpstring;
424+
} elseif ($idx == 'y') {
425+
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
424426
}
425427
$indexid++;
426428
}

app/code/Magento/Backup/Model/BackupFactory.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,20 @@ public function __construct(\Magento\Framework\ObjectManagerInterface $objectMan
3939
*/
4040
public function create($timestamp, $type)
4141
{
42-
$backupId = $timestamp . '_' . $type;
4342
$fsCollection = $this->_objectManager->get(\Magento\Backup\Model\Fs\Collection::class);
4443
$backupInstance = $this->_objectManager->get(\Magento\Backup\Model\Backup::class);
44+
4545
foreach ($fsCollection as $backup) {
46-
if ($backup->getId() == $backupId) {
47-
$backupInstance->setType(
48-
$backup->getType()
49-
)->setTime(
50-
$backup->getTime()
51-
)->setName(
52-
$backup->getName()
53-
)->setPath(
54-
$backup->getPath()
55-
);
46+
if ($backup->getTime() === (int) $timestamp && $backup->getType() === $type) {
47+
$backupInstance->setData(['id' => $backup->getId()])
48+
->setType($backup->getType())
49+
->setTime($backup->getTime())
50+
->setName($backup->getName())
51+
->setPath($backup->getPath());
5652
break;
5753
}
5854
}
55+
5956
return $backupInstance;
6057
}
6158
}

app/code/Magento/Backup/Test/Unit/Model/BackupFactoryTest.php

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -77,42 +77,29 @@ protected function setUp()
7777

7878
public function testCreate()
7979
{
80-
$this->_backupModel->expects(
81-
$this->once()
82-
)->method(
83-
'setType'
84-
)->with(
85-
$this->_data['type']
86-
)->will(
87-
$this->returnSelf()
88-
);
89-
$this->_backupModel->expects(
90-
$this->once()
91-
)->method(
92-
'setTime'
93-
)->with(
94-
$this->_data['time']
95-
)->will(
96-
$this->returnSelf()
97-
);
98-
$this->_backupModel->expects(
99-
$this->once()
100-
)->method(
101-
'setName'
102-
)->with(
103-
$this->_data['name']
104-
)->will(
105-
$this->returnSelf()
106-
);
107-
$this->_backupModel->expects(
108-
$this->once()
109-
)->method(
110-
'setPath'
111-
)->with(
112-
$this->_data['path']
113-
)->will(
114-
$this->returnSelf()
115-
);
80+
$this->_backupModel->expects($this->once())
81+
->method('setType')
82+
->with($this->_data['type'])
83+
->will($this->returnSelf());
84+
85+
$this->_backupModel->expects($this->once())
86+
->method('setTime')
87+
->with($this->_data['time'])
88+
->will($this->returnSelf());
89+
90+
$this->_backupModel->expects($this->once())
91+
->method('setName')
92+
->with($this->_data['name'])
93+
->will($this->returnSelf());
94+
95+
$this->_backupModel->expects($this->once())
96+
->method('setPath')
97+
->with($this->_data['path'])
98+
->will($this->returnSelf());
99+
100+
$this->_backupModel->expects($this->once())
101+
->method('setData')
102+
->will($this->returnSelf());
116103

117104
$this->_instance->create('1385661590', 'snapshot');
118105
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Model\InstantPurchase\CreditCard;
7+
8+
use Magento\Braintree\Gateway\Config\Config;
9+
use Magento\InstantPurchase\PaymentMethodIntegration\AvailabilityCheckerInterface;
10+
11+
/**
12+
* Availability of Braintree vaults for instant purchase.
13+
*/
14+
class AvailabilityChecker implements AvailabilityCheckerInterface
15+
{
16+
/**
17+
* @var Config
18+
*/
19+
private $config;
20+
21+
/**
22+
* AvailabilityChecker constructor.
23+
* @param Config $config
24+
*/
25+
public function __construct(Config $config)
26+
{
27+
$this->config = $config;
28+
}
29+
30+
/**
31+
* @inheritdoc
32+
*/
33+
public function isAvailable(): bool
34+
{
35+
if ($this->config->isVerify3DSecure()) {
36+
// Support of 3D secure not implemented for instant purchase yet.
37+
return false;
38+
}
39+
40+
return true;
41+
}
42+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Model\InstantPurchase\CreditCard;
7+
8+
use Magento\InstantPurchase\PaymentMethodIntegration\PaymentTokenFormatterInterface;
9+
use Magento\Vault\Api\Data\PaymentTokenInterface;
10+
11+
/**
12+
* Braintree stored credit card formatter.
13+
*/
14+
class TokenFormatter implements PaymentTokenFormatterInterface
15+
{
16+
/**
17+
* Most used credit card types
18+
* @var array
19+
*/
20+
public static $baseCardTypes = [
21+
'AE' => 'American Express',
22+
'VI' => 'Visa',
23+
'MC' => 'MasterCard',
24+
'DI' => 'Discover',
25+
'JBC' => 'JBC',
26+
'CUP' => 'China Union Pay',
27+
'MI' => 'Maestro',
28+
];
29+
30+
/**
31+
* @inheritdoc
32+
*/
33+
public function formatPaymentToken(PaymentTokenInterface $paymentToken): string
34+
{
35+
$details = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
36+
if (!isset($details['type'], $details['maskedCC'], $details['expirationDate'])) {
37+
throw new \InvalidArgumentException('Invalid Braintree credit card token details.');
38+
}
39+
40+
if (isset(self::$baseCardTypes[$details['type']])) {
41+
$ccType = self::$baseCardTypes[$details['type']];
42+
} else {
43+
$ccType = $details['type'];
44+
}
45+
46+
$formatted = sprintf(
47+
'%s: %s, %s: %s (%s: %s)',
48+
__('Credit Card'),
49+
$ccType,
50+
__('ending'),
51+
$details['maskedCC'],
52+
__('expires'),
53+
$details['expirationDate']
54+
);
55+
56+
return $formatted;
57+
}
58+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Model\InstantPurchase\PayPal;
7+
8+
use Magento\InstantPurchase\PaymentMethodIntegration\PaymentTokenFormatterInterface;
9+
use Magento\Vault\Api\Data\PaymentTokenInterface;
10+
11+
/**
12+
* Braintree PayPal token formatter.
13+
*/
14+
class TokenFormatter implements PaymentTokenFormatterInterface
15+
{
16+
/**
17+
* @inheritdoc
18+
*/
19+
public function formatPaymentToken(PaymentTokenInterface $paymentToken): string
20+
{
21+
$details = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
22+
if (!isset($details['payerEmail'])) {
23+
throw new \InvalidArgumentException('Invalid Braintree PayPal token details.');
24+
}
25+
26+
$formatted = sprintf(
27+
'%s: %s',
28+
__('PayPal'),
29+
$details['payerEmail']
30+
);
31+
32+
return $formatted;
33+
}
34+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Model\InstantPurchase;
7+
8+
use Magento\Braintree\Gateway\Command\GetPaymentNonceCommand;
9+
use Magento\InstantPurchase\PaymentMethodIntegration\PaymentAdditionalInformationProviderInterface;
10+
use Magento\Vault\Api\Data\PaymentTokenInterface;
11+
12+
/**
13+
* Provides Braintree specific payment additional information for instant purchase.
14+
*/
15+
class PaymentAdditionalInformationProvider implements PaymentAdditionalInformationProviderInterface
16+
{
17+
/**
18+
* @var GetPaymentNonceCommand
19+
*/
20+
private $getPaymentNonceCommand;
21+
22+
/**
23+
* PaymentAdditionalInformationProvider constructor.
24+
* @param GetPaymentNonceCommand $getPaymentNonceCommand
25+
*/
26+
public function __construct(GetPaymentNonceCommand $getPaymentNonceCommand)
27+
{
28+
$this->getPaymentNonceCommand = $getPaymentNonceCommand;
29+
}
30+
31+
/**
32+
* @inheritdoc
33+
*/
34+
public function getAdditionalInformation(PaymentTokenInterface $paymentToken): array
35+
{
36+
$paymentMethodNonce = $this->getPaymentNonceCommand->execute([
37+
PaymentTokenInterface::CUSTOMER_ID => $paymentToken->getCustomerId(),
38+
PaymentTokenInterface::PUBLIC_HASH => $paymentToken->getPublicHash(),
39+
])->get()['paymentMethodNonce'];
40+
41+
return [
42+
'payment_method_nonce' => $paymentMethodNonce,
43+
];
44+
}
45+
}

0 commit comments

Comments
 (0)