FinancialConnectionsAccount.fromJson constructor

FinancialConnectionsAccount.fromJson(
  1. Object? json
)

Implementation

factory FinancialConnectionsAccount.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return FinancialConnectionsAccount(
    accountHolder: map['account_holder'] == null
        ? null
        : BankConnectionsResourceAccountholder.fromJson(
            map['account_holder']),
    balance: map['balance'] == null
        ? null
        : BankConnectionsResourceBalance.fromJson(map['balance']),
    balanceRefresh: map['balance_refresh'] == null
        ? null
        : BankConnectionsResourceBalanceRefresh.fromJson(
            map['balance_refresh']),
    category: FinancialConnectionsAccountCategory.fromJson(map['category']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    displayName:
        map['display_name'] == null ? null : (map['display_name'] as String),
    id: (map['id'] as String),
    institutionName: (map['institution_name'] as String),
    last4: map['last4'] == null ? null : (map['last4'] as String),
    livemode: (map['livemode'] as bool),
    ownership: map['ownership'] == null
        ? null
        : FinancialConnectionsAccountOwnershipOrId.fromJson(map['ownership']),
    ownershipRefresh: map['ownership_refresh'] == null
        ? null
        : BankConnectionsResourceOwnershipRefresh.fromJson(
            map['ownership_refresh']),
    permissions: map['permissions'] == null
        ? null
        : (map['permissions'] as List<Object?>)
            .map((el) =>
                FinancialConnectionsAccountPermissionsItem.fromJson(el))
            .toList(),
    status: FinancialConnectionsAccountStatus.fromJson(map['status']),
    subcategory:
        FinancialConnectionsAccountSubcategory.fromJson(map['subcategory']),
    subscriptions: map['subscriptions'] == null
        ? null
        : (map['subscriptions'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    supportedPaymentMethodTypes:
        (map['supported_payment_method_types'] as List<Object?>)
            .map((el) =>
                FinancialConnectionsAccountSupportedPaymentMethodTypesItem
                    .fromJson(el))
            .toList(),
    transactionRefresh: map['transaction_refresh'] == null
        ? null
        : BankConnectionsResourceTransactionRefresh.fromJson(
            map['transaction_refresh']),
  );
}