TransferReversal.fromJson constructor

TransferReversal.fromJson(
  1. Object? json
)

Implementation

factory TransferReversal.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TransferReversal(
    amount: (map['amount'] as num).toInt(),
    balanceTransaction: map['balance_transaction'] == null
        ? null
        : BalanceTransactionOrId.fromJson(map['balance_transaction']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    currency: (map['currency'] as String),
    destinationPaymentRefund: map['destination_payment_refund'] == null
        ? null
        : RefundOrId.fromJson(map['destination_payment_refund']),
    id: (map['id'] as String),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    sourceRefund: map['source_refund'] == null
        ? null
        : RefundOrId.fromJson(map['source_refund']),
    transfer: TransferOrId.fromJson(map['transfer']),
  );
}