TreasuryTransaction.fromJson constructor

TreasuryTransaction.fromJson(
  1. Object? json
)

Implementation

factory TreasuryTransaction.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TreasuryTransaction(
    amount: (map['amount'] as num).toInt(),
    balanceImpact: TreasuryTransactionsResourceBalanceImpact.fromJson(
        map['balance_impact']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    currency: (map['currency'] as String),
    description: (map['description'] as String),
    entries: map['entries'] == null
        ? null
        : TreasuryTransactionEntries.fromJson(map['entries']),
    financialAccount: (map['financial_account'] as String),
    flow: map['flow'] == null ? null : (map['flow'] as String),
    flowDetails: map['flow_details'] == null
        ? null
        : TreasuryTransactionFlowDetails.fromJson(map['flow_details']),
    flowType: TreasuryTransactionFlowDetailsType.fromJson(map['flow_type']),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    status: TreasuryTransactionStatus.fromJson(map['status']),
    statusTransitions:
        TreasuryTransactionsResourceAbstractTransactionResourceStatusTransitions
            .fromJson(map['status_transitions']),
  );
}