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

Commit 0544520

Browse files
keharperdobooth
andauthored
GraphQL: Add RMA mutations (#8258)
* GraphQL: Add RMA mutations * GraphQL: Add RMA mutations * update customer object * Add RMA mutations * schema updates * Fix typos/formatting * Fix typos/formatting * fix highlighting * Update uid descriptions * Apply suggestions from code review Co-authored-by: Donald Booth <[email protected]> * minor formatting updates * Update rel notes Co-authored-by: Donald Booth <[email protected]>
1 parent 3c89838 commit 0544520

File tree

11 files changed

+649
-18
lines changed

11 files changed

+649
-18
lines changed

src/_data/toc/graphql.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ pages:
195195
edition: b2b-only
196196
exclude_versions: [ "2.3" ]
197197

198+
- label: addReturnComment mutation
199+
url: /graphql/mutations/add-return-comment.html
200+
edition: ee-only
201+
exclude_versions: ["2.3"]
202+
203+
- label: addReturnTracking mutation
204+
url: /graphql/mutations/add-return-tracking.html
205+
edition: ee-only
206+
exclude_versions: ["2.3"]
207+
198208
- label: addSimpleProductsToCart mutation
199209
url: /graphql/mutations/add-simple-products.html
200210

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

388+
- label: removeReturnTracking mutation
389+
url: /graphql/mutations/remove-return-tracking.html
390+
edition: ee-only
391+
exclude_versions: ["2.3"]
392+
378393
- label: removeRewardPointsFromCart mutation
379394
url: /graphql/mutations/remove-reward-points.html
380395
edition: ee-only
@@ -392,13 +407,18 @@ pages:
392407
url: /graphql/mutations/request-password-reset-email.html
393408
exclude_versions: ["2.3"]
394409

395-
- label: revokeCustomerToken mutation
396-
url: /graphql/mutations/revoke-customer-token.html
410+
- label: requestReturn mutation
411+
url: /graphql/mutations/request-return.html
412+
edition: ee-only
413+
exclude_versions: ["2.3"]
397414

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

419+
- label: revokeCustomerToken mutation
420+
url: /graphql/mutations/revoke-customer-token.html
421+
402422
- label: sendEmailToFriend mutation
403423
url: /graphql/mutations/send-email-to-friend.html
404424

src/_includes/graphql/customer-orders-output.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,23 @@ Attribute | Data type | Description
4545
`carrier` | String | The shipping carrier for the order delivery
4646
`comments` | [[SalesCommentItem]](#SalesCommentItem) | Comments on the order
4747
`created_at` | String | Deprecated. Use the `order_date` attribute instead
48-
`credit_memos` | [[CreditMemo]](#CreditMemo) | Contains a list of credit memos for the order
49-
`grand_total` | Float | Deprecated. Use the `totals.grand_total` attribute instead
48+
`credit_memos` | [[CreditMemo](#CreditMemo)] | Contains a list of credit memos for the order
5049
`gift_message` | [GiftMessage](#GiftMessage) | The entered gift message for the order
5150
`gift_receipt_included` | Boolean! | Indicates if the customer requested a gift receipt for the order
5251
`gift_wrapping` | [GiftWrapping](#GiftWrapping) | The selected gift wrapping for the order
53-
`id` | ID! | The unique ID for a `CustomerOrder` object
52+
`grand_total` | Float | Deprecated. Use the `totals.grand_total` attribute instead
53+
`id` | ID! | Unique identifier for the order
5454
`increment_id` | String | Deprecated. Use the `id` attribute instead
55-
`invoices` | [[Invoice]](#Invoice)! | Contains a list of invoices for the order
56-
`items` | [[OrderItemInterface]](#OrderItemInterface) | An array containing the items purchased in this order
55+
`invoices` | [[Invoice](#Invoice)]! | Contains a list of invoices for the order
56+
`items` | [[OrderItemInterface](#OrderItemInterface)] | An array containing the items purchased in this order
57+
`items_eligible_for_return` | [[OrderItemInterface](#OrderItemInterface)] | A list of order items eligible to be in a return request
5758
`number` | String! | The order number
5859
`order_date` | String! | The date the order was placed
5960
`order_number` | String! | Deprecated. Use the `number` attribute instead
6061
`payment_methods` | [[PaymentMethod]](#PaymentMethod) | Payment details for the order
6162
`printed_card_included` | Boolean! | Indicates if the customer requested a printed card for the order
62-
`shipments` | [[OrderShipment]](#OrderShipment) | Shipment list for the order
63+
`returns (pageSize = 20 Int, currentPage = 1 Int)` | [Returns](#Returns) | Return requests associated with this order
64+
`shipments` | [[OrderShipment](#OrderShipment)] | Shipment list for the order
6365
`shipping_address` | [OrderAddress](#OrderAddress) | Shipping address for the order
6466
`shipping_method` | String | Shipping method for the order
6567
`status` | String! | The current status of the order

src/_includes/graphql/customer-output-24.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ Attribute | Data Type | Description
3333
`middlename` |String | The customer's middle name
3434
`orders(filter CustomerOrdersFilterInput, currentPage = 1 Int, pageSize = 20 Int)` | {{ customeroutput_text }} | A list of the customer's placed orders{{ crossref_text }}
3535
`prefix` | String | An honorific, such as Dr., Mr., or Mrs.
36-
`reviews(pageSize: Int = 20 currentPage: Int = 1)` | {{ productreview_text }} | The list of reviews of the product
36+
`return(uid: ID!)` | Return | Gets details about the specified return request
37+
`returns(pageSize: Int = 20 currentPage: Int = 1)` | Returns | Information about the customer's return requests
38+
`reviews(pageSize: Int = 20 currentPage: Int = 1)` | ProductReviews! | The list of reviews of the product
3739
`reward_points` | {{ rewardpoints_text }} | Details about the customer's reward points
3840
`suffix` | String | A value such as Sr., Jr., or III
3941
`taxvat` | String | The customer's Tax/VAT number (for corporate customers)

src/_includes/graphql/return.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
The `Return` object can contain the following attributes:
2+
3+
Attribute | Data Type | Description
4+
--- | --- | ---
5+
`available_shipping_carriers` | [ReturnShippingCarrier] | A list of shipping carriers available for returns
6+
`comments`| [ReturnComment] | A list of comments posted for the return request
7+
`created_at` | String! | The date the return was requested
8+
`customer_email` | String! | Email of the person who created the return request
9+
`customer` | [ReturnCustomer](#ReturnCustomer) | The name of the person who requested the return
10+
`items`| [[ReturnItem]](#ReturnItem) | A list of items being returned
11+
`number` | String! | Human-readable return number
12+
`order` | [CustomerOrder]({{page.baseurl}}/graphql/queries/customer.html#orders) | The order associated with the return
13+
`shipping` | [ReturnShipping](#ReturnShipping) | Shipping information for the return
14+
`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
15+
`uid` | ID! | The unique ID of a `Return` object
16+
17+
#### ReturnComment attributes {#ReturnComment}
18+
19+
The ReturnComment object provides details about an individual comment in a refund request. Comments can be added by a customer or the merchant.
20+
21+
Attribute | Data Type | Description
22+
--- | --- | ---
23+
`author_name` | String! | The name or author who posted the comment
24+
`created_at` | String! | The date and time the comment was posted
25+
`text` | String! | The contents of the comment
26+
`uid` | ID! | The unique ID of a `ReturnComment` object
27+
28+
#### ReturnCustomAttribute attributes {#ReturnCustomAttribute}
29+
30+
Attribute | Data Type | Description
31+
--- | --- | ---
32+
`label` | String! | A description of the attribute
33+
`uid` | ID! | The unique ID of a `ReturnCustomAttribute` attribute
34+
`value` | String! | A JSON-encoded value of the attribute
35+
36+
#### ReturnCustomer attributes {#ReturnCustomer}
37+
38+
The ReturnCustomer object contains information about the person requesting a return.
39+
40+
Attribute | Data Type | Description
41+
--- | --- | ---
42+
`email` | String! | The email address of the refund requester
43+
`firstname` | String | The first name of the refund requester
44+
`lastname` | String | The last name of the refund requester
45+
46+
#### ReturnItem attributes {#ReturnItem}
47+
48+
The ReturnItem object provides details about an individual item in a return request.
49+
50+
Attribute | Data Type | Description
51+
--- | --- | ---
52+
`custom_attributes` | [[ReturnCustomAttribute]](#ReturnCustomAttribute) | Return item custom attributes that are visible on the storefront
53+
`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
54+
`quantity` | Float! | The quantity of the item the merchant authorized to be returned
55+
`request_quantity` | Float! | The quantity of the item requested to be returned
56+
`status`| ReturnItemStatus! | An enum indicating the return status of the item. Possible values are APPROVED, AUTHORIZED, DENIED, PENDING, RECEIVED, and REJECTED
57+
`uid`| ID! | The unique ID of an item of a `Return` object
58+
59+
#### ReturnShipping attributes {#ReturnShipping}
60+
61+
The ReturnShipping object can contain the merchant's shipping address and tracking information.
62+
63+
Attribute | Data Type | Description
64+
--- | --- | ---
65+
`address`| [ReturnShippingAddress](#ReturnShippingAddress) | The merchant-defined return shipping address
66+
`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
67+
68+
#### ReturnShippingAddress attributes {#ReturnShippingAddress}
69+
70+
The ReturnShippingAddress object defines the merchant address for receiving returned items.
71+
72+
Attribute | Data Type | Description
73+
--- | --- | ---
74+
`city` | String! | The city for product returns
75+
`contact_name` | String | The merchant's contact person
76+
`country` | Country! | An object that defines the country for product returns
77+
`postcode` | String! | The postal code for product returns
78+
`region` | Region! | An object that defines the state or province for product returns
79+
`street` | [String]! | The street address for product returns
80+
`telephone` | String | The telephone number for product returns
81+
82+
#### ReturnShippingCarrier attributes {#ReturnShippingCarrier}
83+
84+
The ReturnShippingCarrier object contains details about the shipping carrier used to return a product.
85+
86+
Attribute | Data Type | Description
87+
--- | --- | ---
88+
`label` | String! | A description of the shipping carrier
89+
`uid` | ID! | The unique ID of a `ReturnShippingCarrier` object
90+
91+
#### ReturnShippingTracking attributes {#ReturnShippingTracking}
92+
93+
The ReturnShippingTracking object contains tracking information for an approved return.
94+
95+
Attribute | Data Type | Description
96+
--- | --- | ---
97+
`carrier` | [ReturnShippingCarrier!](#ReturnShippingCarrier) | Contains details of a shipping carrier
98+
`status` | [ReturnShippingTrackingStatus](#ReturnShippingTrackingStatus) | Contains details about the status of a shipment
99+
`tracking_number` | String! | A tracking number assigned by the carrier
100+
`uid` | ID! | The unique ID assigned of a `ReturnShippingTracking` object
101+
102+
#### ReturnShippingTrackingStatus attributes {#ReturnShippingTrackingStatus}
103+
104+
The ReturnShippingTrackingStatus object contains tracking status information for an approved return.
105+
106+
Attribute | Data Type | Description
107+
--- | --- | ---
108+
`text` | String! | Text that describes the status
109+
`type` | ReturnShippingTrackingStatusType! | An enum indicating whether the status type is INFORMATIONAL or an ERROR

src/_includes/graphql/store-config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Attribute | Data Type | Description | Default or example value
7272
`product_reviews_enabled` | String | Indicates whether product reviews are enabled. Possible values: 1 (Yes) and 0 (No) | 1
7373
`product_url_suffix` | String | The suffix applied to product pages, such as `.htm` or `.html` | `.html`
7474
`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
75+
`returns_enabled` | String! | Indicates whether RMA is enabled on the storefront. Possible values: enabled/disabled | Disabled
7576
`root_category_id` | Int | Deprecated. Use `root_category_uid` instead. The ID of the root category | 2
7677
`root_category_uid` | Int | The unique ID for the root category object implementing `CategoryInterface` | 2
7778
`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
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
group: graphql
3+
title: addReturnComment mutation
4+
---
5+
6+
The `addReturnComment` mutation adds a comment to an existing return request.
7+
8+
## Syntax
9+
10+
```graphql
11+
mutation: {
12+
addReturnComment(input: AddReturnCommentInput!): AddReturnCommentOutput
13+
}
14+
```
15+
16+
## Example usage
17+
18+
The following example adds a comment in response to the merchant.
19+
20+
**Request:**
21+
22+
```graphql
23+
mutation{
24+
addReturnComment(input: {
25+
return_uid: "Mw=="
26+
comment_text: "I'd like a refund"})
27+
{
28+
return {
29+
uid
30+
status
31+
comments {
32+
uid
33+
author_name
34+
text
35+
}
36+
}
37+
}
38+
}
39+
```
40+
41+
**Response:**
42+
43+
```json
44+
{
45+
"data": {
46+
"addReturnComment": {
47+
"return": {
48+
"uid": "Mw==",
49+
"status": "PENDING",
50+
"comments": [
51+
{
52+
"uid": "NQ==",
53+
"author_name": "Customer Service",
54+
"text": "We placed your Return request."
55+
},
56+
{
57+
"uid": "Ng==",
58+
"author_name": "Bob Loblaw",
59+
"text": "I want to return the shirt because I don't like the texture of the fabric"
60+
},
61+
{
62+
"uid": "Nw==",
63+
"author_name": "Customer Service",
64+
"text": "OK. Would you like a refund or store credit?"
65+
},
66+
{
67+
"uid": "OA==",
68+
"author_name": "Bob Loblaw",
69+
"text": "I'd like a refund"
70+
}
71+
]
72+
}
73+
}
74+
}
75+
}
76+
```
77+
78+
## Input attributes
79+
80+
The `AddReturnCommentInput` object must contain the following attributes:
81+
82+
Attribute | Data Type | Description
83+
--- | --- | ---
84+
`comment_text` | String! | The text added to the return request
85+
`return_uid` | ID! | The unique ID of a `Return` object
86+
87+
## Output attributes
88+
89+
The `AddReturnCommentOutput` object contains the `Return` object.
90+
91+
Attribute | Data Type | Description
92+
--- | --- | ---
93+
`return` | Return | Contains details about the modified return
94+
95+
### Return object {#Return}
96+
97+
{% include graphql/return.md %}
98+
99+
## Related topics
100+
101+
* [`requestReturn` mutation]({{page.baseurl}}/graphql/mutations/request-return.html)
102+
* [`addReturnTracking` mutation]({{page.baseurl}}/graphql/mutations/add-return-tracking.html)
103+
* [`removeReturnTracking` mutation]({{page.baseurl}}/graphql/mutations/remove-return-tracking.html)

0 commit comments

Comments
 (0)