Skip to content

Commit a8b6b6a

Browse files
author
Serhiy Shkolyarenko
committed
Merge remote-tracking branch 'mainline/develop' into grouped_product
2 parents d0b1917 + e7bc266 commit a8b6b6a

File tree

146 files changed

+3434
-2950
lines changed

Some content is hidden

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

146 files changed

+3434
-2950
lines changed

app/bootstrap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
error_reporting(E_ALL);
1111
#ini_set('display_errors', 1);
12-
umask(0);
1312

1413
/* PHP version validation */
1514
if (version_compare(phpversion(), '5.5.0', '<') === true) {

app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,28 @@
1010
use Magento\Framework\Exception\LocalizedException;
1111
use Magento\Framework\Controller\ResultFactory;
1212
use Magento\Framework\Exception\State\UserLockedException;
13+
use Magento\Security\Model\SecurityCookie;
1314

1415
class Save extends \Magento\Backend\Controller\Adminhtml\System\Account
1516
{
1617
/**
17-
* @var \Magento\Security\Helper\SecurityCookie
18+
* @var SecurityCookie
1819
*/
19-
protected $securityCookieHelper;
20+
private $securityCookie;
2021

2122
/**
22-
* @param \Magento\Backend\App\Action\Context $context
23-
* @param \Magento\Security\Helper\SecurityCookie $securityCookieHelper
23+
* Get security cookie
24+
*
25+
* @return SecurityCookie
26+
* @deprecated
2427
*/
25-
public function __construct(
26-
\Magento\Backend\App\Action\Context $context,
27-
\Magento\Security\Helper\SecurityCookie $securityCookieHelper
28-
) {
29-
parent::__construct($context);
30-
$this->securityCookieHelper = $securityCookieHelper;
28+
private function getSecurityCookie()
29+
{
30+
if (!($this->securityCookie instanceof SecurityCookie)) {
31+
return \Magento\Framework\App\ObjectManager::getInstance()->get(SecurityCookie::class);
32+
} else {
33+
return $this->securityCookie;
34+
}
3135
}
3236

3337
/**
@@ -79,7 +83,7 @@ public function execute()
7983
}
8084
} catch (UserLockedException $e) {
8185
$this->_auth->logout();
82-
$this->securityCookieHelper->setLogoutReasonCookie(
86+
$this->getSecurityCookie()->setLogoutReasonCookie(
8387
\Magento\Security\Model\AdminSessionsManager::LOGOUT_REASON_USER_LOCKED
8488
);
8589
} catch (ValidatorException $e) {

app/code/Magento/Backend/i18n/en_US.csv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ YTD,YTD
206206
"Authentication storage is incorrect.","Authentication storage is incorrect."
207207
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
208208
"Authentication error occurred.","Authentication error occurred."
209+
"Admin session lifetime must be less than or equal to 31536000 seconds (one year)","Admin session lifetime must be less than or equal to 31536000 seconds (one year)"
210+
"Admin session lifetime must be greater than or equal to 60 seconds","Admin session lifetime must be greater than or equal to 60 seconds"
209211
Order,Order
210212
"Order #%1","Order #%1"
211213
"Access denied","Access denied"
@@ -391,7 +393,7 @@ Security,Security
391393
"Add Secret Key to URLs","Add Secret Key to URLs"
392394
"Login is Case Sensitive","Login is Case Sensitive"
393395
"Admin Session Lifetime (seconds)","Admin Session Lifetime (seconds)"
394-
"Values less than 60 are ignored.","Values less than 60 are ignored."
396+
"Please enter at least 60 and at most 31536000 (one year).","Please enter at least 60 and at most 31536000 (one year)."
395397
"Enable Charts","Enable Charts"
396398
Web,Web
397399
"Url Options","Url Options"

app/code/Magento/Backup/Model/Fs/Collection.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ protected function _hideBackupsForApache()
9191
$filename = '.htaccess';
9292
if (!$this->_varDirectory->isFile($filename)) {
9393
$this->_varDirectory->writeFile($filename, 'deny from all');
94-
$this->_varDirectory->changePermissions($filename, 0640);
9594
}
9695
}
9796

app/code/Magento/Braintree/Gateway/Command/CaptureStrategyCommand.php

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Braintree\Gateway\Command;
77

8+
use Braintree\Transaction;
9+
use Magento\Braintree\Model\Adapter\BraintreeAdapter;
10+
use Magento\Braintree\Model\Adapter\BraintreeSearchAdapter;
811
use Magento\Framework\Api\FilterBuilder;
912
use Magento\Framework\Api\SearchCriteriaBuilder;
1013
use Magento\Payment\Gateway\Command;
@@ -18,6 +21,7 @@
1821

1922
/**
2023
* Class CaptureStrategyCommand
24+
* @SuppressWarnings(PHPMD)
2125
*/
2226
class CaptureStrategyCommand implements CommandInterface
2327
{
@@ -36,11 +40,6 @@ class CaptureStrategyCommand implements CommandInterface
3640
*/
3741
const VAULT_CAPTURE = 'vault_capture';
3842

39-
/**
40-
* Braintree clone transaction command
41-
*/
42-
const CLONE_TRANSACTION = 'clone';
43-
4443
/**
4544
* @var CommandPoolInterface
4645
*/
@@ -66,6 +65,16 @@ class CaptureStrategyCommand implements CommandInterface
6665
*/
6766
private $subjectReader;
6867

68+
/**
69+
* @var BraintreeAdapter
70+
*/
71+
private $braintreeAdapter;
72+
73+
/**
74+
* @var BraintreeSearchAdapter
75+
*/
76+
private $braintreeSearchAdapter;
77+
6978
/**
7079
* Constructor
7180
*
@@ -74,19 +83,25 @@ class CaptureStrategyCommand implements CommandInterface
7483
* @param FilterBuilder $filterBuilder
7584
* @param SearchCriteriaBuilder $searchCriteriaBuilder
7685
* @param SubjectReader $subjectReader
86+
* @param BraintreeAdapter $braintreeAdapter
87+
* @param BraintreeSearchAdapter $braintreeSearchAdapter
7788
*/
7889
public function __construct(
7990
CommandPoolInterface $commandPool,
8091
TransactionRepositoryInterface $repository,
8192
FilterBuilder $filterBuilder,
8293
SearchCriteriaBuilder $searchCriteriaBuilder,
83-
SubjectReader $subjectReader
94+
SubjectReader $subjectReader,
95+
BraintreeAdapter $braintreeAdapter,
96+
BraintreeSearchAdapter $braintreeSearchAdapter
8497
) {
8598
$this->commandPool = $commandPool;
8699
$this->transactionRepository = $repository;
87100
$this->filterBuilder = $filterBuilder;
88101
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
89102
$this->subjectReader = $subjectReader;
103+
$this->braintreeAdapter = $braintreeAdapter;
104+
$this->braintreeSearchAdapter = $braintreeSearchAdapter;
90105
}
91106

92107
/**
@@ -102,7 +117,7 @@ public function execute(array $commandSubject)
102117
ContextHelper::assertOrderPayment($paymentInfo);
103118

104119
$command = $this->getCommand($paymentInfo);
105-
return $this->commandPool->get($command)->execute($commandSubject);
120+
$this->commandPool->get($command)->execute($commandSubject);
106121
}
107122

108123
/**
@@ -119,14 +134,30 @@ private function getCommand(OrderPaymentInterface $payment)
119134
}
120135

121136
// do capture for authorization transaction
122-
if (!$existsCapture) {
137+
if (!$existsCapture && !$this->isExpiredAuthorization($payment)) {
123138
return self::CAPTURE;
124139
}
125140

126141
// process capture for payment via Vault
127142
return self::VAULT_CAPTURE;
128143
}
129144

145+
/**
146+
* @param OrderPaymentInterface $payment
147+
* @return boolean
148+
*/
149+
private function isExpiredAuthorization(OrderPaymentInterface $payment)
150+
{
151+
$collection = $this->braintreeAdapter->search(
152+
[
153+
$this->braintreeSearchAdapter->id()->is($payment->getLastTransId()),
154+
$this->braintreeSearchAdapter->status()->is(Transaction::AUTHORIZATION_EXPIRED)
155+
]
156+
);
157+
158+
return $collection->maximumCount() > 0;
159+
}
160+
130161
/**
131162
* Check if capture transaction already exists
132163
*

0 commit comments

Comments
 (0)