Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

GraphQL: Requisition list updates #8408

Merged
merged 3 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/_data/toc/graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ pages:

- label: addProductsToRequisitionList mutation
url: /graphql/mutations/add-products-to-requisition-list.html
edition: ee-only
exclude_versions: [ "2.3" ]

- label: addProductsToWishlist mutation
Expand All @@ -191,6 +192,7 @@ pages:

- label: addRequisitionListItemsToCart mutation
url: /graphql/mutations/add-requisition-list-items-to-cart.html
edition: ee-only
exclude_versions: [ "2.3" ]

- label: addSimpleProductsToCart mutation
Expand Down Expand Up @@ -479,6 +481,7 @@ pages:

- label: updateRequisitionListItems mutation
url: /graphql/mutations/update-requisition-list-items.html
edition: ee-only
exclude_versions: [ "2.3" ]

- label: updateWishlist mutation
Expand Down Expand Up @@ -533,10 +536,16 @@ pages:
url: /graphql/interfaces/order-item-interface.html
exclude_versions: ["2.3"]

- label: RequisitionListItemInterface attributes and implementations
url: /graphql/interfaces/requisition-list-item-interface.html
edition: b2b-only
exclude_versions: ["2.3"]

- label: ShipmentItemInterface attributes and implementations
url: /graphql/interfaces/shipment-item-interface.html
exclude_versions: ["2.3"]


- label: Payment methods
children:

Expand Down
10 changes: 6 additions & 4 deletions src/_includes/graphql/customer-output-24.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,25 @@ Attribute | Data Type | Description
`firstname` | String | The customer's first name
`gender` | Int | The customer's gender (Male - 1, Female - 2)
`group_id` | Int | Deprecated. This attribute is not applicable for GraphQL. The group assigned to the user. Default values are 0 (Not logged in), 1 (General), 2 (Wholesale), and 3 (Retailer)
`id` | Int | Deprecated. This attribute is not applicable for GraphQL.The ID assigned to the customer
`id` | Int | Deprecated. This attribute is not applicable for GraphQL. The ID assigned to the customer
`is_subscribed` | Boolean | Indicates whether the customer is subscribed to the company's newsletter
`lastname` | String | The customer's family name
`middlename` |String | The customer's middle name
`orders(<FilterCriteria>)` | {{ customeroutput_text }} | A list of the customer's placed orders{{ crossref_text }}
`orders(filter CustomerOrdersFilterInput, currentPage = 1 Int, pageSize = 20 Int)` | {{ customeroutput_text }} | A list of the customer's placed orders{{ crossref_text }}
`prefix` | String | An honorific, such as Dr., Mr., or Mrs.
`reviews(pageSize: Int = 20 currentPage: Int = 1)` | ProductReviews! | The list of reviews of the product
`reward_points` | RewardPoints | Details about the customer's reward points
`suffix` | String | A value such as Sr., Jr., or III
`taxvat` | String | The customer's Tax/VAT number (for corporate customers)
`wishlist` | Wishlist! | Contains the contents of the customer's wish lists
`wishlist` | Wishlist! | Deprecated. Use `wishlist_v2` instead. Contains the contents of the customer's wish lists
`wishlist_v2(id ID!)` | Wishlist | Retrieve the specified wish list identified by the unique ID for a Wishlist object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`wishlist_v2(id ID!)` | Wishlist | Retrieve the specified wish list identified by the unique ID for a Wishlist object
`wishlist_v2(id ID!)` | Wishlist | Retrieves the specified wish list identified by the unique ID for a Wishlist object


For B2B, company users can have the following attributes.
For B2B, company administrators and users can have the following attributes.

