ApiErrors.fromJson constructor

ApiErrors.fromJson(
  1. Object? json
)

Implementation

factory ApiErrors.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return ApiErrors(
    charge: map['charge'] == null ? null : (map['charge'] as String),
    code: map['code'] == null ? null : ApiErrorsCode.fromJson(map['code']),
    declineCode:
        map['decline_code'] == null ? null : (map['decline_code'] as String),
    docUrl: map['doc_url'] == null ? null : (map['doc_url'] as String),
    message: map['message'] == null ? null : (map['message'] as String),
    param: map['param'] == null ? null : (map['param'] as String),
    paymentIntent: map['payment_intent'] == null
        ? null
        : PaymentIntent.fromJson(map['payment_intent']),
    paymentMethod: map['payment_method'] == null
        ? null
        : PaymentMethod.fromJson(map['payment_method']),
    paymentMethodType: map['payment_method_type'] == null
        ? null
        : (map['payment_method_type'] as String),
    requestLogUrl: map['request_log_url'] == null
        ? null
        : (map['request_log_url'] as String),
    setupIntent: map['setup_intent'] == null
        ? null
        : SetupIntent.fromJson(map['setup_intent']),
    source:
        map['source'] == null ? null : PaymentSource.fromJson(map['source']),
    type: ApiErrorsType.fromJson(map['type']),
  );
}