11
11
use Magento \Checkout \Api \PaymentSavingRateLimiterInterface ;
12
12
use Magento \Framework \App \ObjectManager ;
13
13
use Magento \Framework \Exception \CouldNotSaveException ;
14
+ use Magento \Quote \Api \CartRepositoryInterface ;
14
15
15
16
/**
16
17
* Payment information management service.
@@ -51,7 +52,7 @@ class PaymentInformationManagement implements \Magento\Checkout\Api\PaymentInfor
51
52
private $ logger ;
52
53
53
54
/**
54
- * @var \Magento\Quote\Api\ CartRepositoryInterface
55
+ * @var CartRepositoryInterface
55
56
*/
56
57
private $ cartRepository ;
57
58
@@ -78,6 +79,7 @@ class PaymentInformationManagement implements \Magento\Checkout\Api\PaymentInfor
78
79
* @param \Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository
79
80
* @param PaymentProcessingRateLimiterInterface|null $paymentRateLimiter
80
81
* @param PaymentSavingRateLimiterInterface|null $saveRateLimiter
82
+ * @param CartRepositoryInterface|null $cartRepository
81
83
* @codeCoverageIgnore
82
84
*/
83
85
public function __construct (
@@ -87,7 +89,8 @@ public function __construct(
87
89
\Magento \Checkout \Model \PaymentDetailsFactory $ paymentDetailsFactory ,
88
90
\Magento \Quote \Api \CartTotalRepositoryInterface $ cartTotalsRepository ,
89
91
?PaymentProcessingRateLimiterInterface $ paymentRateLimiter = null ,
90
- ?PaymentSavingRateLimiterInterface $ saveRateLimiter = null
92
+ ?PaymentSavingRateLimiterInterface $ saveRateLimiter = null ,
93
+ ?CartRepositoryInterface $ cartRepository = null
91
94
) {
92
95
$ this ->billingAddressManagement = $ billingAddressManagement ;
93
96
$ this ->paymentMethodManagement = $ paymentMethodManagement ;
@@ -98,6 +101,8 @@ public function __construct(
98
101
?? ObjectManager::getInstance ()->get (PaymentProcessingRateLimiterInterface::class);
99
102
$ this ->saveRateLimiter = $ saveRateLimiter
100
103
?? ObjectManager::getInstance ()->get (PaymentSavingRateLimiterInterface::class);
104
+ $ this ->cartRepository = $ cartRepository
105
+ ?? ObjectManager::getInstance ()->get (CartRepositoryInterface::class);
101
106
}
102
107
103
108
/**
@@ -154,10 +159,8 @@ public function savePaymentInformation(
154
159
}
155
160
156
161
if ($ billingAddress ) {
157
- /** @var \Magento\Quote\Api\CartRepositoryInterface $quoteRepository */
158
- $ quoteRepository = $ this ->getCartRepository ();
159
162
/** @var \Magento\Quote\Model\Quote $quote */
160
- $ quote = $ quoteRepository ->getActive ($ cartId );
163
+ $ quote = $ this -> cartRepository ->getActive ($ cartId );
161
164
$ customerId = $ quote ->getBillingAddress ()
162
165
->getCustomerId ();
163
166
if (!$ billingAddress ->getCustomerId () && $ customerId ) {
@@ -204,19 +207,4 @@ private function getLogger()
204
207
}
205
208
return $ this ->logger ;
206
209
}
207
-
208
- /**
209
- * Get Cart repository
210
- *
211
- * @return \Magento\Quote\Api\CartRepositoryInterface
212
- * @deprecated 100.2.0
213
- */
214
- private function getCartRepository ()
215
- {
216
- if (!$ this ->cartRepository ) {
217
- $ this ->cartRepository = ObjectManager::getInstance ()
218
- ->get (\Magento \Quote \Api \CartRepositoryInterface::class);
219
- }
220
- return $ this ->cartRepository ;
221
- }
222
210
}
0 commit comments