-
Notifications
You must be signed in to change notification settings - Fork 37
CreateOrder dont working #43
Comments
I have same problem. There is no any response from Klarna. |
Metoden är async vad jag kan se. Prova nedan
|
Also having the same issue. Running the test code in a console application works fine but running that same code in a clean ASP.NET WebForms application freezes the application. The solution suggested by @DUAB-Johan does not solve the issue. Generally it appears to be discouraged to run asynchronous methods in a synchronous way as done in the Klarna library (see for example: https://devblogs.microsoft.com/pfxteam/should-i-expose-synchronous-wrappers-for-asynchronous-methods/) and I am wondering if this is indeed the underlying issue; resulting in an application deadlock. More disturbingly it would suggest Klarna has never actually tested their own code beyond the context of a console application (as is indeed the format of the provided sample project). |
Considering this code works (main method console application):
…while this code doesn't (page load method, asp.net WebForms aspx page):
|
Thanks @DUAB-Johan for the solution. Actually due to the Web Forms limitations you cannot use Task.Result in the Main thread To make the things easier we created a nice example using WebForms to demonstrate how you can use the SDK together with the WebForms: https://github.com/klarna/kco_rest_dotnet/tree/v3.x/Klarna.Rest/SampleProjects/WebForms Follow the link, clone the project and run the example. I hope this example will help you to resolve the issue. Thanks everyone for the feedback! |
Describe the bug
I have a ASP.NET MVC 4 project i trying to integrate Klarna Checkout in using the latest nuget package.
To try something i used the example of createing a checkout order that exist in the github respository and when its doing the first call with the code row:
client.Checkout.CreateOrder(order).Result;
Its stuck there, nothing happening its loading and loading, no timeout or anything...
Which service do you use
Klarna Checkout Rest API, kco_rest_dotnet
To Reproduce
Use your own example code CreateExample in https://github.com/klarna/kco_rest_dotnet/blob/v3.1/Klarna.Rest/Klarna.Rest.Core.Examples/CheckoutApi.cs
Expected behavior
I was expecting a result where i could get the OrderId or a error but dont getting anything.
Additional context
Visual Studio 2017
.Net Framework 4.6.1
ASP:NET MVC 4
Klarna Europe Test Environment
The text was updated successfully, but these errors were encountered: