/**
  * {@inheritdoc}
  */
 public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     $this->cartRepository->get($quoteIdMask->getQuoteId())->setCheckoutMethod(CartManagementInterface::METHOD_GUEST);
     return $this->quoteManagement->placeOrder($quoteIdMask->getQuoteId(), $paymentMethod);
 }
 /**
  * @param \Magento\Checkout\Model\DefaultConfigProvider $subject
  * @param array $result
  * @return array
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterGetConfig(\Magento\Checkout\Model\DefaultConfigProvider $subject, array $result)
 {
     if ($this->persistentHelper->isEnabled() && $this->persistentSession->isPersistent() && !$this->customerSession->isLoggedIn()) {
         /** @var $quoteIdMask \Magento\Quote\Model\QuoteIdMask */
         $quoteIdMask = $this->quoteIdMaskFactory->create();
         $result['quoteData']['entity_id'] = $quoteIdMask->load($this->checkoutSession->getQuote()->getId(), 'quote_id')->getMaskedId();
     }
     return $result;
 }
 /**
  * {@inheritDoc}
  */
 public function getPaymentMethods($cartId, \Magento\Quote\Api\Data\AddressInterface $shippingAddress = null)
 {
     $quoteIdMask = $this->_quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     $quoteId = $quoteIdMask->getQuoteId();
     // if shippingAddress is provided use this country
     $country = null;
     if ($shippingAddress) {
         $country = $shippingAddress->getCountryId();
     }
     return $this->_paymentMethodsHelper->getPaymentMethods($quoteId, $country);
 }
 public function testSave()
 {
     $cartId = 'jIUggbo76';
     $quoteId = 123;
     $itemId = 234;
     /** @var QuoteIdMask|\PHPUnit_Framework_MockObject_MockObject $quoteIdMaskMock */
     $quoteIdMaskMock = $this->getMockBuilder('Magento\\Quote\\Model\\QuoteIdMask')->setMethods(['getQuoteId', 'load'])->disableOriginalConstructor()->getMock();
     $this->quoteIdMaskFactoryMock->expects($this->once())->method('create')->willReturn($quoteIdMaskMock);
     $quoteIdMaskMock->expects($this->once())->method('load')->with($cartId, 'masked_id')->willReturnSelf();
     $quoteIdMaskMock->expects($this->once())->method('getQuoteId')->willReturn($quoteId);
     /** @var MessageInterface|\PHPUnit_Framework_MockObject_MockObject $messageMock */
     $messageMock = $this->getMockBuilder('Magento\\GiftMessage\\Api\\Data\\MessageInterface')->getMockForAbstractClass();
     $this->repositoryMock->expects($this->once())->method('save')->with($quoteId, $messageMock, $itemId)->willReturn(true);
     $this->assertTrue($this->model->save($cartId, $messageMock, $itemId));
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function remove($cartId)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->couponManagement->remove($quoteIdMask->getId());
 }
 /**
  * {@inheritDoc}
  */
 public function saveAddressInformation($cartId, \Magento\Checkout\Api\Data\ShippingInformationInterface $addressInformation)
 {
     /** @var $quoteIdMask \Magento\Quote\Model\QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->shippingInformationManagement->saveAddressInformation($quoteIdMask->getQuoteId(), $addressInformation);
 }
 /**
  * @inheritdoc
  */
 public function estimateByExtendedAddress($cartId, AddressInterface $address)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->getShipmentEstimationManagement()->estimateByExtendedAddress((int) $quoteIdMask->getQuoteId(), $address);
 }
 /**
  * {@inheritdoc}
  */
 public function getList($cartId)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->paymentMethodManagement->getList($quoteIdMask->getQuoteId());
 }
 /**
  * {@inheritdoc}
  */
 public function deleteById($cartId, $itemId)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->repository->deleteById($quoteIdMask->getQuoteId(), $itemId);
 }
 /**
  * {@inheritDoc}
  */
 public function set($cartId, $carrierCode, $methodCode)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->shippingMethodManagement->set($quoteIdMask->getQuoteId(), $carrierCode, $methodCode);
 }
 /**
  * {@inheritdoc}
  */
 public function get($cartId)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->quoteRepository->get($quoteIdMask->getQuoteId());
 }
Пример #12
0
 /**
  * {@inheritdoc}
  */
 public function placeOrder($cartId)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->quoteManagement->placeOrder($quoteIdMask->getId());
 }
 /**
  * {@inheritDoc}
  */
 public function getPaymentInformation($cartId)
 {
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->paymentInformationManagement->getPaymentInformation($quoteIdMask->getQuoteId());
 }
 /**
  * {@inheritDoc}
  */
 public function estimateByAddress($cartId, \Magento\Quote\Api\Data\EstimateAddressInterface $address)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->shippingMethodManagement->estimateByAddress($quoteIdMask->getQuoteId(), $address);
 }
Пример #15
0
 /**
  * {@inheritdoc}
  */
 public function placeOrderCreatingAccount($cartId, $customer, $password, $agreements = null, PaymentInterface $paymentMethod = null)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->quoteManagement->placeOrderCreatingAccount($quoteIdMask->getQuoteId(), $customer, $password, $agreements, $paymentMethod);
 }
 /**
  * {@inheritDoc}
  */
 public function get($cartId)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->shippingAddressManagement->get($quoteIdMask->getQuoteId());
 }
 /**
  * {@inheritDoc}
  */
 public function save($cartId, MessageInterface $giftMessage)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->repository->save($quoteIdMask->getQuoteId(), $giftMessage);
 }
 /**
  * {@inheritDoc}
  */
 public function collectTotals($cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, $shippingCarrierCode = null, $shippingMethodCode = null, \Magento\Quote\Api\Data\TotalsAdditionalDataInterface $additionalData = null)
 {
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->cartTotalManagement->collectTotals($quoteIdMask->getQuoteId(), $paymentMethod, $shippingCarrierCode, $shippingMethodCode, $additionalData);
 }
 /**
  * @{inheritdoc}
  */
 public function saveAddresses($cartId, \Magento\Quote\Api\Data\AddressInterface $billingAddress, \Magento\Quote\Api\Data\AddressInterface $shippingAddress = null, \Magento\Quote\Api\Data\AddressAdditionalDataInterface $additionalData = null)
 {
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     return $this->addressDetailsManagement->saveAddresses($quoteIdMask->getQuoteId(), $billingAddress, $shippingAddress, $additionalData);
 }