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

Customer find function return PHP error when no result #350

Open
lenamsoft opened this issue Dec 21, 2024 · 0 comments
Open

Customer find function return PHP error when no result #350

lenamsoft opened this issue Dec 21, 2024 · 0 comments

Comments

@lenamsoft
Copy link

We have request like this to check if customer exist or not but when I use this function

$gateway->customer()->find($id);

It must not send PHP error when nothing return else we could not continue.

public function find($id, $associationFilterId = null)
{
$this->_validateId($id);
try {
$queryParams = '';
if ($associationFilterId) {
$queryParams = '?association_filter_id=' . $associationFilterId;
}
$path = $this->_config->merchantPath() . '/customers/' . $id . $queryParams;
$response = $this->_http->get($path);
return Customer::factory($response['customer']);
} catch (Exception\NotFound $e) {
throw new Exception\NotFound(
'customer with id ' . $id . ' not found'
);
}
}

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

No branches or pull requests

1 participant