fix(moysklad): accept fractional prices (decimal, not long) in DTOs

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) <noreply@anthropic.com>
This commit is contained in:
nurdotnet 2026-04-21 23:59:44 +05:00
parent 321cb76a7b
commit 22502c11fd

View file

@ -69,7 +69,7 @@ public class MsProduct
public class MsSalePrice 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("currency")] public MsMetaWrapper? Currency { get; set; }
[JsonPropertyName("priceType")] public MsPriceType? PriceType { get; set; } [JsonPropertyName("priceType")] public MsPriceType? PriceType { get; set; }
} }
@ -83,7 +83,7 @@ public class MsPriceType
public class MsMoney public class MsMoney
{ {
[JsonPropertyName("value")] public long Value { get; set; } [JsonPropertyName("value")] public decimal Value { get; set; }
[JsonPropertyName("currency")] public MsMetaWrapper? Currency { get; set; } [JsonPropertyName("currency")] public MsMetaWrapper? Currency { get; set; }
} }