Skip to main content

Manage returned lines

note

repaymentRequestId and returnedLineId in these examples are placeholders — get them from repaymentRequests and the returnedLines.id field of repaymentRequest.

Use these mutations to record what the warehouse received for a repayment request and to confirm the reception, moving the request forward in its lifecycle. The quantities can be recorded while the request is in waiting_warehouse_reception or waiting_for_approval; in any other status the mutations are rejected with Repayment not eligible for changes (BAD_REQUEST).

Set returned line quantities

Use repaymentReturnedLineSetQuantities to record, for a returned line (returnedLines.id), how many items came back (quantityReceived) and how many are in acceptable condition (quantityCompliant, which cannot exceed the received quantity).

Request
mutation repaymentReturnedLineSetQuantities {
  repaymentReturnedLineSetQuantities(
    returnedLineId: "98765"
    quantityReceived: 2
    quantityCompliant: 1
  ) {
    id
    quantityExpected
    quantityReceived
    quantityCompliant
    sku
    skuDescription
    line {
      id
      sku
    }
  }
}
Response
{
  "data": {
    "repaymentReturnedLineSetQuantities": {
      "id": "98765",
      "quantityExpected": 2,
      "quantityReceived": 2,
      "quantityCompliant": 1,
      "sku": "SKU-1",
      "skuDescription": "Demo product",
      "line": {
        "id": "701",
        "sku": "SKU-1"
      }
    }
  },
  "extensions": {
    "queryComplexity": 10,
    "bucketBalance": 9990,
    "bucketRestoreRate": 100
  }
}

Create a missing returned line

Use repaymentReturnedLineCreate in the (rare) case where the warehouse receives an item that was not expected as part of the return. The mutation accepts a RepaymentReturnedLineCreateInput object — its reference lists all the available fields. Send the sku, quantityExpected: 0 and the received and compliant quantities as for the other lines; the created returned line has no nested line.

Request
Response
{
  "data": {
    "repaymentReturnedLineCreate": {
      "id": "98766",
      "quantityExpected": 0,
      "quantityReceived": 1,
      "quantityCompliant": 1,
      "sku": "EXTRA-SKU",
      "skuDescription": "Extra returned item",
      "line": null
    }
  },
  "extensions": {
    "queryComplexity": 9,
    "bucketBalance": 9991,
    "bucketRestoreRate": 100
  }
}

Confirm return line reception

Use repaymentReturnLinesEvaluationConfirm once every returned line has been evaluated: the repayment request moves from waiting_warehouse_reception (the only status that accepts the confirmation) to waiting_for_approval. The mutation accepts a RepaymentReturnedLineEvaluationConfirmInput object — its reference lists all the available fields.

Response
{
  "data": {
    "repaymentReturnLinesEvaluationConfirm": {
      "id": "567",
      "number": "RR-2026-0001",
      "status": "waiting_for_approval",
      "returnedLines": [
        {
          "id": "98765",
          "quantityExpected": 2,
          "quantityReceived": 2,
          "quantityCompliant": 1
        },
        {
          "id": "98766",
          "quantityExpected": 1,
          "quantityReceived": 1,
          "quantityCompliant": 1
        }
      ]
    }
  },
  "extensions": {
    "queryComplexity": 9,
    "bucketBalance": 9991,
    "bucketRestoreRate": 100
  }
}

Relevant permissions

The operations in this page require the following permissions on the API credentials — they are configured for you by Calicantus.

  • repayment_returned_line:mutation:repayment_returned_line_set_quantities
  • repayment_returned_line:mutation:repayment_returned_line_create
  • repayment_returned_line:mutation:repayment_return_lines_evaluation_confirm
  • repayment_returned_line:read
  • repayment_request:read
  • repayment_line:read