InvoiceObject.fromJson constructor

InvoiceObject.fromJson(
  1. Map data
)

Implementation

factory InvoiceObject.fromJson(Map data) {
  return InvoiceObject(
      businessName: data['business_name'],
      isSuccessful: !data.containsKey('message'),
      error: data.containsKey('message')
          ? ErrorObject.fromJson(data)
          : ErrorObject(),
      code: data['code'],
      charge: data.containsKey('charge')
          ? ChargeObject.fromJson(data['charge'])
          : ChargeObject(),
      status: data['status'],
      customerEmail: data['customer_email'],
      url: data['hosted_url'],
      customerName: data['customer_name'],
      memo: data['memo'],
      createdAt: DateTime.tryParse(data['created_at'].toString()),
      updatedAt: DateTime.tryParse(data['updated_at'].toString()),
      localPrice: data['local_price']);
}