Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GuestBillingAddressManagement.php
Go to the documentation of this file.
1 <?php
7 
11 use Magento\Quote\Model\QuoteIdMaskFactory;
12 
17 {
21  private $quoteIdMaskFactory;
22 
26  private $billingAddressManagement;
27 
34  public function __construct(
35  BillingAddressManagementInterface $billingAddressManagement,
36  QuoteIdMaskFactory $quoteIdMaskFactory
37  ) {
38  $this->quoteIdMaskFactory = $quoteIdMaskFactory;
39  $this->billingAddressManagement = $billingAddressManagement;
40  }
41 
45  public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $address, $useForShipping = false)
46  {
48  $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
49  return $this->billingAddressManagement->assign($quoteIdMask->getQuoteId(), $address, $useForShipping);
50  }
51 
55  public function get($cartId)
56  {
58  $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
59  return $this->billingAddressManagement->get($quoteIdMask->getQuoteId());
60  }
61 }
assign($cartId, \Magento\Quote\Api\Data\AddressInterface $address, $useForShipping=false)
$address
Definition: customer.php:38
$cartId
Definition: quote.php:22
__construct(BillingAddressManagementInterface $billingAddressManagement, QuoteIdMaskFactory $quoteIdMaskFactory)