@@ -54,24 +54,28 @@ class PaymentInformationManagement implements \Magento\Checkout\Api\PaymentInfor
54
54
55
55
/**
56
56
* @param \Magento\Quote\Api\BillingAddressManagementInterface $billingAddressManagement
57
- * @param \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
58
- * @param \Magento\Quote\Api\CartManagementInterface $cartManagement
59
- * @param PaymentDetailsFactory $paymentDetailsFactory
60
- * @param \Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository
57
+ * @param \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
58
+ * @param \Magento\Quote\Api\CartManagementInterface $cartManagement
59
+ * @param PaymentDetailsFactory $paymentDetailsFactory
60
+ * @param \Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository
61
+ * @param \Magento\Quote\Api\CartRepositoryInterface|null $cartRepository
61
62
* @codeCoverageIgnore
62
63
*/
63
64
public function __construct (
64
65
\Magento \Quote \Api \BillingAddressManagementInterface $ billingAddressManagement ,
65
66
\Magento \Quote \Api \PaymentMethodManagementInterface $ paymentMethodManagement ,
66
67
\Magento \Quote \Api \CartManagementInterface $ cartManagement ,
67
68
\Magento \Checkout \Model \PaymentDetailsFactory $ paymentDetailsFactory ,
68
- \Magento \Quote \Api \CartTotalRepositoryInterface $ cartTotalsRepository
69
+ \Magento \Quote \Api \CartTotalRepositoryInterface $ cartTotalsRepository ,
70
+ \Magento \Quote \Api \CartRepositoryInterface $ cartRepository = null
69
71
) {
70
72
$ this ->billingAddressManagement = $ billingAddressManagement ;
71
73
$ this ->paymentMethodManagement = $ paymentMethodManagement ;
72
74
$ this ->cartManagement = $ cartManagement ;
73
75
$ this ->paymentDetailsFactory = $ paymentDetailsFactory ;
74
76
$ this ->cartTotalsRepository = $ cartTotalsRepository ;
77
+ $ this ->cartRepository = $ cartRepository ? : \Magento \Framework \App \ObjectManager::getInstance ()
78
+ ->get (\Magento \Quote \Api \CartRepositoryInterface::class);
75
79
}
76
80
77
81
/**
@@ -110,10 +114,8 @@ public function savePaymentInformation(
110
114
\Magento \Quote \Api \Data \AddressInterface $ billingAddress = null
111
115
) {
112
116
if ($ billingAddress ) {
113
- /** @var \Magento\Quote\Api\CartRepositoryInterface $quoteRepository */
114
- $ quoteRepository = $ this ->getCartRepository ();
115
117
/** @var \Magento\Quote\Model\Quote $quote */
116
- $ quote = $ quoteRepository ->getActive ($ cartId );
118
+ $ quote = $ this -> cartRepository ->getActive ($ cartId );
117
119
$ quote ->removeAddress ($ quote ->getBillingAddress ()->getId ());
118
120
$ quote ->setBillingAddress ($ billingAddress );
119
121
$ quote ->setDataChanges (true );
@@ -155,19 +157,4 @@ private function getLogger()
155
157
}
156
158
return $ this ->logger ;
157
159
}
158
-
159
- /**
160
- * Get Cart repository instance.
161
- *
162
- * @return \Magento\Quote\Api\CartRepositoryInterface
163
- * @deprecated
164
- */
165
- private function getCartRepository ()
166
- {
167
- if (!$ this ->cartRepository ) {
168
- $ this ->cartRepository = \Magento \Framework \App \ObjectManager::getInstance ()
169
- ->get (\Magento \Quote \Api \CartRepositoryInterface::class);
170
- }
171
- return $ this ->cartRepository ;
172
- }
173
160
}
0 commit comments