Giter VIP home page Giter VIP logo

mollieapi's Introduction

MollieApi

This project allows you to easily add the Mollie payment provider to your application. Mollie has excellent documentation which I highly recommend you read before using this library.

Support

If you have encounter any issues while using this library or have any feature requests, feel free to open an issue on GitHub. If you need help integrating the Mollie API into your .NET application, please contact me on LinkedIn.

Want to chat with other developers regarding the Mollie API? The official Mollie developer Discord is a great place to provide feedback, ask questions and chat with other developers: Mollie Developer Discord

Contributions

Have you spotted a bug or want to add a missing feature? All pull requests are welcome! Please provide a description of the bug or feature you have fixed/added. Make sure to target the latest development branch.

Getting started and documentation

The library is easy and simple to use. Take a look at the getting started guide and create your first payment using the Mollie API in no time. For the full documentation of all library functions, please take a look at the documentation on the Wiki. There is also a .NET Blazor example project available that displays various features of the library.

Creating a payment in under a minute

Install the NuGet package

Install-Package Mollie.Api

Example code to create a iDeal payment for €100

using IPaymentClient paymentClient = new PaymentClient("{yourApiKey}", new HttpClient());
PaymentRequest paymentRequest = new PaymentRequest() {
    Amount = new Amount(Currency.EUR, 100.00m),
    Description = "Test payment of the example project",
    RedirectUrl = "http://google.com",
	Method = Mollie.Api.Models.Payment.PaymentMethod.Ideal
};
PaymentResponse paymentResponse = await paymentClient.CreatePaymentAsync(paymentRequest);
string checkoutUrl = paymentResponse.Links.Checkout.Href;

Supported .NET versions

This library is built using .NET standard 2.0. This means that the package supports the following .NET implementations:

.NET implementation Version support
.NET and .NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0
.NET Framework 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Mono 5.4, 6.4
Universal Windows Platform 10.0.16299, TBD
Xamarin.iOS 10.14, 12.16
Xamarin.Mac 3.8, 5.16
Xamarin.Android 8.0, 10.0

Source: https://docs.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0

Supported API's

This library currently supports the following API's:

  • Payments API
  • PaymentMethod API
  • PaymentLink API
  • Customers API
  • Mandates API
  • Subscriptions API
  • Refund API
  • Connect API
  • Chargebacks API
  • Invoices API
  • Permissions API
  • Profiles API
  • Organizations API
  • Order API
  • Captures API
  • Onboarding API
  • Balances API
  • Terminal API
  • ClientLink API
  • Wallet API

mollieapi's People

Contributors

awatertrevi avatar cswiers avatar dependabot[bot] avatar dschierm avatar hhoangnl avatar kevenvz avatar kristofytp avatar kryptonite avatar leonm91 avatar lgoudriaan avatar markusdresch avatar martijndijkgraaf avatar michielcornilleesc avatar nvanrooij avatar omeaart avatar p-de-jong avatar pdejong-sieval avatar project01-wim avatar rdeveen avatar renklapper avatar roeland54 avatar senneclaeskens avatar sippelberg avatar sjasses avatar stephanonline avatar thomaskuijper avatar tstrooba avatar viincenttt avatar wouterdirks avatar ziriax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mollieapi's Issues

Exception when PaymentResponse contains metadata

The jsondeserializer throws an exception when the PaymentRespons contains a Metadata object.
This is property is defined as string
To solve it, i made a class "Metadata" and defined the property as Metadata

public class Metadata
{
public string Order_Id { get; set; }
}

This seems to work ok now

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

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?

Async methods deadlock in web environment

I was asked to implement Mollie into an existing webapp but for some reason the CreatePaymentAsync never returns in the web environment. I did a small test using a console application and the same credentials and that worked fine.

I did some research and it turns out the async methods deadlock for some reason. According to this article the await calls can be supplied with an extra method call to ConfigureAwait(false)

I've added this method call to all async calls in MollieClient and everything works perfect now. For example: IRestResponse response = await this._restClient.ExecuteTaskAsync(request).ConfigureAwait(false);

Can I do a pull request for this code or did I introduce a new problem/risk?

Mollie in PCL project (xamarin forms and Prism)

I'm not able to add Mollie.Api to a portable Class Library.
I'm just a starting programmer so i could be that i just do not know how.

Is there a way to install the nuget in pcl? will this be an option in the future?

