ApplicationFee.fromJson constructor

ApplicationFee.fromJson(
  1. Object? json
)

Implementation

factory ApplicationFee.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return ApplicationFee(
    account: AccountOrId.fromJson(map['account']),
    amount: (map['amount'] as num).toInt(),
    amountRefunded: (map['amount_refunded'] as num).toInt(),
    application: ApplicationOrId.fromJson(map['application']),
    balanceTransaction: map['balance_transaction'] == null
        ? null
        : BalanceTransactionOrId.fromJson(map['balance_transaction']),
    charge: ChargeOrId.fromJson(map['charge']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    currency: (map['currency'] as String),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    originatingTransaction: map['originating_transaction'] == null
        ? null
        : ChargeOrId.fromJson(map['originating_transaction']),
    refunded: (map['refunded'] as bool),
    refunds: ApplicationFeeRefunds.fromJson(map['refunds']),
  );
}