Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GuestCartTotalManagement.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Quote\Model\QuoteIdMaskFactory;
10 
15 {
20 
25 
30  public function __construct(
31  \Magento\Quote\Api\CartTotalManagementInterface $cartTotalManagement,
32  QuoteIdMaskFactory $quoteIdMaskFactory
33  ) {
34  $this->cartTotalManagement = $cartTotalManagement;
35  $this->quoteIdMaskFactory = $quoteIdMaskFactory;
36  }
37 
41  public function collectTotals(
42  $cartId,
43  \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
44  $shippingCarrierCode = null,
45  $shippingMethodCode = null,
46  \Magento\Quote\Api\Data\TotalsAdditionalDataInterface $additionalData = null
47  ) {
48  $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
49  return $this->cartTotalManagement->collectTotals(
50  $quoteIdMask->getQuoteId(),
51  $paymentMethod,
52  $shippingCarrierCode,
53  $shippingMethodCode,
54  $additionalData
55  );
56  }
57 }
collectTotals( $cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, $shippingCarrierCode=null, $shippingMethodCode=null, \Magento\Quote\Api\Data\TotalsAdditionalDataInterface $additionalData=null)
$cartId
Definition: quote.php:22
__construct(\Magento\Quote\Api\CartTotalManagementInterface $cartTotalManagement, QuoteIdMaskFactory $quoteIdMaskFactory)