mollie / laravel-mollie

Mollie API client wrapper for Laravel & Mollie Connect provider for Laravel Socialite
https://www.mollie.com/
MIT License
326 stars 62 forks source link

Can't update order redirectUrl #143

Closed jesse-dijkstra closed 4 years ago

jesse-dijkstra commented 4 years ago

I'm trying to update the redirectUrl from a Mollie order, with the following code:

  $mollieOrder = Mollie::api()->orders()->get($mollieOrder->id);
  $mollieOrder->redirectUrl = $mollieOrder->redirectUrl . '?m_order_id=' . $mollieOrder->id;
  $mollieOrder->update();

When I data dump $mollieOrder it shows the updated redirectUrl but when I recall the order like this Mollie::api()->orders()->get($mollieOrder->id); the redirectUrl is not updated, this is the same in the dashboard.

I'm doing the exact same with a Mollie payment like this:

  $payment = Mollie::api()->payments()->get($payment->id);
  $payment->redirectUrl = $payment->redirectUrl . '?m_payment_id=' . $payment->id;
  $payment->update();

which is working great.

sandervanhooft commented 4 years ago

Can you try updating it on the order's payment instead of on the order resource?

jesse-dijkstra commented 4 years ago

Can you try updating it on the order's payment instead of on the order resource?

In this case I can only use the Orders API because Klarna Pay later isn't supporting Payments API

sandervanhooft commented 4 years ago

yes, but you can retrieve the payment of the order's underlying payment

jesse-dijkstra commented 4 years ago

do you have an example?

sandervanhooft commented 4 years ago

I've found the issue. You're right, it should be possible directly on the Order resource. The mollie-api-client is not supporting this yet. I'll fix this this week.

sandervanhooft commented 4 years ago

Hi @jesse-dijkstra ,

I've just released a fix on mollie-api-php. Running composer update should pull in the update.

https://github.com/mollie/mollie-api-php/releases/tag/v2.22.0