orderItemsUpdateWithHttpInfo method
- String id,
- String idempotencyKey, {
- OrderItemUpdateRequest? orderItemUpdateRequest,
- Future<
void> ? abortTrigger,
Update an item
Updates a delivered order item, without a charge. Changes what the item's kind lets a partner change after the purchase, in one call. An update never charges or refunds anything: a change with a price, such as a hotel or flight change, is an amendment (POST /order-items/{id}/amendments/quote). At launch only gift cards can be updated: inputs takes a new recipientEmail and giftMessage, and the gift email is sent again, to the new address with the new message. A card bought without a recipient needs recipientEmail. Every other kind of item returns 422 with code 18004 (UPDATE_NOT_SUPPORTED). Available when the item's actions.update is available; otherwise the update returns 409 with code 18005 (UPDATE_NOT_AVAILABLE), and details[0].reason repeats actions.update.availability (IN_PROGRESS or NOT_AVAILABLE). The same 409 is returned when the item stops being available during the call, for example after a cancel. A member of inputs left out or sent as null keeps its current value, and at least one member must be present. An invalid member returns 400 with code 10001 at inputs.<member>, with the same reasons as the order's inputs, and a member the item's kind does not define returns 400 with code 10001 and reason UNSUPPORTED_FIELD. An item of another partner, or an unknown id, returns 404 with code 10004. A malformed body (not valid JSON, inputs missing, null or not an object, or a top-level member other than inputs) returns 400 with code 10001 before the item is read. The checks on the item then run in this order: 404, 422, 409, then 400 for the members of inputs. Returns the item exactly as GET /order-items/{id} returns it. No webhook is sent for an update. 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. Updating the same item again needs a new key.
Note: This method returns the HTTP Response.
Parameters:
-
String id (required): Order item id (
items[].idfrom the order response). -
String idempotencyKey (required): UUID idempotency key for safe retries of this operation.
-
OrderItemUpdateRequest orderItemUpdateRequest: The members to change.
Implementation
Future<Response> orderItemsUpdateWithHttpInfo(String id, String idempotencyKey, { OrderItemUpdateRequest? orderItemUpdateRequest, Future<void>? abortTrigger, }) async {
// ignore: prefer_const_declarations
final path = r'/api/v1/b2b/order-items/{id}/update'
.replaceAll('{id}', id);
// ignore: prefer_final_locals
Object? postBody = orderItemUpdateRequest;
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,
);
}