diff --git a/app/code/Magento/Quote/Api/AddressDetailsManagementInterface.php b/app/code/Magento/Quote/Api/AddressDetailsManagementInterface.php deleted file mode 100644 index a721e539ddf505abedd92f68433c26e917833a75..0000000000000000000000000000000000000000 --- a/app/code/Magento/Quote/Api/AddressDetailsManagementInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Api; - -interface AddressDetailsManagementInterface -{ - /** - * Save billing and shipping addresses - * - * @param int $cartId - * @param \Magento\Quote\Api\Data\AddressInterface $billingAddress - * @param \Magento\Quote\Api\Data\AddressInterface $shippingAddress - * @param \Magento\Quote\Api\Data\AddressAdditionalDataInterface|null $additionalData - * @param string|null $checkoutMethod - * @return \Magento\Quote\Api\Data\AddressDetailsInterface - */ - public function saveAddresses( - $cartId, - \Magento\Quote\Api\Data\AddressInterface $billingAddress, - \Magento\Quote\Api\Data\AddressInterface $shippingAddress = null, - \Magento\Quote\Api\Data\AddressAdditionalDataInterface $additionalData = null, - $checkoutMethod = null - ); -} diff --git a/app/code/Magento/Quote/Api/Data/AddressDetailsInterface.php b/app/code/Magento/Quote/Api/Data/AddressDetailsInterface.php deleted file mode 100644 index 843d5faa1e38723531baed4c6f1ad6c564f6b674..0000000000000000000000000000000000000000 --- a/app/code/Magento/Quote/Api/Data/AddressDetailsInterface.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Api\Data; - -interface AddressDetailsInterface extends \Magento\Framework\Api\ExtensibleDataInterface -{ - /**#@+ - * Constants defined for keys of array, makes typos less likely - */ - const SHIPPING_METHODS = 'shipping_methods'; - - const PAYMENT_METHODS = 'payment_methods'; - - const FORMATTED_BILLING_ADDRESS = 'formatted_billing_address'; - - const FORMATTED_SHIPPING_ADDRESS = 'formatted_shipping_address'; - - const TOTALS = 'totals'; - - /**#@-*/ - - /** - * @return \Magento\Quote\Api\Data\ShippingMethodInterface[] - */ - public function getShippingMethods(); - - /** - * @return \Magento\Quote\Api\Data\PaymentMethodInterface[] - */ - public function getPaymentMethods(); - - /** - * @param \Magento\Quote\Api\Data\ShippingMethodInterface[] $shippingMethods - * @return $this - */ - public function setShippingMethods($shippingMethods); - - /** - * @param \Magento\Quote\Api\Data\PaymentMethodInterface[] $paymentMethods - * @return $this - */ - public function setPaymentMethods($paymentMethods); - - /** - * @return string|null - */ - public function getFormattedShippingAddress(); - - /** - * @return string - */ - public function getFormattedBillingAddress(); - - /** - * @param string $formattedBillingAddress - * @return $this - */ - public function setFormattedBillingAddress($formattedBillingAddress); - - /** - * @param string $formattedShippingAddress - * @return $this - */ - public function setFormattedShippingAddress($formattedShippingAddress); - - - /** - * Retrieve existing extension attributes object or create a new one. - * - * @return \Magento\Quote\Api\Data\AddressDetailsExtensionInterface|null - */ - public function getExtensionAttributes(); - - /** - * Set an extension attributes object. - * - * @param \Magento\Quote\Api\Data\AddressDetailsExtensionInterface $extensionAttributes - * @return $this - */ - public function setExtensionAttributes( - \Magento\Quote\Api\Data\AddressDetailsExtensionInterface $extensionAttributes - ); - - /** - * @return \Magento\Quote\Api\Data\TotalsInterface - */ - public function getTotals(); - - /** - * @param \Magento\Quote\Api\Data\TotalsInterface $totals - * @return $this - */ - public function setTotals($totals); -} diff --git a/app/code/Magento/Quote/Api/GuestAddressDetailsManagementInterface.php b/app/code/Magento/Quote/Api/GuestAddressDetailsManagementInterface.php deleted file mode 100644 index a4eea1464145c613a5c06acdfb164bd9de819527..0000000000000000000000000000000000000000 --- a/app/code/Magento/Quote/Api/GuestAddressDetailsManagementInterface.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Api; - -interface GuestAddressDetailsManagementInterface -{ - /** - * Save billing and shipping addresses for guest. - * - * @param string $cartId - * @param \Magento\Quote\Api\Data\AddressInterface $billingAddress - * @param \Magento\Quote\Api\Data\AddressInterface|null $shippingAddress - * @param \Magento\Quote\Api\Data\AddressAdditionalDataInterface|null $additionalData - * @return \Magento\Quote\Api\Data\AddressDetailsInterface - */ - public function saveAddresses( - $cartId, - \Magento\Quote\Api\Data\AddressInterface $billingAddress, - \Magento\Quote\Api\Data\AddressInterface $shippingAddress = null, - \Magento\Quote\Api\Data\AddressAdditionalDataInterface $additionalData = null - ); -} diff --git a/app/code/Magento/Quote/Model/AddressDetails.php b/app/code/Magento/Quote/Model/AddressDetails.php deleted file mode 100644 index ba3e3bf697708ee8c0d9fc6c0b5c161c6adb3ab3..0000000000000000000000000000000000000000 --- a/app/code/Magento/Quote/Model/AddressDetails.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Model; - -/** - * @codeCoverageIgnoreStart - */ -class AddressDetails extends \Magento\Framework\Model\AbstractExtensibleModel implements - \Magento\Quote\Api\Data\AddressDetailsInterface -{ - //@codeCoverageIgnoreStart - /** - * @{inheritdoc} - */ - public function getShippingMethods() - { - return $this->getData(self::SHIPPING_METHODS); - } - - /** - * @{inheritdoc} - */ - public function setShippingMethods($shippingMethods) - { - return $this->setData(self::SHIPPING_METHODS, $shippingMethods); - } - - /** - * @{inheritdoc} - */ - public function getPaymentMethods() - { - return $this->getData(self::PAYMENT_METHODS); - } - - /** - * @{inheritdoc} - */ - public function setPaymentMethods($paymentMethods) - { - return $this->setData(self::PAYMENT_METHODS, $paymentMethods); - } - - /** - * @{inheritdoc} - */ - public function getFormattedShippingAddress() - { - return $this->getData(self::FORMATTED_SHIPPING_ADDRESS); - } - - /** - * @{inheritdoc} - */ - public function getFormattedBillingAddress() - { - return $this->getData(self::FORMATTED_BILLING_ADDRESS); - } - - /** - * @{inheritdoc} - */ - public function setFormattedBillingAddress($formattedBillingAddress) - { - return $this->setData(self::FORMATTED_BILLING_ADDRESS, $formattedBillingAddress); - } - - /** - * @{inheritdoc} - */ - public function setFormattedShippingAddress($formattedShippingAddress) - { - return $this->setData(self::FORMATTED_SHIPPING_ADDRESS, $formattedShippingAddress); - } - - /** - * @{inheritdoc} - */ - public function getTotals() - { - return $this->getData(self::TOTALS); - } - - /** - * @{inheritdoc} - */ - public function setTotals($totals) - { - return $this->setData(self::TOTALS, $totals); - } - //@codeCoverageIgnoreEnd - - /** - * {@inheritdoc} - * - * @return \Magento\Quote\Api\Data\AddressDetailsExtensionInterface|null - */ - public function getExtensionAttributes() - { - return $this->_getExtensionAttributes(); - } - - /** - * {@inheritdoc} - * - * @param \Magento\Quote\Api\Data\AddressDetailsExtensionInterface $extensionAttributes - * @return $this - */ - public function setExtensionAttributes( - \Magento\Quote\Api\Data\AddressDetailsExtensionInterface $extensionAttributes - ) { - return $this->_setExtensionAttributes($extensionAttributes); - } -} diff --git a/app/code/Magento/Quote/Model/AddressDetailsManagement.php b/app/code/Magento/Quote/Model/AddressDetailsManagement.php deleted file mode 100644 index 84c6492510a6d02f6b668612047585920dc1bb75..0000000000000000000000000000000000000000 --- a/app/code/Magento/Quote/Model/AddressDetailsManagement.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Model; - -use Magento\Quote\Api\CartTotalRepositoryInterface; -use Magento\Quote\Model\AddressAdditionalDataProcessor; - -class AddressDetailsManagement implements \Magento\Quote\Api\AddressDetailsManagementInterface -{ - /** - * @var \Magento\Quote\Api\BillingAddressManagementInterface - */ - protected $billingAddressManagement; - - /** - * @var \Magento\Quote\Api\ShippingAddressManagementInterface - */ - protected $shippingAddressManagement; - - /** - * @var \Magento\Quote\Api\PaymentMethodManagementInterface - */ - protected $paymentMethodManagement; - - /** - * @var \Magento\Quote\Api\ShippingMethodManagementInterface - */ - protected $shippingMethodManagement; - - /** - * @var AddressDetailsFactory - */ - protected $addressDetailsFactory; - - /** - * @var AddressAdditionalDataProcessor - */ - protected $dataProcessor; - - /** - * @var QuoteRepository - */ - protected $quoteRepository; - - /** - * @var CartTotalRepositoryInterface - */ - protected $cartTotalsRepository; - - /** - * @param \Magento\Quote\Api\BillingAddressManagementInterface $billingAddressManagement - * @param \Magento\Quote\Api\ShippingAddressManagementInterface $shippingAddressManagement - * @param \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement - * @param \Magento\Quote\Api\ShippingMethodManagementInterface $shippingMethodManagement - * @param AddressDetailsFactory $addressDetailsFactory - * @param AddressAdditionalDataProcessor $dataProcessor - * @param QuoteRepository $quoteRepository - * @param CartTotalRepositoryInterface $cartTotalsRepository - */ - public function __construct( - \Magento\Quote\Api\BillingAddressManagementInterface $billingAddressManagement, - \Magento\Quote\Api\ShippingAddressManagementInterface $shippingAddressManagement, - \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement, - \Magento\Quote\Api\ShippingMethodManagementInterface $shippingMethodManagement, - \Magento\Quote\Model\AddressDetailsFactory $addressDetailsFactory, - AddressAdditionalDataProcessor $dataProcessor, - QuoteRepository $quoteRepository, - CartTotalRepositoryInterface $cartTotalsRepository - ) { - $this->billingAddressManagement = $billingAddressManagement; - $this->shippingAddressManagement = $shippingAddressManagement; - $this->paymentMethodManagement = $paymentMethodManagement; - $this->shippingMethodManagement = $shippingMethodManagement; - $this->addressDetailsFactory = $addressDetailsFactory; - $this->dataProcessor = $dataProcessor; - $this->quoteRepository = $quoteRepository; - $this->cartTotalsRepository = $cartTotalsRepository; - } - - /** - * @{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, - $checkoutMethod = null - ) { - $this->billingAddressManagement->assign($cartId, $billingAddress); - - /** @var \Magento\Quote\Api\Data\AddressDetailsInterface $addressDetails */ - $addressDetails = $this->addressDetailsFactory->create(); - if ($shippingAddress) { - $this->shippingAddressManagement->assign($cartId, $shippingAddress); - $addressDetails->setFormattedShippingAddress( - $this->shippingAddressManagement->get($cartId)->format('html') - ); - $addressDetails->setShippingMethods($this->shippingMethodManagement->getList($cartId)); - } - $addressDetails->setPaymentMethods($this->paymentMethodManagement->getList($cartId)); - if ($additionalData !== null) { - $this->dataProcessor->process($additionalData); - } - if ($checkoutMethod != null) { - $this->quoteRepository->save( - $this->quoteRepository->getActive($cartId) - ->setCheckoutMethod($checkoutMethod) - ); - } - - $addressDetails->setFormattedBillingAddress( - $this->billingAddressManagement->get($cartId)->format('html') - ); - - $addressDetails->setTotals($this->cartTotalsRepository->get($cartId)); - return $addressDetails; - } -} diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestAddressDetailsManagement.php b/app/code/Magento/Quote/Model/GuestCart/GuestAddressDetailsManagement.php deleted file mode 100644 index 2671a1ccb7665ebddf0b526f923090d6440c85f4..0000000000000000000000000000000000000000 --- a/app/code/Magento/Quote/Model/GuestCart/GuestAddressDetailsManagement.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Model\GuestCart; - -use Magento\Quote\Model\QuoteIdMaskFactory; - -class GuestAddressDetailsManagement implements \Magento\Quote\Api\GuestAddressDetailsManagementInterface -{ - /** - * @var \Magento\Quote\Api\AddressDetailsManagementInterface - */ - protected $addressDetailsManagement; - - /** - * @var QuoteIdMaskFactory - */ - protected $quoteIdMaskFactory; - - /** - * @param \Magento\Quote\Api\AddressDetailsManagementInterface $addressDetailsManagement - * @param QuoteIdMaskFactory $quoteIdMaskFactory - */ - public function __construct( - \Magento\Quote\Api\AddressDetailsManagementInterface $addressDetailsManagement, - QuoteIdMaskFactory $quoteIdMaskFactory - ) { - $this->addressDetailsManagement = $addressDetailsManagement; - $this->quoteIdMaskFactory = $quoteIdMaskFactory; - } - - /** - * @{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 - ); - } -} diff --git a/app/code/Magento/Quote/Test/Unit/Model/AddressDetailsManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/AddressDetailsManagementTest.php deleted file mode 100644 index bcc880ffb9b332cd4eb691090f839839738655dd..0000000000000000000000000000000000000000 --- a/app/code/Magento/Quote/Test/Unit/Model/AddressDetailsManagementTest.php +++ /dev/null @@ -1,164 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Test\Unit\Model; - -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; - -class AddressDetailsManagementTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Quote\Model\AddressDetailsManagement - */ - protected $model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $billingAddressManagement; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $shippingAddressManagement; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $paymentMethodManagement; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $shippingMethodManagement; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $addressDetailsFactory; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $dataProcessor; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $quoteRepository; - - /** - * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager - */ - protected $objectManager; - - protected function setUp() - { - $this->objectManager = new ObjectManager($this); - $this->billingAddressManagement = $this->getMock('\Magento\Quote\Api\BillingAddressManagementInterface'); - $this->shippingAddressManagement = $this->getMock('\Magento\Quote\Api\ShippingAddressManagementInterface'); - $this->paymentMethodManagement = $this->getMock('\Magento\Quote\Api\PaymentMethodManagementInterface'); - $this->shippingMethodManagement = $this->getMock('\Magento\Quote\Api\ShippingMethodManagementInterface'); - $this->addressDetailsFactory = - $this->getMock('\Magento\Quote\Model\AddressDetailsFactory', ['create'], [], '', false); - $this->dataProcessor = $this->getMock('\Magento\Quote\Model\AddressAdditionalDataProcessor', [], [], '', false); - $this->quoteRepository = $this->getMock( - '\Magento\Quote\Model\QuoteRepository', - ['setCheckoutMethod', 'getActive', 'save'], - [], - '', - false - ); - - $this->model = $this->objectManager->getObject( - 'Magento\Quote\Model\AddressDetailsManagement', - [ - 'billingAddressManagement' => $this->billingAddressManagement, - 'shippingAddressManagement' => $this->shippingAddressManagement, - 'paymentMethodManagement' => $this->paymentMethodManagement, - 'shippingMethodManagement' => $this->shippingMethodManagement, - 'addressDetailsFactory' => $this->addressDetailsFactory, - 'dataProcessor' => $this->dataProcessor, - 'quoteRepository' => $this->quoteRepository - ] - ); - } - - public function testSaveAddresses() - { - $cartId = 100; - $checkoutMethod = 'onePage'; - $additionalData = $this->getMock('\Magento\Quote\Api\Data\AddressAdditionalDataInterface'); - $billingAddressMock = $this->getMock('\Magento\Quote\Model\Quote\Address', [], [], '', false); - $shippingAddressMock = $this->getMock('\Magento\Quote\Model\Quote\Address', [], [], '', false); - - $this->billingAddressManagement->expects($this->once()) - ->method('assign') - ->with($cartId, $billingAddressMock) - ->willReturn(1); - - $billingAddressMock->expects($this->once())->method('format')->with('html'); - $this->billingAddressManagement->expects($this->once()) - ->method('get') - ->with($cartId) - ->willReturn($billingAddressMock); - - $this->shippingAddressManagement->expects($this->once()) - ->method('assign') - ->with($cartId, $shippingAddressMock) - ->willReturn(1); - - $shippingAddressMock->expects($this->once())->method('format')->with('html'); - $this->shippingAddressManagement->expects($this->once()) - ->method('get') - ->with($cartId) - ->willReturn($shippingAddressMock); - - $shippingMethodMock = $this->getMock('\Magento\Quote\Api\Data\ShippingMethodInterface'); - $this->shippingMethodManagement->expects($this->once()) - ->method('getList') - ->with($cartId) - ->willReturn([$shippingMethodMock]); - $paymentMethodMock = $this->getMock('\Magento\Quote\Api\Data\PaymentMethodInterface'); - $this->paymentMethodManagement->expects($this->once()) - ->method('getList') - ->with($cartId) - ->willReturn([$paymentMethodMock]); - - $addressDetailsMock = $this->getMock('\Magento\Quote\Model\AddressDetails', [], [], '', false); - $this->addressDetailsFactory->expects($this->once())->method('create')->willReturn($addressDetailsMock); - - $addressDetailsMock->expects($this->once()) - ->method('setShippingMethods') - ->with([$shippingMethodMock]) - ->willReturnSelf(); - $addressDetailsMock->expects($this->once()) - ->method('setPaymentMethods') - ->with([$paymentMethodMock]) - ->willReturnSelf(); - $this->dataProcessor->expects($this->once())->method('process')->with($additionalData); - - $quote = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false); - $this->quoteRepository->expects($this->once()) - ->method('getActive') - ->with($cartId) - ->will($this->returnSelf()); - $this->quoteRepository->expects($this->once()) - ->method('setCheckoutMethod') - ->with($checkoutMethod) - ->will($this->returnValue($quote)); - $this->quoteRepository->expects($this->once()) - ->method('save') - ->with($quote); - - $this->model->saveAddresses( - $cartId, - $billingAddressMock, - $shippingAddressMock, - $additionalData, - $checkoutMethod - ); - } -} diff --git a/app/code/Magento/Quote/etc/di.xml b/app/code/Magento/Quote/etc/di.xml index 716008aba602c7593e3c5c357f2eead2d75865eb..0c3b51e3a5ddc2e2a5c3b6991de7eb92629c999b 100644 --- a/app/code/Magento/Quote/etc/di.xml +++ b/app/code/Magento/Quote/etc/di.xml @@ -36,7 +36,6 @@ <preference for="Magento\Quote\Api\GuestShippingAddressManagementInterface" type="Magento\Quote\Model\GuestCart\GuestShippingAddressManagement" /> <preference for="Magento\Quote\Api\GuestShippingMethodManagementInterface" type="Magento\Quote\Model\GuestCart\GuestShippingMethodManagement" /> <preference for="Magento\Quote\Api\GuestBillingAddressManagementInterface" type="Magento\Quote\Model\GuestCart\GuestBillingAddressManagement" /> - <preference for="Magento\Quote\Api\GuestAddressDetailsManagementInterface" type="Magento\Quote\Model\GuestCart\GuestAddressDetailsManagement" /> <preference for="Magento\Quote\Api\GuestCartTotalManagementInterface" type="\Magento\Quote\Model\GuestCart\GuestCartTotalManagement" /> <preference for="Magento\Quote\Api\Data\EstimateAddressInterface" type="Magento\Quote\Model\EstimateAddress" /> <type name="Magento\Webapi\Controller\Rest\ParamsOverrider"> @@ -56,8 +55,6 @@ <argument name="addressConfig" xsi:type="object">Magento\Customer\Model\Address\Config\Proxy</argument> </arguments> </type> - <preference for="Magento\Quote\Api\AddressDetailsManagementInterface" type="Magento\Quote\Model\AddressDetailsManagement" /> - <preference for="Magento\Quote\Api\Data\AddressDetailsInterface" type="Magento\Quote\Model\AddressDetails" /> <preference for="Magento\Quote\Api\Data\AddressAdditionalDataInterface" type="Magento\Quote\Model\AddressAdditionalData" /> <preference for="Magento\Quote\Api\Data\TotalsAdditionalDataInterface" type="Magento\Quote\Model\Cart\TotalsAdditionalData" /> <preference for="\Magento\Quote\Model\Quote\Address\CustomAttributeListInterface" type="\Magento\Quote\Model\Quote\Address\CustomAttributeList" /> diff --git a/app/code/Magento/Quote/etc/webapi.xml b/app/code/Magento/Quote/etc/webapi.xml index 503332a8290789310186a88cf13bcf1bf5a35870..8e5e097a995cd6aa38aa77f568f2c0ba97f1d9cd 100644 --- a/app/code/Magento/Quote/etc/webapi.xml +++ b/app/code/Magento/Quote/etc/webapi.xml @@ -376,12 +376,6 @@ <resource ref="anonymous" /> </resources> </route> - <route url="/V1/guest-carts/:cartId/addresses" method="POST"> - <service class="Magento\Quote\Api\GuestAddressDetailsManagementInterface" method="saveAddresses"/> - <resources> - <resource ref="anonymous" /> - </resources> - </route> <!-- Managing My Cart Billing address --> <route url="/V1/carts/mine/billing-address" method="GET"> @@ -519,15 +513,6 @@ <parameter name="cartId" force="true">%cart_id%</parameter> </data> </route> - <route url="/V1/carts/mine/addresses" method="POST"> - <service class="Magento\Quote\Api\AddressDetailsManagementInterface" method="saveAddresses"/> - <resources> - <resource ref="self" /> - </resources> - <data> - <parameter name="cartId" force="true">%cart_id%</parameter> - </data> - </route> <!-- Managing Cart Order --> <route url="/V1/carts/:cartId/order" method="PUT"> diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/AddressDetailsManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/AddressDetailsManagementTest.php deleted file mode 100644 index 9081283ffa462a2520d277f2826c088e965061c6..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/AddressDetailsManagementTest.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Api; - -class AddressDetailsManagementTest extends \Magento\TestFramework\TestCase\WebapiAbstract -{ - const SERVICE_VERSION = 'V1'; - const SERVICE_NAME = 'quoteAddressDetailsManagementV1'; - const RESOURCE_PATH = '/V1/carts/'; - - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $objectManager; - - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - } - - /** - * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php - */ - public function testSaveAddresses() - { - /** @var \Magento\Quote\Model\Quote $quote */ - $quote = $this->objectManager->create('Magento\Quote\Model\Quote'); - $quote->load('test_order_1', 'reserved_order_id'); - - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . 'mine/addresses', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => [ - 'service' => self::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'SaveAddresses', - ], - ]; - - $addressData = [ - 'firstname' => 'John', - 'lastname' => 'Smith', - 'email' => 'cat@dog.com', - 'company' => 'eBay Inc', - 'street' => ['Typical Street', 'Tiny House 18'], - 'city' => 'Big City', - 'region_id' => 12, - 'region' => 'California', - 'region_code' => 'CA', - 'postcode' => '0985432', - 'country_id' => 'US', - 'telephone' => '88776655', - 'fax' => '44332255', - ]; - $requestData = [ - 'cart_id' => $quote->getId(), - 'billingAddress' => $addressData, - 'shippingAddress' => $addressData - ]; - - $response = $this->_webApiCall($serviceInfo, $requestData); - - $this->assertArrayHasKey('shipping_methods', $response); - $this->assertCount(1, $response['shipping_methods']); - $this->assertEquals('flatrate', $response['shipping_methods'][0]['method_code']); - - $this->assertArrayHasKey('payment_methods', $response); - $this->assertCount(2, $response['payment_methods']); - $this->assertEquals('checkmo', $response['payment_methods'][0]['code']); - } -} diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartTotalRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartTotalRepositoryTest.php index 1380a7251302f4d63ac9f61358ecb24a6bd8643c..bef10d5a5cfb5ab0114aab0bc7e4e60d5fc4e0cc 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartTotalRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartTotalRepositoryTest.php @@ -77,6 +77,7 @@ class CartTotalRepositoryTest extends WebapiAbstract Totals::KEY_BASE_SHIPPING_INCL_TAX => $shippingAddress->getBaseShippingInclTax(), Totals::KEY_BASE_CURRENCY_CODE => $quote->getBaseCurrencyCode(), Totals::KEY_QUOTE_CURRENCY_CODE => $quote->getQuoteCurrencyCode(), + Totals::KEY_ITEMS_QTY => $quote->getItemsQty(), Totals::KEY_ITEMS => [$this->getQuoteItemTotalsData($quote)], ]; @@ -85,6 +86,10 @@ class CartTotalRepositoryTest extends WebapiAbstract $data = $this->formatTotalsData($data); $actual = $this->_webApiCall($this->getServiceInfoForTotalsService($cartId), $requestData); unset($actual['items'][0]['options']); + unset($actual['weee_tax_applied_amount']); + + /** TODO: cover total segments with separate test */ + unset($actual['total_segments']); if (array_key_exists('extension_attributes', $actual)) { unset($actual['extension_attributes']); } @@ -231,12 +236,17 @@ class CartTotalRepositoryTest extends WebapiAbstract Totals::KEY_BASE_SHIPPING_INCL_TAX => $shippingAddress->getBaseShippingInclTax(), Totals::KEY_BASE_CURRENCY_CODE => $quote->getBaseCurrencyCode(), Totals::KEY_QUOTE_CURRENCY_CODE => $quote->getQuoteCurrencyCode(), + Totals::KEY_ITEMS_QTY => $quote->getItemsQty(), Totals::KEY_ITEMS => [$this->getQuoteItemTotalsData($quote)], ]; $data = $this->formatTotalsData($data); $actual = $this->_webApiCall($serviceInfo); unset($actual['items'][0]['options']); + unset($actual['weee_tax_applied_amount']); + + /** TODO: cover total segments with separate test */ + unset($actual['total_segments']); if (array_key_exists('extension_attributes', $actual)) { unset($actual['extension_attributes']); }