Viincenttt / MollieApi

This project allows you to easily add the Mollie payment provider to your application.
MIT License
150 stars 85 forks source link

System.ArgumentException in callback when a user pays using the payment method 'giftcard' #52

Closed peefke closed 6 years ago

peefke commented 6 years ago

Our client enabled gift cards in the Mollie dashboard. When a user pays with a gift card the transaction succeeds, but in the callback to us, we get the error below. It seems the value 'giftcard' is not parsed correctly?

Exception: System.ArgumentException Message: Requested value 'giftcard' was not found. Source: mscorlib at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult) at Mollie.Api.JsonConverters.PaymentResponseConverter.GetPaymentMethod(JObject jObject) at Mollie.Api.JsonConverters.PaymentResponseConverter.Create(Type objectType, JObject jObject) at Mollie.Api.JsonConverters.JsonCreationConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)

Which makes sense:

// Decompiled with JetBrains decompiler // Type: Mollie.Api.Models.Payment.PaymentMethod // Assembly: Mollie.Api, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null // MVID: D1284B43-BB17-405E-8DD3-3E77EE457199 // Assembly location: E:\Work\GM\Dev\packages\Mollie.Api.1.5.0\lib\netstandard1.2\Mollie.Api.dll

using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.Runtime.Serialization;

namespace Mollie.Api.Models.Payment { [JsonConverter(typeof (StringEnumConverter))] public enum PaymentMethod { [EnumMember(Value = "ideal")] Ideal, [EnumMember(Value = "creditcard")] CreditCard, [EnumMember(Value = "mistercash")] MisterCash, [EnumMember(Value = "sofort")] Sofort, [EnumMember(Value = "banktransfer")] BankTransfer, [EnumMember(Value = "directdebit")] DirectDebit, [EnumMember(Value = "belfius")] Belfius, [EnumMember(Value = "bitcoin")] Bitcoin, [EnumMember(Value = "podiumcadeaukaart")] PodiumCadeaukaart, [EnumMember(Value = "paypal")] PayPal, [EnumMember(Value = "paysafecard")] PaySafeCard, [EnumMember(Value = "kbc")] Kbc, } }

Can this be foreseen?

peefke commented 6 years ago

pull req created.

there seem many more types missing, could these also be added? thanks in advance!

image

Viincenttt commented 6 years ago

I have added the giftcard payment method and will release a new version soon. I've also noticed that Mollie has also added the ING Home pay method that was also missing.

KimGrus commented 6 years ago

Can you update de NuGet package to?

Viincenttt commented 6 years ago

Hi KimGrus,

I will update the NuGet package when I'm done testing some other changes that I also want to include in the new version. I'm hoping to finalize the new version this weekend.

Kind regards, Vincent

Viincenttt commented 6 years ago

Hi all,

This bug is now resolved in version 1.5.1.

Kind regards, Vincent