ConfirmationToken.fromJson constructor

ConfirmationToken.fromJson(
  1. Object? json
)

Implementation

factory ConfirmationToken.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return ConfirmationToken(
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    expiresAt: map['expires_at'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['expires_at'] as int).toInt()),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    mandateData: map['mandate_data'] == null
        ? null
        : ConfirmationTokenMandateData.fromJson(map['mandate_data']),
    paymentIntent: map['payment_intent'] == null
        ? null
        : (map['payment_intent'] as String),
    paymentMethodPreview: map['payment_method_preview'] == null
        ? null
        : ConfirmationTokenPaymentMethodPreview.fromJson(
            map['payment_method_preview']),
    returnUrl:
        map['return_url'] == null ? null : (map['return_url'] as String),
    setupFutureUsage: map['setup_future_usage'] == null
        ? null
        : ConfirmationTokenSetupFutureUsage.fromJson(
            map['setup_future_usage']),
    setupIntent:
        map['setup_intent'] == null ? null : (map['setup_intent'] as String),
    shipping: map['shipping'] == null
        ? null
        : ConfirmationTokenShipping.fromJson(map['shipping']),
    useStripeSdk: (map['use_stripe_sdk'] as bool),
  );
}