PaymentIntentPaymentMethodOptionsCardMandateOptions.fromJson constructor

PaymentIntentPaymentMethodOptionsCardMandateOptions.fromJson(
  1. Object? json
)

Implementation

factory PaymentIntentPaymentMethodOptionsCardMandateOptions.fromJson(
    Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PaymentIntentPaymentMethodOptionsCardMandateOptions(
    amount: (map['amount'] as num).toInt(),
    amountType: PaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType
        .fromJson(map['amount_type']),
    description:
        map['description'] == null ? null : (map['description'] as String),
    endDate: map['end_date'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['end_date'] as int).toInt()),
    interval:
        PaymentIntentPaymentMethodOptionsCardMandateOptionsInterval.fromJson(
            map['interval']),
    intervalCount: map['interval_count'] == null
        ? null
        : (map['interval_count'] as num).toInt(),
    reference: (map['reference'] as String),
    startDate: DateTime.fromMillisecondsSinceEpoch(
        (map['start_date'] as int).toInt()),
    supportedTypes: map['supported_types'] == null
        ? null
        : (map['supported_types'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
  );
}