InvoicePreview.fromJson constructor

InvoicePreview.fromJson(
  1. Map<String, dynamic> j
)

Implementation

factory InvoicePreview.fromJson(Map<String, dynamic> j) {
  final brand = _objektOderNull(j, 'brand');
  final einvoice = _objektOderNull(j, 'einvoice');
  return InvoicePreview(
    docType: _pflicht<String>(j, 'docType'),
    invoiceDate: _pflicht<String>(j, 'invoiceDate'),
    taxScheme: _pflicht<String>(j, 'taxScheme'),
    taxCountry: _pflicht<String>(j, 'taxCountry'),
    priceMode: _pflicht<String>(j, 'priceMode'),
    totals: InvoiceTotals.fromJson(_objekt(j, 'totals')),
    dueDate: _text(j, 'dueDate'),
    customerId: _text(j, 'customerId'),
    taxSchemeReason: _text(j, 'taxSchemeReason'),
    reverseChargeReason: _text(j, 'reverseChargeReason'),
    language: _text(j, 'language') == 'en' ? 'en' : 'de',
    brandId: brand != null && brand['id'] is String ? brand['id'] as String : null,
    brandName: brand != null && brand['name'] is String ? brand['name'] as String : null,
    einvoice: einvoice != null ? EInvoiceStatus.fromJson(einvoice) : null,
  );
}