TerminalReaderRefundPaymentOptions.fromJson constructor

TerminalReaderRefundPaymentOptions.fromJson(
  1. Object? json
)

Implementation

factory TerminalReaderRefundPaymentOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TerminalReaderRefundPaymentOptions(
    amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
    charge: map['charge'] == null ? null : (map['charge'] as String),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    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
        : (map['payment_intent'] as String),
    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),
  );
}