TreasuryReceivedDebit.fromJson constructor

TreasuryReceivedDebit.fromJson(
  1. Object? json
)

Implementation

factory TreasuryReceivedDebit.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TreasuryReceivedDebit(
    amount: (map['amount'] as num).toInt(),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    currency: (map['currency'] as String),
    description: (map['description'] as String),
    failureCode: map['failure_code'] == null
        ? null
        : TreasuryReceivedDebitFailureCode.fromJson(map['failure_code']),
    financialAccount: map['financial_account'] == null
        ? null
        : (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),
    initiatingPaymentMethodDetails: map[
                'initiating_payment_method_details'] ==
            null
        ? null
        : TreasurySharedResourceInitiatingPaymentMethodDetailsInitiatingPaymentMethodDetails
            .fromJson(map['initiating_payment_method_details']),
    linkedFlows: TreasuryReceivedDebitsResourceLinkedFlows.fromJson(
        map['linked_flows']),
    livemode: (map['livemode'] as bool),
    network: TreasuryReceivedDebitNetwork.fromJson(map['network']),
    reversalDetails: map['reversal_details'] == null
        ? null
        : TreasuryReceivedCreditReversalDetails.fromJson(
            map['reversal_details']),
    status: TreasuryReceivedCreditStatus.fromJson(map['status']),
    transaction: map['transaction'] == null
        ? null
        : TreasuryTransactionOrId.fromJson(map['transaction']),
  );
}