kind regards,
Daniel Commandeur

Probleem met API key

While creating a payment (like in the example) I always get the error: The provided token isn't an oauth token.

Retreiving a list of payment methods works fine.

What could be the issue ?

Reference required to assembly 'System.Threading.Tasks

Hi Vincent,

After upgrading to the newest version I get:
Compiler Error Message: BC30652: Reference required to assembly 'System.Threading.Tasks, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' containing the type 'System.Threading.Tasks.Task`1'. Add one to your project.

Imports System.Threading.Tasks does not work. Any other solution?

tnx!

Can't upgrade due to .Net Standard dependency

I got stuck with an older version because my solution does not support .Net Standard.

Would it be possible to add a dependency group in the nuspec file that targets .NET Framework 4.5 without .Net Standard?

I believe it would be something like this (not 100% sure though):

    <dependencies>
      <group targetFramework=".NETFramework4.5">
         <dependency id="Newtonsoft.Json" version="10.0.3" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETStandard1.2">
        <dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
        <dependency id="Newtonsoft.Json" version="10.0.3" exclude="Build,Analyzers" />
      </group>
    </dependencies>

NuGet not compatible with .Net Core 1.x

Please recompile or .net Standard https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/

Installing RestSharp 105.2.3.
Installing Mollie.Api 1.3.7.
Package Mollie.Api 1.3.7 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Mollie.Api 1.3.7 supports: net45 (.NETFramework,Version=v4.5)
Package RestSharp 105.2.3 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package RestSharp 105.2.3 supports:
  - monoandroid10 (MonoAndroid,Version=v1.0)
  - monotouch10 (MonoTouch,Version=v1.0)
  - net35 (.NETFramework,Version=v3.5)
  - net40 (.NETFramework,Version=v4.0)
  - net40-client (.NETFramework,Version=v4.0,Profile=Client)
  - net45 (.NETFramework,Version=v4.5)
  - net451 (.NETFramework,Version=v4.5.1)
  - net452 (.NETFramework,Version=v4.5.2)
  - net46 (.NETFramework,Version=v4.6)
  - sl5 (Silverlight,Version=v5.0)
  - wp8 (WindowsPhone,Version=v8.0)
  - wp81 (WindowsPhone,Version=v8.1)
  - xamarinios10 (Xamarin.iOS,Version=v1.0)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.

System.AggregateExceptions

Hi.,

I'm new at this., and going to implement into my system. Need help about mollie refund.
Thanks.

this._refundClient = new RefundClient(apiKey);
RefundRequest requestModel = new RefundRequest()
{
                Amount = 25,
                Message = 'Refund_Remarks'
};

var response = this._refundClient.CreateRefundAsync(PaymentId, requestModel).Result; // this line crashed
return response; 

var response = this._refundClient.CreateRefundAsync(PaymentId, requestModel).Result; // this line
from this line , i'm getting Error like:

at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
Inner Exception - {"Unknown field: message"}

Support for the Mollie Reseller API

Hi,

Do you plan on supporting the Reseller API any time soon? We're currently doing a project on which we plan to use your abstraction in order to interface with the Mollie API, but we also need access to the Reseller API.

Thanks in advance!

Regards,
Wouter Roos

A strongly-named assembly is required

For using Mollie.Api in in a signed .NET assembly, Mollie.Api has to be signed too.
Also RestSharp used by Mollie.Api will need need be signed as well.

NuGet package Brutal.Dev.StrongNameSigner.2.1.0 can be used to add signatures in .csproj, like:

....






Could you add signatures?

Thanks a lot for adding KBC pay type support today so fast :)

Unable to create a new mandate

Creating a new mandate seems to be broken in the example web application. No errors occur, but no mandates are created.

The cause of this is still unknown.

Error: Unknown http exception occured with status code: 0.

Hi Viicenttt,

We are using your API and sometimes we receive strange errors when calling GetPaymentAsync method to validate a payment.
We are logging exceptions and this is the error we get:

Error: Unknown http exception occured with status code: 0.

We contacted Mollie support but they don't give us any info about it.
Can you help us with this issue.

Regards, Pablo

I need a little bit of help

Hello,
Is there anybody who can help me a little bit further.

I've been succesfull in making a "paymentrequest" to mollie and I also can get the "paymentresponse".
PaymentResponse result = this._mollieClient.GetPaymentAsync(psPaymentId).Result;

