From 5e7e1daa5581a08623b1c4bafd9e41e15165d501 Mon Sep 17 00:00:00 2001 From: eugene-shab Date: Fri, 26 Oct 2018 14:10:39 +0300 Subject: [PATCH 01/15] addConfigurableProductsToCart --- .../AddConfigurableProductsToCart.php | 89 +++++++++++++++++++ .../etc/schema.graphqls | 35 ++++++++ 2 files changed, 124 insertions(+) create mode 100644 app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php diff --git a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php new file mode 100644 index 000000000000..5b908835adbe --- /dev/null +++ b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php @@ -0,0 +1,89 @@ +arrayManager = $arrayManager; + $this->getCartForUser = $getCartForUser; + $this->addProductsToCart = $addProductsToCart; + $this->extractDataFromCart = $extractDataFromCart; + } + + /** + * @inheritdoc + */ + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) + { + $cartHash = $this->arrayManager->get('input/cart_id', $args); + $cartItems = $this->arrayManager->get('input/cartItems', $args); + + if (!isset($cartHash)) { + throw new GraphQlInputException(__('Missing key "cart_id" in cart data')); + } + + if (!isset($cartItems) || !is_array($cartItems) || empty($cartItems)) { + throw new GraphQlInputException(__('Missing key "cartItems" in cart data')); + } + + $currentUserId = $context->getUserId(); + $cart = $this->getCartForUser->execute((string)$cartHash, $currentUserId); + + $this->addProductsToCart->execute($cart, $cartItems); + $cartData = $this->extractDataFromCart->execute($cart); + + return [ + 'cart' => $cartData, + ]; + } +} diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls index 267a94a1d434..44ba8e7a957f 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls +++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls @@ -1,5 +1,8 @@ # Copyright © Magento, Inc. All rights reserved. # See COPYING.txt for license details. +type Mutation { + addConfigurableProductsToCart(input: AddConfigurableProductsToCartInput): AddConfigurableProductsToCartOutput @resolver(class: "Magento\\ConfigurableProductGraphQl\\Model\\Resolver\\AddConfigurableProductsToCart") +} type ConfigurableProduct implements ProductInterface, PhysicalProductInterface, CustomizableProductInterface @doc(description: "ConfigurableProduct defines basic features of a configurable product and its simple product variants") { variants: [ConfigurableVariant] @doc(description: "An array of variants of products") @resolver(class: "Magento\\ConfigurableProductGraphQl\\Model\\Resolver\\ConfigurableVariant") @@ -35,3 +38,35 @@ type ConfigurableProductOptionsValues @doc(description: "ConfigurableProductOpti store_label: String @doc(description: "The label of the product on the current store") use_default_value: Boolean @doc(description: "Indicates whether to use the default_label") } + +input AddConfigurableProductsToCartInput { + cart_id: String! + cartItems: [ConfigurableProductCartItemInput!]! +} + +type AddConfigurableProductsToCartOutput { + cart: Cart! +} + +input ConfigurableProductCartItemInput { + data: CartItemDetailsInput! + variant_sku: String! + customizable_options:[CustomizableOptionInput!] +} + +type ConfigurableCartItem implements CartItemInterface { + customizable_options: [SelectedCustomizableOption]! + configurable_options: [SelectedConfigurableOption!]! +} + +type SelectedConfigurableOption { + id: Int! + option_label: String! + value_id: Int! + value_label: String! +} + +input CartItemDetailsInput { + sku: String! + qty: Float! +} From d5bece530c0b76c8a8bd97e1b0031b2c082a6fe5 Mon Sep 17 00:00:00 2001 From: eugene-shab Date: Fri, 26 Oct 2018 15:01:13 +0300 Subject: [PATCH 02/15] Updated PHPDoc Comments --- app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php | 2 ++ .../Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php | 1 + 2 files changed, 3 insertions(+) diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php index 96259f226494..005cf3a10ca8 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/AddProductsToCart.php @@ -45,6 +45,8 @@ public function __construct( * @param Quote $cart * @param array $cartItems * @throws GraphQlInputException + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException */ public function execute(Quote $cart, array $cartItems): void { diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php index aa5b41daebdc..2303d2aa14f0 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php @@ -61,6 +61,7 @@ public function __construct( * @return void * @throws GraphQlNoSuchEntityException * @throws GraphQlInputException + * @throws \Magento\Framework\Exception\LocalizedException */ public function execute(Quote $cart, array $cartItemData): void { From 109a44b7565641e42522c1fb1a77510a5d4b8ad9 Mon Sep 17 00:00:00 2001 From: eugene-shab Date: Fri, 26 Oct 2018 15:07:27 +0300 Subject: [PATCH 03/15] Move CartItemDetailsInput to quote scheme. --- .../Magento/ConfigurableProductGraphQl/etc/schema.graphqls | 5 ----- app/code/Magento/QuoteGraphQl/etc/schema.graphqls | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls index 44ba8e7a957f..12841a6e4510 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls +++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls @@ -65,8 +65,3 @@ type SelectedConfigurableOption { value_id: Int! value_label: String! } - -input CartItemDetailsInput { - sku: String! - qty: Float! -} diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index f692aa57b218..763f4031c7c3 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -94,3 +94,8 @@ type CartItemSelectedOptionValuePrice { units: String! type: PriceTypeEnum! } + +input CartItemDetailsInput { + sku: String! + qty: Float! +} From 583ac3683361b823757d2ce1221825bff4a8aa61 Mon Sep 17 00:00:00 2001 From: eugene-shab Date: Mon, 29 Oct 2018 14:39:45 +0200 Subject: [PATCH 04/15] Fix hard depends. --- app/code/Magento/ConfigurableProductGraphQl/composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/ConfigurableProductGraphQl/composer.json b/app/code/Magento/ConfigurableProductGraphQl/composer.json index a22df27734b7..0f0bd5d70a4c 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/composer.json +++ b/app/code/Magento/ConfigurableProductGraphQl/composer.json @@ -7,6 +7,7 @@ "magento/module-catalog": "*", "magento/module-configurable-product": "*", "magento/module-catalog-graph-ql": "*", + "magento/module-quote-graph-ql": "*", "magento/framework": "*" }, "license": [ From 3d7a5d11b283e1b3c35787e85e5a9396f9e34133 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Wed, 6 Feb 2019 13:18:12 -0600 Subject: [PATCH 05/15] GraphQL-256: [BugFix] Configurable products > Variants > Attributes are empty -- fix static tests --- .../Model/Resolver/ConfigurableVariant.php | 4 +--- .../Model/Resolver/Variant/Attributes.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/ConfigurableVariant.php b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/ConfigurableVariant.php index 2a218409dcee..3e07fecb2ebe 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/ConfigurableVariant.php +++ b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/ConfigurableVariant.php @@ -71,9 +71,7 @@ public function __construct( } /** - * Fetch and format configurable variants. - * - * {@inheritDoc} + * @inheritdoc */ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) { diff --git a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php index 3c30b9c102ff..d3351d216d21 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php +++ b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php @@ -7,6 +7,8 @@ namespace Magento\ConfigurableProductGraphQl\Model\Resolver\Variant; +use Magento\Framework\GraphQl\Query\Resolver\ContextInterface; +use Magento\Framework\GraphQl\Query\Resolver\Value; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; @@ -20,6 +22,14 @@ class Attributes implements ResolverInterface * Format product's option data to conform to GraphQL schema * * {@inheritdoc} + * + * @param Field $field + * @param ContextInterface $context + * @param ResolveInfo $info + * @param array|null $value + * @param array|null $args + * @throws \Exception + * @return mixed|Value */ public function resolve( Field $field, From 41ff41da0348d95ff4959666427503d328d49217 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Wed, 6 Feb 2019 13:22:16 -0600 Subject: [PATCH 06/15] GraphQL-256: [BugFix] Configurable products > Variants > Attributes are empty -- fix static tests --- .../ConfigurableProductGraphQl/Model/Variant/Collection.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/Model/Variant/Collection.php b/app/code/Magento/ConfigurableProductGraphQl/Model/Variant/Collection.php index 5b62d5d0d143..9fda4ec0173e 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/Model/Variant/Collection.php +++ b/app/code/Magento/ConfigurableProductGraphQl/Model/Variant/Collection.php @@ -96,7 +96,6 @@ public function addParentProduct(Product $product) : void if (!empty($this->childrenMap)) { $this->childrenMap = []; - } $this->parentProducts[$product->getId()] = $product; } From 0dd75839a6b8fcb9358329a56277069bb2e3b69f Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Thu, 7 Feb 2019 09:18:42 +0200 Subject: [PATCH 07/15] graphQl-256: fixed issue with array access --- .../Model/Resolver/Variant/Attributes.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php index d3351d216d21..b8e2ba523116 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php +++ b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php @@ -7,6 +7,7 @@ namespace Magento\ConfigurableProductGraphQl\Model\Resolver\Variant; +use Magento\Catalog\Model\Product; use Magento\Framework\GraphQl\Query\Resolver\ContextInterface; use Magento\Framework\GraphQl\Query\Resolver\Value; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; @@ -45,12 +46,14 @@ public function resolve( $data = []; foreach ($value['options'] as $option) { $code = $option['attribute_code']; - if (!isset($value['product']['model'][$code])) { + /** @var Product|null $model */ + $model = $value['product']['model'] ?? null; + if (!$model || !$model->getData($code)) { continue; } foreach ($option['values'] as $optionValue) { - if ($optionValue['value_index'] != $value['product']['model'][$code]) { + if ($optionValue['value_index'] != $model->getData($code)) { continue; } $data[] = [ From 548e33ee48f2ab97495366207780899d017baf24 Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Thu, 7 Feb 2019 20:45:28 +0200 Subject: [PATCH 08/15] graphQl-296: sed billing address on cart added --- .../Address/BillingAddressDataProvider.php | 72 ++++ .../Model/Cart/Address/Mapper/Address.php | 62 +++ .../Address/ShippingAddressesDataProvider.php | 76 ++++ .../Model/Cart/SetBillingAddressOnCart.php | 99 +++++ .../Model/Resolver/BillingAddress.php | 48 +++ .../Resolver/SetBillingAddressOnCart.php | 82 ++++ .../Model/Resolver/ShippingAddresses.php | 48 +++ .../Magento/QuoteGraphQl/etc/schema.graphqls | 12 +- .../Quote/SetBillingAddressOnCartTest.php | 407 ++++++++++++++++++ 9 files changed, 902 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/Address/BillingAddressDataProvider.php create mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php create mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingAddressesDataProvider.php create mode 100644 app/code/Magento/QuoteGraphQl/Model/Cart/SetBillingAddressOnCart.php create mode 100644 app/code/Magento/QuoteGraphQl/Model/Resolver/BillingAddress.php create mode 100644 app/code/Magento/QuoteGraphQl/Model/Resolver/SetBillingAddressOnCart.php create mode 100644 app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddresses.php create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetBillingAddressOnCartTest.php diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/BillingAddressDataProvider.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/BillingAddressDataProvider.php new file mode 100644 index 000000000000..bcd781025a6d --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/BillingAddressDataProvider.php @@ -0,0 +1,72 @@ +cartRepository = $cartRepository; + $this->addressMapper = $addressMapper; + $this->dataObjectConverter = $dataObjectConverter; + } + + /** + * Collect and return information about a billing addresses + * + * @param CartInterface $cart + * @return null|array + */ + public function getCartAddresses(CartInterface $cart): ?array + { + $cart = $this->cartRepository->get($cart->getId()); + $billingAddress = $cart->getBillingAddress(); + + if (!$billingAddress) { + return null; + } + $billingData = $this->dataObjectConverter->toFlatArray($billingAddress, [], AddressInterface::class); + $addressData = array_merge($billingData, $this->addressMapper->toNestedArray($billingAddress)); + + return $addressData; + } +} diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php new file mode 100644 index 000000000000..752ab1ceccbd --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php @@ -0,0 +1,62 @@ + [ + 'code' => $address->getCountryId(), + 'label' => $address->getCountry() + ], + 'region' => [ + 'code' => $address->getRegionCode(), + 'label' => $address->getRegion() + ], + 'street' => $address->getStreet(), + 'selected_shipping_method' => [ + 'code' => $address->getShippingMethod(), + 'label' => $address->getShippingDescription(), + 'free_shipping' => $address->getFreeShipping(), + ], + 'items_weight' => $address->getWeight(), + 'customer_notes' => $address->getCustomerNotes() + ]; + + if (!$address->hasItems()) { + return $addressData; + } + + $addressItemsData = []; + foreach ($address->getAllItems() as $addressItem) { + $addressItemsData[] = [ + 'cart_item_id' => $addressItem->getQuoteItemId(), + 'quantity' => $addressItem->getQty() + ]; + } + $addressData['cart_items'] = $addressItemsData; + + return $addressData; + } +} diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingAddressesDataProvider.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingAddressesDataProvider.php new file mode 100644 index 000000000000..eb9d76080959 --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/ShippingAddressesDataProvider.php @@ -0,0 +1,76 @@ +dataObjectConverter = $dataObjectConverter; + $this->cartRepository = $cartRepository; + $this->addressMapper = $addressMapper; + } + + /** + * Collect and return information about shipping addresses + * + * @param CartInterface $cart + * @return array + */ + public function getCartAddresses(CartInterface $cart): array + { + $cart = $this->cartRepository->get($cart->getId()); + $addressData = []; + $shippingAddresses = $cart->getAllShippingAddresses(); + + if ($shippingAddresses) { + foreach ($shippingAddresses as $shippingAddress) { + $shippingData = $this->dataObjectConverter->toFlatArray($shippingAddress, [], AddressInterface::class); + $addressData[] = array_merge($shippingData, $this->addressMapper->toNestedArray($shippingAddress)); + } + } + + return $addressData; + } +} diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/SetBillingAddressOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/SetBillingAddressOnCart.php new file mode 100644 index 000000000000..97b1ed09decc --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/SetBillingAddressOnCart.php @@ -0,0 +1,99 @@ +billingAddressManagement = $billingAddressManagement; + $this->addressRepository = $addressRepository; + $this->addressModel = $addressModel; + $this->checkCustomerAccount = $checkCustomerAccount; + } + + /** + * @inheritdoc + */ + public function execute(ContextInterface $context, CartInterface $cart, array $billingAddress): void + { + $customerAddressId = $billingAddress['customer_address_id'] ?? null; + $addressInput = $billingAddress['address'] ?? null; + $useForShipping = $billingAddress['use_for_shipping'] ?? false; + + if (null === $customerAddressId && null === $addressInput) { + throw new GraphQlInputException( + __('The billing address must contain either "customer_address_id" or "address".') + ); + } + if ($customerAddressId && $addressInput) { + throw new GraphQlInputException( + __('The billing address cannot contain "customer_address_id" and "address" at the same time.') + ); + } + $addresses = $cart->getAllShippingAddresses(); + if ($useForShipping && count($addresses) > 1) { + throw new GraphQlInputException( + __('Using the "use_for_shipping" option with multishipping is not possible.') + ); + } + if (null === $customerAddressId) { + $billingAddress = $this->addressModel->addData($addressInput); + } else { + $this->checkCustomerAccount->execute($context->getUserId(), $context->getUserType()); + + /** @var AddressInterface $customerAddress */ + $customerAddress = $this->addressRepository->getById($customerAddressId); + $billingAddress = $this->addressModel->importCustomerAddressData($customerAddress); + } + + $this->billingAddressManagement->assign($cart->getId(), $billingAddress, $useForShipping); + } +} diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/BillingAddress.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/BillingAddress.php new file mode 100644 index 000000000000..7de5a4ac05c2 --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/BillingAddress.php @@ -0,0 +1,48 @@ +addressDataProvider = $addressDataProvider; + } + + /** + * @inheritdoc + */ + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) + { + if (!isset($value['model'])) { + throw new LocalizedException(__('"model" value should be specified')); + } + + $cart = $value['model']; + + return $this->addressDataProvider->getCartAddresses($cart); + } +} diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetBillingAddressOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetBillingAddressOnCart.php new file mode 100644 index 000000000000..01a35f4b4152 --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetBillingAddressOnCart.php @@ -0,0 +1,82 @@ +getCartForUser = $getCartForUser; + $this->arrayManager = $arrayManager; + $this->setBillingAddressOnCart = $setBillingAddressOnCart; + } + + /** + * @inheritdoc + */ + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) + { + $billingAddress = $this->arrayManager->get('input/billing_address', $args); + $maskedCartId = $this->arrayManager->get('input/cart_id', $args); + + if (!$maskedCartId) { + throw new GraphQlInputException(__('Required parameter "cart_id" is missing')); + } + if (!$billingAddress) { + throw new GraphQlInputException(__('Required parameter "billing_address" is missing')); + } + + $maskedCartId = $args['input']['cart_id']; + $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId()); + + $this->setBillingAddressOnCart->execute($context, $cart, $billingAddress); + + return [ + 'cart' => [ + 'cart_id' => $maskedCartId, + 'model' => $cart, + ] + ]; + } +} diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddresses.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddresses.php new file mode 100644 index 000000000000..caa0eee22d70 --- /dev/null +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddresses.php @@ -0,0 +1,48 @@ +addressDataProvider = $addressDataProvider; + } + + /** + * @inheritdoc + */ + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) + { + if (!isset($value['model'])) { + throw new LocalizedException(__('"model" value should be specified')); + } + + $cart = $value['model']; + + return $this->addressDataProvider->getCartAddresses($cart); + } +} diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index 4c1101a5f90a..c7216f9b1a1b 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -12,7 +12,7 @@ type Mutation { setShippingAddressesOnCart(input: SetShippingAddressesOnCartInput): SetShippingAddressesOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingAddressesOnCart") applyCouponToCart(input: ApplyCouponToCartInput): ApplyCouponToCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ApplyCouponToCart") removeCouponFromCart(input: RemoveCouponFromCartInput): RemoveCouponFromCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\RemoveCouponFromCart") - setBillingAddressOnCart(input: SetBillingAddressOnCartInput): SetBillingAddressOnCartOutput + setBillingAddressOnCart(input: SetBillingAddressOnCartInput): SetBillingAddressOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetBillingAddressOnCart") setShippingMethodsOnCart(input: SetShippingMethodsOnCartInput): SetShippingMethodsOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingMethodsOnCart") addSimpleProductsToCart(input: AddSimpleProductsToCartInput): AddSimpleProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart") } @@ -35,9 +35,13 @@ input CartItemQuantityInput { input SetBillingAddressOnCartInput { cart_id: String! + billing_address: BillingAddressInput! +} + +input BillingAddressInput { customer_address_id: Int address: CartAddressInput - # TODO: consider adding "Same as shipping" option + use_for_shipping: Boolean } input CartAddressInput { @@ -97,8 +101,8 @@ type Cart { cart_id: String items: [CartItemInterface] applied_coupon: AppliedCoupon - addresses: [CartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartAddresses") -} + shipping_addresses: [CartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddresses") + billing_address: CartAddress! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\BillingAddress")} type CartAddress { firstname: String diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetBillingAddressOnCartTest.php new file mode 100644 index 000000000000..62fae71fa79f --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetBillingAddressOnCartTest.php @@ -0,0 +1,407 @@ +quoteResource = $objectManager->create(QuoteResource::class); + $this->quote = $objectManager->create(Quote::class); + $this->quoteIdToMaskedId = $objectManager->create(QuoteIdToMaskedQuoteIdInterface::class); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php + */ + public function testSetNewGuestBillingAddressOnCart() + { + $this->quoteResource->load( + $this->quote, + 'test_order_with_simple_product_without_address', + 'reserved_order_id' + ); + $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId()); + + $query = <<graphQlQuery($query); + + self::assertArrayHasKey('cart', $response['setBillingAddressOnCart']); + $cartResponse = $response['setBillingAddressOnCart']['cart']; + self::assertArrayHasKey('billing_address', $cartResponse); + $billingAddressResponse = $cartResponse['billing_address']; + $this->assertNewAddressFields($billingAddressResponse); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php + */ + public function testSetNewGuestBillingAddressOnUseForShippingCart() + { + $this->quoteResource->load( + $this->quote, + 'test_order_with_simple_product_without_address', + 'reserved_order_id' + ); + $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId()); + + $query = <<graphQlQuery($query); + + self::assertArrayHasKey('cart', $response['setBillingAddressOnCart']); + $cartResponse = $response['setBillingAddressOnCart']['cart']; + self::assertArrayHasKey('billing_address', $cartResponse); + $billingAddressResponse = $cartResponse['billing_address']; + self::assertArrayHasKey('shipping_addresses', $cartResponse); + $shippingAddressResponse = current($cartResponse['shipping_addresses']); + $this->assertNewAddressFields($billingAddressResponse); + $this->assertNewAddressFields($shippingAddressResponse); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php + */ + public function testSetSavedBillingAddressOnCartByGuest() + { + $this->quoteResource->load( + $this->quote, + 'test_order_with_simple_product_without_address', + 'reserved_order_id' + ); + $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId()); + + $query = <<graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php + * @magentoApiDataFixture Magento/Customer/_files/customer.php + */ + public function testSetNewRegisteredCustomerBillingAddressOnCart() + { + $this->quoteResource->load( + $this->quote, + 'test_order_with_simple_product_without_address', + 'reserved_order_id' + ); + $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId()); + $this->quoteResource->load( + $this->quote, + 'test_order_with_simple_product_without_address', + 'reserved_order_id' + ); + $this->quote->setCustomerId(1); + $this->quoteResource->save($this->quote); + + $headerMap = $this->getHeaderMap(); + + $query = <<graphQlQuery($query, [], '', $headerMap); + + self::assertArrayHasKey('cart', $response['setBillingAddressOnCart']); + $cartResponse = $response['setBillingAddressOnCart']['cart']; + self::assertArrayHasKey('billing_address', $cartResponse); + $billingAddressResponse = $cartResponse['billing_address']; + $this->assertNewAddressFields($billingAddressResponse); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php + */ + public function testSetSavedRegisteredCustomerBillingAddressOnCart() + { + $this->quoteResource->load( + $this->quote, + 'test_order_with_simple_product_without_address', + 'reserved_order_id' + ); + $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId()); + $this->quoteResource->load( + $this->quote, + 'test_order_with_simple_product_without_address', + 'reserved_order_id' + ); + $this->quote->setCustomerId(1); + $this->quoteResource->save($this->quote); + + $headerMap = $this->getHeaderMap(); + + $query = <<graphQlQuery($query, [], '', $headerMap); + + self::assertArrayHasKey('cart', $response['setBillingAddressOnCart']); + $cartResponse = $response['setBillingAddressOnCart']['cart']; + self::assertArrayHasKey('billing_address', $cartResponse); + $billingAddressResponse = $cartResponse['billing_address']; + $this->assertSavedBillingAddressFields($billingAddressResponse); + } + + /** + * Verify the all the whitelisted fields for a New Address Object + * + * @param array $billingAddressResponse + */ + private function assertNewAddressFields(array $billingAddressResponse): void + { + $assertionMap = [ + ['response_field' => 'firstname', 'expected_value' => 'test firstname'], + ['response_field' => 'lastname', 'expected_value' => 'test lastname'], + ['response_field' => 'company', 'expected_value' => 'test company'], + ['response_field' => 'street', 'expected_value' => [0 => 'test street 1', 1 => 'test street 2']], + ['response_field' => 'city', 'expected_value' => 'test city'], + ['response_field' => 'postcode', 'expected_value' => '887766'], + ['response_field' => 'telephone', 'expected_value' => '88776655'] + ]; + + $this->assertResponseFields($billingAddressResponse, $assertionMap); + } + + /** + * Verify the all the whitelisted fields for a Address Object + * + * @param array $billingAddressResponse + */ + private function assertSavedBillingAddressFields(array $billingAddressResponse): void + { + $assertionMap = [ + ['response_field' => 'firstname', 'expected_value' => 'John'], + ['response_field' => 'lastname', 'expected_value' => 'Smith'], + ['response_field' => 'company', 'expected_value' => 'CompanyName'], + ['response_field' => 'street', 'expected_value' => [0 => 'Green str, 67']], + ['response_field' => 'city', 'expected_value' => 'CityM'], + ['response_field' => 'postcode', 'expected_value' => '75477'], + ['response_field' => 'telephone', 'expected_value' => '3468676'] + ]; + + $this->assertResponseFields($billingAddressResponse, $assertionMap); + } + + /** + * @param string $username + * @return array + */ + private function getHeaderMap(string $username = 'customer@example.com'): array + { + $password = 'password'; + /** @var CustomerTokenServiceInterface $customerTokenService */ + $customerTokenService = ObjectManager::getInstance() + ->get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($username, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + return $headerMap; + } + + public function tearDown() + { + /** @var \Magento\Config\Model\ResourceModel\Config $config */ + $config = ObjectManager::getInstance()->get(\Magento\Config\Model\ResourceModel\Config::class); + + //default state of multishipping config + $config->saveConfig( + Data::XML_PATH_CHECKOUT_MULTIPLE_AVAILABLE, + 1, + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, + 0 + ); + + /** @var \Magento\Framework\App\Config\ReinitableConfigInterface $config */ + $config = ObjectManager::getInstance()->get(\Magento\Framework\App\Config\ReinitableConfigInterface::class); + $config->reinit(); + } +} From 957ca74c8b8b8c56f6cbbabfc446223027d6c4c1 Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Thu, 7 Feb 2019 20:47:13 +0200 Subject: [PATCH 09/15] graphQl-296: statix fix --- app/code/Magento/QuoteGraphQl/etc/schema.graphqls | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index c7216f9b1a1b..d4990b345789 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -102,7 +102,8 @@ type Cart { items: [CartItemInterface] applied_coupon: AppliedCoupon shipping_addresses: [CartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddresses") - billing_address: CartAddress! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\BillingAddress")} + billing_address: CartAddress! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\BillingAddress") +} type CartAddress { firstname: String From d0578be194182f4dc5c219fbec3b38a417db1aec Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Thu, 7 Feb 2019 20:49:30 +0200 Subject: [PATCH 10/15] graphQl-296: fixed test --- .../Quote/SetShippingAddressOnCartTest.php | 58 ++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php index a023d37895c2..d60876e7c0be 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php @@ -7,7 +7,9 @@ namespace Magento\GraphQl\Quote; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Integration\Api\CustomerTokenServiceInterface; +use Magento\Multishipping\Helper\Data; use Magento\Quote\Model\Quote; use Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface; use Magento\Quote\Model\ResourceModel\Quote as QuoteResource; @@ -79,7 +81,7 @@ public function testSetNewGuestShippingAddressOnCart() } ) { cart { - addresses { + shipping_addresses { firstname lastname company @@ -96,8 +98,8 @@ public function testSetNewGuestShippingAddressOnCart() self::assertArrayHasKey('cart', $response['setShippingAddressesOnCart']); $cartResponse = $response['setShippingAddressesOnCart']['cart']; - self::assertArrayHasKey('addresses', $cartResponse); - $shippingAddressResponse = current($cartResponse['addresses']); + self::assertArrayHasKey('shipping_addresses', $cartResponse); + $shippingAddressResponse = current($cartResponse['shipping_addresses']); $this->assertNewShippingAddressFields($shippingAddressResponse); } @@ -126,7 +128,7 @@ public function testSetSavedShippingAddressOnCartByGuest() } ) { cart { - addresses { + shipping_addresses { firstname lastname company @@ -171,7 +173,7 @@ public function testSetMultipleShippingAddressesOnCartByGuest() } ) { cart { - addresses { + shipping_addresses { firstname lastname company @@ -184,6 +186,18 @@ public function testSetMultipleShippingAddressesOnCartByGuest() } } QUERY; + /** @var \Magento\Config\Model\ResourceModel\Config $config */ + $config = ObjectManager::getInstance()->get(\Magento\Config\Model\ResourceModel\Config::class); + $config->saveConfig( + Data::XML_PATH_CHECKOUT_MULTIPLE_AVAILABLE, + null, + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, + 0 + ); + /** @var \Magento\Framework\App\Config\ReinitableConfigInterface $config */ + $config = ObjectManager::getInstance()->get(\Magento\Framework\App\Config\ReinitableConfigInterface::class); + $config->reinit(); + self::expectExceptionMessage('You cannot specify multiple shipping addresses.'); $this->graphQlQuery($query); } @@ -225,7 +239,7 @@ public function testSetSavedAndNewShippingAddressOnCartAtTheSameTime() } ) { cart { - addresses { + shipping_addresses { firstname lastname company @@ -267,7 +281,7 @@ public function testSetShippingAddressOnCartWithNoAddresses() } ) { cart { - addresses { + shipping_addresses { firstname lastname company @@ -332,7 +346,7 @@ public function testSetNewRegisteredCustomerShippingAddressOnCart() } ) { cart { - addresses { + shipping_addresses { firstname lastname company @@ -349,8 +363,8 @@ public function testSetNewRegisteredCustomerShippingAddressOnCart() self::assertArrayHasKey('cart', $response['setShippingAddressesOnCart']); $cartResponse = $response['setShippingAddressesOnCart']['cart']; - self::assertArrayHasKey('addresses', $cartResponse); - $shippingAddressResponse = current($cartResponse['addresses']); + self::assertArrayHasKey('shipping_addresses', $cartResponse); + $shippingAddressResponse = current($cartResponse['shipping_addresses']); $this->assertNewShippingAddressFields($shippingAddressResponse); } @@ -390,7 +404,7 @@ public function testSetSavedRegisteredCustomerShippingAddressOnCart() } ) { cart { - addresses { + shipping_addresses { firstname lastname company @@ -407,8 +421,8 @@ public function testSetSavedRegisteredCustomerShippingAddressOnCart() self::assertArrayHasKey('cart', $response['setShippingAddressesOnCart']); $cartResponse = $response['setShippingAddressesOnCart']['cart']; - self::assertArrayHasKey('addresses', $cartResponse); - $shippingAddressResponse = current($cartResponse['addresses']); + self::assertArrayHasKey('shipping_addresses', $cartResponse); + $shippingAddressResponse = current($cartResponse['shipping_addresses']); $this->assertSavedShippingAddressFields($shippingAddressResponse); } @@ -466,4 +480,22 @@ private function getHeaderMap(string $username = 'customer@example.com'): array $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; return $headerMap; } + + public function tearDown() + { + /** @var \Magento\Config\Model\ResourceModel\Config $config */ + $config = ObjectManager::getInstance()->get(\Magento\Config\Model\ResourceModel\Config::class); + + //default state of multishipping config + $config->saveConfig( + Data::XML_PATH_CHECKOUT_MULTIPLE_AVAILABLE, + 1, + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, + 0 + ); + + /** @var \Magento\Framework\App\Config\ReinitableConfigInterface $config */ + $config = ObjectManager::getInstance()->get(\Magento\Framework\App\Config\ReinitableConfigInterface::class); + $config->reinit(); + } } From 8a3c8665c407d462e4edc651051d0ea2f4bb02a3 Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Fri, 8 Feb 2019 07:58:00 +0200 Subject: [PATCH 11/15] graphQl-296: fixed Api functional tests --- .../testsuite/Magento/GraphQl/Quote/GetCartTest.php | 7 +++---- .../Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php index 78204aaa567b..f0038351bcdc 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php @@ -70,7 +70,7 @@ public function testGetOwnCartForRegisteredCustomer() self::assertArrayHasKey('Cart', $response); self::assertNotEmpty($response['Cart']['items']); - self::assertNotEmpty($response['Cart']['addresses']); + self::assertNotEmpty($response['Cart']['shipping_addresses']); } /** @@ -141,10 +141,9 @@ private function prepareGetCartQuery( items { id } - addresses { + shipping_addresses { firstname, - lastname, - address_type + lastname } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php index 7e77284c6b22..a0aef67faad6 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php @@ -79,7 +79,7 @@ public function testSetShippingMethodOnCart() self::assertArrayHasKey('setShippingMethodsOnCart', $response); self::assertArrayHasKey('cart', $response['setShippingMethodsOnCart']); self::assertEquals($maskedQuoteId, $response['setShippingMethodsOnCart']['cart']['cart_id']); - $addressesInformation = $response['setShippingMethodsOnCart']['cart']['addresses']; + $addressesInformation = $response['setShippingMethodsOnCart']['cart']['shipping_addresses']; self::assertCount(2, $addressesInformation); self::assertEquals( $addressesInformation[0]['selected_shipping_method']['code'], @@ -221,7 +221,7 @@ private function prepareMutationQuery( cart { cart_id, - addresses { + shipping_addresses { selected_shipping_method { code label From c840eb284479d74b23f1f1f674c14fecd9e4fd47 Mon Sep 17 00:00:00 2001 From: Vitaliy Boyko Date: Fri, 8 Feb 2019 21:25:22 +0200 Subject: [PATCH 12/15] graphQl-296: fixed shipping method test --- .../Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php index a0aef67faad6..1c6679ee30f2 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php @@ -80,7 +80,7 @@ public function testSetShippingMethodOnCart() self::assertArrayHasKey('cart', $response['setShippingMethodsOnCart']); self::assertEquals($maskedQuoteId, $response['setShippingMethodsOnCart']['cart']['cart_id']); $addressesInformation = $response['setShippingMethodsOnCart']['cart']['shipping_addresses']; - self::assertCount(2, $addressesInformation); + self::assertCount(1, $addressesInformation); self::assertEquals( $addressesInformation[0]['selected_shipping_method']['code'], $shippingCarrierCode . '_' . $shippingMethodCode From 64f7f695020cd7ca3ac059c58b0ceee55ad88d27 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 11 Feb 2019 14:28:51 -0600 Subject: [PATCH 13/15] GraphQL-142: [Cart Operations] Add configurable product to Cart --- .../AddConfigurableProductsToCart.php | 89 ------------------- .../etc/schema.graphqls | 2 +- 2 files changed, 1 insertion(+), 90 deletions(-) delete mode 100644 app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php diff --git a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php b/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php deleted file mode 100644 index 5b908835adbe..000000000000 --- a/app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/AddConfigurableProductsToCart.php +++ /dev/null @@ -1,89 +0,0 @@ -arrayManager = $arrayManager; - $this->getCartForUser = $getCartForUser; - $this->addProductsToCart = $addProductsToCart; - $this->extractDataFromCart = $extractDataFromCart; - } - - /** - * @inheritdoc - */ - public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) - { - $cartHash = $this->arrayManager->get('input/cart_id', $args); - $cartItems = $this->arrayManager->get('input/cartItems', $args); - - if (!isset($cartHash)) { - throw new GraphQlInputException(__('Missing key "cart_id" in cart data')); - } - - if (!isset($cartItems) || !is_array($cartItems) || empty($cartItems)) { - throw new GraphQlInputException(__('Missing key "cartItems" in cart data')); - } - - $currentUserId = $context->getUserId(); - $cart = $this->getCartForUser->execute((string)$cartHash, $currentUserId); - - $this->addProductsToCart->execute($cart, $cartItems); - $cartData = $this->extractDataFromCart->execute($cart); - - return [ - 'cart' => $cartData, - ]; - } -} diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls index 12841a6e4510..df95632c4b60 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls +++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls @@ -1,7 +1,7 @@ # Copyright © Magento, Inc. All rights reserved. # See COPYING.txt for license details. type Mutation { - addConfigurableProductsToCart(input: AddConfigurableProductsToCartInput): AddConfigurableProductsToCartOutput @resolver(class: "Magento\\ConfigurableProductGraphQl\\Model\\Resolver\\AddConfigurableProductsToCart") + addConfigurableProductsToCart(input: AddConfigurableProductsToCartInput): AddConfigurableProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart") } type ConfigurableProduct implements ProductInterface, PhysicalProductInterface, CustomizableProductInterface @doc(description: "ConfigurableProduct defines basic features of a configurable product and its simple product variants") { From e9946e1950ba5931d4cc25c2136f72ec3d79d7c5 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 11 Feb 2019 14:30:35 -0600 Subject: [PATCH 14/15] GraphQL-296: [Cart Operations] Set Billing Address --- .../QuoteGraphQl/Model/Cart/Address/Mapper/Address.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php index 752ab1ceccbd..64ac407e2692 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/Address/Mapper/Address.php @@ -1,7 +1,7 @@ Date: Mon, 11 Feb 2019 15:42:27 -0600 Subject: [PATCH 15/15] GraphQL-142: [Cart Operations] Add configurable product to Cart --- app/code/Magento/ConfigurableProductGraphQl/composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/composer.json b/app/code/Magento/ConfigurableProductGraphQl/composer.json index 0f0bd5d70a4c..a22df27734b7 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/composer.json +++ b/app/code/Magento/ConfigurableProductGraphQl/composer.json @@ -7,7 +7,6 @@ "magento/module-catalog": "*", "magento/module-configurable-product": "*", "magento/module-catalog-graph-ql": "*", - "magento/module-quote-graph-ql": "*", "magento/framework": "*" }, "license": [