Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
GraphQL-292: Cleanup quote GraphQL scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
naydav committed Feb 21, 2019
1 parent 192e28a commit 11b3a4f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type AddConfigurableProductsToCartOutput {
}

input ConfigurableProductCartItemInput {
data: CartItemDetailsInput!
data: CartItemInput!
variant_sku: String!
customizable_options:[CustomizableOptionInput!]
}
Expand Down
93 changes: 39 additions & 54 deletions app/code/Magento/QuoteGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,48 @@ 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")
addSimpleProductsToCart(input: AddSimpleProductsToCartInput): AddSimpleProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart")
addVirtualProductsToCart(input: AddVirtualProductsToCartInput): AddVirtualProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart")
applyCouponToCart(input: ApplyCouponToCartInput): ApplyCouponToCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ApplyCouponToCart")
removeCouponFromCart(input: RemoveCouponFromCartInput): RemoveCouponFromCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\RemoveCouponFromCart")
setShippingAddressesOnCart(input: SetShippingAddressesOnCartInput): SetShippingAddressesOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingAddressesOnCart")
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")
addVirtualProductsToCart(input: AddVirtualProductsToCartInput): AddVirtualProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart")
}

input AddSimpleProductsToCartInput {
cart_id: String!
cartItems: [SimpleProductCartItemInput!]!
}

input SimpleProductCartItemInput {
data: CartItemInput!
customizable_options:[CustomizableOptionInput!]
}

input AddVirtualProductsToCartInput {
cart_id: String!
cartItems: [VirtualProductCartItemInput!]!
}

input VirtualProductCartItemInput {
data: CartItemInput!
customizable_options:[CustomizableOptionInput!]
}

input CartItemInput {
sku: String!
qty: Float!
}

input CustomizableOptionInput {
id: Int!
value: String!
}

input ApplyCouponToCartInput {
cart_id: String!
coupon_code: String!
}

input SetShippingAddressesOnCartInput {
Expand All @@ -24,7 +57,7 @@ input SetShippingAddressesOnCartInput {
}

input ShippingAddressInput {
customer_address_id: Int # Can be provided in one-page checkout and is required for multi-shipping checkout
customer_address_id: Int # If provided then will be used address from address book
address: CartAddressInput
cart_items: [CartItemQuantityInput!]
}
Expand Down Expand Up @@ -81,19 +114,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!
}

type ApplyCouponToCartOutput {
cart: Cart!
}
Expand Down Expand Up @@ -172,31 +192,6 @@ type RemoveCouponFromCartOutput {
cart: Cart
}

input AddSimpleProductsToCartInput {
cart_id: String!
cartItems: [SimpleProductCartItemInput!]!
}

input AddVirtualProductsToCartInput {
cart_id: String!
cartItems: [VirtualProductCartItemInput!]!
}

input SimpleProductCartItemInput {
data: CartItemInput!
customizable_options:[CustomizableOptionInput!]
}

input VirtualProductCartItemInput {
data: CartItemInput!
customizable_options:[CustomizableOptionInput!]
}

input CustomizableOptionInput {
id: Int!
value: String!
}

type AddSimpleProductsToCartOutput {
cart: Cart!
}
Expand All @@ -213,11 +208,6 @@ type VirtualCartItem implements CartItemInterface @doc(description: "Virtual Car
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!
Expand Down Expand Up @@ -246,8 +236,3 @@ type CartItemSelectedOptionValuePrice {
units: String!
type: PriceTypeEnum!
}

input CartItemDetailsInput {
sku: String!
qty: Float!
}

0 comments on commit 11b3a4f

Please sign in to comment.