But I also want to receive the "IdealPaymentResponse" and "IdealPaymentResponseDetails".
How can I get these responses?

Thanks for any help.

Aart

Missing 'subscriptionId' field in PaymentResponse

The mollie documentation says there's a subscriptionId field in the /payment/get response but the field is missing in this library. I really love this library but this one would make it even better, thanks!

HttpClient per request

I was about to start using the Mollie API with this project but then I noticed the usage of a seperate HttpClient instance for every request. Well, not exactly for every request but at least for every API-client by calling this.CreateHttpClient(clientId, clientSecret);.

To my knowledge this is not in accordance with best practices for using the HttpClient. This way of using HttpClient can lead to a lot of persistent open connections on the server running the application as well as a lot of overhead and CPU usage (for disposing the client). More about this can be read on https://blogs.msdn.microsoft.com/shacorn/2016/10/21/best-practices-for-using-httpclient-on-services/ and https://msdn.microsoft.com/en-us/library/system.net.http.httpclient(v=vs.110).aspx#Anchor_5.

Would it be an option to create one static instance that would stay alive during application lifetime? I myself usually use a singleton which is injected with ninject in my asp.net applications (kernel.Bind<HttpClient>().ToSelf().InSingletonScope();). This could be used as well but might be unhandy for folks not using dependency injection.

Any suggestions?

Webhook en webforms example

Hallo Vincent,

Ik maak nu gebruik van de Mollie betaal API. Ik heb een C# webforms website en heb dit getest maar er zijn nog wat vragen.

Ik zie dat deze API niet direct van een webhook gebruik lijkt te maken of het moet al onderwater zijn. Ik geef aan de API alleen een bedrag, beschrijving en redirecturl mee.

Is de webhook idd niet perse nodig? Het lijkt zo te werken.

Hieronder de code op de betaalpagina. Wellicht kan je tips geven?

        // Creeer betaling
        PaymentClient paymentClient = new PaymentClient("test_xxx");
        PaymentRequest paymentRequest = new PaymentRequest()
        {
            Amount = Convert.ToDecimal(bedrag.Text),
            Description = beschrijving.Text,
            RedirectUrl = "https://kinderopvangkerkrade.nl/nl/MollieCheckBedankpagina.aspx"
        };

        PaymentResponse paymentResponse = paymentClient.CreatePaymentAsync(paymentRequest).Result;
        var status = paymentResponse.Status;
        Session["betaling"] = paymentClient;
        Session["betalingId"] = paymentResponse.Id;

        // Start betaling
        PaymentResponse result = paymentClient.GetPaymentAsync(paymentResponse.Id).Result;
        var url = result.Links.PaymentUrl;

Hieronder de code op de bedankpagina:

        var idBetaling = Session["betalingId"].ToString();
        PaymentClient paymentClient = (Mollie.Api.Client.PaymentClient) Session["betaling"];
        PaymentResponse result = paymentClient.GetPaymentAsync(idBetaling).Result;

        betalingId.Text = result.Id;
        betalingStatus.Text = result.Status.ToString();

        if (result.Status.ToString().ToLower() == "paid")
        {
            melding.Text = "Betaling succesvol.";
        }
        else
        {
            melding.Text = "Betaling mislukt!";
        }

Is de werking correct zover je kan zien? Ik heb dus geen webhook maar ik kan op de bedankpagina toch de status opvragen. Ik sla het betaalobject op in een sessie en die blijft over de betaling bij Mollie heen dan ook behouden tot op de bedankpagina.

Metadata should probably be an object, or a collection, not a string

Metadata is a free-form JSON object in Mollie's api. In your mapping it is a string. Setting it to "just" a string will fail with a dynamic error. Setting it to a JSON string (with JSON.NET, NewtonSoft.Json etc) works though, and the result needs to be parsed back into a dynamic type.

For instance, something like the following works (for retrieving it):

result = mollieClient.GetPaymentAsync(paymentId).Result;
if (!String.IsNullOrEmpty(result.Metadata))
{
    // be careful, must be dynamic!
    dynamic metaData = Newtonsoft.Json. JsonConvert.DeserializeObject<dynamic>(result.Metadata);
    orderConfirmationEmail = metaData.emailTo;
}

The syntax, if you'd device the JSON by hand, for the above code fragment, could look like this:

