Order.fromJson constructor

Order.fromJson(
  1. Map<String, dynamic> json
)

Implementation

Order.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  parentId = json['parent_id'];
  number = json['number'];
  orderKey = json['order_key'];
  createdVia = json['created_via'];
  version = json['version'];
  status = json['status'];
  currency = json['currency'];
  dateCreated = json['date_created'];
  dateCreatedGmt = json['date_created_gmt'];
  dateModified = json['date_modified'];
  dateModifiedGmt = json['date_modified_gmt'];
  discountTotal = json['discount_total'];
  discountTax = json['discount_tax'];
  shippingTotal = json['shipping_total'];
  shippingTax = json['shipping_tax'];
  cartTax = json['cart_tax'];
  total = json['total'];
  totalTax = json['total_tax'];
  pricesIncludeTax = json['prices_include_tax'];
  customerId = json['customer_id'];
  customerIpAddress = json['customer_ip_address'];
  customerUserAgent = json['customer_user_agent'];
  customerNote = json['customer_note'];
  billing =
      json['billing'] != null ? Billing.fromJson(json['billing']) : null;
  shipping =
      json['shipping'] != null ? Shipping.fromJson(json['shipping']) : null;
  paymentMethod = json['payment_method'];
  paymentMethodTitle = json['payment_method_title'];
  transactionId = json['transaction_id'];
  datePaid = json['date_paid'];
  datePaidGmt = json['date_paid_gmt'];
  dateCompleted = json['date_completed'];
  dateCompletedGmt = json['date_completed_gmt'];
  cartHash = json['cart_hash'];
  if (json['meta_data'] != null) {
    metaData =
        (json['meta_data'] as List).map((i) => MetaData.fromJson(i)).toList();
  }
  if (json['line_items'] != null) {
    lineItems = [];
    json['line_items'].forEach((v) {
      lineItems!.add(LineItems.fromJson(v));
    });
  }
  if (json['tax_lines'] != null) {
    taxLines = [];
    json['tax_lines'].forEach((v) {
      taxLines!.add(TaxLines.fromJson(v));
    });
  }
  if (json['shipping_lines'] != null) {
    shippingLines = [];
    json['shipping_lines'].forEach((v) {
      shippingLines!.add(ShippingLines.fromJson(v));
    });
  }
  if (json['fee_lines'] != null) {
    feeLines = [];
    json['fee_lines'].forEach((v) {
      feeLines!.add(FeeLine.fromJson(v));
    });
  }
  if (json['coupon_lines'] != null) {
    couponLines = [];
    json['coupon_lines'].forEach((v) {
      couponLines!.add(CouponLine.fromJson(v));
    });
  }

  if (json['refunds'] != null) {
    refunds = [];
    json['refunds'].forEach((v) {
      refunds!.add(Refunds.fromJson(v));
    });
  }
  links = json['_links'] != null ? Links.fromJson(json['_links']) : null;
}