You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The listCharges method in the EfiPay library throws an EfiException when the customer_document parameter contains leading zeros, even though the documentation suggests it should accept CPF or CNPJ strings. The error message indicates an incorrect document format, likely due to an internal conversion to an integer that strips the leading zeros. This prevents valid CPF/CNPJ numbers with leading zeros from being used.
Steps to Reproduce:
Use the following code snippet (or similar) with a customer_document value containing leading zeros:
<?phpuseEfi\Exception\EfiException;
useEfi\EfiPay;
// Replace with your actual options$options = [
'sandbox' => true, // Or false for production'client_id' => 'YOUR_CLIENT_ID',
'client_secret' => 'YOUR_CLIENT_SECRET',
'certificate' => '/path/to/your/certificate.pem',
];
$params = [
"charge_type" => "subscription",
"begin_date" => "2024-02-18",
"end_date" => "2025-02-18",
"customer_document" => "03973638004"// CPF with leading zero
];
try {
$api = newEfiPay($options);
$response = $api->listCharges($params);
print_r($response);
} catch (EfiException$e) {
print_r($e->code . "<br>");
print_r($e->error . "<br>");
print_r($e->errorDescription) . "<br>");
}
Execute the PHP script.
Expected Result:
The listCharges method should successfully execute and return a list of charges (or an empty list if no matching charges are found). The customer_document should be accepted as a valid string.
Actual Result:
An EfiException is thrown with the following error message (or similar, depending on the specific document number):
Description:
The
listCharges
method in the EfiPay library throws anEfiException
when thecustomer_document
parameter contains leading zeros, even though the documentation suggests it should accept CPF or CNPJ strings. The error message indicates an incorrect document format, likely due to an internal conversion to an integer that strips the leading zeros. This prevents valid CPF/CNPJ numbers with leading zeros from being used.Steps to Reproduce:
Use the following code snippet (or similar) with a
customer_document
value containing leading zeros:Execute the PHP script.
Expected Result:
The
listCharges
method should successfully execute and return a list of charges (or an empty list if no matching charges are found). Thecustomer_document
should be accepted as a valid string.Actual Result:
An
EfiException
is thrown with the following error message (or similar, depending on the specific document number):The text was updated successfully, but these errors were encountered: