Skip to content

Commit

Permalink
Merge pull request #664 from magento-fearless-kiwis/MAGETWO-62136
Browse files Browse the repository at this point in the history
[Kiwi] Prepare code base for 2.1.4
  • Loading branch information
Oleksii Korshenko authored Dec 13, 2016
2 parents bd7f025 + f20117e commit 7d6b7d2
Show file tree
Hide file tree
Showing 590 changed files with 17,737 additions and 2,960 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/Authorizenet/Model/Source/Cctype.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ class Cctype extends PaymentCctype
*/
public function getAllowedTypes()
{
return ['VI', 'MC', 'AE', 'DI', 'OT', 'JCB', 'DN'];
return ['VI', 'MC', 'AE', 'DI', 'JCB', 'DN'];
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Authorizenet/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
"version": "100.1.2",
"version": "100.1.3",
"license": [
"proprietary"
],
Expand Down
10 changes: 10 additions & 0 deletions app/code/Magento/Authorizenet/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,14 @@
<argument name="storage" xsi:type="object">Magento\Authorizenet\Model\Directpost\Session\Storage</argument>
</arguments>
</type>
<type name="Magento\Config\Model\Config\Export\ExcludeList">
<arguments>
<argument name="configs" xsi:type="array">
<item name="payment/authorizenet_directpost/login" xsi:type="string">1</item>
<item name="payment/authorizenet_directpost/trans_key" xsi:type="string">1</item>
<item name="payment/authorizenet_directpost/trans_md5" xsi:type="string">1</item>
<item name="payment/authorizenet_directpost/merchant_email" xsi:type="string">1</item>
</argument>
</arguments>
</type>
</config>
23 changes: 18 additions & 5 deletions app/code/Magento/Backend/App/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@

use Magento\Config\App\Config\Type\System;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\ObjectManager;

/**
* Backend config accessor.
*/
class Config implements ConfigInterface
{
/**
* @var \Magento\Framework\App\Config\ScopePool
*
* @deprecated
*/
protected $_scopePool;

/**
* @var \Magento\Framework\App\Config
*/
Expand All @@ -29,12 +37,17 @@ class Config implements ConfigInterface
private $data;

/**
* @param \Magento\Framework\App\Config $appConfig
* @return void
* @param \Magento\Framework\App\Config\ScopePool $scopePool
* @param \Magento\Framework\App\Config|null $appConfig
*/
public function __construct(\Magento\Framework\App\Config $appConfig)
{
$this->appConfig = $appConfig;
public function __construct(
\Magento\Framework\App\Config\ScopePool $scopePool,
\Magento\Framework\App\Config $appConfig = null
) {
$this->_scopePool = $scopePool;
$this->appConfig = $appConfig ?: ObjectManager::getInstance()->get(
\Magento\Framework\App\Config::class
);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Backend/Test/Unit/App/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ protected function setUp()
'',
false
);
$this->model = new \Magento\Backend\App\Config($this->appConfig);
$this->model = new \Magento\Backend\App\Config(
$this->getMock(\Magento\Framework\App\Config\ScopePool::class, [], [], '', false, false),
$this->appConfig
);
}

public function testGetValue()
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"magento/framework": "100.1.*"
},
"type": "magento2-module",
"version": "100.1.1",
"version": "100.1.2",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
18 changes: 18 additions & 0 deletions app/code/Magento/Backend/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,22 @@
</argument>
</arguments>
</type>
<type name="Magento\Config\Model\Config\Export\ExcludeList">
<arguments>
<argument name="configs" xsi:type="array">
<item name="trans_email/ident_general/name" xsi:type="string">1</item>
<item name="trans_email/ident_general/email" xsi:type="string">1</item>
<item name="trans_email/ident_sales/name" xsi:type="string">1</item>
<item name="trans_email/ident_sales/email" xsi:type="string">1</item>
<item name="trans_email/ident_support/name" xsi:type="string">1</item>
<item name="trans_email/ident_support/email" xsi:type="string">1</item>
<item name="trans_email/ident_custom1/name" xsi:type="string">1</item>
<item name="trans_email/ident_custom1/email" xsi:type="string">1</item>
<item name="trans_email/ident_custom2/name" xsi:type="string">1</item>
<item name="trans_email/ident_custom2/email" xsi:type="string">1</item>
<item name="admin/url/custom" xsi:type="string">1</item>
<item name="admin/url/custom_path" xsi:type="string">1</item>
</argument>
</arguments>
</type>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Braintree\Block\Customer\PayPal;

use Magento\Braintree\Gateway\Config\PayPal\Config;
use Magento\Braintree\Model\Ui\PayPal\ConfigProvider;
use Magento\Framework\View\Element\Template;
use Magento\Vault\Api\Data\PaymentTokenInterface;
use Magento\Vault\Block\AbstractTokenRenderer;

/**
* Class VaultTokenRenderer
*/
class VaultTokenRenderer extends AbstractTokenRenderer
{
/**
* @var Config
*/
private $config;

public function __construct(
Template\Context $context,
Config $config,
array $data = []
) {
parent::__construct($context, $data);
$this->config = $config;
}

/**
* @inheritdoc
*/
public function getIconUrl()
{
return $this->config->getPayPalIcon()['url'];
}

/**
* @inheritdoc
*/
public function getIconHeight()
{
return $this->config->getPayPalIcon()['height'];
}

/**
* @inheritdoc
*/
public function getIconWidth()
{
return $this->config->getPayPalIcon()['width'];
}

/**
* Can render specified token
*
* @param PaymentTokenInterface $token
* @return boolean
*/
public function canRender(PaymentTokenInterface $token)
{
return $token->getPaymentMethodCode() === ConfigProvider::PAYPAL_CODE;
}

/**
* Get email of PayPal payer
* @return string
*/
public function getPayerEmail()
{
return $this->getTokenDetails()['payerEmail'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,25 @@ private function isExpiredAuthorization(OrderPaymentInterface $payment)
*/
private function isExistsCaptureTransaction(OrderPaymentInterface $payment)
{
$filters[] = $this->filterBuilder->setField('payment_id')
->setValue($payment->getId())
->create();
$this->searchCriteriaBuilder->addFilters(
[
$this->filterBuilder
->setField('payment_id')
->setValue($payment->getId())
->create(),
]
);

$filters[] = $this->filterBuilder->setField('txn_type')
->setValue(TransactionInterface::TYPE_CAPTURE)
->create();
$this->searchCriteriaBuilder->addFilters(
[
$this->filterBuilder
->setField('txn_type')
->setValue(TransactionInterface::TYPE_CAPTURE)
->create(),
]
);

$searchCriteria = $this->searchCriteriaBuilder->addFilters($filters)
->create();
$searchCriteria = $this->searchCriteriaBuilder->create();

$count = $this->transactionRepository->getList($searchCriteria)->getTotalCount();
return (boolean) $count;
Expand Down
24 changes: 24 additions & 0 deletions app/code/Magento/Braintree/Gateway/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ class Config extends \Magento\Payment\Gateway\Config\Config
const KEY_KOUNT_MERCHANT_ID = 'kount_id';
const FRAUD_PROTECTION = 'fraudprotection';

/**
* Get list of available dynamic descriptors keys
* @var array
*/
private static $dynamicDescriptorKeys = [
'name', 'phone', 'url'
];

/**
* Return the country specific card type config
*
Expand Down Expand Up @@ -170,6 +178,22 @@ public function isActive()
return (bool) $this->getValue(self::KEY_ACTIVE);
}

/**
* Get list of configured dynamic descriptors
* @return array
*/
public function getDynamicDescriptors()
{
$values = [];
foreach (self::$dynamicDescriptorKeys as $key) {
$value = $this->getValue('descriptor_' . $key);
if (!empty($value)) {
$values[$key] = $value;
}
}
return $values;
}

/**
* Get Merchant account ID
*
Expand Down
51 changes: 51 additions & 0 deletions app/code/Magento/Braintree/Gateway/Config/PayPal/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\Braintree\Gateway\Config\PayPal;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Payment\Model\CcConfig;

/**
* Class Config
*/
Expand All @@ -22,6 +25,26 @@ class Config extends \Magento\Payment\Gateway\Config\Config

const KEY_REQUIRE_BILLING_ADDRESS = 'require_billing_address';

/**
* @var CcConfig
*/
private $ccConfig;

/**
* @var array
*/
private $icon = [];

public function __construct(
ScopeConfigInterface $scopeConfig,
CcConfig $ccConfig,
$methodCode = null,
$pathPattern = self::DEFAULT_PATH_PATTERN
) {
parent::__construct($scopeConfig, $methodCode, $pathPattern);
$this->ccConfig = $ccConfig;
}

/**
* Get Payment configuration status
*
Expand Down Expand Up @@ -79,4 +102,32 @@ public function getTitle()
{
return $this->getValue(self::KEY_TITLE);
}

/**
* Is need to skip order review
* @return bool
*/
public function isSkipOrderReview()
{
return (bool) $this->getValue('skip_order_review');
}

/**
* Get PayPal icon
* @return array
*/
public function getPayPalIcon()
{
if (empty($this->icon)) {
$asset = $this->ccConfig->createAsset('Magento_Braintree::images/paypal.png');
list($width, $height) = getimagesize($asset->getSourceFile());
$this->icon = [
'url' => $asset->getUrl(),
'width' => $width,
'height' => $height
];
}

return $this->icon;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function readAmount(array $subject)
*/
public function readCustomerId(array $subject)
{
if (empty($subject['customer_id'])) {
if (!isset($subject['customer_id'])) {
throw new \InvalidArgumentException('The "customerId" field does not exists');
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Braintree\Gateway\Request;

use Magento\Payment\Gateway\Request\BuilderInterface;
use Magento\Braintree\Gateway\Config\Config;

/**
* Class DescriptorDataBuilder
*/
class DescriptorDataBuilder implements BuilderInterface
{
/**
* @var string
*/
private static $descriptorKey = 'descriptor';

/**
* @var Config
*/
private $config;

/**
* DescriptorDataBuilder constructor.
* @param Config $config
*/
public function __construct(Config $config)
{
$this->config = $config;
}

/**
* @inheritdoc
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function build(array $buildSubject)
{
$values = $this->config->getDynamicDescriptors();
return !empty($values) ? [self::$descriptorKey => $values] : [];
}
}
Loading

0 comments on commit 7d6b7d2

Please sign in to comment.