toJson method

Map<String, dynamic> toJson()

Implementation

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

  if (this.refunds != null) {
    data['refunds'] = this.refunds!.map((v) => v.toJson()).toList();
  }
  if (this.links != null) {
    data['_links'] = this.links!.toJson();
  }
  return data;
}