getCheckoutInfoQuery method
Returns a Checkout object.
Returns the Checkout object of the checkout with the checkoutId
.
Implementation
Future<Checkout> getCheckoutInfoQuery(String checkoutId,
{bool getShippingInfo = true,
bool withPaymentId = false,
bool deleteThisPartOfCache = false}) async {
final WatchQueryOptions _optionsRequireShipping = WatchQueryOptions(
document: gql(getCheckoutInfoAboutShipping),
variables: {
'id': checkoutId,
});
QueryResult result = await _graphQLClient!.query(_optionsRequireShipping);
final WatchQueryOptions _options = WatchQueryOptions(
document: gql(_requiresShipping(result) == true && getShippingInfo
? withPaymentId
? getCheckoutInfoWithPaymentId
: getCheckoutInfo
: withPaymentId
? getCheckoutInfoWithPaymentIdWithoutShipping
: getCheckoutInfoWithoutShipping),
variables: {
'id': checkoutId,
});
final QueryResult _queryResult = (await _graphQLClient!.query(_options));
checkForError(_queryResult);
if (deleteThisPartOfCache) {
_graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
}
return Checkout.fromJson(_queryResult.data!['node']);
}