SetupAttempt.fromJson constructor

SetupAttempt.fromJson(
  1. Object? json
)

Implementation

factory SetupAttempt.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SetupAttempt(
    application: map['application'] == null
        ? null
        : ApplicationOrId.fromJson(map['application']),
    attachToSelf: map['attach_to_self'] == null
        ? null
        : (map['attach_to_self'] as bool),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    customer: map['customer'] == null
        ? null
        : BankAccountCustomerOrId.fromJson(map['customer']),
    flowDirections: map['flow_directions'] == null
        ? null
        : (map['flow_directions'] as List<Object?>)
            .map((el) => SetupAttemptFlowDirectionsItem.fromJson(el))
            .toList(),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    onBehalfOf: map['on_behalf_of'] == null
        ? null
        : AccountOrId.fromJson(map['on_behalf_of']),
    paymentMethod: PaymentMethodOrId.fromJson(map['payment_method']),
    paymentMethodDetails: SetupAttemptPaymentMethodDetails.fromJson(
        map['payment_method_details']),
    setupError: map['setup_error'] == null
        ? null
        : ApiErrors.fromJson(map['setup_error']),
    setupIntent: SetupIntentOrId.fromJson(map['setup_intent']),
    status: (map['status'] as String),
    usage: (map['usage'] as String),
  );
}