InvoicePreview.fromJson constructor
InvoicePreview.fromJson(
- Map<String, dynamic> j
)
Implementation
factory InvoicePreview.fromJson(Map<String, dynamic> j) {
final brand = j['brand'];
final einvoice = 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 is Map && brand['id'] is String ? brand['id'] as String : null,
brandName: brand is Map && brand['name'] is String ? brand['name'] as String : null,
einvoice: einvoice is Map ? EInvoiceStatus.fromJson(Map<String, dynamic>.from(einvoice)) : null,
);
}