Dispute.fromJson constructor
Dispute.fromJson(
- Object? json
Implementation
factory Dispute.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return Dispute(
amount: (map['amount'] as num).toInt(),
balanceTransactions: (map['balance_transactions'] as List<Object?>)
.map((el) => BalanceTransaction.fromJson(el))
.toList(),
charge: ChargeOrId.fromJson(map['charge']),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
currency: (map['currency'] as String),
evidence: DisputeEvidence.fromJson(map['evidence']),
evidenceDetails: DisputeEvidenceDetails.fromJson(map['evidence_details']),
id: (map['id'] as String),
isChargeRefundable: (map['is_charge_refundable'] as bool),
livemode: (map['livemode'] as bool),
metadata: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
networkReasonCode: map['network_reason_code'] == null
? null
: (map['network_reason_code'] as String),
paymentIntent: map['payment_intent'] == null
? null
: PaymentIntentOrId.fromJson(map['payment_intent']),
paymentMethodDetails: map['payment_method_details'] == null
? null
: DisputePaymentMethodDetails.fromJson(map['payment_method_details']),
reason: (map['reason'] as String),
status: DisputeStatus.fromJson(map['status']),
);
}