bunq / sdk_csharp

C# SDK for bunq API
MIT License
35 stars 22 forks source link

Event missing from endpoints #121

Closed bluewalk closed 5 years ago

bluewalk commented 5 years ago

Steps to reproduce:

  1. Try to retrieve events

What should happen:

  1. Have an endpoint for Events

SDK version and environment

Extra info:

bluewalk commented 5 years ago

Furthermore the following models are missing when implementing Event endpoint

bluewalk commented 5 years ago

I see the objects have been generated. But I see there's still an error on sdk_csharp/BunqSdk/Model/Generated/Object/InvoiceItemGroup.cs

public InvoiceItem Item { get; set; }

should be

public List<InvoiceItem> Item { get; set; }

or deserialization will fail

bluewalk commented 5 years ago

Another error is that MonetaryAccountId on the Event Generated object is a string instead of an int/long as it should be.

Also

Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Bunq.Sdk.Model.Generated.Endpoint.AttachmentPublic]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'BunqMeFundraiserResult.bunqme_fundraiser_profile.attachment.uuid', line 54, position 17.'

Seems to be this in BunqMeFundraiserProfile class:


        /// <summary>
        /// The attachments attached to the fundraiser profile.
        /// </summary>
        [JsonProperty(PropertyName = "attachment")]
        public List<AttachmentPublic> Attachment { get; set; }

The API returns just a single object, so why declare a list?

            "attachment": {
                "uuid": "863d8405-xxxx-xxxx-xxxx-b99bc7b786c0",
                "description": "",
                "content_type": "image/jpeg"
            },

Or will the API return an array if there are multiple attachments? If so, structure shouldn't change and it should always be an array. But as far as I've seen it always has one attachment for a profile...

Is the generator having some issues or is the swagger definition incorrect?

see https://github.com/bluewalk/sdk_csharp/tree/release-1.10.2-fixes

bluewalk commented 5 years ago

Another error:

Newtonsoft.Json.JsonSerializationException: Error setting value to 'Vat' on 'Bunq.Sdk.Model.Generated.Object.InvoiceItem'. ---> System.InvalidCastException: Unable to cast object of type 'System.Decimal' to type 'System.Nullable`1[System.Double]'.

and

Newtonsoft.Json.JsonSerializationException: Error setting value to 'Quantity' on 'Bunq.Sdk.Model.Generated.Object.InvoiceItem'. ---> System.InvalidCastException: Unable to cast object of type 'System.Decimal' to type 'System.Nullable`1[System.Double]'.

I've added the fixes in the release-1.10.2-fixes branch

bluewalk commented 5 years ago

Unfortunately these errors still exist in the latest version