Skip to content

Commit 6c15577

Browse files
committed
fix: Returns actual money value
Removes the Math.Floor and division by 100 which was incorrectly converting the value to cents instead of dollars. This ensures that the correct money values are returned in both the single decimal and dictionary decimal converters.
1 parent 24ba4f5 commit 6c15577

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

libs/GuestLineSDK/Primitives/CoerceToMoneyDecimalJsonConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ public class CoerceToMoneyDecimalJsonConverter : JsonConverter<decimal?>
1717
string? valueString = reader.GetString();
1818
if (decimal.TryParse(valueString, out decimal value))
1919
{
20-
return Math.Floor(value) / 100;
20+
return value;
2121
}
2222
}
2323
else if (reader.TokenType == JsonTokenType.Number)
2424
{
2525
if (reader.TryGetDecimal(out var value))
2626
{
27-
return Math.Floor(value) / 100;
27+
return value;
2828
}
2929
}
3030
else if (reader.TokenType == JsonTokenType.Null)

libs/GuestLineSDK/Primitives/ObpDictionaryJsonConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class ObpDictionaryJsonConverter : JsonConverter<Dictionary<int, decimal?
3636
string? valueString = reader.GetString();
3737
if (decimal.TryParse(valueString, out decimal value))
3838
{
39-
dictionary[key] = Math.Floor(value) / 100;
39+
dictionary[key] = value;
4040
}
4141
else
4242
{
@@ -47,7 +47,7 @@ public class ObpDictionaryJsonConverter : JsonConverter<Dictionary<int, decimal?
4747
{
4848
if (reader.TryGetDecimal(out var value))
4949
{
50-
dictionary[key] = Math.Floor(value) / 100;
50+
dictionary[key] = value;
5151
}
5252
else
5353
{

0 commit comments

Comments
 (0)