orderItemsQuoteAmendmentWithHttpInfo method

Future<Response> orderItemsQuoteAmendmentWithHttpInfo(
  1. String id,
  2. String idempotencyKey, {
  3. AmendmentQuoteRequest? amendmentQuoteRequest,
  4. Future<void>? abortTrigger,
})

Quote an amendment

Quotes a change to a delivered order item. Available only when the item's actions.amendment is available: the item must be fulfilled, not refunded, and its product must support automatic changes. Items whose changes need manual review show manualReview and use the manual amendment routes instead. A kind of item that can never be amended returns 422 with code 18002 (AMENDMENT_NOT_SUPPORTED); otherwise an amendment that is not allowed now returns 409 with code 18003 (AMENDMENT_NOT_AVAILABLE), and details[0].reason repeats actions.amendment.availability (MANUAL_REVIEW or NOT_AVAILABLE). An item of another partner, or an unknown id, returns 404 with code 10004. Send the requested change in attributes, in the shape the item's product defines; top-level names that start with _ are reserved for OpenRoam and ignored. The response has an amendmentRequestId, the time the quote was made (processedAt), the time it expires (expiresAt) and one or more options, each with an id, an amountToPay and an amountToRefund in the API key's currency, and an amendmentFee: a fee for the change, already included in those amounts, or null when none applies. Nothing changes and nothing is charged until you confirm the quote with POST /order-items/{id}/amendments/confirm, before expiresAt. 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 (IDEMPOTENCY_KEY_IN_PROGRESS), and a different body with the same key 409 with code 12001. A request that ended in an error can be sent again with the same key and body.

Note: This method returns the HTTP Response.

Parameters:

  • String id (required): Order item id (items[].id from the order response).

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

  • AmendmentQuoteRequest amendmentQuoteRequest: The requested change.

Implementation

Future<Response> orderItemsQuoteAmendmentWithHttpInfo(String id, String idempotencyKey, { AmendmentQuoteRequest? amendmentQuoteRequest, Future<void>? abortTrigger, }) async {
  // ignore: prefer_const_declarations
  final path = r'/api/v1/b2b/order-items/{id}/amendments/quote'
    .replaceAll('{id}', id);

  // ignore: prefer_final_locals
  Object? postBody = amendmentQuoteRequest;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  headerParams[r'Idempotency-Key'] = parameterToString(idempotencyKey);

  const contentTypes = <String>['application/json', 'text/json', 'application/*+json'];


  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
    abortTrigger: abortTrigger,
  );
}