TaxCalculation.fromJson constructor
TaxCalculation.fromJson(
- Object? json
Implementation
factory TaxCalculation.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return TaxCalculation(
amountTotal: (map['amount_total'] as num).toInt(),
currency: (map['currency'] as String),
customer: map['customer'] == null ? null : (map['customer'] as String),
customerDetails:
TaxProductResourceCustomerDetails.fromJson(map['customer_details']),
expiresAt: map['expires_at'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['expires_at'] as int).toInt()),
id: map['id'] == null ? null : (map['id'] as String),
lineItems: map['line_items'] == null
? null
: TaxCalculationLineItems.fromJson(map['line_items']),
livemode: (map['livemode'] as bool),
shippingCost: map['shipping_cost'] == null
? null
: TaxCalculationShippingCost.fromJson(map['shipping_cost']),
taxAmountExclusive: (map['tax_amount_exclusive'] as num).toInt(),
taxAmountInclusive: (map['tax_amount_inclusive'] as num).toInt(),
taxBreakdown: (map['tax_breakdown'] as List<Object?>)
.map((el) => TaxProductResourceTaxBreakdown.fromJson(el))
.toList(),
taxDate:
DateTime.fromMillisecondsSinceEpoch((map['tax_date'] as int).toInt()),
);
}