RefundCreateOptions.fromJson constructor

RefundCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory RefundCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return RefundCreateOptions(
    amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
    charge: map['charge'] == null ? null : (map['charge'] as String),
    currency: map['currency'] == null ? null : (map['currency'] as String),
    customer: map['customer'] == null ? null : (map['customer'] as String),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    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),
                )),
    paymentIntent: map['payment_intent'] == null
        ? null
        : (map['payment_intent'] as String),
    reason: map['reason'] == null
        ? null
        : TerminalReaderReaderResourceRefundPaymentActionReason.fromJson(
            map['reason']),
    refundApplicationFee: map['refund_application_fee'] == null
        ? null
        : (map['refund_application_fee'] as bool),
    reverseTransfer: map['reverse_transfer'] == null
        ? null
        : (map['reverse_transfer'] as bool),
  );
}