Closed pepeh closed 5 months ago
Hi @pepeh ,
Thanks for reaching out. Can you please share:
That helps us pinpoint the issue.
@sandervanhooft This issue exists in all package versions (Lines changed 4-6 years ago)
Order documentation says
_links
object will contain self
, checkout
, dashboard
, and documentation
objects inside but here code uses $this->_links->refunds
that will never present inside order object
According to the API documentation at Mollie's Orders API, it appears that refunds are only included within the order object if the embed=refunds parameter is utilized. However, even with this parameter, the Order::refunds method may not function as expected since it relies on _links to access refunds.
Furthermore, when examining the documentation for Order Refunds, it's clear that retrieving refunds requires a separate HTTP request as demonstrated in the provided CURL example. Despite this, the PHP code snippet suggests accessing refunds directly through the Order object, akin to how it's approached in Node.js with a method that iterates over order refunds. This discrepancy suggests that there might be a more streamlined way to access refunds similar to the Node.js implementation, which uses mollieClient.orderRefunds.iterate({ orderId: 'ord_stTC2WHAuS' }) for a more intuitive and direct method of retrieval.
a code sample that produces the issue
@sandervanhooft The PHP code snippet provided mirrors what is found in the documentation available at Mollie's Refunds API
<?php
$mollie = new \Mollie\Api\MollieApiClient();
$mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");
$order = $mollie->orders->get("ord_stTC2WHAuS");
$refunds = $order->refunds();
Hi @pepeh ,
It looks like you're right! Investigating.
A patch is being prepared in #714
@pepeh Once this patch is released you can shave off a call to the Mollie API:
<?php
$mollie = new \Mollie\Api\MollieApiClient();
$mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");
// $order = $mollie->orders->get("ord_stTC2WHAuS"); // no longer required to fetch the Order first
$refunds = $mollie->orderRefunds->pageForId("ord_stTC2WHAuS");
Specifications
Describe the issue
Method Order::refunds never returns order refunds.
What is the correct way to get order refunds?