IssuingTransaction.fromJson constructor

IssuingTransaction.fromJson(
  1. Object? json
)

Implementation

factory IssuingTransaction.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return IssuingTransaction(
    amount: (map['amount'] as num).toInt(),
    amountDetails: map['amount_details'] == null
        ? null
        : IssuingAuthorizationAmountDetails.fromJson(map['amount_details']),
    authorization: map['authorization'] == null
        ? null
        : IssuingAuthorizationOrId.fromJson(map['authorization']),
    balanceTransaction: map['balance_transaction'] == null
        ? null
        : BalanceTransactionOrId.fromJson(map['balance_transaction']),
    card: IssuingCardOrId.fromJson(map['card']),
    cardholder: map['cardholder'] == null
        ? null
        : IssuingCardholderOrId.fromJson(map['cardholder']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    currency: (map['currency'] as String),
    dispute: map['dispute'] == null
        ? null
        : IssuingDisputeOrId.fromJson(map['dispute']),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    merchantAmount: (map['merchant_amount'] as num).toInt(),
    merchantCurrency: (map['merchant_currency'] as String),
    merchantData:
        IssuingAuthorizationMerchantData.fromJson(map['merchant_data']),
    metadata: (map['metadata'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as String),
            )),
    networkData: map['network_data'] == null
        ? null
        : IssuingTransactionNetworkData.fromJson(map['network_data']),
    purchaseDetails: map['purchase_details'] == null
        ? null
        : IssuingTransactionPurchaseDetails.fromJson(map['purchase_details']),
    token:
        map['token'] == null ? null : IssuingTokenOrId.fromJson(map['token']),
    treasury: map['treasury'] == null
        ? null
        : IssuingTransactionTreasury.fromJson(map['treasury']),
    type: IssuingTransactionType.fromJson(map['type']),
    wallet: map['wallet'] == null
        ? null
        : IssuingTransactionWallet.fromJson(map['wallet']),
  );
}