Skip to content

Commit

Permalink
Merge pull request #3844 from magento-engcom/ENGCOM-4431
Browse files Browse the repository at this point in the history
GraphQL-433: Prepare Quote GraphQL scheme for 2.3.1 release
  • Loading branch information
naydav authored Mar 5, 2019
2 parents 605ec6f + d741b16 commit 74962be
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 258 deletions.
30 changes: 0 additions & 30 deletions app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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: 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!
}
228 changes: 1 addition & 227 deletions app/code/Magento/QuoteGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
@@ -1,232 +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")
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")
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!
}

# 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!
}

type ApplyCouponToCartOutput {
cart: Cart!
}

type Cart {
cart_id: String
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: String!
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!
error_message: String
amount: Float!
base_amount: Float!
price_excl_tax: Float!
price_incl_tax: 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!
}

input CartItemDetailsInput {
sku: String!
qty: Float!
createEmptyCart: String @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CreateEmptyCart") @doc(description:"Creates empty shopping cart for guest or logged in user")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -75,7 +76,9 @@ public function testAddProductIfQuantityIsNotAvailable()
}
) {
cart {
cart_id
items {
qty
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 74962be

Please sign in to comment.