softwerkab / fortnox-csharp-api-sdk

.NET SDK for Fortnox API.
MIT License
52 stars 64 forks source link

Error converting value "FRX" to type 'System.Nullable`1[Fortnox.SDK.Entities.AbsenceCauseCode]' #231

Closed jazzn3rd closed 2 years ago

jazzn3rd commented 2 years ago

In AbsenceCauseCode.cs https://github.com/FortnoxAB/csharp-api-sdk/blob/master/FortnoxSDK/Entities/Absence%20Transactions/AbsenceCauseCode.cs

The enum does not handle FRX (Flextid)

Callstack:

Newtonsoft.Json.JsonSerializationException: Error converting value "FRX" to type 'System.Nullable`1[Fortnox.SDK.Entities.AbsenceCauseCode]'. Path 'AbsenceTransactions[1].CauseCode', line 1, position 426.
 ---> System.ArgumentException: Requested value 'FRX' was not found.
   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, NamingStrategy namingStrategy, String value, Boolean disallowNumber)
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Fortnox.SDK.Serialization.JsonEntitySerializer.Deserialize[T](String json)
   at Fortnox.SDK.Connectors.Base.SearchableEntityConnector`3.GetSinglePage[T](SearchRequest`1 request)
   at Fortnox.SDK.Connectors.Base.SearchableEntityConnector`3.SendAsync[T](SearchRequest`1 request)
   at Fortnox.SDK.Connectors.Base.SearchableEntityConnector`3.BaseFind(BaseSearch searchSettings)
   at Fortnox.SDK.Connectors.AbsenceTransactionConnector.FindAsync(AbsenceTransactionSearch searchSettings)
richardrandak commented 2 years ago

(EDITED) The documentation does not specify FRX. However, I will add it to the enum.

I checked also attendence codes, there was FLX as Flextid -/+. However, this seems to be changed, in GUI i can see the FRX in absence for Flextid- and NVX in attendence for flextid+, which is also missing from Attendence enum.

Can you confirm this?

jazzn3rd commented 2 years ago

I know. I also reacted to this. But if one sign in a Fortnox instance the Cause Code is there. So they must have missed updating the documentation.

Den tors 17 feb. 2022 12:19richardrandak @.***> skrev:

The documentation specifies only these.. I don't see the FRX here. However, I can added to the enum.

[image: Screenshot_1] https://user-images.githubusercontent.com/58220739/154470350-c09e6e30-e5b1-4c91-bfda-b9a155fd0935.png

— Reply to this email directly, view it on GitHub https://github.com/FortnoxAB/csharp-api-sdk/issues/231#issuecomment-1042844071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMTCEDYMD7QUNBHHI3RXSD3U3TKTJANCNFSM5OETEHCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

richardrandak commented 2 years ago

The NVX and FRX codes were added. Update the NuGet to new version.