VictorAvelar / mollie-api-go

Golang wrapper for Mollie's REST API with full resource coverage.
https://www.mollie.com/developers/libraries/golang
MIT License
63 stars 37 forks source link

Implement Orders API resource #12

Closed VictorAvelar closed 5 years ago

VictorAvelar commented 5 years ago

Description Implement the API endpoints related to the chargebacks resource and provide test coverage, as an example you might take a look at #6

Additional context The API reference for refunds can be found here: https://docs.mollie.com/reference/v2/orders-api/get-order

VictorAvelar commented 5 years ago

@dwikur21 are you taking this one?

dwikur21 commented 5 years ago

Yes, already working on it.

dwikur21 commented 5 years ago

@VictorAvelar I have a question about the create order. Here they expect the Payment object to be passed as one of the parameters (optional). My concern is, not all of the parameter listed is in Payment object:

Should I create a new object for that parameter or edit the existing Payment object?

VictorAvelar commented 5 years ago

As far as I can see in the docs instantiating an order will also create a payment, so I will rather have a custom struct called CreateOrderRequest or something along that line, so that is clear that the information contained is only used for creating an order.

dwikur21 commented 5 years ago

Ok, thanks

dwikur21 commented 5 years ago

@VictorAvelar what do you think about using this package for checking the required parameters for the request? It will reduce the complexity of parameters checking in my opinion

VictorAvelar commented 5 years ago

@VictorAvelar what do you think about using this package for checking the required parameters for the request? It will reduce the complexity of parameters checking in my opinion

I gave validation a lot of thoughts and here is how I feel we should handle it:

From a package design point of view, I feel we should only provide the transport from the user to the server, if the client wants to have validation then they can have it before calling the endpoint, for strict validation in fact, the source of truth should be the API itself, that way we avoid conflicts, unnecessary complexity and also bringing a new dependency to any user that pulls the package.

Also they can have more control on how their data is processed and we only take care of being the carrier from A <=> B, if B returns a validation error then we will carry back that error to the user.

dwikur21 commented 5 years ago

@VictorAvelar what do you think about using this package for checking the required parameters for the request? It will reduce the complexity of parameters checking in my opinion

I gave validation a lot of thoughts and here is how I feel we should handle it:

From a package design point of view, I feel we should only provide the transport from the user to the server, if the client wants to have validation then they can have it before calling the endpoint, for strict validation in fact, the source of truth should be the API itself, that way we avoid conflicts, unnecessary complexity and also bringing a new dependency to any user that pulls the package.

Also they can have more control on how their data is processed and we only take care of being the carrier from A <=> B, if B returns a validation error then we will carry back that error to the user.

Ahhh so we shouldn't check any required parameters, let Mollie itself do the checks. If that is so, I'll refactor the refund code.

VictorAvelar commented 5 years ago

@VictorAvelar what do you think about using this package for checking the required parameters for the request? It will reduce the complexity of parameters checking in my opinion

I gave validation a lot of thoughts and here is how I feel we should handle it: From a package design point of view, I feel we should only provide the transport from the user to the server, if the client wants to have validation then they can have it before calling the endpoint, for strict validation in fact, the source of truth should be the API itself, that way we avoid conflicts, unnecessary complexity and also bringing a new dependency to any user that pulls the package. Also they can have more control on how their data is processed and we only take care of being the carrier from A <=> B, if B returns a validation error then we will carry back that error to the user.

Ahhh so we shouldn't check any required parameters, let Mollie itself do the checks. If that is so, I'll refactor the refund code.

but let's not mix concerns, we can have a refactor ticket for refunds.