ordersQuoteOrder method
- MixedOrderRequest? mixedOrderRequest,
- Future<
void> ? abortTrigger,
Quote an order
Prices a mixed order body with current prices, without placing an order. Takes the same body as order creation (one to five items of one or several product types, a total quantity of at most five) and needs no Idempotency-Key. Nothing is charged, held or created; referenceId is checked for its format and not for uniqueness. Returns currency, items, total and expiresAt. Each item is the quote item that its product's own quote route returns, with productType; its publicId can be a new one (gift cards, hotels and flights issue one), so order with the publicId of the quote. total is the sum of each item's price times its quantity in the quote currency. expiresAt is the earliest details.expiresAt of the items that have one, and null when none has. Items are checked as the order checks them: first the inputs of every item, then the offer of every item, then each item is priced in request order. The first failing item ends the quote with the code and path of its product's quote route, under items[i], for example 409 / 11002 at items[i].inputs.maxPrice when the current price is above the guard. A quote does not reserve a price: to hold the quoted price, send it as inputs.maxPrice in the order.
Parameters:
- MixedOrderRequest mixedOrderRequest: The order to price.
Implementation
Future<MixedQuote?> ordersQuoteOrder({ MixedOrderRequest? mixedOrderRequest, Future<void>? abortTrigger, }) async {
final response = await ordersQuoteOrderWithHttpInfo(mixedOrderRequest: mixedOrderRequest, 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), 'MixedQuote',) as MixedQuote;
}
return null;
}