SourceTransaction.fromJson constructor

SourceTransaction.fromJson(
  1. Object? json
)

Implementation

factory SourceTransaction.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SourceTransaction(
    achCreditTransfer: map['ach_credit_transfer'] == null
        ? null
        : SourceTransactionAchCreditTransferData.fromJson(
            map['ach_credit_transfer']),
    amount: (map['amount'] as num).toInt(),
    chfCreditTransfer: map['chf_credit_transfer'] == null
        ? null
        : SourceTransactionChfCreditTransferData.fromJson(
            map['chf_credit_transfer']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    currency: (map['currency'] as String),
    gbpCreditTransfer: map['gbp_credit_transfer'] == null
        ? null
        : SourceTransactionGbpCreditTransferData.fromJson(
            map['gbp_credit_transfer']),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    paperCheck: map['paper_check'] == null
        ? null
        : SourceTransactionPaperCheckData.fromJson(map['paper_check']),
    sepaCreditTransfer: map['sepa_credit_transfer'] == null
        ? null
        : SourceTransactionSepaCreditTransferData.fromJson(
            map['sepa_credit_transfer']),
    source: (map['source'] as String),
    status: (map['status'] as String),
    type: SourceTransactionType.fromJson(map['type']),
  );
}