Cart.fromJson constructor
Implementation
Cart.fromJson(Map<String, dynamic> json) {
cartId = json['cartId'];
intent = json['intent'];
billingType = json['billingType'];
paymentId = json['paymentId'];
billingToken = json['billingToken'];
if (json['items'] != null) {
items = <Items>[];
json['items'].forEach((v) {
items!.add(Items.fromJson(v));
});
}
amounts =
json['amounts'] != null ? Amounts.fromJson(json['amounts']) : null;
description = json['description'];
cancelUrl = json['cancelUrl'] != null
? CancelUrl.fromJson(json['cancelUrl'])
: null;
returnUrl = json['returnUrl'] != null
? CancelUrl.fromJson(json['returnUrl'])
: null;
total = json['total'] != null ? UnitPrice.fromJson(json['total']) : null;
if (json['shippingMethods'] != null) {
shippingMethods = <ShippingMethods>[];
json['shippingMethods'].forEach((v) {
shippingMethods!.add(ShippingMethods.fromJson(v));
});
}
shippingAddress = json['shippingAddress'] != null
? ShippingAddress.fromJson(json['shippingAddress'])
: null;
billingAddress = json['billingAddress'] != null
? ShippingAddress.fromJson(json['billingAddress'])
: null;
totalAllowedOverCaptureAmount =
json['totalAllowedOverCaptureAmount'] != null
? UnitPrice.fromJson(json['totalAllowedOverCaptureAmount'])
: null;
}