WooOrder.fromJson constructor

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

Implementation

WooOrder.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 ? new Billing.fromJson(json['billing']) : null;
  shipping = json['shipping'] != null
      ? new 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'];
  metaData =
      (json['meta_data'] as List).map((i) => MetaData.fromJson(i)).toList();
  if (json['line_items'] != null) {
    lineItems = <LineItems>[];
    json['line_items'].forEach((v) {
      lineItems!.add(new LineItems.fromJson(v));
    });
  }
  if (json['tax_lines'] != null) {
    taxLines = <TaxLines>[];
    json['tax_lines'].forEach((v) {
      taxLines!.add(new TaxLines.fromJson(v));
    });
  }
  if (json['shipping_lines'] != null) {
    shippingLines = <ShippingLines>[];
    json['shipping_lines'].forEach((v) {
      shippingLines!.add(new ShippingLines.fromJson(v));
    });
  }
  if (json['fee_lines'] != null) {
    feeLines = <WooOrderFeeLine>[];
    json['fee_lines'].forEach((v) {
      feeLines!.add(new WooOrderFeeLine.fromJson(v));
    });
  }
  if (json['coupon_lines'] != null) {
    couponLines = [];
    json['coupon_lines'].forEach((v) {
      couponLines!.add(new WooOrderCouponLine.fromJson(v));
    });
  }

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