TaxCalculationCreateOptions.fromJson constructor

TaxCalculationCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory TaxCalculationCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TaxCalculationCreateOptions(
    currency: (map['currency'] as String),
    customer: map['customer'] == null ? null : (map['customer'] as String),
    customerDetails: map['customer_details'] == null
        ? null
        : CalculationCustomerDetails.fromJson(map['customer_details']),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    lineItems: (map['line_items'] as List<Object?>)
        .map((el) => CalculationLineItemsItem.fromJson(el))
        .toList(),
    shippingCost: map['shipping_cost'] == null
        ? null
        : CalculationShippingCost.fromJson(map['shipping_cost']),
    taxDate:
        map['tax_date'] == null ? null : (map['tax_date'] as num).toInt(),
  );
}