ChargeObject.fromJson constructor

ChargeObject.fromJson(
  1. Map data
)

Implementation

factory ChargeObject.fromJson(Map data) {
  return ChargeObject(
      metaData: data['metadata'],
      name: data['name'],
      isSuccessful: !data.containsKey('message'),
      error: data.containsKey('message')
          ? ErrorObject.fromJson(data)
          : ErrorObject(),
      description: data['description'],
      pricingType: data['pricing_type'],
      addresses: data['addresses'],
      code: data['code'],
      createdAt: DateTime.tryParse(data['created_at'].toString()),
      confirmedAt: DateTime.tryParse(data['confirmed_at'].toString()),
      exchangeRate: data['exchange_rates'],
      expiresAt: DateTime.tryParse(data['expires_at'].toString()),
      url: data['hosted_url'],
      id: data['id'],
      pricing: data['pricing'],
      payments: data['payments'],
      supportEmail: data['support_email'],
      timeline: data['timeline']);
}