< Summary

Information
Class: Services.ApiServices.OzonApi.Filters.UnfulfilledProduct
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/ApiServices/OzonApi/Filters/UnfulfilledListResponse.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 81
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Sku()100%210%
get_OfferId()100%210%
get_Name()100%210%
get_Quantity()100%210%
get_Price()100%210%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/ApiServices/OzonApi/Filters/UnfulfilledListResponse.cs

#LineLine coverage
 1using Newtonsoft.Json;
 2using Newtonsoft.Json.Linq;
 3
 4namespace 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")]
 066        public long Sku { get; set; }
 67
 68        [JsonProperty("offer_id")]
 069        public string OfferId { get; set; } = "";
 70
 71        [JsonProperty("name")]
 072        public string Name { get; set; } = "";
 73
 74        [JsonProperty("quantity")]
 075        public int Quantity { get; set; }
 76
 77        // v4 API возвращает price как объект {"price":"...", "original_price":"..."}
 78        [JsonProperty("price")]
 079        public JToken? Price { get; set; }
 80    }
 81}