buckaroo-it / BuckarooSdk_DotNet

Software Development Kit which can be used for easy access to the Buckaroo API.
MIT License
6 stars 18 forks source link

No response on execute #8

Open bordenbreejen opened 6 years ago

bordenbreejen commented 6 years ago

I am trying to do a test payment with ideal, but after filling in all the fields you would normally fill in using the rest api, i get no response after calling execute. The thread seems to block somewhere. I have tried different issuers, different banks, but no luck so far. Does anyone maybe have an example or has something broken?

FrostAndFlame commented 5 years ago

@bordenbreejen I've found the root cause. That's because of .GetAwaiter().GetResult() inside ConfiguredServiceTransaction.Execute. I've created PR to add ExecuteAsync method. Hope this will help. https://github.com/buckaroo-it/BuckarooSdk_DotNet/pull/10

coenvdwel commented 5 years ago

The .GetAwaiter().GetResult() is hideous and I think you should move the async all the way up the tree - the ExecuteAsync approach is a nice and safe alternative.

Although this is definitely better, I'm not really sure why the original version should block. We've moved on to our own fork, but this core method invocation is still there (and works as expected). Could you clarify on that, for my understanding?

FrostAndFlame commented 5 years ago

@coenvdwel Thanks for quick feedback on this! Why .GetAwaiter().GetResult() is a bad idea -> https://stackoverflow.com/a/39007110 "This is most commonly seen when called on the UI thread or in an ASP.NET context (for pre-Core ASP.NET)." I caught deadlock in ASP.NET context.

coenvdwel commented 5 years ago

Thanks! Will fix this in our fork, too. We're not in a 'one-thread-at-the-time' context, that's why we're getting away with it, probably. But this is better in any way!