TaxProductResourceTaxCalculationShippingCost.fromJson constructor

TaxProductResourceTaxCalculationShippingCost.fromJson(
  1. Object? json
)

Implementation

factory TaxProductResourceTaxCalculationShippingCost.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TaxProductResourceTaxCalculationShippingCost(
    amount: (map['amount'] as num).toInt(),
    amountTax: (map['amount_tax'] as num).toInt(),
    shippingRate: map['shipping_rate'] == null
        ? null
        : (map['shipping_rate'] 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),
  );
}