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