TreasuryOutboundTransfer.fromJson constructor
TreasuryOutboundTransfer.fromJson(
- Object? json
Implementation
factory TreasuryOutboundTransfer.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return TreasuryOutboundTransfer(
amount: (map['amount'] as num).toInt(),
cancelable: (map['cancelable'] as bool),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
currency: (map['currency'] as String),
description:
map['description'] == null ? null : (map['description'] as String),
destinationPaymentMethod: map['destination_payment_method'] == null
? null
: (map['destination_payment_method'] as String),
destinationPaymentMethodDetails:
OutboundTransfersPaymentMethodDetails.fromJson(
map['destination_payment_method_details']),
expectedArrivalDate: DateTime.fromMillisecondsSinceEpoch(
(map['expected_arrival_date'] as int).toInt()),
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),
)),
returnedDetails: map['returned_details'] == null
? null
: TreasuryOutboundPaymentReturnedDetails.fromJson(
map['returned_details']),
statementDescriptor: (map['statement_descriptor'] as String),
status: TreasuryOutboundPaymentStatus.fromJson(map['status']),
statusTransitions:
TreasuryOutboundTransfersResourceStatusTransitions.fromJson(
map['status_transitions']),
transaction: TreasuryTransactionOrId.fromJson(map['transaction']),
);
}