processReturnInspection
Requires permission inventory:stock_movement:create and at least one of purchase:debit_note:create or sales:credit_note:create.
Records the inspection of a RECEIVED return and completes it: for each line, the accepted, rejected and restock quantities. Accepted plus rejected cannot exceed the quantity returned, and the restock quantity cannot exceed the accepted quantity. A return that is not yet received is refused, and inspection can run only once: a return changed or already processed asks you to refresh and try again. It moves stock and issues the credit note (customer return) or debit note (supplier return), so it needs the stock movement create permission and that direction's note create permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation ProcessReturnInspection($input: InspectionInput!, $returnId: String!) {
processReturnInspection(input: $input, returnId: $returnId) {
creditNoteId
message
success
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation ProcessReturnInspection($input: InspectionInput!, $returnId: String!) {\n processReturnInspection(input: $input, returnId: $returnId) {\n creditNoteId\n message\n success\n }\n}",
"variables": {
"input": {
"items": [
{
"acceptedQuantity": 0,
"inspectionResult": "DONATE",
"itemId": "string",
"qualityScore": 0,
"rejectedQuantity": 0,
"repairQuantity": 0,
"restockQuantity": 0,
"scrapQuantity": 0
}
],
"overallResult": "FAIL"
},
"returnId": "string"
}
}
EOF
Variables:
{
"input": {
"items": [
{
"acceptedQuantity": 0,
"inspectionResult": "DONATE",
"itemId": "string",
"qualityScore": 0,
"rejectedQuantity": 0,
"repairQuantity": 0,
"restockQuantity": 0,
"scrapQuantity": 0
}
],
"overallResult": "FAIL"
},
"returnId": "string"
}
Response:
{
"data": {
"processReturnInspection": {
"creditNoteId": "string",
"message": "string",
"success": true
}
}
}
processReturnInspection(
input: InspectionInput!
returnId: String!
): ReturnActionResult!
Arguments
processReturnInspection.input ● InspectionInput! non-null input
The details of the inspection request.
processReturnInspection.returnId ● String! non-null scalar
The ID of the return.
Type
ReturnActionResult object
The result of an RMA step that does not return a record, such as an inspection.