USPS / api-examples

86 stars 19 forks source link

Domestic Label Response v3 - Labels (3.2.2) streetAddress and secondaryAddress swapped #25

Open dylandrush opened 8 months ago

dylandrush commented 8 months ago

Describe the bug When posting to https://api-cat.usps.com/labels/v3/label, the streetAddress and secondaryAddress fields in both the toAddress and fromAddress fields get swapped in the response. The label also reflects this swap. You can see this behavior in the example request: domesticlabel-v3-request.json

    "toAddress": {
        "firstName": "Joe",
        "lastName": "Doe",
        "streetAddress": "1100 Wyoming",
        "secondaryAddress": "Suite 150",
        "city": "St. Louis",
        "state": "MO",
        "ZIPCode": "63118"
    },

and response: domesticlabel-v3-response.json

    "labelAddress": {
        "streetAddress": "STE 150",
        "secondaryAddress": "1100 WYOMING ST",
        "city": "SAINT LOUIS",
        "state": "MO",
        "ZIPCode": "63118",
        "ZIPPlus4": "2628",
        "firstName": "JOE",
        "lastName": "DOE",
        "ignoreBadAddress": false
    },

To Reproduce Steps to reproduce the behavior:

  1. POST https://api-cat.usps.com/labels/v3/label <with the data from USPS's github domesticlable-v3-request.json>
  2. View the response and see that the streetAddress and secondaryAddress are swapped

Expected behavior A scrubbed version of the streetAddress is returned in the streetAddress field as well as the secondaryAddress.

Additional context The documentation specifies that the labelMetadata/labelAddress/streetAddress field is required, however, if no secondaryAddress was provided, streetAddress is not returned, only secondaryAddress with the data from streetAddress