From 61f64700be793e58881afcaf9c4cfc35da4291c2 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 4 Mar 2019 16:25:25 -0600 Subject: [PATCH 1/3] GraphQL-433: Prepare Quote GraphQL scheme for 2.3.1 release --- app/code/Magento/QuoteGraphQl/etc/schema.graphqls | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index a76f7d59c3f77..dc71c1c8047c5 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -7,8 +7,6 @@ type Query { type Mutation { createEmptyCart: String @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CreateEmptyCart") @doc(description:"Creates an empty shopping cart for a guest or logged in user") - applyCouponToCart(input: ApplyCouponToCartInput): ApplyCouponToCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\Coupon\\ApplyCouponToCart") - removeCouponFromCart(input: RemoveCouponFromCartInput): RemoveCouponFromCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\Coupon\\RemoveCouponFromCart") 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") @@ -98,7 +96,6 @@ type ApplyCouponToCartOutput { } type Cart { - cart_id: String items: [CartItemInterface] applied_coupon: AppliedCoupon shipping_addresses: [CartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddresses") From d90e8317af39a29635b200289586b2b74cbeafb1 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 4 Mar 2019 16:48:06 -0600 Subject: [PATCH 2/3] GraphQL-433: Prepare Quote GraphQL scheme for 2.3.1 release --- .../etc/schema.graphqls | 2 +- .../Magento/QuoteGraphQl/etc/schema.graphqls | 19 +------------------ .../Quote/AddSimpleProductToCartTest.php | 4 +++- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls index df95632c4b606..d4780c5c0867a 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls +++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls @@ -49,7 +49,7 @@ type AddConfigurableProductsToCartOutput { } input ConfigurableProductCartItemInput { - data: CartItemDetailsInput! + data: CartItemInput! variant_sku: String! customizable_options:[CustomizableOptionInput!] } diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index dc71c1c8047c5..f0a155a86d8b9 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -78,14 +78,6 @@ type SetShippingMethodsOnCartOutput { cart: Cart! } -# If no address is provided, the system get address assigned to a quote -# If there's no address at all - the system returns all shipping methods -input AvailableShippingMethodsOnCartInput { - cart_id: String! - customer_address_id: Int - address: CartAddressInput -} - input ApplyCouponToCartInput { cart_id: String! coupon_code: String! @@ -119,7 +111,7 @@ type CartAddress { } type CartItemQuantity { - cart_item_id: String! + cart_item_id: Int! quantity: Float! } @@ -142,11 +134,7 @@ type AvailableShippingMethod { carrier_title: String! method_code: String! method_title: String! - error_message: String amount: Float! - base_amount: Float! - price_excl_tax: Float! - price_incl_tax: Float! } enum AdressTypeEnum { @@ -222,8 +210,3 @@ type CartItemSelectedOptionValuePrice { units: String! type: PriceTypeEnum! } - -input CartItemDetailsInput { - sku: String! - qty: Float! -} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php index 4cbc614e1b8dc..bb5bced73fbb4 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php @@ -75,7 +75,9 @@ public function testAddProductIfQuantityIsNotAvailable() } ) { cart { - cart_id + items { + qty + } } } } From 3e4b38cd782244d50ea3293ccc38078d9567e16e Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Mon, 4 Mar 2019 17:56:26 -0600 Subject: [PATCH 3/3] GraphQL-433: Prepare Quote GraphQL scheme for 2.3.1 release --- .../etc/schema.graphqls | 30 --- .../Magento/QuoteGraphQl/etc/schema.graphqls | 208 +----------------- .../Quote/AddSimpleProductToCartTest.php | 1 + .../Magento/GraphQl/Quote/CouponTest.php | 1 + .../Magento/GraphQl/Quote/GetCartTest.php | 1 + .../Quote/SetBillingAddressOnCartTest.php | 1 + .../Quote/SetShippingAddressOnCartTest.php | 1 + 7 files changed, 6 insertions(+), 237 deletions(-) diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls index d4780c5c0867a..267a94a1d434e 100644 --- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls +++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls @@ -1,8 +1,5 @@ # Copyright © Magento, Inc. All rights reserved. # See COPYING.txt for license details. -type Mutation { - 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") { variants: [ConfigurableVariant] @doc(description: "An array of variants of products") @resolver(class: "Magento\\ConfigurableProductGraphQl\\Model\\Resolver\\ConfigurableVariant") @@ -38,30 +35,3 @@ 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: CartItemInput! - 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! -} diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index f0a155a86d8b9..b314b7118c9d4 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -1,212 +1,6 @@ # Copyright © Magento, Inc. All rights reserved. # See COPYING.txt for license details. -type Query { - cart(cart_id: String!): Cart @resolver (class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\Cart") @doc(description:"Returns information about shopping cart") -} - type Mutation { - createEmptyCart: String @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CreateEmptyCart") @doc(description:"Creates an empty shopping cart for a guest or logged in user") - 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 @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") -} - -input SetShippingAddressesOnCartInput { - cart_id: String! - shipping_addresses: [ShippingAddressInput!]! -} - -input ShippingAddressInput { - customer_address_id: Int # Can be provided in one-page checkout and is required for multi-shipping checkout - address: CartAddressInput - cart_items: [CartItemQuantityInput!] -} - -input CartItemQuantityInput { - cart_item_id: Int! - quantity: Float! -} - -input SetBillingAddressOnCartInput { - cart_id: String! - billing_address: BillingAddressInput! -} - -input BillingAddressInput { - customer_address_id: Int - address: CartAddressInput - use_for_shipping: Boolean -} - -input CartAddressInput { - firstname: String! - lastname: String! - company: String - street: [String!]! - city: String! - region: String - postcode: String - country_code: String! - telephone: String! - save_in_address_book: Boolean! -} - -input SetShippingMethodsOnCartInput { - cart_id: String! - shipping_methods: [ShippingMethodForAddressInput!]! -} - -input ShippingMethodForAddressInput { - cart_address_id: Int! - carrier_code: String! - method_code: String! -} - -type SetBillingAddressOnCartOutput { - cart: Cart! -} - -type SetShippingAddressesOnCartOutput { - cart: Cart! -} - -type SetShippingMethodsOnCartOutput { - cart: Cart! -} - -input ApplyCouponToCartInput { - cart_id: String! - coupon_code: String! -} - -type ApplyCouponToCartOutput { - cart: Cart! -} - -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") -} - -type CartAddress { - firstname: String - lastname: String - company: String - street: [String] - city: String - region: CartAddressRegion - postcode: String - country: CartAddressCountry - telephone: String - address_type: AdressTypeEnum - items_weight: Float - customer_notes: String - cart_items: [CartItemQuantity] -} - -type CartItemQuantity { - cart_item_id: Int! - quantity: Float! -} - -type CartAddressRegion { - code: String - label: String -} - -type CartAddressCountry { - code: String - label: String -} - -type SelectedShippingMethod { - amount: Float! -} - -type AvailableShippingMethod { - carrier_code: String! - carrier_title: String! - method_code: String! - method_title: String! - amount: Float! -} - -enum AdressTypeEnum { - SHIPPING - BILLING -} - -type AppliedCoupon { - code: String! -} - -input RemoveCouponFromCartInput { - cart_id: String! -} - -type RemoveCouponFromCartOutput { - cart: Cart -} - -input AddSimpleProductsToCartInput { - cart_id: String! - cartItems: [SimpleProductCartItemInput!]! -} - -input SimpleProductCartItemInput { - data: CartItemInput! - customizable_options:[CustomizableOptionInput!] -} - -input CustomizableOptionInput { - id: Int! - value: String! -} - -type AddSimpleProductsToCartOutput { - cart: Cart! -} - -type SimpleCartItem implements CartItemInterface @doc(description: "Simple Cart Item") { - customizable_options: [SelectedCustomizableOption] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CustomizableOptions") -} - -input CartItemInput { - sku: String! - qty: Float! -} - -interface CartItemInterface @typeResolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CartItemTypeResolver") { - id: String! - qty: Float! - product: ProductInterface! -} - -type SelectedCustomizableOption { - id: Int! - label: String! - type: String! - is_required: Int! - values: [SelectedCustomizableOptionValue!]! - sort_order: Int! -} - -type SelectedCustomizableOptionValue { - id: Int! - label: String! - value: String! - price: CartItemSelectedOptionValuePrice! - sort_order: Int! -} - -type CartItemSelectedOptionValuePrice { - value: Float! - units: String! - type: PriceTypeEnum! + createEmptyCart: String @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CreateEmptyCart") @doc(description:"Creates empty shopping cart for guest or logged in user") } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php index bb5bced73fbb4..be87fc7d552e1 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductToCartTest.php @@ -35,6 +35,7 @@ class AddSimpleProductToCartTest extends GraphQlAbstract */ protected function setUp() { + $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/434'); $objectManager = Bootstrap::getObjectManager(); $this->quoteResource = $objectManager->get(QuoteResource::class); $this->quote = $objectManager->create(Quote::class); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CouponTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CouponTest.php index 1f8ad06a9f8ed..eeff35ea1bcda 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CouponTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CouponTest.php @@ -35,6 +35,7 @@ class CouponTest extends GraphQlAbstract protected function setUp() { + $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/434'); $objectManager = Bootstrap::getObjectManager(); $this->quoteResource = $objectManager->create(QuoteResource::class); $this->quote = $objectManager->create(Quote::class); 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 44cd2ef526bd5..369504524d2fc 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/GetCartTest.php @@ -44,6 +44,7 @@ class GetCartTest extends GraphQlAbstract */ protected function setUp() { + $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/434'); $objectManager = Bootstrap::getObjectManager(); $this->quoteResource = $objectManager->create(QuoteResource::class); $this->quote = $objectManager->create(Quote::class); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetBillingAddressOnCartTest.php index bfe57109d107d..763220973ae54 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetBillingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetBillingAddressOnCartTest.php @@ -44,6 +44,7 @@ class SetBillingAddressOnCartTest extends GraphQlAbstract protected function setUp() { + $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/434'); $objectManager = Bootstrap::getObjectManager(); $this->quoteResource = $objectManager->get(QuoteResource::class); $this->quoteFactory = $objectManager->get(QuoteFactory::class); 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 c3685c88ae487..044edb91bc8e5 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php @@ -44,6 +44,7 @@ class SetShippingAddressOnCartTest extends GraphQlAbstract protected function setUp() { + $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/434'); $objectManager = Bootstrap::getObjectManager(); $this->quoteResource = $objectManager->get(QuoteResource::class); $this->quoteFactory = $objectManager->get(QuoteFactory::class);