TreasuryCreditReversal.fromJson constructor

TreasuryCreditReversal.fromJson(
  1. Object? json
)

Implementation

factory TreasuryCreditReversal.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TreasuryCreditReversal(
    amount: (map['amount'] as num).toInt(),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    currency: (map['currency'] as String),
    financialAccount: (map['financial_account'] as String),
    hostedRegulatoryReceiptUrl: map['hosted_regulatory_receipt_url'] == null
        ? null
        : (map['hosted_regulatory_receipt_url'] as String),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    metadata: (map['metadata'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as String),
            )),
    network: TreasuryCreditReversalNetwork.fromJson(map['network']),
    receivedCredit: (map['received_credit'] as String),
    status: TreasuryCreditReversalStatus.fromJson(map['status']),
    statusTransitions:
        TreasuryReceivedCreditsResourceStatusTransitions.fromJson(
            map['status_transitions']),
    transaction: map['transaction'] == null
        ? null
        : TreasuryTransactionOrId.fromJson(map['transaction']),
  );
}