var orderConfirmationMail = Request.Form["email"];
PaymentRequest paymentRequest = new PaymentRequest()
{
    Amount = 123.45M,
    Description = "my first pony",
    RedirectUrl = "http://xyz.com",
    Metadata = "{ \"emailTo\": \"" + orderConfirmationEmail + "\" }"  // ouch, ugly...
};

I'm not saying there's something seriously broken or so, but being able to send metadata with a request painlessly would certainly be beneficial. Perhaps you can turn the type into a collection? Or create a specific action, say SetMetadataFromJson(string json) and SetMetadataFromCollection(ICollection data). Just some suggestions which I think would make using this library even easier ;).

Btw, let's not forget that I had little to no trouble using your library. After a few moments of "getting used to", I managed to use it effectively and easily. Thanks for your excellent work!

Refund response can't be deserialized when the status is Queued

Creating a refund when there are insufficient funds throws a Newtonsoft.Json.JsonSerializationException

    Error converting value "queued" to type 'Mollie.Api.Models.Refund.RefundStatus'. Path 'status', line 1, position 699.

This happens when Mollie sets the refund status to Queued. This status is not defined in MollieApi/Mollie.Api/Models/Refund/RefundStatus.cs.

The possible values for Refund Status are:

queued - The refund will be processed once you have enough balance. The refund may be cancelled.
pending - The refund will be processed soon (usually the next business day). The refund may be cancelled.
processing - The refund is being processed. Cancellation is no longer possible.
refunded - The refund has been paid out to the consumer.
failed - The refund has failed during processing.

PaymentResponse.cs mandateID

I was happy to see you also added MandateID in the PaymentResponse, because this means it would be much easier to determine which mandateID is used for a first payment, but I've test it and mandateID is empty for a first payment, I think this property is only available in a PaymentRequest?

PaymentResponse does not contain Details field with IdealPaymentResponseDetails

I wish to get the IBAN of a customer that has done a payment.

If I do

PaymentClient paymentClient = new PaymentClient(MollieApiKey);
var payment = paymentClient.GetPaymentAsync(item.BetalingId).Result;
var myDetails=payment.Details;

the Details does not exist. In debug is it is available, so (for now) I've rewritten the code to

PaymentClient paymentClient = new PaymentClient(MollieApiKey);
dynamic payment = paymentClient.GetPaymentAsync(item.BetalingId).Result;
if (payment != null && payment.Details != null)
{
    var bankAccount = payment.Details as Mollie.Api.Models.Payment.Response.IdealPaymentResponseDetails;
    if (bankAccount != null)
    {
        item.Iban = bankAccount.ConsumerAccount;
        item.DateChecked = currentDate;
    }
}

And then it works correctly. However, I'd love to see that the IdealPaymentResponseDetails field is added to the PaymentResponse object.

Creditcardpayment 'American Express' throws an error while others work

Error converting value "American Express" to type 'System.Nullable`1[Mollie.Api.Models.Payment.Response.CreditCardLabel]'. Path 'details.cardLabel', line 1, position 458.

Error:
Inner-Inner-Message: Requested value 'American Express' was not found.
Inner-Inner-Stack: at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)

Stacktrace:
**** EXCEPTION IS THROWN ****
Message: One or more errors occurred.
Stack: at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at ExtraVestiging40.MollieAPIPaymentProvider.MollieAPIPaymentProvider.GetPayment(String sPaymentId) at CheckoutPaymentMollieAPICheck.CheckPayment() in d:\WebsitesEV\evRoodenrijsb2c\CheckoutPaymentMollieAPICheck.aspx.cs:line 174 Inner-Message: Error converting value "American Express" to type 'System.Nullable1[Mollie.Api.Models.Payment.Response.CreditCardLabel]'. Path 'details.cardLabel', line 1, position 458.
Inner-Stack: at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
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.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.Populate(JsonReader reader, Object target)
at Mollie.Api.JsonConverters.JsonCreationConverter1.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.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 Mollie.Api.Client.BaseMollieClient.ProcessHttpResponseMessage[T](IRestResponse response) at Mollie.Api.Client.BaseMollieClient.<ExecuteRequestAsync>d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Mollie.Api.Client.BaseMollieClient.<GetAsync>d__61.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Mollie.Api.Client.PaymentClient.d__3.MoveNext()
Inner-Inner-Message: Requested value 'American Express' was not found.
Inner-Inner-Stack: at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)

