Skip to content

Commit 6b75291

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-56052' into troll_bugfix
2 parents 166c317 + c530573 commit 6b75291

File tree

19 files changed

+578
-237
lines changed

19 files changed

+578
-237
lines changed

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'];
20+
return ['VI', 'MC', 'AE', 'DI', 'JCB', 'DN'];
2121
}
2222
}

app/code/Magento/Authorizenet/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<payment>
1111
<authorizenet_directpost>
1212
<active>0</active>
13-
<cctypes>AE,VI,MC,DI</cctypes>
13+
<cctypes>AE,VI,MC,DI,JCB,DN</cctypes>
1414
<debug>0</debug>
1515
<email_customer>0</email_customer>
1616
<login backend_model="Magento\Config\Model\Config\Backend\Encrypted" />

app/code/Magento/Paypal/view/frontend/web/js/view/payment/method-renderer/in-context/checkout-express.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ define(
2525
) {
2626
'use strict';
2727

28+
// State of PayPal module initialization
29+
var clientInit = false;
30+
2831
return Component.extend({
2932

3033
defaults: {
@@ -93,15 +96,26 @@ define(
9396
* @returns {Object}
9497
*/
9598
initClient: function () {
99+
var selector = '#' + this.getButtonId();
100+
96101
_.each(this.clientConfig, function (fn, name) {
97102
if (typeof fn === 'function') {
98103
this.clientConfig[name] = fn.bind(this);
99104
}
100105
}, this);
101106

102-
domObserver.get('#' + this.getButtonId(), function () {
103-
paypalExpressCheckout.checkout.setup(this.merchantId, this.clientConfig);
104-
}.bind(this));
107+
if (!clientInit) {
108+
domObserver.get(selector, function () {
109+
paypalExpressCheckout.checkout.setup(this.merchantId, this.clientConfig);
110+
clientInit = true;
111+
domObserver.off(selector);
112+
}.bind(this));
113+
} else {
114+
domObserver.get(selector, function () {
115+
$(selector).on('click', this.clientConfig.click);
116+
domObserver.off(selector);
117+
}.bind(this));
118+
}
105119

106120
return this;
107121
},

app/code/Magento/Ui/view/base/web/js/grid/provider.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ define([
4343
.initStorage()
4444
.clearData();
4545

46+
// Load data when there will
47+
// be no more pending assets.
48+
resolver(this.reload, this);
49+
4650
return this;
4751
},
4852

@@ -122,9 +126,11 @@ define([
122126
* Handles changes of 'params' object.
123127
*/
124128
onParamsChange: function () {
125-
this.firstLoad ?
126-
resolver(this.reload, this) :
129+
// It's necessary to make a reload only
130+
// after the initial loading has been made.
131+
if (!this.firstLoad) {
127132
this.reload();
133+
}
128134
},
129135

130136
/**
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Vault\Api;
7+
8+
use Magento\Vault\Model\VaultPaymentInterface;
9+
10+
/**
11+
* Contains methods to retrieve vault payment methods
12+
* This interface is consistent with \Magento\Payment\Api\PaymentMethodListInterface
13+
* @api
14+
*/
15+
interface PaymentMethodListInterface
16+
{
17+
/**
18+
* Get list of available vault payments
19+
* @param int $storeId
20+
* @return VaultPaymentInterface[]
21+
*/
22+
public function getList($storeId);
23+
24+
/**
25+
* Get list of enabled in the configuration vault payments
26+
* @param int $storeId
27+
* @return VaultPaymentInterface[]
28+
*/
29+
public function getActiveList($storeId);
30+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Vault\Model;
7+
8+
use Magento\Payment\Api\Data\PaymentMethodInterface;
9+
use Magento\Payment\Api\PaymentMethodListInterface;
10+
use Magento\Payment\Model\Method\InstanceFactory;
11+
use Magento\Payment\Model\MethodInterface;
12+
use Magento\Vault\Api\PaymentMethodListInterface as VaultPaymentMethodListInterface;
13+
14+
/**
15+
* Contains methods to retrieve configured vault payments
16+
*/
17+
class PaymentMethodList implements VaultPaymentMethodListInterface
18+
{
19+
/**
20+
* @var InstanceFactory
21+
*/
22+
private $instanceFactory;
23+
24+
/**
25+
* @var PaymentMethodListInterface
26+
*/
27+
private $paymentMethodList;
28+
29+
/**
30+
* PaymentMethodList constructor.
31+
* @param PaymentMethodListInterface $paymentMethodList
32+
* @param InstanceFactory $instanceFactory
33+
*/
34+
public function __construct(PaymentMethodListInterface $paymentMethodList, InstanceFactory $instanceFactory)
35+
{
36+
$this->instanceFactory = $instanceFactory;
37+
$this->paymentMethodList = $paymentMethodList;
38+
}
39+
40+
/**
41+
* @inheritdoc
42+
*/
43+
public function getList($storeId)
44+
{
45+
return $this->filterList($this->paymentMethodList->getList($storeId));
46+
}
47+
48+
/**
49+
* @inheritdoc
50+
*/
51+
public function getActiveList($storeId)
52+
{
53+
return $this->filterList($this->paymentMethodList->getActiveList($storeId));
54+
}
55+
56+
/**
57+
* Filter vault methods from payments
58+
* @param PaymentMethodInterface[] $list
59+
* @return VaultPaymentInterface[]
60+
*/
61+
private function filterList(array $list)
62+
{
63+
$paymentMethods = array_map(
64+
function (PaymentMethodInterface $paymentMethod) {
65+
return $this->instanceFactory->create($paymentMethod);
66+
},
67+
$list
68+
);
69+
70+
$availableMethods = array_filter(
71+
$paymentMethods,
72+
function (MethodInterface $methodInstance) {
73+
return $methodInstance instanceof VaultPaymentInterface;
74+
}
75+
);
76+
return array_values($availableMethods);
77+
}
78+
}

app/code/Magento/Vault/Model/Ui/TokensConfigProvider.php

Lines changed: 11 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77

88
use Magento\Checkout\Model\ConfigProviderInterface;
99
use Magento\Framework\App\ObjectManager;
10-
use Magento\Payment\Api\Data\PaymentMethodInterface;
1110
use Magento\Store\Model\StoreManagerInterface;
11+
use Magento\Vault\Api\PaymentMethodListInterface;
1212
use Magento\Vault\Model\CustomerTokenManagement;
13-
use Magento\Vault\Model\VaultPaymentInterface;
1413

1514
/**
1615
* Class ConfigProvider
@@ -39,14 +38,9 @@ final class TokensConfigProvider implements ConfigProviderInterface
3938
private $customerTokenManagement;
4039

4140
/**
42-
* @var \Magento\Payment\Api\PaymentMethodListInterface
41+
* @var PaymentMethodListInterface
4342
*/
44-
private $paymentMethodList;
45-
46-
/**
47-
* @var \Magento\Payment\Model\Method\InstanceFactory
48-
*/
49-
private $paymentMethodInstanceFactory;
43+
private $vaultPaymentList;
5044

5145
/**
5246
* Constructor
@@ -112,7 +106,8 @@ public function getConfig()
112106
private function getComponentProviders()
113107
{
114108
$providers = [];
115-
$vaultPaymentMethods = $this->getVaultPaymentMethodList();
109+
$storeId = $this->storeManager->getStore()->getId();
110+
$vaultPaymentMethods = $this->getVaultPaymentList()->getActiveList($storeId);
116111

117112
foreach ($vaultPaymentMethods as $method) {
118113
$providerCode = $method->getProviderCode();
@@ -141,60 +136,15 @@ private function getComponentProvider($vaultProviderCode)
141136
}
142137

143138
/**
144-
* Get list of active Vault payment methods.
145-
*
146-
* @return VaultPaymentInterface[]
147-
*/
148-
private function getVaultPaymentMethodList()
149-
{
150-
$storeId = $this->storeManager->getStore()->getId();
151-
152-
$paymentMethods = array_map(
153-
function (PaymentMethodInterface $paymentMethod) {
154-
return $this->getPaymentMethodInstanceFactory()->create($paymentMethod);
155-
},
156-
$this->getPaymentMethodList()->getActiveList($storeId)
157-
);
158-
159-
$availableMethods = array_filter(
160-
$paymentMethods,
161-
function (\Magento\Payment\Model\MethodInterface $methodInstance) {
162-
return $methodInstance instanceof VaultPaymentInterface;
163-
}
164-
);
165-
166-
return $availableMethods;
167-
}
168-
169-
/**
170-
* Get payment method list.
171-
*
172-
* @return \Magento\Payment\Api\PaymentMethodListInterface
173-
* @deprecated
174-
*/
175-
private function getPaymentMethodList()
176-
{
177-
if ($this->paymentMethodList === null) {
178-
$this->paymentMethodList = ObjectManager::getInstance()->get(
179-
\Magento\Payment\Api\PaymentMethodListInterface::class
180-
);
181-
}
182-
return $this->paymentMethodList;
183-
}
184-
185-
/**
186-
* Get payment method instance factory.
187-
*
188-
* @return \Magento\Payment\Model\Method\InstanceFactory
139+
* Get instance of vault payment list instance
140+
* @return PaymentMethodListInterface
189141
* @deprecated
190142
*/
191-
private function getPaymentMethodInstanceFactory()
143+
private function getVaultPaymentList()
192144
{
193-
if ($this->paymentMethodInstanceFactory === null) {
194-
$this->paymentMethodInstanceFactory = ObjectManager::getInstance()->get(
195-
\Magento\Payment\Model\Method\InstanceFactory::class
196-
);
145+
if ($this->vaultPaymentList === null) {
146+
$this->vaultPaymentList = ObjectManager::getInstance()->get(PaymentMethodListInterface::class);
197147
}
198-
return $this->paymentMethodInstanceFactory;
148+
return $this->vaultPaymentList;
199149
}
200150
}

0 commit comments

Comments
 (0)