TerminalReaderReaderResourceRefundPaymentAction.fromJson constructor

TerminalReaderReaderResourceRefundPaymentAction.fromJson(
  1. Object? json
)

Implementation

factory TerminalReaderReaderResourceRefundPaymentAction.fromJson(
    Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TerminalReaderReaderResourceRefundPaymentAction(
    amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
    charge: map['charge'] == null ? null : ChargeOrId.fromJson(map['charge']),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    paymentIntent: map['payment_intent'] == null
        ? null
        : PaymentIntentOrId.fromJson(map['payment_intent']),
    reason: map['reason'] == null
        ? null
        : TerminalReaderReaderResourceRefundPaymentActionReason.fromJson(
            map['reason']),
    refund: map['refund'] == null ? null : RefundOrId.fromJson(map['refund']),
    refundApplicationFee: map['refund_application_fee'] == null
        ? null
        : (map['refund_application_fee'] as bool),
    refundPaymentConfig: map['refund_payment_config'] == null
        ? null
        : TerminalReaderReaderResourceRefundPaymentConfig.fromJson(
            map['refund_payment_config']),
    reverseTransfer: map['reverse_transfer'] == null
        ? null
        : (map['reverse_transfer'] as bool),
  );
}