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

Is there a way to get the raw response? #676

Open
JensDeMuynck opened this issue Mar 10, 2025 · 2 comments
Open

Is there a way to get the raw response? #676

JensDeMuynck opened this issue Mar 10, 2025 · 2 comments

Comments

@JensDeMuynck
Copy link
Contributor

For example: $rawResponse = $CashEntry->save()->getRawResponse() ?

@rojtjo
Copy link

rojtjo commented Mar 10, 2025

As far as I can see from looking at the save and fill methods, the raw response is not preserved.

Your best option would be to use the insert or update method directly, but since the fill method is protected you cannot use it directly without some workaround.

Potential workaround:

$cashEntry = new CashEntry($connection);

$rawResponse = Closure::bind(function () use ($cashEntry) {
    $data = $cashEntry->update();

    $cashEntry->fill($data);

    return $data;
}, null, CashEntry::class)();

@DannyvdSluijs
Copy link
Contributor

Perhaps the Guzzle middleware option could be helpful in you case.

https://github.com/picqer/exact-php-client/wiki/Exact-php-client-tips#log-api-request-and-response

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

No branches or pull requests

3 participants