1
import 'package:vkdart/vkontakte.dart';
5
/// See https://dev.vk.com/ru/reference/objects/market-order
6
class MarketOrderModel {
8
final Map<String, dynamic> payload;
10
// ignore: public_member_api_docs
11
MarketOrderModel(this.payload);
14
int? get id => payload['id'];
17
int? get groupId => payload['group_id'];
20
int? get userId => payload['user_id'];
22
/// The date the order was created in Unixtime format.
23
int? get createdAt => payload['date'];
25
/// ID of the option group.
26
int? get variantsGroupingId => payload['variants_grouping_id'];
28
/// Whether the option is the main one.
29
bool? get isMainVariant => payload['is_main_variant'];
32
List<MarketOrderPropertyValuesModel>? get propertyValues =>
33
(payload['property_values'] as List?)
34
?.map((e) => MarketOrderPropertyValuesModel(
35
(e as Map).cast<String, dynamic>()))
38
/// The quantity of the product in the cart.
39
int? get cartQuantity => payload['cart_quantity'];
42
int? get status => payload['status'];
44
/// The number of items in the order.
45
int? get itemsCount => payload['items_count'];
47
/// The total cost of the order.
48
Map<String, dynamic>? get totalPrice => payload['total_price'];
50
/// the cost in hundredths of a unit of currency.
51
int? get totalPriceAmount => totalPrice?['amount'];
53
/// currency identifier
54
int? get totalPriceCurrencyId => totalPrice?['currency']?['id'];
56
/// currency designation;
57
String? get totalPriceCurrencyName => totalPrice?['currency']?['name'];
59
/// a string representation of the order value.
60
String? get totalPriceText => totalPrice?['text'];
62
/// The order number, consisting of the customer ID and the order ID.
63
int? get displayOrderId => payload['display_order_id'];
65
/// Comment on the order.
66
String? get comment => payload['comment'];
68
/// See https://dev.vk.com/ru/reference/objects/market-order#preview_order_items
69
List<MarketAttachmentModel>? get previewOrderItems =>
70
(payload['preview_order_items'] as List)
71
.map((e) => MarketAttachmentModel((e as Map).cast<String, dynamic>()))
74
/// Delivery information.
76
/// See https://dev.vk.com/ru/reference/objects/market-order#delivery
77
Map<String, dynamic>? get delivery => payload['delivery'];
80
String? get deliveryAddress => delivery?['address'];
83
String? get deliveryType => delivery?['type'];
85
/// the track number for tracking the order.
86
String? get deliveryTrackNumber => delivery?['track_number'];
88
/// a link to track the order by track number.
89
String? get deliveryTrackLink => delivery?['track_link'];
91
/// information about the pick-up point.
92
Object? get deliveryPoint => delivery?['delivery_point'];
94
/// Information about the buyer.
96
/// See https://dev.vk.com/ru/reference/objects/market-order#recipient
97
Map<String, dynamic>? get recipient => payload['recipient'];
100
String? get recipientName => recipient?['name'];
102
/// The buyer's number.
103
String? get recipientPhone => recipient?['phone'];
105
/// String representation of customer information.
106
String? get recipientDisplayText => recipient?['display_text'];
109
/// Market Order Property Values model.
111
/// See https://dev.vk.com/ru/reference/objects/market-order#property_values
112
class MarketOrderPropertyValuesModel {
113
// ignore: public_member_api_docs
114
MarketOrderPropertyValuesModel(this.payload);
117
final Map<String, dynamic> payload;
120
int get variantId => payload['variant_id'];
123
String get variantName => payload['variant_name'];
126
String get propertyName => payload['property_name'];