Attribute | Data Type | Description
--- | --- | ---
`job_title` | String | The job title for a B2B company user
`requisition_lists (pageSize = 20 Int, currentPage = 1 Int, filter RequisitionListFilterInput)` | RequisitionLists | Contains the customer's requisition lists
`role`| CompanyRole | The role name and permissions assigned to the company user
`status` | CompanyUserStatusEnum | Indicates whether the company user is ACTIVE or INACTIVE
`team` | CompanyTeam | The team the company user is assigned to
Expand Down
12 changes: 11 additions & 1 deletion src/_includes/graphql/requisition-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@ The `RequisitionList` object contains the following attributes.
Attribute | Data Type | Description
--- | --- | ---
`description` | String | Optional text that describes the requisition list
`items` | RequistionListItems | An array of products added to the requisition list
`items` | [RequistionListItems](#RequistionListItems) | An array of products added to the requisition list
`items_count` | Int! | The number of items in the list
`name` | String! | The requisition list name
`uid` | ID! | The unique requisition list ID
`updated_at` | String | The time of the last modification of the requisition list

### RequistionListItems attributes {#RequistionListItems}

The `RequistionListItems` object contains the following attributes.

Attribute | Data Type | Description
--- | --- | ---
`items` | [RequisitionListItemInterface]! | An array of items in the requisition list
`page_info` | SearchResultPageInfo | Contains pagination metadata
`total_pages` | Int! | The number of pages returned
159 changes: 159 additions & 0 deletions src/guides/v2.4/graphql/interfaces/requisition-list-item-interface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
---
group: graphql
title: RequisitionListItemInterface attributes and implementations
---

`RequisitionListItemInterface` provides details about items in a requisition list. It has the following implementations:

* [`BundleRequisitionListItem`](#BundleRequisitionListItem)
* [`ConfigurableRequisitionListItem`](#ConfigurableRequisitionListItem)
* [`DownloadableRequisitionListItem`](#DownloadableRequisitionListItem)
* [`GiftCardRequisitionListItem`](#GiftCardRequisitionListItem)
* [`SimpleRequisitionListItem`](#SimpleRequisitionListItem)
* [`VirtualRequisitionListItem`](#VirtualRequisitionListItem)

{:.bs-callout-info}
There is not an implementation for grouped products. The items within a grouped product are managed individually.

## Attributes

The `RequisitionListItemInterface` defines the following attributes.

Attribute | Data Type | Description
--- | --- | ---
`customizable_options`: [SelectedCustomizableOption] | Selected custom options for an item in the requisition list
`product` | [ProductInterface!]({{page.baseurl}}/graphql/interfaces/product-interface.html) | Contains details about an item added to a requisition list
`quantity` | Float! | The amount added
`uid` | ID! | The unique ID for the requisition list item

## Implementations

### BundleRequisitionListItem attributes {#BundleRequisitionListItem}

The `BundleRequisitionListItem` implementation adds the following attribute.

Attribute | Data Type | Description
--- | --- | ---
`bundle_options`| [SelectedBundleOption]! | An array of selected options for a bundle product

### ConfigurableRequisitionListItem attributes {#ConfigurableRequisitionListItem}

The `ConfigurableRequisitionListItem` implementation adds the following attribute.

Attribute | Data Type | Description
--- | --- | ---
`configurable_options`| [SelectedConfigurableOption] | Selected configurable options for an item in the requisition list

### DownloadableRequisitionListItem attributes {#DownloadableRequisitionListItem}

The `ConfigurableRequisitionListItem` implementation adds the following attributes.

Attribute | Data Type | Description
--- | --- | ---
`links`| [DownloadableProductLinks] | An array of links for downloadable products in the requisition list
`samples` | [DownloadableProductSamples] An array of links to downloadable product samples

### GiftCardRequisitionListItem attributes {#GiftCardRequisitionListItem}

The `GiftCardRequisitionListItem` implementation adds the following attributes.

Attribute | Data Type | Description
--- | --- | ---
`gift_card_options` | GiftCardOptions! | An array that defines gift card properties

#### GiftCardOptions attributes {#GiftCardOptions}

The GiftCardOptions object provides details about a gift card. All attributes are optional for a requisition list.

Attribute | Data Type | Description
--- | --- | ---
`amount`| Money | The amount and currency of the gift card
`custom_giftcard_amount` | Money | The custom amount and currency of the gift card
`message` | String | A message to the recipient
`recipient_email` | String | The name of the person receiving the gift card
`sender_email` | String | The email address of the person sending the gift card
`sender_name` | String | The name of the person sending the gift card

### SimpleRequisitionListItem attributes {#SimpleRequisitionListItem}

The SimpleRequisitionListItem data type does not provide additional attributes to the `RequisitionListItemInterface`.

### VirtualRequisitionListItem attributes {#VirtualRequisitionListItem}

The VirtualRequisitionListItem data type does not provide additional attributes to the `RequisitionListItemInterface`.

## Example usage

The following mutation adds a product to a requisition list and returns information about the products in the list.

**Request:**

```graphql
mutation {
addProductsToRequisitionList(
requisitionListUid: "Mg=="
requisitionListItems: [
{
sku: "MS10"
quantity: 1
selected_options: ["Y29uZmlndXJhYmxlLzkzLzUw","Y29uZmlndXJhYmxlLzE2MC8xNjg"]
}
]
) {
requisition_list {
uid
items {
items {
... on RequisitionListItemInterface {
uid
product {
uid
sku
name
}
quantity
}
}
}
items_count
}
}
}
```

**Response:**

```json
{
"data": {
"addProductsToRequisitionList": {
"requisition_list": {
"uid": "Mg==",
"items": {
"items": [
{
"uid": "Mg==",
"product": {
"uid": "MTA=",
"sku": "24-WB05",
"name": "Savvy Shoulder Tote"
},
"quantity": 1
},
{
"uid": "Mw==",
"product": {
"uid": "NTk2",
"sku": "MS10",
"name": "Logan HeatTec&reg; Tee"
},
"quantity": 1
}
]
},
"items_count": 2
}
}
}
}
```
47 changes: 27 additions & 20 deletions src/guides/v2.4/graphql/queries/customer.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,26 +629,6 @@ Attribute | Data Type | Description

{% include graphql/product-review.md %}

### Wishlist attributes {#Wishlist}

Attribute | Data type | Description
--- | --- | ---
`items` | [[WishlistItem](#wishlistitem)] | An array of items in the customer's wish list
`items_count` | Int | The number of items in the wish list
`id` | ID | The unique identifier of the wish list
`sharing_code` | String | An encrypted code that Magento uses to link to the wish list
`updated_at` | String | The time of the last modification to the wish list

#### WishlistItem attributes {#wishlistitem}

Attribute | Data type | Description
--- | --- | ---
`added_at` | String | The time when the customer added the item to the wish list
`description` | String | The customer's comment about this item
`id` | Int | The wish list item ID
`product` | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html) | The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes
`qty` | Float | The quantity of this wish list item

### Store credit attributes

In {{site.data.var.ee}}, the merchant can assign store credit to customers. Magento maintains the history of all changes to the balance of store credit available to the customer. The customer must be logged in to access the store credit history and balance.
Expand Down Expand Up @@ -694,6 +674,33 @@ Attribute | Data Type | Description

{% include graphql/wishlist.md %}

## B2B output attributes {#B2b}

If B2B is installed the `Customer` object can contain additional information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If B2B is installed the `Customer` object can contain additional information.
If B2B is installed, the `Customer` object can contain additional information.


### RequisitionListFilterInput attributes {#RequisitionListFilterInput}

The `RequisitionListFilterInput` object defines filters that limit the number of requisition lists returned.

Attribute | Data Type | Description
--- | --- | ---
`name` | FilterMatchTypeInput | Filter by the display name of the requisition list
`uids` | FilterEqualTypeInput | Filter requisition lists by one or more requisition list IDs

### RequisitionList attributes {#RequisitionList}

{% include graphql/requisition-list.md %}

### RequisitionLists attributes {#RequisitionList}

The RequisitionLists object contains an array of requisition lists.

Attribute | Data Type | Description
--- | --- | ---
`items` | [[RequisitionList]](#RequisitionList) | An array of requisition lists
`page_info` | SearchResultPageInfo | Contains pagination metadata
`total_count` | Int | The number of returned requisition lists

## Related topics

* [isEmailAvailable query]({{page.baseurl}}/graphql/queries/is-email-available.html)
Expand Down