Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
ShippingMethodManagement Class Reference
Inheritance diagram for ShippingMethodManagement:
ShippingMethodManagementInterface ShippingMethodManagementInterface ShipmentEstimationInterface

Public Member Functions

 __construct (\Magento\Quote\Api\CartRepositoryInterface $quoteRepository, Cart\ShippingMethodConverter $converter, \Magento\Customer\Api\AddressRepositoryInterface $addressRepository, \Magento\Quote\Model\Quote\TotalsCollector $totalsCollector, AddressInterfaceFactory $addressFactory=null, QuoteAddressResource $quoteAddressResource=null)
 
- Public Member Functions inherited from ShippingMethodManagementInterface
 estimateByAddress ($cartId, \Magento\Quote\Api\Data\EstimateAddressInterface $address)
 
 estimateByAddressId ($cartId, $addressId)
 
 getList ($cartId)
 
- Public Member Functions inherited from ShippingMethodManagementInterface
 set ($cartId, $carrierCode, $methodCode)
 
 get ($cartId)
 
- Public Member Functions inherited from ShipmentEstimationInterface
 estimateByExtendedAddress ($cartId, AddressInterface $address)
 

Protected Member Functions

 getEstimatedRates (\Magento\Quote\Model\Quote $quote, $country, $postcode, $regionId, $region, $address=null)
 

Protected Attributes

 $quoteRepository
 
 $converter
 
 $addressRepository
 
 $totalsCollector
 

Detailed Description

Shipping method read service

@SuppressWarnings(PHPMD.CouplingBetweenObjects)

Definition at line 26 of file ShippingMethodManagement.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Quote\Api\CartRepositoryInterface  $quoteRepository,
Cart\ShippingMethodConverter  $converter,
\Magento\Customer\Api\AddressRepositoryInterface  $addressRepository,
\Magento\Quote\Model\Quote\TotalsCollector  $totalsCollector,
AddressInterfaceFactory  $addressFactory = null,
QuoteAddressResource  $quoteAddressResource = null 
)

Constructor

Parameters
\Magento\Quote\Api\CartRepositoryInterface$quoteRepository
Cart\ShippingMethodConverter$converter
\Magento\Customer\Api\AddressRepositoryInterface$addressRepository
Quote\TotalsCollector$totalsCollector
AddressInterfaceFactory | null$addressFactory
QuoteAddressResource | null$quoteAddressResource

Definition at line 82 of file ShippingMethodManagement.php.

89  {
90  $this->quoteRepository = $quoteRepository;
91  $this->converter = $converter;
92  $this->addressRepository = $addressRepository;
93  $this->totalsCollector = $totalsCollector;
94  $this->addressFactory = $addressFactory ?: ObjectManager::getInstance()
95  ->get(AddressInterfaceFactory::class);
96  $this->quoteAddressResource = $quoteAddressResource ?: ObjectManager::getInstance()
97  ->get(QuoteAddressResource::class);
98  }
$addressFactory
Definition: quote.php:20

Member Function Documentation

◆ getEstimatedRates()

getEstimatedRates ( \Magento\Quote\Model\Quote  $quote,
  $country,
  $postcode,
  $regionId,
  $region,
  $address = null 
)
protected

Get estimated rates

Parameters
Quote$quote
int$country
string$postcode
int$regionId
string$region
\Magento\Framework\Api\ExtensibleDataInterface | null$address
Returns
\Magento\Quote\Api\Data\ShippingMethodInterface[] An array of shipping methods.
Deprecated:
100.1.6

Definition at line 271 of file ShippingMethodManagement.php.

278  {
279  if (!$address) {
280  $address = $this->getAddressFactory()->create()
281  ->setCountryId($country)
282  ->setPostcode($postcode)
283  ->setRegionId($regionId)
284  ->setRegion($region);
285  }
286  return $this->getShippingMethods($quote, $address);
287  }
$quote
$address
Definition: customer.php:38

Field Documentation

◆ $addressRepository

$addressRepository
protected

Definition at line 50 of file ShippingMethodManagement.php.

◆ $converter

$converter
protected

Definition at line 43 of file ShippingMethodManagement.php.

◆ $quoteRepository

$quoteRepository
protected

Definition at line 36 of file ShippingMethodManagement.php.

◆ $totalsCollector

$totalsCollector
protected

Definition at line 55 of file ShippingMethodManagement.php.


The documentation for this class was generated from the following file: