department-of-veterans-affairs / va-mobile-app

"If VA were a company, it would have a flagship mobile app."
https://department-of-veterans-affairs.github.io/va-mobile-app/
17 stars 2 forks source link

Bug - Sev-2 -Saving some non-US addresses is currently broken #4635

Closed Sparowhawk closed 1 year ago

Sparowhawk commented 1 year ago

Attempting to save a non-US non military base address for Anguilla currently doesn't work.

Address Used: Rock Farm The Valley AI-2640 Anguilla

Address we send to verify address api: {"addressLine1": "Rock Farm", "addressLine2": null, "addressLine3": null, "addressMetaData": {"addressType": "International", "confidenceScore": 100}, "addressPou": "CORRESPONDENCE", "addressType": "INTERNATIONAL", "city": "The Valley", "countryCodeIso3": "AIA", "id": 144109, "internationalPostalCode": "AI-2640", "province": null, "stateCode": null, "zipCode": null, "zipCodeSuffix": null}

Address we get back as suggested address(note no postal code anymore): {"addressLine1": "Rock Farm", "addressLine2": null, "addressLine3": null, "addressMetaData": {"addressType": "International", "confidenceScore": 100}, "addressPou": "CORRESPONDENCE", "addressType": "INTERNATIONAL", "city": "The Valley", "countryCodeIso3": "AIA", "id": 144109, "internationalPostalCode": null, "province": null, "stateCode": null, "zipCode": null, "zipCodeSuffix": null}

We then pass this address as is to the update address api and then it just hangs up and times out.

Attempted fixes on front end was re-adding the postal code back and adding the validation key parameter from the verify address api. Both did not work.

aherzberg commented 1 year ago

Was able to successfully update address with suggested address {"addressLine1": "Rock Farm", "addressLine2": null, "addressLine3": null, "addressMetaData": {"addressType": "International", "confidenceScore": 100}, "addressPou": "CORRESPONDENCE", "addressType": "INTERNATIONAL", "city": "The Valley", "countryCodeIso3": "AIA", "id": 144109, "internationalPostalCode": null, "province": null, "stateCode": null, "zipCode": null, "zipCodeSuffix": null}. Looking at Anguillas address format here: https://www.upu.int/UPU/media/upu/PostalEntitiesFiles/addressingUnit/aiaEn.pdf. It looks like there is only one postal code for the whole territory so the international postal code and countryCodeIso3 are redundant. @Sparowhawk could you try updating the address again with Judy to make sure it wasn't just a temporary upstream service issue?

aherzberg commented 1 year ago

I was able to send the following payload to the validate endpoint (not through the app but to the endpoint directly)

{
   "addressLine1":"Rock Farm",
   "addressLine2":null,
   "addressLine3":null,
   "addressPou":"CORRESPONDENCE",
   "addressType":"INTERNATIONAL",
   "city":"The Valley",
   "countryCodeIso3":"AIA",
   "id":144109,
   "internationalPostalCode":"AI-2640",
   "province":null,
   "stateCode":null,
   "zipCode":null,
   "zipCodeSuffix":null
}

and get the following response

{
    "data": [
        {
            "id": "9b141dff-da2c-4a98-8ca3-de57dab13dff",
            "type": "suggested_address",
            "attributes": {
                "addressLine1": "Rock Farm",
                "addressLine2": null,
                "addressLine3": null,
                "addressPou": "CORRESPONDENCE",
                "addressType": "INTERNATIONAL",
                "city": "The Valley",
                "countryCodeIso3": "AIA",
                "internationalPostalCode": null,
                "province": null,
                "stateCode": null,
                "zipCode": null,
                "zipCodeSuffix": null
            },
            "meta": {
                "address": {
                    "confidenceScore": 100.0,
                    "addressType": "International"
                },
                "validationKey": 164231053
            }
        }
    ]
}

but trying to mirror this on the app causes the saving animation to loop endlessly. so rather then a temporary upstream service issue, it looks like there's some FE logic blocking the endpoints.

I was also able to add the international postal code and still have it save by not using the suggested address.

Sparowhawk commented 1 year ago

@aherzberg so I just tried calling it again and I am getting timed out by the api,

I tried sending both with the suggested address again and without and with the postal code and without.

Here is our code block for this with console commands added for debugging

console.debug('edit api called') await api.put('/v0/user/addresses', addressData as unknown as api.Params) console.debug('edit api done')

The log hangs up after edit api called is displayed. It is calling the endpoint correctly as I have tried several other countries as well as states and it get through. So there is some issue with BE logic processing our API request for this country code

aherzberg commented 1 year ago

Lets try to find the disconnect between the two. Do you have any network monitoring like Charles proxy to see the exact network request being sent? that'll be a better apples to apples comparison.

Sparowhawk commented 1 year ago

We found the issue is using query paramters for put requests. After confirming with Andrew that removing the paramaters for all put requests wouldn't negatively effect the other put requests in the app I am making a change and will have a PR shortly

aherzberg commented 1 year ago

@TKDickson If I move this to ticket to QA review on the BE board will that mess with the change in pipeline you just made on the QA board?

TKDickson commented 1 year ago

@aherzberg no idea, go ahead and try it. If it does mess things up I will hunt it down and move it back again.

We don't often have too many bugs that are tagged both BE and FE, but if that starts to increase and this ends up breaking things, we could likely add an automation that moving it to "with QA" on the FE board moves it on the BE, or vice versa.

aherzberg commented 1 year ago

moved to QA review, let me know if that messed it up.

TKDickson commented 1 year ago

Nope, it's in the right spot still! Nice.

TKDickson commented 1 year ago

The infamous Anguilla address (above) saves successfully, as do legitimate domestic/residential addresses, slightly-incorrect domestic addresses (a real address, but using 'Rd' instead of 'Dr' to trigger a validation warning). I'm seeing some frustrating behavior with overseas military addresses that I want to dig into a little bit more.

TKDickson commented 1 year ago

There's still a chance we can get helpful info back from the VA profile team about overseas military addresses today -- if we get that info in time, I'll test it before closing this ticket. If we don't, I'll still close this ticket (this sprint) and will follow up on that testing separately.

TKDickson commented 1 year ago

Did not hear back on this; moving ticket to done column

StacyB2023 commented 1 year ago

@TKDickson Just checking status on this one? It says open, should we close it?

TKDickson commented 1 year ago

Hey @StacyB2023 - nope, that's @DJUltraTom 's job this sprint. Please don't touch this.

Our current process is to leave tickets open (in the done column) until they have been confirmed in the RC build. Tom's got this ticket, and a few others, still in the Done column to close for his section.

StacyB2023 commented 1 year ago

@TKDickson sounds good.