EasyPost / easypost-java

EasyPost Shipping API Client Library for Java
https://easypost.com/docs/api
MIT License
53 stars 37 forks source link

[Bug]: Address verification errors are being incorrectly parsed by the library #288

Closed joshlevin closed 10 months ago

joshlevin commented 10 months ago

Software Version

6.8.0

Language Version

11

Operating System

Ubuntu Linux

What happened?

  1. Create an address with verify: true, or use createAndVerify
  2. API returns error objects with details of verification failures, as expected.
  3. Address verification errors are being mapped incorrectly to {"message": "API did not return error details.", "code": "NO RESPONSE CODE"} regardless of the actual error code and message returned by the API!

What was expected?

Given the following API response:

"verifications":{"zip4":{"success":false,"errors":[{"code":"E.ADDRESS.NOT_FOUND","field":"address","message":"Address not found","suggestion":null}],"details":null},"delivery":{"success":false,"errors":[{"code":"E.ADDRESS.NOT_FOUND","field":"address","message":"Address not found","suggestion":null}],"details":{}

Expected that Error objects should have the error codes and messages received, instead of the generic fallback of "API did not return error details." and "NO RESPONSE CODE"

Sample Code

No response

Relevant logs

address.prettyPrint():

"verifications": {
    "zip4": {
      "success": false,
      "errors": [
        {
          "message": "API did not return error details.",
          "code': "NO RESPONSE CODE",
          "errors": null,
          "suggestion": null,
          "field": null
        }
      ],
      "details": null
    },
    "delivery": {
      "success": false,
      "errors": [
        {
          "message": "API did not return error details.",
          "code": "NO RESPONSE CODE",
          "errors": null,
          "suggestion": null,
          "field": null
        }
      ],
      "details": {
        "latitude": null,
        "longitude": null,
        "time_zone": null
      }
    },
nwithan8 commented 10 months ago

Hello! Thank you for reporting this! We are in the process of triaging it and will keep you updated!

nwithan8 commented 10 months ago

Thank you again for reaching out @joshlevin . It seems we have a bug in our deserializer and are patching it in https://github.com/EasyPost/easypost-java/pull/289. We hope to have a fixed release out soon!