Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Erro no tratamento da Exception na falha da criação de pagamento #316

Open
raulfdias opened this issue Dec 5, 2019 · 1 comment
Open

Comments

@raulfdias
Copy link

Olá, bom dia!

Estou tendo um problema no tratamento de erros efetuado pela classe Error [vendor\moip\moip-sdk-php\src\Exceptions\Error.php line 91].
As propriedades do json para criação do array não estão sendo validadas. Foi necessário efetuar um alteração manual:

DE:
if (!empty($error_obj->errors)) {
foreach ($error_obj->errors as $error) {
$errors[] = new self($error->code, $error->path, $error->description);
}
} elseif (!empty($error_obj->error)) {
$errors[] = new self('', '', $error_obj->error);
}

PARA:
if (!empty($error_obj->errors)) {
foreach ($error_obj->errors as $error) {
$code = $error->code ?? null;
$path = $error->path ?? null;
$description = $error->description ?? null;
$errors[] = new self($code, $path, $description);
}
} elseif (!empty($error_obj->error)) {
$errors[] = new self('', '', $error_obj->error);
}

Favor acompanhar. Abraços!!

@WebkulOpencart
Copy link

WebkulOpencart commented Dec 23, 2019

I am facing the same issue and created a PR for the same #318

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

No branches or pull requests

2 participants