Skip to content

Commit 5a849b1

Browse files
committed
Merge branch 'develop' of https://github.com/magento-qmt/magento2ce into PR
2 parents 1d8b89c + 532dcd5 commit 5a849b1

File tree

161 files changed

+5365
-803
lines changed

Some content is hidden

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

161 files changed

+5365
-803
lines changed

.htaccess

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,6 @@
3232

3333
DirectoryIndex index.php
3434

35-
<IfModule mod_php5.c>
36-
37-
############################################
38-
## adjust memory limit
39-
40-
php_value memory_limit 768M
41-
php_value max_execution_time 18000
42-
43-
############################################
44-
## disable automatic session start
45-
## before autoload was initialized
46-
47-
php_flag session.auto_start off
48-
49-
############################################
50-
## enable resulting html compression
51-
52-
#php_flag zlib.output_compression on
53-
54-
###########################################
55-
## disable user agent verification to not break multiple image upload
56-
57-
php_flag suhosin.session.cryptua off
58-
59-
</IfModule>
60-
61-
<IfModule mod_php7.c>
62-
6335
############################################
6436
## adjust memory limit
6537

@@ -82,8 +54,6 @@
8254

8355
php_flag suhosin.session.cryptua off
8456

85-
</IfModule>
86-
8757
<IfModule mod_security.c>
8858
###########################################
8959
## disable POST processing to not break multiple image upload

.htaccess.sample

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,6 @@
3232

3333
DirectoryIndex index.php
3434

35-
<IfModule mod_php5.c>
36-
37-
############################################
38-
## adjust memory limit
39-
40-
php_value memory_limit 768M
41-
php_value max_execution_time 18000
42-
43-
############################################
44-
## disable automatic session start
45-
## before autoload was initialized
46-
47-
php_flag session.auto_start off
48-
49-
############################################
50-
## enable resulting html compression
51-
52-
#php_flag zlib.output_compression on
53-
54-
###########################################
55-
## disable user agent verification to not break multiple image upload
56-
57-
php_flag suhosin.session.cryptua off
58-
59-
</IfModule>
60-
61-
<IfModule mod_php7.c>
62-
6335
############################################
6436
## adjust memory limit
6537

@@ -82,8 +54,6 @@
8254

8355
php_flag suhosin.session.cryptua off
8456

85-
</IfModule>
86-
8757
<IfModule mod_security.c>
8858
###########################################
8959
## disable POST processing to not break multiple image upload

app/code/Magento/Authorizenet/Model/Source/Cctype.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ class Cctype extends PaymentCctype
1717
*/
1818
public function getAllowedTypes()
1919
{
20-
return ['VI', 'MC', 'AE', 'DI', 'OT'];
20+
return ['VI', 'MC', 'AE', 'DI'];
2121
}
2222
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Block\Customer\PayPal;
7+
8+
use Magento\Braintree\Gateway\Config\PayPal\Config;
9+
use Magento\Braintree\Model\Ui\PayPal\ConfigProvider;
10+
use Magento\Framework\View\Element\Template;
11+
use Magento\Vault\Api\Data\PaymentTokenInterface;
12+
use Magento\Vault\Block\AbstractTokenRenderer;
13+
14+
/**
15+
* Class VaultTokenRenderer
16+
*/
17+
class VaultTokenRenderer extends AbstractTokenRenderer
18+
{
19+
/**
20+
* @var Config
21+
*/
22+
private $config;
23+
24+
public function __construct(
25+
Template\Context $context,
26+
Config $config,
27+
array $data = []
28+
) {
29+
parent::__construct($context, $data);
30+
$this->config = $config;
31+
}
32+
33+
/**
34+
* @inheritdoc
35+
*/
36+
public function getIconUrl()
37+
{
38+
return $this->config->getPayPalIcon()['url'];
39+
}
40+
41+
/**
42+
* @inheritdoc
43+
*/
44+
public function getIconHeight()
45+
{
46+
return $this->config->getPayPalIcon()['height'];
47+
}
48+
49+
/**
50+
* @inheritdoc
51+
*/
52+
public function getIconWidth()
53+
{
54+
return $this->config->getPayPalIcon()['width'];
55+
}
56+
57+
/**
58+
* Can render specified token
59+
*
60+
* @param PaymentTokenInterface $token
61+
* @return boolean
62+
*/
63+
public function canRender(PaymentTokenInterface $token)
64+
{
65+
return $token->getPaymentMethodCode() === ConfigProvider::PAYPAL_CODE;
66+
}
67+
68+
/**
69+
* Get email of PayPal payer
70+
* @return string
71+
*/
72+
public function getPayerEmail()
73+
{
74+
return $this->getTokenDetails()['payerEmail'];
75+
}
76+
}

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ class Config extends \Magento\Payment\Gateway\Config\Config
3030
const KEY_KOUNT_MERCHANT_ID = 'kount_id';
3131
const FRAUD_PROTECTION = 'fraudprotection';
3232

