Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve Payment linked to Order ? #141

Closed
Pyo25 opened this issue Nov 19, 2020 · 3 comments
Closed

Retrieve Payment linked to Order ? #141

Pyo25 opened this issue Nov 19, 2020 · 3 comments

Comments

@Pyo25
Copy link

Pyo25 commented Nov 19, 2020

Hi,

The doc says we can get payments linked to an Order using the embed parameter.
However it doesn't seem supported by this gem.

How can I get payments linked to an order then?

It's possible to get the order linked to a payment but not the inverse. Am I right?

Thank you!

@justincase
Copy link
Collaborator

justincase commented Jan 11, 2021

Hi @Pyo25,

Correct, it's not yet supported by the Ruby client. In the meantime, there's a workaround that you could use:

order = Mollie::Order.get("ord_kEn1PlbGa", embed: "payments")
payments = Mollie::List.new(
  {
    "_embedded" => order.attributes["_embedded"]
  },
  Mollie::Payment
)

Please keep in mind that #attributes should not be used in general and could break in future versions of the client.

@Pyo25
Copy link
Author

Pyo25 commented Sep 9, 2021

Hi @justincase ,

A few months later (oops sorry), thank you for the workaround.
Not the best solution as it could be broken, but at least it works now.

Thank you!

@justincase
Copy link
Collaborator

Hi @Pyo25,

You no longer need the workaround in v4.10.0 (tagged on GitHub - releases on rubygems.org are running behind due to #140).

order = Mollie::Order.get("ord_kEn1PlbGa", embed: "payments")
payments = order.payments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants