6
6
namespace Magento \Paypal \Helper ;
7
7
8
8
use Magento \Framework \App \ObjectManager ;
9
- use Magento \Payment \Model \Method \AbstractMethod ;
10
- use Magento \Paypal \Model \Billing \Agreement \MethodInterface ;
9
+ use Magento \Payment \Api \Data \PaymentMethodInterface ;
10
+ use Magento \Payment \Api \PaymentMethodListInterface ;
11
+ use Magento \Payment \Model \Method \InstanceFactory ;
12
+ use Magento \Payment \Model \MethodInterface ;
13
+ use Magento \Paypal \Model \Billing \Agreement \MethodInterface as BillingAgreementMethodInterface ;
11
14
12
15
/**
13
16
* Paypal Data helper
@@ -45,12 +48,12 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
45
48
private $ configFactory ;
46
49
47
50
/**
48
- * @var \Magento\Payment\Api\ PaymentMethodListInterface
51
+ * @var PaymentMethodListInterface
49
52
*/
50
53
private $ paymentMethodList ;
51
54
52
55
/**
53
- * @var \Magento\Payment\Model\Method\ InstanceFactory
56
+ * @var InstanceFactory
54
57
*/
55
58
private $ paymentMethodInstanceFactory ;
56
59
@@ -100,21 +103,21 @@ public function shouldAskToCreateBillingAgreement(\Magento\Paypal\Model\Config $
100
103
*
101
104
* @param null|string|bool|int|\Magento\Store\Model\Store $store
102
105
* @param \Magento\Quote\Model\Quote|null $quote
103
- * @return MethodInterface []
106
+ * @return BillingAgreementMethodInterface []
104
107
*/
105
108
public function getBillingAgreementMethods ($ store = null , $ quote = null )
106
109
{
107
110
$ activeMethods = array_map (
108
- function (\ Magento \ Payment \ Api \ Data \ PaymentMethodInterface $ method ) {
111
+ function (PaymentMethodInterface $ method ) {
109
112
return $ this ->getPaymentMethodInstanceFactory ()->create ($ method );
110
113
},
111
114
$ this ->getPaymentMethodList ()->getActiveList ($ store )
112
115
);
113
116
114
117
$ result = array_filter (
115
118
$ activeMethods ,
116
- function (AbstractMethod $ method ) use ($ quote ) {
117
- return $ method ->isAvailable ($ quote ) && $ method instanceof MethodInterface ;
119
+ function (MethodInterface $ method ) use ($ quote ) {
120
+ return $ method instanceof BillingAgreementMethodInterface && $ method ->isAvailable ($ quote );
118
121
}
119
122
);
120
123
@@ -142,14 +145,14 @@ public function getHtmlTransactionId($methodCode, $txnId)
142
145
/**
143
146
* Get payment method list.
144
147
*
145
- * @return \Magento\Payment\Api\ PaymentMethodListInterface
148
+ * @return PaymentMethodListInterface
146
149
* @deprecated
147
150
*/
148
151
private function getPaymentMethodList ()
149
152
{
150
153
if ($ this ->paymentMethodList === null ) {
151
154
$ this ->paymentMethodList = ObjectManager::getInstance ()->get (
152
- \ Magento \ Payment \ Api \ PaymentMethodListInterface::class
155
+ PaymentMethodListInterface::class
153
156
);
154
157
}
155
158
return $ this ->paymentMethodList ;
@@ -158,14 +161,14 @@ private function getPaymentMethodList()
158
161
/**
159
162
* Get payment method instance factory.
160
163
*
161
- * @return \Magento\Payment\Model\Method\ InstanceFactory
164
+ * @return InstanceFactory
162
165
* @deprecated
163
166
*/
164
167
private function getPaymentMethodInstanceFactory ()
165
168
{
166
169
if ($ this ->paymentMethodInstanceFactory === null ) {
167
170
$ this ->paymentMethodInstanceFactory = ObjectManager::getInstance ()->get (
168
- \ Magento \ Payment \ Model \ Method \ InstanceFactory::class
171
+ InstanceFactory::class
169
172
);
170
173
}
171
174
return $ this ->paymentMethodInstanceFactory ;
0 commit comments