shippingMethodManagement = $shippingMethodManagement; $this->paymentMethodManagement = $paymentMethodManagement; $this->cartTotalsRepository = $cartTotalsRepository; $this->dataProcessor = $dataProcessor; } /** * {@inheritDoc} */ public function collectTotals( $cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, $shippingCarrierCode = null, $shippingMethodCode = null, \Magento\Quote\Api\Data\TotalsAdditionalDataInterface $additionalData = null ) { if ($shippingCarrierCode && $shippingMethodCode) { $this->shippingMethodManagement->set($cartId, $shippingCarrierCode, $shippingMethodCode); } $this->paymentMethodManagement->set($cartId, $paymentMethod); if ($additionalData !== null) { $this->dataProcessor->process($additionalData, $cartId); } return $this->cartTotalsRepository->get($cartId); } }