Skip to content

Commit 22cbf56

Browse files
committed
Merge pull request #358 from magento-mpi/PR-MPI-S76
[MPI] Sprint 76
2 parents 2ea8cdd + e0a9574 commit 22cbf56

File tree

332 files changed

+12583
-2084
lines changed

Some content is hidden

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

332 files changed

+12583
-2084
lines changed

app/code/Magento/Authorizenet/view/adminhtml/web/js/direct-post.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ directPost.prototype = {
2020
var prepare = function (event, method) {
2121
if (method === 'authorizenet_directpost') {
2222
this.preparePayment();
23+
} else {
24+
jQuery('#edit_form')
25+
.off('submitOrder.authorizenet');
2326
}
2427
};
2528
this.iframeId = iframeId;
@@ -76,7 +79,7 @@ directPost.prototype = {
7679
this.changeInputOptions('autocomplete', 'off');
7780
jQuery('#edit_form')
7881
.off('submitOrder')
79-
.on('submitOrder', this.submitAdminOrder.bind(this));
82+
.on('submitOrder.authorizenet', this.submitAdminOrder.bind(this));
8083
if ($(this.iframeId)) {
8184
// Temporary solution will be removed after refactoring Authorize.Net (sales) functionality
8285
jQuery('.scalable.save:not(disabled)').removeAttr('onclick');

app/code/Magento/Backend/App/AbstractAction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function __construct(Action\Context $context)
102102
*/
103103
protected function _isAllowed()
104104
{
105-
return $this->_authorization->isAllowed(self::ADMIN_RESOURCE);
105+
return $this->_authorization->isAllowed(static::ADMIN_RESOURCE);
106106
}
107107

108108
/**

app/code/Magento/BraintreeTwo/Block/Adminhtml/Form/Field/Cctypes.php renamed to app/code/Magento/BraintreeTwo/Block/Adminhtml/Form/Field/CcTypes.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
*/
66
namespace Magento\BraintreeTwo\Block\Adminhtml\Form\Field;
77

8+
use Magento\BraintreeTwo\Helper\CcType;
89
use Magento\Framework\View\Element\Context;
910
use Magento\Framework\View\Element\Html\Select;
10-
use Magento\BraintreeTwo\Helper\CcType;
1111

1212
/**
13-
* Class Cctypes
13+
* Class CcTypes
1414
*/
15-
class Cctypes extends Select
15+
class CcTypes extends Select
1616
{
1717
/**
18-
* @var \
18+
* @var CcType
1919
*/
2020
private $ccTypeHelper;
2121

2222
/**
2323
* Constructor
2424
*
25-
* @param \Magento\Framework\View\Element\Context $context
26-
* @param \Magento\BraintreeTwo\Helper\CcType $ccTypeHelper
25+
* @param Context $context
26+
* @param CcType $ccTypeHelper
2727
* @param array $data
2828
*/
2929
public function __construct(

app/code/Magento/BraintreeTwo/Block/Adminhtml/Form/Field/Countries.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
class Countries extends Select
1616
{
1717
/**
18-
* @var \Magento\BraintreeTwo\Helper\Country
18+
* @var Country
1919
*/
2020
private $countryHelper;
2121

2222
/**
2323
* Constructor
2424
*
25-
* @param \Magento\Framework\View\Element\Context $context
26-
* @param \Magento\BraintreeTwo\Helper\Country $countryHelper
25+
* @param Context $context
26+
* @param Country $countryHelper
2727
* @param array $data
2828
*/
2929
public function __construct(Context $context, Country $countryHelper, array $data = [])

app/code/Magento/BraintreeTwo/Block/Adminhtml/Form/Field/CountryCreditCard.php

+7-8
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
*/
66
namespace Magento\BraintreeTwo\Block\Adminhtml\Form\Field;
77

8-
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
98
use Magento\Framework\DataObject;
9+
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
1010

1111
/**
1212
* Class CountryCreditCard
1313
*/
1414
class CountryCreditCard extends AbstractFieldArray
1515
{
1616
/**
17-
* @var \Magento\BraintreeTwo\Block\Adminhtml\Form\Field\Countries
17+
* @var Countries
1818
*/
1919
protected $countryRenderer = null;
2020

2121
/**
22-
* @var \Magento\BraintreeTwo\Block\Adminhtml\Form\Field\CcTypes
22+
* @var CcTypes
2323
*/
2424
protected $ccTypesRenderer = null;
2525

2626
/**
2727
* Returns renderer for country element
2828
*
29-
* @return \Magento\BraintreeTwo\Block\Adminhtml\Form\Field\Countries
29+
* @return Countries
3030
*/
3131
protected function getCountryRenderer()
3232
{
@@ -43,13 +43,13 @@ protected function getCountryRenderer()
4343
/**
4444
* Returns renderer for country element
4545
*
46-
* @return \Magento\BraintreeTwo\Block\Adminhtml\Form\Field\Cctypes
46+
* @return CcTypes
4747
*/
4848
protected function getCcTypesRenderer()
4949
{
5050
if (!$this->ccTypesRenderer) {
5151
$this->ccTypesRenderer = $this->getLayout()->createBlock(
52-
Cctypes::class,
52+
CcTypes::class,
5353
'',
5454
['data' => ['is_render_to_js_template' => true]]
5555
);
@@ -84,7 +84,7 @@ protected function _prepareToRender()
8484
/**
8585
* Prepare existing row data object
8686
*
87-
* @param \Magento\Framework\DataObject $row
87+
* @param DataObject $row
8888
* @return void
8989
*/
9090
protected function _prepareArrayRow(DataObject $row)
@@ -102,6 +102,5 @@ protected function _prepareArrayRow(DataObject $row)
102102
}
103103
}
104104
$row->setData('option_extra_attrs', $options);
105-
return;
106105
}
107106
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\BraintreeTwo\Block\Customer;
7+
8+
use Magento\BraintreeTwo\Model\Ui\ConfigProvider;
9+
use Magento\Framework\View\Element\Template;
10+
use Magento\Vault\Api\Data\PaymentTokenInterface;
11+
use Magento\Vault\Block\AbstractCardRenderer;
12+
13+
class CardRenderer extends AbstractCardRenderer
14+
{
15+
/**
16+
* Can render specified token
17+
*
18+
* @param PaymentTokenInterface $token
19+
* @return boolean
20+
*/
21+
public function canRender(PaymentTokenInterface $token)
22+
{
23+
return $token->getPaymentMethodCode() === ConfigProvider::CODE;
24+
}
25+
26+
/**
27+
* @return string
28+
*/
29+
public function getNumberLast4Digits()
30+
{
31+
return $this->getTokenDetails()['maskedCC'];
32+
}
33+
34+
/**
35+
* @return string
36+
*/
37+
public function getExpDate()
38+
{
39+
return $this->getTokenDetails()['expirationDate'];
40+
}
41+
42+
/**
43+
* @return string
44+
*/
45+
public function getIconUrl()
46+
{
47+
return $this->getIconForType($this->getTokenDetails()['type'])['url'];
48+
}
49+
50+
/**
51+
* @return int
52+
*/
53+
public function getIconHeight()
54+
{
55+
return $this->getIconForType($this->getTokenDetails()['type'])['height'];
56+
}
57+
58+
/**
59+
* @return int
60+
*/
61+
public function getIconWidth()
62+
{
63+
return $this->getIconForType($this->getTokenDetails()['type'])['width'];
64+
}
65+
}

app/code/Magento/BraintreeTwo/Block/Form.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Magento\BraintreeTwo\Gateway\Config\Config as GatewayConfig;
1010
use Magento\BraintreeTwo\Model\Adminhtml\Source\CcType;
1111
use Magento\BraintreeTwo\Model\Ui\ConfigProvider;
12-
use Magento\Checkout\Model\ConfigProviderInterface;
1312
use Magento\Framework\View\Element\Template\Context;
1413
use Magento\Payment\Block\Form\Cc;
1514
use Magento\Payment\Model\Config;
@@ -37,17 +36,17 @@ class Form extends Cc
3736
protected $ccType;
3837

3938
/**
40-
* @var ConfigProviderInterface
39+
* @var VaultPaymentInterface
4140
*/
42-
protected $vaultConfigProvider;
41+
protected $vaultService;
4342

4443
/**
4544
* @param Context $context
4645
* @param Config $paymentConfig
4746
* @param Quote $sessionQuote
4847
* @param GatewayConfig $gatewayConfig
4948
* @param CcType $ccType
50-
* @param ConfigProviderInterface $vaultConfigProvider
49+
* @param VaultPaymentInterface $vaultService
5150
* @param array $data
5251
*/
5352
public function __construct(
@@ -56,14 +55,14 @@ public function __construct(
5655
Quote $sessionQuote,
5756
GatewayConfig $gatewayConfig,
5857
CcType $ccType,
59-
ConfigProviderInterface $vaultConfigProvider,
58+
VaultPaymentInterface $vaultService,
6059
array $data = []
6160
) {
6261
parent::__construct($context, $paymentConfig, $data);
6362
$this->sessionQuote = $sessionQuote;
6463
$this->gatewayConfig = $gatewayConfig;
6564
$this->ccType = $ccType;
66-
$this->vaultConfigProvider = $vaultConfigProvider;
65+
$this->vaultService = $vaultService;
6766
}
6867

6968
/**
@@ -92,8 +91,7 @@ public function useCvv()
9291
*/
9392
public function isVaultEnabled()
9493
{
95-
$vault = $this->vaultConfigProvider->getConfig()[VaultPaymentInterface::CODE];
96-
return $vault['is_enabled'] && $vault['vault_provider_code'] == ConfigProvider::CODE;
94+
return $this->vaultService->isActiveForPayment(ConfigProvider::CODE);
9795
}
9896

9997
/**

0 commit comments

Comments
 (0)