OrderDTO.fromJson constructor
OrderDTO.fromJson(
- Map<String, dynamic> json
)
Implementation
OrderDTO.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
status = json['status'] != null
? OrderStatus.values
.firstWhere((e) => e.toString() == 'OrderStatus.${json['status']}')
: null;
type = json['type'];
isPaid = json['isPaid'];
isTest = json['isTest'];
customerNote = json['customerNote'];
storeNote = json['storeNote'];
paymentMethod = json['paymentMethod'];
store = json['store'] != null ? StoreDTO.fromJson(json['store']) : null;
if (json['campaigns'] != null) {
campaigns = <CampaignDTO>[];
json['campaigns'].forEach((v) {
campaigns!.add(CampaignDTO.fromJson(v));
});
}
customer =
json['customer'] != null ? Customer.fromJson(json['customer']) : null;
billingAddress = json['billingAddress'] != null
? AddressDTO.fromJson(json['billingAddress'])
: null;
shippingAddress = json['shippingAddress'] != null
? AddressDTO.fromJson(json['shippingAddress'])
: null;
if (json['items'] != null) {
items = <Items>[];
json['items'].forEach((v) {
items!.add(Items.fromJson(v));
});
}
if (json['invoices'] != null) {
invoices = <Invoices>[];
json['invoices'].forEach((v) {
invoices!.add(Invoices.fromJson(v));
});
}
deliveryDate = json['deliveryDate'];
}