This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
8341 requisition list mutations #8354
Merged
keharper
merged 16 commits into
magento:requisition-lists
from
chiranjeevi-cj:8341-requisition-list-mutations
Dec 16, 2020
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4e9a457
Added documentation for requisition list mutation
a8cab77
Added quotes to the status
e6a856c
removed cart object in clearCustomerCart input attributes table
b7d9839
Followed the standards and changed the anchor names
9522eb4
Update src/_includes/graphql/requisition-list.md
chiranjeevi-cj 033ecb7
Apply suggestions from code review
chiranjeevi-cj e96c156
arranged the attributes in alphabetical order and added uid in requis…
c1cb304
removed blank space
1fe7b4e
Apply suggestions from code review
chiranjeevi-cj e938a0c
updated the updateRequisitionListItems mutation
5213cd5
Delete requisition-list.md
chiranjeevi-cj db46ee0
updated the files
448213c
Update add-requisition-list-items-to-cart.md
keharper 56c9d43
Update clear-customer-cart.md
keharper 463a25b
Update update-requisition-list-items.md
keharper c58c241
Merge branch 'requisition-lists' into 8341-requisition-list-mutations
keharper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
src/guides/v2.4/graphql/mutations/add-products-to-requisition-list.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
group: graphql | ||
title: addProductsToRequisitionList mutation | ||
b2b_only: true | ||
contributor_name: EY | ||
--- | ||
The `addProductsToRequisitionList` mutation adds products to a requisition list. | ||
|
||
This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html). | ||
|
||
{:.bs-callout-info} | ||
Use the [storeConfig query]({{page.baseurl}}/graphql/queries/store-config.html) with the `btob_website_configuration_requisition_list_active` attribute to determine whether requisition lists are supported. | ||
|
||
## Syntax | ||
|
||
```graphql | ||
mutation { | ||
addProductsToRequisitionList( | ||
requisitionListUid: ID! | ||
requisitionListItems: [RequisitionListItemsInput!]! | ||
) { | ||
AddProductsToRequisitionListOutput | ||
} | ||
} | ||
``` | ||
|
||
## Example usage | ||
|
||
The following example adds products to a requisition list. | ||
|
||
**Request:** | ||
|
||
``` graphql | ||
mutation { | ||
addProductsToRequisitionList( | ||
requisitionListUid: "Y29uZmlndXJhYmxlLzkzLzUz" | ||
requisitionListItems: [ | ||
{ | ||
sku: "sku" | ||
quantity: 1 | ||
selected_options: ["Y29uZmlndXJhYmxlLzkzLzUz","Y29uZmlndXJhYmxlLzE0NC8xNzE="] | ||
} | ||
] | ||
) { | ||
requisition_list { | ||
uid | ||
items_count | ||
} | ||
} | ||
} | ||
``` | ||
|
||
**Response:** | ||
|
||
``` json | ||
{ | ||
"data": { | ||
"addProductsToRequisitionList": { | ||
"requisition_list": { | ||
"uid": "1", | ||
"items_count": 1 | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Input attributes | ||
|
||
The `addProductsToRequisitionList` mutation requires the following input. | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`requisitionListItems`| [[RequisitionListItemsInput](#RequisitionListItemsInput)!]! | An array of products to be added to the requisition list | ||
`requisitionListUid`| ID! | The unique ID of the requisition list | ||
|
||
### RequisitionListItemsInput attributes {#RequisitionListItemsInput} | ||
|
||
The `RequisitionListItemsInput` type contains the list of products to add to a requisition list. | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`entered_options` | [EnteredOptionInput!] | An array of customer entered option IDs | ||
`parent_sku` | String | For configurable products, the SKU of the parent product | ||
`quantity` | Float | The quantity of the product to add | ||
`selected_options` | [String!] | An array of selected option IDs | ||
`sku` | String! | The product SKU | ||
|
||
## Output attributes | ||
|
||
The `addProductsToRequisitionList` object returns the requisition list object. | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`requisition_list` | [[RequisitionList](#RequisitionList)] | The requisition list after the items were added | ||
|
||
### RequisitionList attributes {#RequisitionList} | ||
|
||
The `RequisitionList` object can contain the following attributes. | ||
|
||
{% include graphql/requisition-list.md %} |
98 changes: 98 additions & 0 deletions
98
src/guides/v2.4/graphql/mutations/add-requisition-list-items-to-cart.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
group: graphql | ||
title: addRequisitionListItemsToCart mutation | ||
b2b_only: true | ||
contributor_name: EY | ||
--- | ||
The `addRequisitionListItemsToCart` mutation adds requisition list items to the cart. | ||
|
||
This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html). | ||
|
||
{:.bs-callout-info} | ||
Use the [storeConfig query]({{page.baseurl}}/graphql/queries/store-config.html) with the `btob_website_configuration_requisition_list_active` attribute to determine whether requisition lists are supported. | ||
|
||
## Syntax | ||
|
||
```graphql | ||
mutation { | ||
addRequisitionListItemsToCart ( | ||
requisitionListUid: ID | ||
requisitionListItemUids: [ID!] | ||
) { | ||
AddRequisitionListItemsToCartOutput | ||
} | ||
} | ||
``` | ||
|
||
## Example usage | ||
|
||
The following example adds items to the cart. | ||
|
||
**Request:** | ||
|
||
``` graphql | ||
mutation { | ||
addRequisitionListItemsToCart | ||
( | ||
requisitionListUid: "Y29uZmlndXJhYmxlLzkzLzUz" | ||
requisitionListItemUids: ["1","2"] | ||
) { | ||
status | ||
} | ||
} | ||
``` | ||
|
||
**Response:** | ||
|
||
``` json | ||
{ | ||
"data": { | ||
"addRequisitionListItemsToCart": { | ||
"status": "true" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Input attributes | ||
|
||
The `addRequisitionListItemsToCart` mutation requires the following input. | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`requisitionListItemUids`| [ID!] | An array of UIDs presenting products to be added to the cart. If no UIDs are specified, all items in the requisition list will be added to the cart | ||
`requisitionListUid`| ID! | The unique ID of the requisition list | ||
|
||
## Output attributes | ||
|
||
The `addRequisitionListItemsToCart` object returns the status, cart and errors object. | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`add_requisition_list_items_to_cart_user_errors` | [[AddRequisitionListItemToCartUserError!](#AddRequisitionListItemToCartUserError)] | Indicates why the attempt to add items to the requistion list was not successful | ||
`cart` | [Cart](#CartObject) | The cart after adding requisition list items. | ||
`status` | Boolean! | Indicates whether the attempt to add items to the requisition list was successful | ||
|
||
### AddRequisitionListItemToCartUserError attributes {#AddRequisitionListItemToCartUserError} | ||
|
||
The `AddRequisitionListItemToCartUserError` type contains the list of errors which indicates why the attempt to add items to the requistion list was not successful. | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`message` | String! | A description of the error | ||
`type` | [AddRequisitionListItemToCartUserErrorType!](#AddRequisitionListItemToCartUserErrorType) | The Error type | ||
|
||
### AddRequisitionListItemToCartUserErrorType {#AddRequisitionListItemToCartUserErrorType} | ||
|
||
Type | Description | ||
--- | --- | ||
`LOW_QUANTITY` | The quantity of one of the items is low | ||
`OPTIONS_UPDATED` | The options have been updated | ||
`OUT_OF_STOCK` | One of the items is out of stock | ||
`UNAVAILABLE_SKU` | One of the items SKU is unavailable | ||
|
||
### Cart object {#CartObject} | ||
|
||
The `Cart` object can contain the following attributes. | ||
|
||
{% include graphql/cart-object-24.md %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
group: graphql | ||
title: clearCustomerCart mutation | ||
b2b_only: true | ||
contributor_name: EY | ||
--- | ||
The `clearCustomerCart` mutation clears the customer's cart. | ||
|
||
This mutation requires a valid [customer authentication token]({{page.baseurl}}/graphql/mutations/generate-customer-token.html). | ||
|
||
{:.bs-callout-info} | ||
Use the [storeConfig query]({{page.baseurl}}/graphql/queries/store-config.html) with the `btob_website_configuration_requisition_list_active` attribute to determine whether requisition lists are supported. | ||
|
||
## Syntax | ||
|
||
```graphql | ||
mutation { | ||
clearCustomerCart( | ||
cartUid: String! | ||
) { | ||
ClearCustomerCartOutput | ||
} | ||
} | ||
``` | ||
|
||
## Example usage | ||
|
||
The following example clears the customer's cart. | ||
|
||
**Request:** | ||
|
||
``` graphql | ||
mutation { | ||
clearCustomerCart( | ||
cartUid: "1" | ||
) { | ||
status | ||
} | ||
} | ||
``` | ||
|
||
**Response:** | ||
|
||
``` json | ||
{ | ||
"data": { | ||
"clearCustomerCart": { | ||
"status": "true" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Input attributes | ||
|
||
The `clearCustomerCart` mutation requires the following input. | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`cartUid`| String! | Indicates whether cart was cleared | ||
|
||
## Output attributes | ||
|
||
The `clearCustomerCart` object returns the status and cart object. | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`cart` | [Cart](#CartObject) | The cart after clearing items | ||
`status` | Boolean! | The requisition list after the items were added | ||
|
||
### Cart object {#CartObject} | ||
|
||
The `Cart` object can contain the following attributes. | ||
|
||
{% include graphql/cart-object-24.md %} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.