From 22502c11fd8ddc1240f24355914b6a12587f71e0 Mon Sep 17 00:00:00 2001 From: nurdotnet <278048682+nurdotnet@users.noreply.github.com> Date: Tue, 21 Apr 2026 23:59:44 +0500 Subject: [PATCH] fix(moysklad): accept fractional prices (decimal, not long) in DTOs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MoySklad returns minPrice.value and salePrices[*].value as fractional numbers for some accounts/products (not always pure kopecks). Deserializing as long failed with "out of bounds for an Int64" → 500 on import. Switch MsMoney.Value and MsSalePrice.Value to decimal, which accepts both integer and decimal representations. Division by 100m already happens when mapping to local Product, so semantics are unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Integrations/MoySklad/MoySkladDtos.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/food-market.infrastructure/Integrations/MoySklad/MoySkladDtos.cs b/src/food-market.infrastructure/Integrations/MoySklad/MoySkladDtos.cs index a656300..c4f47b8 100644 --- a/src/food-market.infrastructure/Integrations/MoySklad/MoySkladDtos.cs +++ b/src/food-market.infrastructure/Integrations/MoySklad/MoySkladDtos.cs @@ -69,7 +69,7 @@ public class MsProduct public class MsSalePrice { - [JsonPropertyName("value")] public long Value { get; set; } // minor units (копейки/тиын) + [JsonPropertyName("value")] public decimal Value { get; set; } // minor units (копейки/тиын) — MoySklad may return fractional [JsonPropertyName("currency")] public MsMetaWrapper? Currency { get; set; } [JsonPropertyName("priceType")] public MsPriceType? PriceType { get; set; } } @@ -83,7 +83,7 @@ public class MsPriceType public class MsMoney { - [JsonPropertyName("value")] public long Value { get; set; } + [JsonPropertyName("value")] public decimal Value { get; set; } [JsonPropertyName("currency")] public MsMetaWrapper? Currency { get; set; } }