-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Summary
We encountered an InvalidArgumentException while utilizing your SDK to verify an international address:
Failed to send a postcard using Lob: “Invalid value 'Housenumber/Building' for 'coverage', must be one of 'SUBBUILDING', 'HOUSENUMBER/BUILDING', 'STREET', 'LOCALITY', 'SPARSE'”.
Expected Behavior
In this case, the exception should not be thrown since the response from the Lob service is Housenumber/Building, whereas the SDK expects it to be in uppercase as HOUSENUMBER/BUILDING. It's worth noting that PHP's in_array method is case-sensitive.
Current Behavior
The SDK is throwing an exception, as mentioned before, when attempting to verify an international address.
Possible Solution
To address the issue, there are two potential solutions:
- Modify the response from the Lob service to send the
coveragein uppercase to match the SDK's expectations. - Alternatively, you can modify the SDK code by adding
strtoupper($coverage)as the first parameter of thein_arraymethod.
Steps to Reproduce
Using a simple code like this, leads to same error:
$verificationApi = new IntlVerificationsApi($this->config);
$verificationWritable = new IntlVerificationWritable([
'recipient' => $recipientFullname,
'primary_line' => $address->addressLine1,
'secondary_line' => $address->addressLine2,
'city' => $address->city,
'state' => $address->state,
'postal_code' => $address->postalCode,
'country' => $address->country->code,
]);
$verification = $verificationApi->verifySingle($verificationWritable);Context (Environment)
Version: 4.2.0
alies-dev
Metadata
Metadata
Assignees
Labels
No labels
