Refund.fromJson constructor
Refund.fromJson(
- Object? json
Implementation
factory Refund.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return Refund(
amount: (map['amount'] as num).toInt(),
balanceTransaction: map['balance_transaction'] == null
? null
: BalanceTransactionOrId.fromJson(map['balance_transaction']),
charge: map['charge'] == null ? null : ChargeOrId.fromJson(map['charge']),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
currency: (map['currency'] as String),
description:
map['description'] == null ? null : (map['description'] as String),
destinationDetails: map['destination_details'] == null
? null
: RefundDestinationDetails.fromJson(map['destination_details']),
failureBalanceTransaction: map['failure_balance_transaction'] == null
? null
: BalanceTransactionOrId.fromJson(map['failure_balance_transaction']),
failureReason: map['failure_reason'] == null
? null
: (map['failure_reason'] as String),
id: (map['id'] as String),
instructionsEmail: map['instructions_email'] == null
? null
: (map['instructions_email'] as String),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
nextAction: map['next_action'] == null
? null
: RefundNextAction.fromJson(map['next_action']),
paymentIntent: map['payment_intent'] == null
? null
: PaymentIntentOrId.fromJson(map['payment_intent']),
reason:
map['reason'] == null ? null : RefundReason.fromJson(map['reason']),
receiptNumber: map['receipt_number'] == null
? null
: (map['receipt_number'] as String),
sourceTransferReversal: map['source_transfer_reversal'] == null
? null
: TransferReversalOrId.fromJson(map['source_transfer_reversal']),
status: map['status'] == null ? null : (map['status'] as String),
transferReversal: map['transfer_reversal'] == null
? null
: TransferReversalOrId.fromJson(map['transfer_reversal']),
);
}