-
Notifications
You must be signed in to change notification settings - Fork 51
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
Currency is not mapped in the ListPayoutsResponse #119
Comments
Hey @StApostol Sorry you're running into issue here, but I'm not quite sure I understand your problem. Why are you trying to access a key called
Cheers! |
@zenmasterjobo I'll try to explain my problem in code. $apiClient = new \Square\SquareClient([
'customUrl' => 'https://connect.squareup.com',
'environment' => 'production',
'accessToken' => $accessToken,
]);
$response = $apiClient->getPayoutsApi()->getPayout($payoutId);
assert($response instanceof \Square\Http\ApiResponse);
$result = $response->getResult();
assert($result instanceof \Square\Models\ListPayoutsResponse);
$payouts = $result->getPayoutEntries(); As a result, the $payouts variable contains an array of objects of the Square\Models\Payout class. In further logic I can't get the currency because it is not filled in the object. When I add a method to the Square\Models\Money class, the property is filled in public function setCurrencyCode(?string $currency): void
{
$this->currency = $currency;
} I think the main problem is that in the rest of the API the |
Ahhh, yes - I understand your issue now, thanks for writing this up! So this is actually bug with the In the meantime the workarounds that you can use here.
Sorry for the unfavorable workarounds right now. The Payouts API team is actively working on how to best mitigate this bug. Let me know if you need clarification or have further questions! |
@zenmasterjobo Thanks, hopefully the API will be fixed. Can you suggest how to get a list of payments and orders for payout more efficiently?
|
Yeah, I'll try to remember to update this thread when that fix goes through! And I think what you have there makes sense. I tried to think of some other spots you could shortcut on, but I don't think you can. |
Describe the bug
The documentation https://developer.squareup.com/reference/square/payouts-api/list-payouts says we get
amount_money
withcurrency_code
. But when converting, we use thecurrency
field, as a result we have an empty value in the objectExpected behavior
The expected result is that the Money object has a filled currency value
Screenshots

Server raw response

Square SDK version
29.0.0.20230720
The text was updated successfully, but these errors were encountered: