TaxCalculationLineItem.fromJson constructor

TaxCalculationLineItem.fromJson(
  1. Object? json
)

Implementation

factory TaxCalculationLineItem.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TaxCalculationLineItem(
    amount: (map['amount'] as num).toInt(),
    amountTax: (map['amount_tax'] as num).toInt(),
    id: (map['id'] as String),
    livemode: (map['livemode'] as bool),
    product: map['product'] == null ? null : (map['product'] as String),
    quantity: (map['quantity'] as num).toInt(),
    reference: map['reference'] == null ? null : (map['reference'] as String),
    taxBehavior:
        TaxCalculationShippingCostTaxBehavior.fromJson(map['tax_behavior']),
    taxBreakdown: map['tax_breakdown'] == null
        ? null
        : (map['tax_breakdown'] as List<Object?>)
            .map((el) => TaxProductResourceLineItemTaxBreakdown.fromJson(el))
            .toList(),
    taxCode: (map['tax_code'] as String),
  );
}