TreasuryInboundTransfer.fromJson constructor

TreasuryInboundTransfer.fromJson(
  1. Object? json
)

Implementation

factory TreasuryInboundTransfer.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TreasuryInboundTransfer(
    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),
    failureDetails: map['failure_details'] == null
        ? null
        : TreasuryInboundTransferFailureDetails.fromJson(
            map['failure_details']),
    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),
    linkedFlows:
        TreasuryInboundTransfersResourceInboundTransferResourceLinkedFlows
            .fromJson(map['linked_flows']),
    livemode: (map['livemode'] as bool),
    metadata: (map['metadata'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as String),
            )),
    originPaymentMethod: (map['origin_payment_method'] as String),
    originPaymentMethodDetails: map['origin_payment_method_details'] == null
        ? null
        : InboundTransfers.fromJson(map['origin_payment_method_details']),
    returned: map['returned'] == null ? null : (map['returned'] as bool),
    statementDescriptor: (map['statement_descriptor'] as String),
    status: TreasuryInboundTransferStatus.fromJson(map['status']),
    statusTransitions:
        TreasuryInboundTransfersResourceInboundTransferResourceStatusTransitions
            .fromJson(map['status_transitions']),
    transaction: map['transaction'] == null
        ? null
        : TreasuryTransactionOrId.fromJson(map['transaction']),
  );
}