IssuingCardholder.fromJson constructor

IssuingCardholder.fromJson(
  1. Object? json
)

Implementation

factory IssuingCardholder.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return IssuingCardholder(
    billing: IssuingCardholderAddress.fromJson(map['billing']),
    company: map['company'] == null
        ? null
        : IssuingCardholderCompany.fromJson(map['company']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    email: map['email'] == null ? null : (map['email'] as String),
    id: (map['id'] as String),
    individual: map['individual'] == null
        ? null
        : IssuingCardholderIndividual.fromJson(map['individual']),
    livemode: (map['livemode'] as bool),
    metadata: (map['metadata'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as String),
            )),
    name: (map['name'] as String),
    phoneNumber:
        map['phone_number'] == null ? null : (map['phone_number'] as String),
    preferredLocales: map['preferred_locales'] == null
        ? null
        : (map['preferred_locales'] as List<Object?>)
            .map((el) => IssuingCardholderPreferredLocalesItem.fromJson(el))
            .toList(),
    requirements: IssuingCardholderRequirements.fromJson(map['requirements']),
    spendingControls: map['spending_controls'] == null
        ? null
        : IssuingCardholderSpendingControls.fromJson(
            map['spending_controls']),
    status: IssuingCardholderStatus.fromJson(map['status']),
    type: IssuingCardholderType.fromJson(map['type']),
  );
}