| | | 1 | | using Newtonsoft.Json; |
| | | 2 | | using Newtonsoft.Json.Linq; |
| | | 3 | | |
| | | 4 | | namespace Services.ApiServices.OzonApi.Filters |
| | | 5 | | { |
| | | 6 | | public class UnfulfilledListResponse |
| | | 7 | | { |
| | | 8 | | [JsonProperty("postings")] |
| | | 9 | | public List<UnfulfilledPosting> Postings { get; set; } = new(); |
| | | 10 | | |
| | | 11 | | [JsonProperty("has_next")] |
| | | 12 | | public bool HasNext { get; set; } |
| | | 13 | | |
| | | 14 | | [JsonProperty("cursor")] |
| | | 15 | | public string? Cursor { get; set; } |
| | | 16 | | |
| | | 17 | | [JsonProperty("total")] |
| | | 18 | | public int Total { get; set; } |
| | | 19 | | } |
| | | 20 | | |
| | | 21 | | public class UnfulfilledPosting |
| | | 22 | | { |
| | | 23 | | [JsonProperty("posting_number")] |
| | | 24 | | public string PostingNumber { get; set; } = ""; |
| | | 25 | | |
| | | 26 | | [JsonProperty("status")] |
| | | 27 | | public string Status { get; set; } = ""; |
| | | 28 | | |
| | | 29 | | // Информация о складе в v4 вложена в delivery_method |
| | | 30 | | [JsonProperty("delivery_method")] |
| | | 31 | | public UnfulfilledDeliveryMethod? DeliveryMethod { get; set; } |
| | | 32 | | |
| | | 33 | | [JsonProperty("products")] |
| | | 34 | | public List<UnfulfilledProduct> Products { get; set; } = new(); |
| | | 35 | | |
| | | 36 | | [JsonProperty("cutoff_date")] |
| | | 37 | | public DateTime? CutoffDate { get; set; } |
| | | 38 | | |
| | | 39 | | [JsonProperty("shipment_date")] |
| | | 40 | | public DateTime? ShipmentDate { get; set; } |
| | | 41 | | |
| | | 42 | | // Вспомогательные свойства |
| | | 43 | | public long WarehouseId => DeliveryMethod?.WarehouseId ?? 0; |
| | | 44 | | public string? WarehouseName => DeliveryMethod?.Warehouse; |
| | | 45 | | } |
| | | 46 | | |
| | | 47 | | public class UnfulfilledDeliveryMethod |
| | | 48 | | { |
| | | 49 | | [JsonProperty("id")] |
| | | 50 | | public long Id { get; set; } |
| | | 51 | | |
| | | 52 | | [JsonProperty("name")] |
| | | 53 | | public string? Name { get; set; } |
| | | 54 | | |
| | | 55 | | [JsonProperty("warehouse_id")] |
| | | 56 | | public long WarehouseId { get; set; } |
| | | 57 | | |
| | | 58 | | // В v4 название склада хранится как строка в поле "warehouse" |
| | | 59 | | [JsonProperty("warehouse")] |
| | | 60 | | public string? Warehouse { get; set; } |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | public class UnfulfilledProduct |
| | | 64 | | { |
| | | 65 | | [JsonProperty("sku")] |
| | 0 | 66 | | public long Sku { get; set; } |
| | | 67 | | |
| | | 68 | | [JsonProperty("offer_id")] |
| | 0 | 69 | | public string OfferId { get; set; } = ""; |
| | | 70 | | |
| | | 71 | | [JsonProperty("name")] |
| | 0 | 72 | | public string Name { get; set; } = ""; |
| | | 73 | | |
| | | 74 | | [JsonProperty("quantity")] |
| | 0 | 75 | | public int Quantity { get; set; } |
| | | 76 | | |
| | | 77 | | // v4 API возвращает price как объект {"price":"...", "original_price":"..."} |
| | | 78 | | [JsonProperty("price")] |
| | 0 | 79 | | public JToken? Price { get; set; } |
| | | 80 | | } |
| | | 81 | | } |