OrderWC.fromJson constructor

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

Implementation

OrderWC.fromJson(Map<String, dynamic> json) {
  paymentMethod = json['payment_method'];
  paymentMethodTitle = json['payment_method_title'];
  setPaid = json['set_paid'];
  status = json['status'];
  currency = json['currency'];
  customerId = json['customer_id'];
  if (json['customer_note'] != null) {
    customerNote = json['customer_note'];
  }
  if (json['transaction_id'] != null) {
    transactionId = json['transaction_id'];
  }
  if (json['parent_id']) {
    parentId = json['parent_id'];
  }
  if (json['meta_data'] != null) {
    metaData = [];
    json['meta_data'].forEach((v) {
      metaData!.add(MetaData.fromJson(v));
    });
  }
  if (json['fee_lines'] != null) {
    feeLines = [];
    json['fee_lines'].forEach((v) {
      feeLines!.add(FeeLines.fromJson(v));
    });
  }
  if (json['coupon_lines'] != null) {
    couponLines = [];
    json['coupon_lines'].forEach((v) {
      couponLines!.add(CouponLines.fromJson(v));
    });
  }
  billing =
      json['billing'] != null ? Billing.fromJson(json['billing']) : null;
  shipping =
      json['shipping'] != null ? Shipping.fromJson(json['shipping']) : null;
  if (json['line_items'] != null) {
    lineItems = [];
    json['line_items'].forEach((v) {
      lineItems!.add(LineItems.fromJson(v));
    });
  }
  if (json['shipping_lines'] != null) {
    shippingLines = [];
    json['shipping_lines'].forEach((v) {
      shippingLines!.add(ShippingLines.fromJson(v));
    });
  }
}