33+
/**
34+
* Get list of available dynamic descriptors keys
35+
* @var array
36+
*/
37+
private static $dynamicDescriptorKeys = [
38+
'name', 'phone', 'url'
39+
];
40+
3341
/**
3442
* Return the country specific card type config
3543
*
@@ -169,4 +177,20 @@ public function isActive()
169177
{
170178
return (bool) $this->getValue(self::KEY_ACTIVE);
171179
}
180+
181+
/**
182+
* Get list of configured dynamic descriptors
183+
* @return array
184+
*/
185+
public function getDynamicDescriptors()
186+
{
187+
$values = [];
188+
foreach (self::$dynamicDescriptorKeys as $key) {
189+
$value = $this->getValue('descriptor_' . $key);
190+
if (!empty($value)) {
191+
$values[$key] = $value;
192+
}
193+
}
194+
return $values;
195+
}
172196
}

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

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

8+
use Magento\Framework\App\Config\ScopeConfigInterface;
9+
use Magento\Payment\Model\CcConfig;
10+
811
/**
912
* Class Config
1013
*/
@@ -22,6 +25,26 @@ class Config extends \Magento\Payment\Gateway\Config\Config
2225

2326
const KEY_REQUIRE_BILLING_ADDRESS = 'require_billing_address';
2427

28+
/**
29+
* @var CcConfig
30+
*/
31+
private $ccConfig;
32+
33+
/**
34+
* @var array
35+
*/
36+
private $icon = [];
37+
38+
public function __construct(
39+
ScopeConfigInterface $scopeConfig,
40+
CcConfig $ccConfig,
41+
$methodCode = null,
42+
$pathPattern = self::DEFAULT_PATH_PATTERN
43+
) {
44+
parent::__construct($scopeConfig, $methodCode, $pathPattern);
45+
$this->ccConfig = $ccConfig;
46+
}
47+
2548
/**
2649
* Get Payment configuration status
2750
*
@@ -79,4 +102,32 @@ public function getTitle()
79102
{
80103
return $this->getValue(self::KEY_TITLE);
81104
}
105+
106+
/**
107+
* Is need to skip order review
108+
* @return bool
109+
*/
110+
public function isSkipOrderReview()
111+
{
112+
return (bool) $this->getValue('skip_order_review');
113+
}
114+
115+
/**
116+
* Get PayPal icon
117+
* @return array
118+
*/
119+
public function getPayPalIcon()
120+
{
121+
if (empty($this->icon)) {
122+
$asset = $this->ccConfig->createAsset('Magento_Braintree::images/paypal.png');
123+
list($width, $height) = getimagesize($asset->getSourceFile());
124+
$this->icon = [
125+
'url' => $asset->getUrl(),
126+
'width' => $width,
127+
'height' => $height
128+
];
129+
}
130+
131+
return $this->icon;
132+
}
82133
}

app/code/Magento/Braintree/Gateway/Helper/SubjectReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function readAmount(array $subject)
8383
*/
8484
public function readCustomerId(array $subject)
8585
{
86-
if (empty($subject['customer_id'])) {
86+
if (!isset($subject['customer_id'])) {
8787
throw new \InvalidArgumentException('The "customerId" field does not exists');
8888
}
8989

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Gateway\Request;
7+
8+
use Magento\Payment\Gateway\Request\BuilderInterface;
9+
use Magento\Braintree\Gateway\Config\Config;
10+
11+
/**
12+
* Class DescriptorDataBuilder
13+
*/
14+
class DescriptorDataBuilder implements BuilderInterface
15+
{
16+
/**
17+
* @var string
18+
*/
19+
private static $descriptorKey = 'descriptor';
20+
21+
/**
22+
* @var Config
23+
*/
24+
private $config;
25+
26+
/**
27+
* DescriptorDataBuilder constructor.
28+
* @param Config $config
29+
*/
30+
public function __construct(Config $config)
31+
{
32+
$this->config = $config;
33+
}
34+
35+
/**
36+
* @inheritdoc
37+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
38+
*/
39+
public function build(array $buildSubject)
40+
{
41+
$values = $this->config->getDynamicDescriptors();
42+
return !empty($values) ? [self::$descriptorKey => $values] : [];
43+
}
44+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Gateway\Request\PayPal;
7+
8+
use Magento\Braintree\Gateway\Helper\SubjectReader;
9+
use Magento\Braintree\Observer\DataAssignObserver;
10+
use Magento\Payment\Gateway\Request\BuilderInterface;
11+
12+
/**
13+
* Class DeviceDataBuilder
14+
*/
15+
class DeviceDataBuilder implements BuilderInterface
16+
{
17+
/**
18+
* @var string
19+
*/
20+
private static $deviceDataKey = 'deviceData';
21+
22+
/**
23+
* @var SubjectReader
24+
*/
25+
private $subjectReader;
26+
27+
/**
28+
* DeviceDataBuilder constructor.
29+
* @param SubjectReader $subjectReader
30+
*/
31+
public function __construct(SubjectReader $subjectReader)
32+
{
33+
$this->subjectReader = $subjectReader;
34+
}
35+
36+
/**
37+
* @inheritdoc
38+
*/
39+
public function build(array $buildSubject)
40+
{
41+
$result = [];
42+
$paymentDO = $this->subjectReader->readPayment($buildSubject);
43+
44+
$payment = $paymentDO->getPayment();
45+
$data = $payment->getAdditionalInformation();
46+
if (!empty($data[DataAssignObserver::DEVICE_DATA])) {
47+
$result[self::$deviceDataKey] = $data[DataAssignObserver::DEVICE_DATA];
48+
}
49+
50+
return $result;
51+
}
52+
}

0 commit comments

Comments
 (0)