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

GraphQL: Add RMA mutations #8258

Merged
merged 19 commits into from
Dec 23, 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
24 changes: 22 additions & 2 deletions src/_data/toc/graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ pages:
edition: b2b-only
exclude_versions: [ "2.3" ]

- label: addReturnComment mutation
url: /graphql/mutations/add-return-comment.html
edition: ee-only
exclude_versions: ["2.3"]

- label: addReturnTracking mutation
url: /graphql/mutations/add-return-tracking.html
edition: ee-only
exclude_versions: ["2.3"]

- label: addSimpleProductsToCart mutation
url: /graphql/mutations/add-simple-products.html

Expand Down Expand Up @@ -375,6 +385,11 @@ pages:
url: /graphql/mutations/remove-products-from-wishlist.html
exclude_versions: ["2.3"]

- label: removeReturnTracking mutation
url: /graphql/mutations/remove-return-tracking.html
edition: ee-only
exclude_versions: ["2.3"]

- label: removeRewardPointsFromCart mutation
url: /graphql/mutations/remove-reward-points.html
edition: ee-only
Expand All @@ -392,13 +407,18 @@ pages:
url: /graphql/mutations/request-password-reset-email.html
exclude_versions: ["2.3"]

- label: revokeCustomerToken mutation
url: /graphql/mutations/revoke-customer-token.html
- label: requestReturn mutation
url: /graphql/mutations/request-return.html
edition: ee-only
exclude_versions: ["2.3"]

- label: resetPassword mutation
url: /graphql/mutations/reset-password.html
exclude_versions: ["2.3"]

- label: revokeCustomerToken mutation
url: /graphql/mutations/revoke-customer-token.html

- label: sendEmailToFriend mutation
url: /graphql/mutations/send-email-to-friend.html