New package for subscriptions

Hi Vincent,

I see that you also implemented the subscription API. Great!!
Are you planning to package that fantastic new feature as well in a v1.3.3?
(p.s. sorry to make an 'issue' for it, but I have no idea how to ask you in another way...)

Regards,
Owin

Locale

The Locale enum needs at least one extra value.

I tested on a PC with Location set to Netherlands, but language set to English (United Kingdom).

I didn't specify a locale when creating the payment. The payment was created without any errors. However, when trying to retrieve that payment from the Mollie API, I get de-serialization errors. The Locale being returned is "uk", not "en" as expected.

Adding "UK" to the Locale enum solves the problem.

Cannot compile the solution

Hai, no clue if this is the right place to add comments / issues.

I downloaded the solution, loaded it into VS2015, rebuild the solution and get several errors.
Why?

Severity Code Description Project File Line Source Suppression State
Error CS1061 'BaseMollieApiTestClass' does not contain a definition for 'ApiTestKey' and no extension method 'ApiTestKey' accepting a first argument of type 'BaseMollieApiTestClass' could be found (are you missing a using directive or an assembly reference?) Mollie.Tests.Integration D:\Develop\DotNet35\MollieApi-master\Mollie.Tests.Integration\Framework\BaseMollieApiTestClass.cs 22 IntelliSense Active

Severity Code Description Project File Line Source Suppression State
Error CS0121 The call is ambiguous between the following methods or properties: 'Mollie.Api.Extensions.RestSharpExtensionMethods.IsScuccessStatusCode(System.Net.HttpStatusCode)' and 'Mollie.Api.Extensions.RestSharpExtensionMethods.IsScuccessStatusCode(System.Net.HttpStatusCode)' Mollie.Api D:\Develop\DotNet35\MollieApi-master\Mollie.Api\Extensions\RestSharpExtensionMethods.cs 7 IntelliSense Active

Severity Code Description Project File Line Source Suppression State
Error CS0121 The call is ambiguous between the following methods or properties: 'Mollie.Api.Extensions.RestSharpExtensionMethods.IsSuccessful(RestSharp.IRestResponse)' and 'Mollie.Api.Extensions.RestSharpExtensionMethods.IsSuccessful(RestSharp.IRestResponse)' Mollie.Api D:\Develop\DotNet35\MollieApi-master\Mollie.Api\Client\BaseMollieClient.cs 66 IntelliSense Active

p.s. If there is some forum, please add details so I can ask questions overthere while implementing these classes.

Regards, Marc

Payment screen is by default in german

Hi Vicent,

I've implemented your molly API which was really easy to implement.

The only problem i'm experiencing is that the default value of the property Locale in PaymentRequest is Local.DE. This is probably because that is the fist value of the enumeration.

PaymentResponse does not expose FailedDatetime

Hi again

I'm using Mollie.Api from NuGet, version 1.5.1. Works like a charm! (Now that I fixed the problems I reported earlier that were entirely my own doing, heheh...;) )

Anyway, It seems that Mollie exposes also a 'failedDatetime' property in the payment status. See https://www.mollie.com/en/docs/reference/payments/get

failedDatetime
DATETIME
Optional – The date and time the payment failed, in ISO 8601 format. This parameter is omitted if the payment did not fail (yet).

Unless I'm mistaken, Mollie.Api.Models.Payment.Response.PaymentResponse does not seem to contain a property FailedDatetime yet. Could you say if you'll add this in the foreseeable future?

Thank you kindly for this API, it's a great help!

New Package for customer/mandates

Hi Vincent,

Great work you are doing, also by including customer and mandates. Will you also create a new NuGet package for this update?
Hope you can answer this, otherwise I'll use the code itself, but makes updating less handy...

Regards,
Owin

kbc pay type is not supported

Mollie added a new payment type "KBC/CBC Payment Button", which is not supported as yet - please add it.

Current API 1.3.6 throws error when KBC/CBC Payment Button is used:

