SetupIntentUpdateOptions.fromJson constructor

SetupIntentUpdateOptions.fromJson(
  1. Object? json
)

Implementation

factory SetupIntentUpdateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SetupIntentUpdateOptions(
    attachToSelf: map['attach_to_self'] == null
        ? null
        : (map['attach_to_self'] as bool),
    customer: map['customer'] == null ? null : (map['customer'] as String),
    description:
        map['description'] == null ? null : (map['description'] as String),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    flowDirections: map['flow_directions'] == null
        ? null
        : (map['flow_directions'] as List<Object?>)
            .map((el) => SetupAttemptFlowDirectionsItem.fromJson(el))
            .toList(),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    paymentMethod: map['payment_method'] == null
        ? null
        : (map['payment_method'] as String),
    paymentMethodConfiguration: map['payment_method_configuration'] == null
        ? null
        : (map['payment_method_configuration'] as String),
    paymentMethodData: map['payment_method_data'] == null
        ? null
        : PaymentIntentPaymentMethodData.fromJson(map['payment_method_data']),
    paymentMethodOptions: map['payment_method_options'] == null
        ? null
        : SetupIntentCreateOptionsPaymentMethodOptions.fromJson(
            map['payment_method_options']),
    paymentMethodTypes: map['payment_method_types'] == null
        ? null
        : (map['payment_method_types'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
  );
}