Comments (6)
Hi Owin,
Here's an example I copied from one of my real life projects:
[HttpPost]
public async Task<ActionResult> ProcessPayment(string id) {
await this._paymentService.ProcessPayment(id);
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
Your code looks fine to me. Is this a production or a test environment? Make sure your site publicly available on the internet and isn't blocked by a firewall or something.
You could also try to post a payment id to your site yourself to see if that also gives the same 502 error.
from mollieapi.
Thanx!
It's a test environment. It is publicly available in the cloud, so there
should not be a firewall.
It is also getting reached, because my code is firing and handled, only
the response is not correct.
I see a difference between our codes is that you use an actionresult where
I have used an HttpResponseMessage. I changed it and now I only get 1 call,
so I think they now recieve correct responsecode. Thanx!
Owin
On Fri, Aug 5, 2016 at 10:46 AM, Vincent Kok [email protected]
wrote:
Hi Owin,
Here's an example I copied from one of my real life projects:
[HttpPost]public async Task ProcessPayment(string id) {
await this._paymentService.ProcessPayment(id);
return new HttpStatusCodeResult(HttpStatusCode.OK);
}Your code looks fine to me. Is this a production or a test environment?
Make sure your site publicly available on the internet and isn't blocked by
a firewall or something.You could also try to post a payment id to site yourself to see if that
also gives the same 502 error.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#9 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALCR14anBwAzg-thPKtKcjXyn1hFU-qxks5qcvhngaJpZM4Jddgc
.
from mollieapi.
Good to hear it's working.
from mollieapi.
Sorry to open such an old topic, but could someone help please?
I've tried everything from [FromBody] to just plain string and whatever I do, Mollie gets a 404.
// Nope
[HttpPost]
public HttpResponseMessage Post(string id)
{
return new HttpResponseMessage(HttpStatusCode.OK);
}
// Nope
[HttpPost]
public HttpResponseMessage Post([FromBody] string id)
{
return new HttpResponseMessage(HttpStatusCode.OK);
}
When I completely remove the id parameter from my method, then Mollie can call it. But obviously, then I don't have the paymentId! :(
// Works, but no id :(
[HttpPost]
public HttpResponseMessage Post()
{
return new HttpResponseMessage(HttpStatusCode.OK);
}
My routing is just default, shouldn't be a big deal right?
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Can anyone shed some light on this? I'm pulling my hair out....
from mollieapi.
Looks like it might be a routing issue. Are you able to post to the API controller method yourself? You can test using using a simple plugin such as Postman (https://www.getpostman.com/)
from mollieapi.
Hi Vincent,
thank you kindly for your reply.
I've been using Postman, but I am struggling to figure out what to enter for the body:
- form-data entering key: "id" and value: "test" fails magnificently with an UnsupportedMediaTypeException
- raw fares no better: If I enter "test", my action is called :) but [FromBody] string id is still null :(
- Update: Raw with input "{ "id": "test" }" => [FormBody] string id still null
Do you know what the exact format is?
I wish they'd just chosen a querystring parameter.... Would be so much easier.
Final update
Found it!
- Set body to "raw" and type to "JSON (application/json)"
- Use as body: { id: "test" } (I'm a doofus)
- Don't use [FromBody]string id, but create a dedicated object to hold a property:
public class PaymentId
{
public string id { get; set; }
}
[HttpPost]
public HttpResponseMessage Post([FromBody]PaymentId id)
{
return new HttpResponseMessage(HttpStatusCode.OK);
}
from mollieapi.
Related Issues (20)
- Add support for the new Create Capture endpoint HOT 1
- Add support for split auth capture HOT 1
- Add unit tests and documentation for the new Terminals API HOT 1
- Add support for the Billie payment method HOT 3
- Add support for the create client link endpoint HOT 6
- OrderRequest and OrderResponse are missing support for various payment method specific properties HOT 2
- Restructure folder structure to make the repository in-line with modern open-source repositories HOT 1
- Update project to .NET standard 2.0 HOT 2
- Add extension method to register all Mollie API clients using dependency injection HOT 1
- IPaymentClient should inherit from IDisposable HOT 7
- Support for get payment refund HOT 2
- Pagination on GetChargebacksListAsync HOT 3
- Wallet API support HOT 1
- GetInvoiceListAsync : Unprocessable Entity - Non-existent query parameter "include" for this API call HOT 4
- Add support for Klarna One payment method HOT 1
- UpdateCustomerAsync throws error 502 HOT 3
- Create customer throws error when using the testmode property in the request HOT 2
- Enable nullable references in Mollie.Api project
- How to set your own idempotency key? HOT 10
- Add an .editorconfig file to help maintain styling HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mollieapi.