System.ArgumentException: Requested value 'kbc' was not found.
at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
at Mollie.Api.JsonConverters.PaymentResponseConverter.GetPaymentMethod(JObject jObject) in E:\Development\GitHub\MollieApi\Mollie.Api\JsonConverters\PaymentResponseConverter.cs:line 26
at Mollie.Api.JsonConverters.PaymentResponseConverter.Create(Type objectType, JObject jObject) in E:\Development\GitHub\MollieApi\Mollie.Api\JsonConverters\PaymentResponseConverter.cs:line 17
at Mollie.Api.JsonConverters.JsonCreationConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in E:\Development\GitHub\MollieApi\Mollie.Api\JsonConverters\JsonCreationConverter.cs:line 39
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, 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 Mollie.Api.Client.MollieClient.ProcessHttpResponseMessage[T](IRestResponse response) in E:\Development\GitHub\MollieApi\Mollie.Api\Client\MollieClient.cs:line 173

415 Unsupported Media Type

When i use the following code:

var preparePayment = new Mollie.Api.Models.Payment.Request.PaymentRequest()
                {
                    Amount = order.Totals.Total,
                    Locale = Helpers.ShopHelper.GetCurrentLanguage().ToLowerInvariant(),
                    Description = "Invoice °" + order.OrderNumber,
                    CustomerId = MollieId,
                    RedirectUrl = Url.Action("Finish", "Cart", new { }, Request.Url.Scheme),
                    WebhookUrl = Url.Action("MolliePaymentWebHook", "EndPoint", new { }, Request.Url.Scheme),
                    Metadata = order.Id.ToString()
                };
var response = await molliePay.CreatePaymentAsync(preparePayment);

The error that throws in the library = Unsupported Input received. But i added the source to check the underlying issue. Which gives 415 Unsupported Media Type.

I haven't changed anything in the code and it sets the UTF-8 and application/json content-type. But for some reason it just doesn't work.

Any thoughts? I have a feeling it could be a framework issue ( .net standard versions), but i'm not sure.

The requested value inghomepay cannot be found

When I call GetPaymentListAsync I get the error above. This used to work fine, but is failing since a few days. Has there been a change at the Mollie API? Is there a way to fix this?

System.IO.FileNotFoundException occurred: System.Net.Http

When I add the Mollie.Api package in a console application and start the PaymentClient this error shows up. What is the problem?

System.IO.FileNotFoundException occurred
HResult=0x80070002
Message=Kan bestand of assembly System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a of een van de afhankelijkheden hiervan niet laden. Het systeem kan het opgegeven bestand niet vinden.
Source=
StackTrace:
at Mollie.Api.Client.BaseMollieClient..ctor(String apiKey) in C:\Users\pasca\Documents\Projecten\SBR\Mollie.Api\Client\BaseMollieClient.cs:line 29
at Mollie.Api.Client.PaymentClient..ctor(String apiKey) in C:\Users\pasca\Documents\Projecten\SBR\Mollie.Api\Client\PaymentClient.cs:line 9
at SBRMollieKoppeling.Program.Main(String[] args) in C:\Users\pasca\Documents\Projecten\SBR\SBRMollieKoppeling\Program.cs:line 22

Inner Exception 1:
FileNotFoundException: Kan bestand of assembly System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a of een van de afhankelijkheden hiervan niet laden. Het systeem kan het opgegeven bestand niet vinden.

Missing Revoking of a Mandate in MandateClient

Hi Vincent,

In the Mandateclient, there is only support for retrieval of a mandate and a mandatelist.
When deleting a subscription of a recurring payment, I think the mandate should also be deleted. Can you add the revocation method?

Cheers!
Owin

(sorry if this issue is created twice, network failure...)

Mollie gets HTTPresponse 502 back from webhook

Hi Vincent,

I have implemented the webhook like this

        [HttpPost]
        public async Task<System.Net.Http.HttpResponseMessage> WebHook([System.Web.Http.FromBody] string id)
{
            string paymentId = id;

            //Do things (that do not throw an error)

            return new HttpResponseMessage(HttpStatusCode.OK);
}

I tried a few methods of returning a httpresponse 200, but it keeps failing which keeps Mollie retrying the webhook call.
I cannot see an implementation in your test project of the webhook and that makes sense, but you must have one, so my question is how do you let Mollie know that their webhook call succeeded?

Thanx a bunch!

Owin

Extend CustomerResponse with payment methods

Hello, Vincent.
Wouldn't it be so difficult for you to extend this response type with the list of the last used payment methods as Mollie provides?
"recentlyUsedMethods": []

Webhook with empty id

Hi,
does someone faced the same issue as me, when I make a payment the webhook input param is always empty?

