IssuingCardholderCreateOptions.fromJson constructor

IssuingCardholderCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory IssuingCardholderCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return IssuingCardholderCreateOptions(
    billing: CardholderBilling.fromJson(map['billing']),
    company: map['company'] == null
        ? null
        : CardholderCompany.fromJson(map['company']),
    email: map['email'] == null ? null : (map['email'] as String),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    individual: map['individual'] == null
        ? null
        : CardholderIndividual.fromJson(map['individual']),
    metadata: map['metadata'] == null
        ? null
        : (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(),
    spendingControls: map['spending_controls'] == null
        ? null
        : CardholderSpendingControls.fromJson(map['spending_controls']),
    status: map['status'] == null
        ? null
        : BillingMeterStatus.fromJson(map['status']),
    type: map['type'] == null
        ? null
        : IssuingCardholderType.fromJson(map['type']),
  );
}