updateAttributes method

Future<void> updateAttributes(
  1. String checkoutId, {
  2. bool? allowPartialAddresses,
  3. Map<String, String>? customAttributes,
  4. String? note,
})

Updates the attributes of a Checkout

Implementation

Future<void> updateAttributes(
  String checkoutId, {
  bool? allowPartialAddresses,
  Map<String, String>? customAttributes,
  String? note,
}) async {
  final MutationOptions _options = MutationOptions(
    document: gql(checkoutAttributesUpdateMutation),
    variables: {
      'checkoutId': checkoutId,
      'input': {
        if (allowPartialAddresses != null)
          'allowPartialAddresses': allowPartialAddresses,
        if (customAttributes != null)
          'customAttributes': [
            for (var entry in customAttributes.entries)
              {
                'key': entry.key,
                'value': entry.value,
              }
          ],
        if (note != null) 'note': note,
      },
    },
  );
  final QueryResult result = await _graphQLClient!.mutate(_options);
  checkForError(
    result,
    key: 'checkoutAttributesUpdateV2',
    errorKey: 'checkoutUserErrors',
  );
}