flutter-woocommerce-app/LabelStoreMax/lib/models/cart_line_item.dart
2020-03-28 04:53:06 +00:00

84 lines
2.4 KiB
Dart

// Label StoreMAX
//
// Created by Anthony Gordon.
// Copyright © 2020 WooSignal. All rights reserved.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
class CartLineItem {
String name;
int productId;
int variationId;
int quantity;
bool isManagedStock;
int stockQuantity;
String shippingClassId;
String taxStatus;
String taxClass;
bool shippingIsTaxable;
String subtotal;
String total;
String imageSrc;
String variationOptions;
String stockStatus;
Object metaData = {};
CartLineItem(
{this.name,
this.productId,
this.variationId,
this.isManagedStock,
this.stockQuantity,
this.quantity,
this.stockStatus,
this.shippingClassId,
this.taxStatus,
this.taxClass,
this.shippingIsTaxable,
this.variationOptions,
this.imageSrc,
this.subtotal,
this.total,
this.metaData});
CartLineItem.fromJson(Map<String, dynamic> json)
: name = json['name'],
productId = json['product_id'],
variationId = json['variation_id'],
quantity = json['quantity'],
shippingClassId = json['shipping_class_id'].toString(),
taxStatus = json['tax_status'],
stockQuantity = json['stock_quantity'],
isManagedStock = json['is_managed_stock'],
shippingIsTaxable = json['shipping_is_taxable'],
subtotal = json['subtotal'],
total = json['total'],
taxClass = json['tax_class'],
stockStatus = json['stock_status'],
imageSrc = json['image_src'],
variationOptions = json['variation_options'],
metaData = json['metaData'];
Map<String, dynamic> toJson() => {
'name': name,
'product_id': productId,
'variation_id': variationId,
'quantity': quantity,
'shipping_class_id': shippingClassId,
'tax_status': taxStatus,
'tax_class': taxClass,
'stock_status': stockStatus,
'is_managed_stock': isManagedStock,
'stock_quantity': stockQuantity,
'shipping_is_taxable': shippingIsTaxable,
'image_src': imageSrc,
'variation_options': variationOptions,
'subtotal': subtotal,
'total': total,
'meta_data': metaData,
};
}