ordersRetryFulfillment method

Future<OrderFulfillmentRetryResult?> ordersRetryFulfillment(
  1. String orderId,
  2. String idempotencyKey, {
  3. Future<void>? abortTrigger,
})

Retry an order's fulfillment

Starts delivery again for the order items that failed and can safely be bought again. Available when the order is processing, partiallyFulfilled or fulfillmentFailed and at least one item is confirmed as not delivered and not refunded, as actions.fulfillmentRetry shows. Fulfilled items are never bought again. Returns 202 with the order id and retriedItemIds, the items[].id values being retried; the outcome arrives later through the order, the fulfillment status endpoint and the order.fulfillment.updated webhook. An order that is not eligible, including one created in the dashboard, which must be retried there, returns 400 with code 10001. A concurrent retry of the same order returns 409. Requires an Idempotency-Key header (a UUID). Repeating a completed request with the same key returns 409 with code 12000 (IDEMPOTENCY_KEY_ALREADY_USED); one still running returns 409 with code 12002. Use a new key for each new retry attempt.

Parameters:

  • String orderId (required): Order id.

  • String idempotencyKey (required): UUID idempotency key for safe retries of this operation.

Implementation

Future<OrderFulfillmentRetryResult?> ordersRetryFulfillment(String orderId, String idempotencyKey, { Future<void>? abortTrigger, }) async {
  final response = await ordersRetryFulfillmentWithHttpInfo(orderId, idempotencyKey, abortTrigger: abortTrigger,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OrderFulfillmentRetryResult',) as OrderFulfillmentRetryResult;

  }
  return null;
}