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

The FIND enpoints are not considering the on_behalf_of flag #135

Open
ghostika opened this issue Jan 31, 2022 · 1 comment
Open

The FIND enpoints are not considering the on_behalf_of flag #135

ghostika opened this issue Jan 31, 2022 · 1 comment
Assignees
Labels

Comments

@ghostika
Copy link

I was about to implement the currency cloud API and after some debugging I realised, if I call the
$this->client->beneficiaries()->find($beneficiary, null, $payout->getOnBehalfOf()); function, the find method doesn't consider the on_behalf_of value (3rd argument). It always searches in the main account, not in the sub account.

After I changed the following line, it worked, but I'm not sure if it would create some error in other places:

AbstractEntityEntryPoint::doFind function

from this

        $response = $this->request(
            'GET',
            $entryPoint,
            call_user_func($converterToRequest, $searchModel, $onBehalfOf) + $this->convertPaginationToRequest(
                $pagination
            )
        );

to this

        $response = $this->request(
            'GET',
            $entryPoint,
            call_user_func($converterToRequest, $searchModel, $onBehalfOf) + $this->convertPaginationToRequest(
                $pagination
            ) + [
                'on_behalf_of' => $onBehalfOf
            ]
        );

Creating a beneficiary on behalf of functions.

Could you please check this issue, for the time being, I will add a custom request to our code.

@mijaelsaban
Copy link

mijaelsaban commented Dec 19, 2022

I think I have the same issue here but trying something different:

$this->client->onBehalfOf($contactId, function (CurrencyCloud $client) {
             $this->beneficiaries = $client->beneficiaries()->find()->getBeneficiaries();
         });

where $this->beneficiaries is always from the main account but not the ones on behalf of.

Any solution? or just create an HTTP request without the SDK?

Thank you,

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

No branches or pull requests

3 participants