Mollie.Api.Models.Payment.Locale doesn't support all locales

Besides the locales mentioned in the Mollie documentation, it has come to my attention that Mollie can also pass in other locales, such as 'uk'. This trips over the class Mollie.Api.Models.Payment.Locale, resulting in the following error message:

Error converting value "uk" to type 'Mollie.Api.Models.Payment.Locale'. Path 'locale', line 1, position 442. ---> System.ArgumentException: Requested value 'uk' was not found.

The cause of this is that not all possible locales are defined in this class: https://github.com/Viincenttt/MollieApi/blob/master/Mollie.Api/Models/Payment/Locale.cs

I talked to Mollie support on the phone stating that if you leave the Locale parameter empty when creating the payment request, Mollie will pass in the users' browser-language when calling the webhook.

I think that the Locale.cs should be extented so it contains more locales or the locale parameter should be a string so that it more flexible for future locales.

Create 2.0 version

Hey,

What about creating a 2.0 version with full api support (including molli connect) and removing the deprecated functions?

Could not load file or assembly 'RestSharp'

I've installed nuget package of MollieApi, it has installed successfully with Restsharp 105.2.3.0.

I have simply add this code,

PaymentClient paymentClient = new PaymentClient("myapikey");
PaymentRequest paymentRequest = new PaymentRequest() {
    Amount = 100,
    Description = "Test payment of the example project",
    RedirectUrl = "http://google.com"
};

PaymentResponse paymentResponse = paymentClient.CreatePaymentAsync(paymentRequest).Result;

it has build and run, but on runtime I alwasy get this error,

Exception information: 
    Exception type: FileNotFoundException 
    Exception message: Could not load file or assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

NuGet package error

I got a problem with the package, NuGet specifices that the dependency is the following:

Newtonsoft.Json (>= 8.0.2)

When installed it upgraded our Newtonsoft.Json to version 8.0.2 (as needed) (from 6.0.0). But when run it gave an error that Newtonsoft.Json 10.0.3 dll could not be found.

I looked at your github and saw that you use 10.0.3 so I would suggest you to update your nuspec file (could not find on github) to include the same reference.

Settlements API

@Viincenttt thank you for all the work you put into the MollieApi works great!!

But what I'm missing is the possibility to find out which payments are included in a settlement to my bank account. Now I'm looking at the Mollie API documentation and it tells me that there is the Settlements API with the function: "List settlements" which returns all information I'm looking for (transaction ID's within a settlement ID and date) but I see it isn't implemented in the C# MollieApi. Do you have any plans to implement it? I was wondering if it is difficult to implement? And where to start if I would like to look into it?

MisterCash

Hi All,

Can any one tell me, Which Payment request model is required for MisterCash ?

Thanks All

Add MandateId parameter to CreatePaymentAsync method

Hi,

Can you please add the MandateId parameter to the CreatePaymentAsync method? This parameter, which is not documented by Mollie yet, allows a user to specify which mandate to use for a recurring payment. This is useful when a customer has multiple valid mandates.

Thank you!

Nik

Adding CustomerId and RecurringType to PaymentResponse Model

Hi vincent,

I had some contact with Mollie last week on recurring payments, and I found out that the customerId and recurringType are also properties of the payment response.
{"resource":"payment","id":"tr_xxXXxxXX","mode":"test","createdDatetime":"2016-07-28T14:06:49.0Z","status":"open","expiryPeriod":"PT13M39S","amount":"0.01","description":"Test","method":null,"metadata":null,"details":null,"profileId":"pfl_xxXXxxXX","customerId":"cst_xxXXxxXXxx","recurringType":"first","links":{"paymentUrl":"https://www.mollie.com/payscreen/select-method/XXxxXXxx","redirectUrl":"http://mollie.com"}}

Since I did not see them in your Paymentsresponse model I thought I would add them, test them and offer you a pull request.

However, when trying to test using the SimpleExample or WebappplicationExample I recieved unhandled exceptions in both, also in the original version without my changes:
Exception: An error has occured while performing an action on the Mollie Api. Please view the Error property for more information about the exception.
Error property: {Mollie.Api.Models.MollieErrorMessage}
So that does not help me much...

Is this something that you can reproduce?
After this error is solved, would you like me to add these 2 properties to the PaymentResponse via a pull request?

Regards,
Owin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.