CreditNoteLinesItem.fromJson constructor

CreditNoteLinesItem.fromJson(
  1. Object? json
)

Implementation

factory CreditNoteLinesItem.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return CreditNoteLinesItem(
    amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
    description:
        map['description'] == null ? null : (map['description'] as String),
    invoiceLineItem: map['invoice_line_item'] == null
        ? null
        : (map['invoice_line_item'] as String),
    quantity:
        map['quantity'] == null ? null : (map['quantity'] as num).toInt(),
    taxAmounts: map['tax_amounts'] == null
        ? null
        : (map['tax_amounts'] as List<Object?>)
            .map((el) => CreditNoteTaxAmountsItem.fromJson(el))
            .toList(),
    taxRates: map['tax_rates'] == null
        ? null
        : (map['tax_rates'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    type: CreditNoteLineItemType.fromJson(map['type']),
    unitAmount: map['unit_amount'] == null
        ? null
        : (map['unit_amount'] as num).toInt(),
    unitAmountDecimal: map['unit_amount_decimal'] == null
        ? null
        : (map['unit_amount_decimal'] as String),
  );
}