Payout.fromJson constructor
Payout.fromJson(
- Object? json
Implementation
factory Payout.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return Payout(
amount: (map['amount'] as num).toInt(),
arrivalDate: DateTime.fromMillisecondsSinceEpoch(
(map['arrival_date'] as int).toInt()),
automatic: (map['automatic'] as bool),
balanceTransaction: map['balance_transaction'] == null
? null
: BalanceTransactionOrId.fromJson(map['balance_transaction']),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
currency: (map['currency'] as String),
description:
map['description'] == null ? null : (map['description'] as String),
destination: map['destination'] == null
? null
: PayoutDestinationOrId.fromJson(map['destination']),
failureBalanceTransaction: map['failure_balance_transaction'] == null
? null
: BalanceTransactionOrId.fromJson(map['failure_balance_transaction']),
failureCode:
map['failure_code'] == null ? null : (map['failure_code'] as String),
failureMessage: map['failure_message'] == null
? null
: (map['failure_message'] as String),
id: (map['id'] as String),
livemode: (map['livemode'] as bool),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
method: (map['method'] as String),
originalPayout: map['original_payout'] == null
? null
: PayoutOrId.fromJson(map['original_payout']),
reconciliationStatus:
PayoutReconciliationStatus.fromJson(map['reconciliation_status']),
reversedBy: map['reversed_by'] == null
? null
: PayoutOrId.fromJson(map['reversed_by']),
sourceType: (map['source_type'] as String),
statementDescriptor: map['statement_descriptor'] == null
? null
: (map['statement_descriptor'] as String),
status: (map['status'] as String),
type: PayoutType.fromJson(map['type']),
);
}