Expand Down
14 changes: 8 additions & 6 deletions src/_includes/graphql/customer-orders-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,23 @@ Attribute | Data type | Description
`carrier` | String | The shipping carrier for the order delivery
`comments` | [[SalesCommentItem]](#SalesCommentItem) | Comments on the order
`created_at` | String | Deprecated. Use the `order_date` attribute instead
`credit_memos` | [[CreditMemo]](#CreditMemo) | Contains a list of credit memos for the order
`grand_total` | Float | Deprecated. Use the `totals.grand_total` attribute instead
`credit_memos` | [[CreditMemo](#CreditMemo)] | Contains a list of credit memos for the order
`gift_message` | [GiftMessage](#GiftMessage) | The entered gift message for the order
`gift_receipt_included` | Boolean! | Indicates if the customer requested a gift receipt for the order
`gift_wrapping` | [GiftWrapping](#GiftWrapping) | The selected gift wrapping for the order
`id` | ID! | The unique ID for a `CustomerOrder` object
`grand_total` | Float | Deprecated. Use the `totals.grand_total` attribute instead
`id` | ID! | Unique identifier for the order
`increment_id` | String | Deprecated. Use the `id` attribute instead
`invoices` | [[Invoice]](#Invoice)! | Contains a list of invoices for the order
`items` | [[OrderItemInterface]](#OrderItemInterface) | An array containing the items purchased in this order
`invoices` | [[Invoice](#Invoice)]! | Contains a list of invoices for the order
`items` | [[OrderItemInterface](#OrderItemInterface)] | An array containing the items purchased in this order
`items_eligible_for_return` | [[OrderItemInterface](#OrderItemInterface)] | A list of order items eligible to be in a return request
`number` | String! | The order number
`order_date` | String! | The date the order was placed
`order_number` | String! | Deprecated. Use the `number` attribute instead
`payment_methods` | [[PaymentMethod]](#PaymentMethod) | Payment details for the order
`printed_card_included` | Boolean! | Indicates if the customer requested a printed card for the order
`shipments` | [[OrderShipment]](#OrderShipment) | Shipment list for the order
`returns (pageSize = 20 Int, currentPage = 1 Int)` | [Returns](#Returns) | Return requests associated with this order
`shipments` | [[OrderShipment](#OrderShipment)] | Shipment list for the order
`shipping_address` | [OrderAddress](#OrderAddress) | Shipping address for the order
`shipping_method` | String | Shipping method for the order
`status` | String! | The current status of the order
Expand Down
4 changes: 3 additions & 1 deletion src/_includes/graphql/customer-output-24.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ Attribute | Data Type | Description
`middlename` |String | The customer's middle name
`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)` | {{ productreview_text }} | The list of reviews of the product
`return(uid: ID!)` | Return | Gets details about the specified return request
`returns(pageSize: Int = 20 currentPage: Int = 1)` | Returns | Information about the customer's return requests
`reviews(pageSize: Int = 20 currentPage: Int = 1)` | ProductReviews! | The list of reviews of the product
`reward_points` | {{ rewardpoints_text }} | 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)
Expand Down
109 changes: 109 additions & 0 deletions src/_includes/graphql/return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
The `Return` object can contain the following attributes:

Attribute | Data Type | Description
--- | --- | ---
`available_shipping_carriers` | [ReturnShippingCarrier] | A list of shipping carriers available for returns
`comments`| [ReturnComment] | A list of comments posted for the return request
`created_at` | String! | The date the return was requested
`customer_email` | String! | Email of the person who created the return request
`customer` | [ReturnCustomer](#ReturnCustomer) | The name of the person who requested the return
`items`| [[ReturnItem]](#ReturnItem) | A list of items being returned
`number` | String! | Human-readable return number
`order` | [CustomerOrder]({{page.baseurl}}/graphql/queries/customer.html#orders) | The order associated with the return
`shipping` | [ReturnShipping](#ReturnShipping) | Shipping information for the return
`status` | ReturnStatus | An enum indicating the status of the return request. Possible values are APPROVED, AUTHORIZED, CLOSED, DENIED, PARTIALLY_APPROVED, PARTIALLY_AUTHORIZED, PARTIALLY_RECEIVED, PARTIALLY_REJECTED, PENDING, PROCESSED_AND_CLOSED, RECEIVED, and REJECTED
`uid` | ID! | The unique ID of a `Return` object

#### ReturnComment attributes {#ReturnComment}

The ReturnComment object provides details about an individual comment in a refund request. Comments can be added by a customer or the merchant.

Attribute | Data Type | Description
--- | --- | ---
`author_name` | String! | The name or author who posted the comment
`created_at` | String! | The date and time the comment was posted
`text` | String! | The contents of the comment
`uid` | ID! | The unique ID of a `ReturnComment` object

#### ReturnCustomAttribute attributes {#ReturnCustomAttribute}

Attribute | Data Type | Description
--- | --- | ---
`label` | String! | A description of the attribute
`uid` | ID! | The unique ID of a `ReturnCustomAttribute` attribute
`value` | String! | A JSON-encoded value of the attribute

#### ReturnCustomer attributes {#ReturnCustomer}

The ReturnCustomer object contains information about the person requesting a return.

Attribute | Data Type | Description
--- | --- | ---
`email` | String! | The email address of the refund requester
`firstname` | String | The first name of the refund requester
`lastname` | String | The last name of the refund requester

#### ReturnItem attributes {#ReturnItem}

The ReturnItem object provides details about an individual item in a return request.

Attribute | Data Type | Description
--- | --- | ---
`custom_attributes` | [[ReturnCustomAttribute]](#ReturnCustomAttribute) | Return item custom attributes that are visible on the storefront
`order_item` | [OrderItemInterface!]({{page.baseurl}}/graphql/interfaces/order-item-interface.html) | Provides access to the product being returned, including information about selected and entered options
`quantity` | Float! | The quantity of the item the merchant authorized to be returned
`request_quantity` | Float! | The quantity of the item requested to be returned
`status`| ReturnItemStatus! | An enum indicating the return status of the item. Possible values are APPROVED, AUTHORIZED, DENIED, PENDING, RECEIVED, and REJECTED
`uid`| ID! | The unique ID of an item of a `Return` object

#### ReturnShipping attributes {#ReturnShipping}

The ReturnShipping object can contain the merchant's shipping address and tracking information.

Attribute | Data Type | Description
--- | --- | ---
`address`| [ReturnShippingAddress](#ReturnShippingAddress) | The merchant-defined return shipping address
`tracking(uid: ID)` | [[ReturnShippingTracking](#ReturnShippingTracking)] | The unique ID for a `ReturnShippingTracking` object. If a single UID is specified, contains a single tracking record. Otherwise, contains all tracking information

#### ReturnShippingAddress attributes {#ReturnShippingAddress}

The ReturnShippingAddress object defines the merchant address for receiving returned items.

Attribute | Data Type | Description
--- | --- | ---
`city` | String! | The city for product returns
`contact_name` | String | The merchant's contact person
`country` | Country! | An object that defines the country for product returns
`postcode` | String! | The postal code for product returns
`region` | Region! | An object that defines the state or province for product returns
`street` | [String]! | The street address for product returns
`telephone` | String | The telephone number for product returns

#### ReturnShippingCarrier attributes {#ReturnShippingCarrier}

The ReturnShippingCarrier object contains details about the shipping carrier used to return a product.

Attribute | Data Type | Description
--- | --- | ---
`label` | String! | A description of the shipping carrier
`uid` | ID! | The unique ID of a `ReturnShippingCarrier` object

#### ReturnShippingTracking attributes {#ReturnShippingTracking}

The ReturnShippingTracking object contains tracking information for an approved return.

Attribute | Data Type | Description
--- | --- | ---
`carrier` | [ReturnShippingCarrier!](#ReturnShippingCarrier) | Contains details of a shipping carrier
`status` | [ReturnShippingTrackingStatus](#ReturnShippingTrackingStatus) | Contains details about the status of a shipment
`tracking_number` | String! | A tracking number assigned by the carrier
`uid` | ID! | The unique ID assigned of a `ReturnShippingTracking` object

#### ReturnShippingTrackingStatus attributes {#ReturnShippingTrackingStatus}

The ReturnShippingTrackingStatus object contains tracking status information for an approved return.

Attribute | Data Type | Description
--- | --- | ---
`text` | String! | Text that describes the status
`type` | ReturnShippingTrackingStatusType! | An enum indicating whether the status type is INFORMATIONAL or an ERROR
1 change: 1 addition & 0 deletions src/_includes/graphql/store-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Attribute | Data Type | Description | Default or example value
`product_reviews_enabled` | String | Indicates whether product reviews are enabled. Possible values: 1 (Yes) and 0 (No) | 1
`product_url_suffix` | String | The suffix applied to product pages, such as `.htm` or `.html` | `.html`
`required_character_classes_number` | String | The number of different character classes required in a password (lowercase, uppercase, digits, special characters). <br/>Configuration path: customer/password/required_character_classes_number | 2
`returns_enabled` | String! | Indicates whether RMA is enabled on the storefront. Possible values: enabled/disabled | Disabled
`root_category_id` | Int | Deprecated. Use `root_category_uid` instead. The ID of the root category | 2
`root_category_uid` | Int | The unique ID for the root category object implementing `CategoryInterface` | 2
`sales_fixed_product_tax_display_setting` | [FixedProductTaxDisplaySettings](#FixedProductTaxDisplaySettings) | Corresponds to the **Display Prices In Sales Modules** field. It indicates how Fixed Product Taxes information is displayed on cart, checkout, and order pages | FPT_DISABLED
Expand Down
103 changes: 103 additions & 0 deletions src/guides/v2.4/graphql/mutations/add-return-comment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
group: graphql
title: addReturnComment mutation
---

The `addReturnComment` mutation adds a comment to an existing return request.

## Syntax

```graphql
mutation: {
addReturnComment(input: AddReturnCommentInput!): AddReturnCommentOutput
}
```

## Example usage

The following example adds a comment in response to the merchant.

**Request:**

```graphql
mutation{
addReturnComment(input: {
return_uid: "Mw=="
comment_text: "I'd like a refund"})
{
return {
uid
status
comments {
uid
author_name
text
}
}
}
}
```

**Response:**

```json
{
"data": {
"addReturnComment": {
"return": {
"uid": "Mw==",
"status": "PENDING",
"comments": [
{
"uid": "NQ==",
"author_name": "Customer Service",
"text": "We placed your Return request."
},
{
"uid": "Ng==",
"author_name": "Bob Loblaw",
"text": "I want to return the shirt because I don't like the texture of the fabric"
},
{
"uid": "Nw==",
"author_name": "Customer Service",
"text": "OK. Would you like a refund or store credit?"
},
{
"uid": "OA==",
"author_name": "Bob Loblaw",
"text": "I'd like a refund"
}
]
}
}
}
}
```

## Input attributes

The `AddReturnCommentInput` object must contain the following attributes:

Attribute | Data Type | Description
--- | --- | ---
`comment_text` | String! | The text added to the return request
`return_uid` | ID! | The unique ID of a `Return` object

## Output attributes

The `AddReturnCommentOutput` object contains the `Return` object.

Attribute | Data Type | Description
--- | --- | ---
`return` | Return | Contains details about the modified return

### Return object {#Return}

{% include graphql/return.md %}

## Related topics

* [`requestReturn` mutation]({{page.baseurl}}/graphql/mutations/request-return.html)
* [`addReturnTracking` mutation]({{page.baseurl}}/graphql/mutations/add-return-tracking.html)
* [`removeReturnTracking` mutation]({{page.baseurl}}/graphql/mutations/remove-return-tracking.html)
Loading