diff --git a/design-documents/graph-ql/coverage/b2b/negotiableQuotes.graphqls b/design-documents/graph-ql/coverage/b2b/negotiableQuotes.graphqls index 71ad69b77..b5151223e 100644 --- a/design-documents/graph-ql/coverage/b2b/negotiableQuotes.graphqls +++ b/design-documents/graph-ql/coverage/b2b/negotiableQuotes.graphqls @@ -165,15 +165,12 @@ enum NegotiableQuoteCommentCreatorType { SELLER } -type NegotiableQuote { - uid: ID! +type NegotiableQuote implements QuoteInterface { name: String! - items: [CartItemInterface!] # Attachment Support is dependent on headless File Upload design # attachments: [AttachmentContent] comments: [NegotiableQuoteComment!] history: [NegotiableQuoteHistoryEntry!] - prices: CartPrices buyer: NegotiableQuoteUser! created_at: String @doc(description: "Timestamp indicating when the negotiable quote was created.") updated_at: String @doc(description: "Timestamp indicating when the negotiable quote was updated.") @@ -282,7 +279,7 @@ type NegotiableQuoteHistoryProductsRemovedChange { # Usage in Luma: https://github.com/magento/magento2b2b/blob/0e791b5f7cd604ee6ee40b7225807c01b7f70cf2/app/code/Magento/NegotiableQuote/view/base/templates/quote/history.phtml#L148-L169 type NegotiableQuoteHistoryProductsAddedChange { - # TODO: List of products added and their respective options. + # TODO: List of products added and their respective options. } # Usage in Luma: https://github.com/magento/magento2b2b/blob/0e791b5f7cd604ee6ee40b7225807c01b7f70cf2/app/code/Magento/NegotiableQuote/view/base/templates/quote/history.phtml#L172-L197 diff --git a/design-documents/graph-ql/coverage/quote.graphqls b/design-documents/graph-ql/coverage/quote.graphqls index 4d38f67bb..62f6f60ed 100644 --- a/design-documents/graph-ql/coverage/quote.graphqls +++ b/design-documents/graph-ql/coverage/quote.graphqls @@ -2,27 +2,27 @@ # 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") @cache(cacheable: false) - customerCart: Cart! @resolver (class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CustomerCart") @doc(description:"Returns information about the customer shopping cart") @cache(cacheable: false) + cart(cart_id: String!): Cart @doc(description:"Returns information about shopping cart") @cache(cacheable: false) + customerCart: Cart! @doc(description:"Returns information about the customer shopping cart") @cache(cacheable: false) } type Mutation { - createEmptyCart(input: createEmptyCartInput): String @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CreateEmptyCart") @doc(description:"Creates an empty shopping cart for a guest or logged in user") - 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") - updateCartItems(input: UpdateCartItemsInput): UpdateCartItemsOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\UpdateCartItems") - removeItemFromCart(input: RemoveItemFromCartInput): RemoveItemFromCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\RemoveItemFromCart") - 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") - setPaymentMethodOnCart(input: SetPaymentMethodOnCartInput): SetPaymentMethodOnCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\SetPaymentMethodOnCart") - setGuestEmailOnCart(input: SetGuestEmailOnCartInput): SetGuestEmailOnCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\SetGuestEmailOnCart") - setPaymentMethodAndPlaceOrder(input: SetPaymentMethodAndPlaceOrderInput): PlaceOrderOutput @deprecated(reason: "Should use setPaymentMethodOnCart and placeOrder mutations in single request.") @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetPaymentAndPlaceOrder") - mergeCarts(source_cart_id: String!, destination_cart_id: String!): Cart! @doc(description:"Merges the source cart into the destination cart") @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\MergeCarts") - placeOrder(input: PlaceOrderInput): PlaceOrderOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\PlaceOrder") - addProductsToCart(cartId: String!, cartItems: [CartItemInput!]!): AddProductsToCartOutput @doc(description:"Add any type of product to the cart") @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddProductsToCart") + createEmptyCart(input: createEmptyCartInput): String @doc(description:"Creates an empty shopping cart for a guest or logged in user") + addSimpleProductsToCart(input: AddSimpleProductsToCartInput): AddSimpleProductsToCartOutput + addVirtualProductsToCart(input: AddVirtualProductsToCartInput): AddVirtualProductsToCartOutput + applyCouponToCart(input: ApplyCouponToCartInput): ApplyCouponToCartOutput + removeCouponFromCart(input: RemoveCouponFromCartInput): RemoveCouponFromCartOutput + updateCartItems(input: UpdateCartItemsInput): UpdateCartItemsOutput + removeItemFromCart(input: RemoveItemFromCartInput): RemoveItemFromCartOutput + setShippingAddressesOnCart(input: SetShippingAddressesOnCartInput): SetShippingAddressesOnCartOutput + setBillingAddressOnCart(input: SetBillingAddressOnCartInput): SetBillingAddressOnCartOutput + setShippingMethodsOnCart(input: SetShippingMethodsOnCartInput): SetShippingMethodsOnCartOutput + setPaymentMethodOnCart(input: SetPaymentMethodOnCartInput): SetPaymentMethodOnCartOutput + setGuestEmailOnCart(input: SetGuestEmailOnCartInput): SetGuestEmailOnCartOutput + setPaymentMethodAndPlaceOrder(input: SetPaymentMethodAndPlaceOrderInput): PlaceOrderOutput @deprecated(reason: "Should use setPaymentMethodOnCart and placeOrder mutations in single request.") + mergeCarts(source_cart_id: String!, destination_cart_id: String!): Cart! @doc(description:"Merges the source cart into the destination cart") + placeOrder(input: PlaceOrderInput): PlaceOrderOutput + addProductsToCart(cartId: String!, cartItems: [CartItemInput!]!): AddProductsToCartOutput @doc(description:"Add any type of product to the cart") } input createEmptyCartInput { @@ -86,7 +86,7 @@ input CartItemUpdateInput { # When `cart_item_id` is removed in a future version, we can mark `cart_item_uid` as non-nullable # with minimal disruption cart_item_id: Int @deprecated(reason: "Use the `cart_item_uid` field instead") - cart_item_interface_uid: ID @doc(description: "Required field. Unique Identifier from objects implementing `CartItemInterface`") + cart_item_interface_uid: ID! @doc(description: "Required field. Unique Identifier from objects implementing `CartItemInterface`") quantity: Float customizable_options: [CustomizableOptionInput!] } @@ -106,7 +106,7 @@ input RemoveItemFromCartInput { # When `cart_item_id` is removed in a future version, we can mark `cart_item_uid` as non-nullable # with minimal disruption cart_item_id: Int @deprecated(reason: "Use the `cart_item_uid` field instead") - cart_item_interface_uid: ID @doc(description: "Required field. Unique Identifier from objects implementing `CartItemInterface`") + cart_item_interface_uid: ID! @doc(description: "Required field. Unique Identifier from objects implementing `CartItemInterface`") } input SetShippingAddressesOnCartInput { @@ -187,7 +187,7 @@ type CartPrices { discount: CartDiscount @deprecated(reason: "Use discounts instead ") subtotal_with_discount_excluding_tax: Money applied_taxes: [CartTaxItem] - discounts: [Discount] @doc(description:"An array of applied discounts") @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\Discounts") + discounts: [Discount] @doc(description:"An array of applied discounts") } type CartTaxItem { @@ -224,22 +224,30 @@ type PlaceOrderOutput { order: Order! } -type Cart { - id: ID! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\MaskedCartId") @doc(description: "The ID of the cart.") - items: [CartItemInterface] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartItems") - applied_coupon: AppliedCoupon @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\AppliedCoupon") @doc(description:"An array of coupons that have been applied to the cart") @deprecated(reason: "Use applied_coupons instead ") - applied_coupons: [AppliedCoupon] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\AppliedCoupons") @doc(description:"An array of `AppliedCoupon` objects. Each object contains the `code` text attribute, which specifies the coupon code") - email: String @resolver (class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartEmail") - shipping_addresses: [ShippingCartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddresses") - billing_address: BillingCartAddress @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\BillingAddress") - available_payment_methods: [AvailablePaymentMethod] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AvailablePaymentMethods") @doc(description: "Available payment methods") - selected_payment_method: SelectedPaymentMethod @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SelectedPaymentMethod") - prices: CartPrices @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartPrices") - total_quantity: Float! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartTotalQuantity") - is_virtual: Boolean! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartIsVirtual") +interface QuoteInterface { + uid: ID! + items: [CartItemInterface]! + total_quantity: Float! + is_virtual: Boolean! + prices: CartPrices! + applied_coupons: [AppliedCoupon]! @doc(description:"An array of `AppliedCoupon` objects. Each object contains the `code` text attribute, which specifies the coupon code") + shipping_addresses: [ShippingCartAddress]! @doc(description: "Set Shipping addresses") + billing_address: BillingCartAddress + available_payment_methods: [AvailablePaymentMethod]! @doc(description: "Available payment methods based on different factors") + selected_payment_method: SelectedPaymentMethod } -interface CartAddressInterface @typeResolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartAddressTypeResolver") { +interface QuoteItemInterface { + uid: ID! +} + +type Cart implements QuoteInterface{ + id: ID! @deprecated(reason: "Use `QuoteInterface.uid` instead") @doc(description: "The ID of the cart.") + applied_coupon: AppliedCoupon @deprecated(reason: "Use `applied_coupons` instead ") @doc(description:"An array of coupons that have been applied to the cart") + email: String +} + +interface CartAddressInterface { firstname: String! lastname: String! company: String @@ -252,8 +260,8 @@ interface CartAddressInterface @typeResolver(class: "\\Magento\\QuoteGraphQl\\Mo } type ShippingCartAddress implements CartAddressInterface { - available_shipping_methods: [AvailableShippingMethod] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddress\\AvailableShippingMethods") - selected_shipping_method: SelectedShippingMethod @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddress\\SelectedShippingMethod") + available_shipping_methods: [AvailableShippingMethod] + selected_shipping_method: SelectedShippingMethod customer_notes: String items_weight: Float @deprecated(reason: "This information shoud not be exposed on frontend") cart_items: [CartItemQuantity] @deprecated(reason: "`cart_items_v2` should be used instead") @@ -346,18 +354,18 @@ type SetGuestEmailOnCartOutput { } type SimpleCartItem implements CartItemInterface @doc(description: "Simple Cart Item") { - customizable_options: [SelectedCustomizableOption] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CustomizableOptions") + customizable_options: [SelectedCustomizableOption] } type VirtualCartItem implements CartItemInterface @doc(description: "Virtual Cart Item") { - customizable_options: [SelectedCustomizableOption] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CustomizableOptions") + customizable_options: [SelectedCustomizableOption] } -interface CartItemInterface @typeResolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\CartItemTypeResolver") { +interface CartItemInterface { id: String! @deprecated(reason: "Use CartItemInterface.uid instead") uid: ID! @doc(description: "Unique identifier for a Cart Item") quantity: Float! - prices: CartItemPrices @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartItemPrices") + prices: CartItemPrices product: ProductInterface! }