orderItemsConfirmAmendment method

Future<AmendmentConfirmResult?> orderItemsConfirmAmendment(
  1. String id,
  2. String idempotencyKey, {
  3. AmendmentConfirmRequest? amendmentConfirmRequest,
  4. Future<void>? abortTrigger,
})

Confirm an amendment

Confirms a quoted amendment, paying any surcharge or receiving any refund. Send the amendmentRequestId from the quote and, optionally, the selectedOptionId of one of its options (the first option is used when it is omitted). The quote is checked again before anything is charged: an expired or unknown quote, or an option that is no longer offered, returns 400 with code 10001; request a new quote then. Where the change is priced again before the charge (hotels), a price that changed since the quote returns 400 with code 10001 without maxPrice, and is charged when it is within maxPrice. A price above maxPrice returns 409 with code 11002 at maxPrice, with nothing charged; a maxPrice in another currency than the quoted amounts returns 400 with code 10001 at maxPrice.currency. A change refused when it is sent (for example, a flight whose price changed since the quote) gets its surcharge back and returns 400 with code 10001. Confirming the same quote again with a new Idempotency-Key returns 200 with the amendment that quote created, and nothing is charged twice. A confirm that was interrupted after its payment is finished first: its change is sent, or its surcharge is returned. Two confirms of one quote sent at the same time make one amendment: the other returns 200 with it, or 409 with code 10005 while the first is still running; send it again shortly. A kind of item that can never be amended returns 422 with code 18002 (AMENDMENT_NOT_SUPPORTED), and an amendment that is not allowed now returns 409 with code 18003 (AMENDMENT_NOT_AVAILABLE). An item of another partner, or an unknown id, returns 404 with code 10004. A surcharge is charged with paymentMethod balance, its only value: the wallet linked to the API key. Any other value returns 400 with code 10001 at paymentMethod. A refund goes to that wallet. Returns the amendmentRequestId, the new amendmentId, its status, and the payment or refund that was made (null when none). A failed payment carries 16000 (PAYMENT_FAILED) in payment.failure. Amendments do not change fulfillmentVersion; read the order again for the changed item. 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.

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.

  • AmendmentConfirmRequest amendmentConfirmRequest: The quote and option to confirm, and an optional price limit.

Implementation

Future<AmendmentConfirmResult?> orderItemsConfirmAmendment(String id, String idempotencyKey, { AmendmentConfirmRequest? amendmentConfirmRequest, Future<void>? abortTrigger, }) async {
  final response = await orderItemsConfirmAmendmentWithHttpInfo(id, idempotencyKey, amendmentConfirmRequest: amendmentConfirmRequest, 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), 'AmendmentConfirmResult',) as AmendmentConfirmResult;

  }
  return null;
}