{"record":{"id":"fe1499338e56091c","repo":"nopSolutions/nopCommerce","slug":"address-is-incomplete","errorCode":null,"errorMessage":"Address is incomplete","messagePattern":"Address is incomplete","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs","lineNumber":733,"sourceCode":"            throw new NopException(\"Address not set\");\n\n        //for international transactions, the two digit ISO country code is required to determine tax jurisdictions\n        if (!string.IsNullOrEmpty(address.country) &&\n            !string.Equals(address.country, \"US\", StringComparison.InvariantCultureIgnoreCase) &&\n            !string.Equals(address.country, \"CA\", StringComparison.InvariantCultureIgnoreCase))\n        {\n            return;\n        }\n\n        //for US and Canadian addresses a postal code is required\n        if (!string.IsNullOrEmpty(address.postalCode))\n            return;\n\n        //however a full address (street address, city, state, and zip code) will return the best tax calculation\n        if (!string.IsNullOrEmpty(address.line1) && !string.IsNullOrEmpty(address.city) && !string.IsNullOrEmpty(address.region))\n            return;\n\n        throw new NopException(\"Address is incomplete\");\n    }\n\n    #endregion\n\n    #region Certificates\n\n    /// <summary>\n    /// Create or update the passed customer for the company\n    /// </summary>\n    /// <param name=\"customer\">Customer</param>\n    /// <param name=\"companyId\">Selected company id</param>\n    /// <param name=\"customerExists\">Whether the customer is already created</param>\n    /// <returns>\n    /// A task that represents the asynchronous operation\n    /// The task result contains the customer details\n    /// </returns>\n    protected async Task<CustomerModel> CreateOrUpdateCustomerAsync(Customer customer, int companyId, bool customerExists)\n    {","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs#L715-L751","documentation":"For US and Canadian addresses (country US or CA) Avalara requires a postal code; if absent, a full street+city+region is accepted. CheckAddressDetails throws when country is US/CA, postalCode is empty, AND at least one of line1, city, or region is also empty - the jurisdiction cannot be resolved reliably.","triggerScenarios":"Country equals US or CA (case-insensitive), postalCode is null/empty, and the address lacks a complete line1 + city + region triple. International (non-US/CA) addresses skip this check entirely.","commonSituations":"Customer entered a US address without a ZIP code; the address form does not require postal code; region/state was not mapped from the nopCommerce StateProvince; guest checkout with partial address data; ZIP stripped by a sanitizer.","solutions":["Require postal code for US/CA countries on the address form.","If ZIP is unavailable, ensure line1, city, and region are all populated.","Validate address completeness in nopCommerce before submitting to Avalara.","Confirm the StateProvince to region mapping is not empty."],"exampleFix":"// before\nif (!string.IsNullOrEmpty(address.line1) && !string.IsNullOrEmpty(address.city) && !string.IsNullOrEmpty(address.region))\n    return;\nthrow new NopException(\"Address is incomplete\");\n\n// after - report the missing fields\nvar missing = new List<string>();\nif (string.IsNullOrEmpty(address.line1)) missing.Add(\"street\");\nif (string.IsNullOrEmpty(address.city)) missing.Add(\"city\");\nif (string.IsNullOrEmpty(address.region)) missing.Add(\"state/region\");\nthrow new NopException($\"Address is incomplete: a US/CA address needs a postal code or all of street, city, and state. Missing: {string.Join(\", \", missing)}\");","handlingStrategy":"validation","validationCode":"// Pre-validate US/CA address completeness\nstatic bool IsAddressComplete(AddressLocationInfo a)\n{\n    if (a is null) return false;\n    var isUsCa = string.Equals(a.country, \"US\", StringComparison.OrdinalIgnoreCase)\n              || string.Equals(a.country, \"CA\", StringComparison.OrdinalIgnoreCase);\n    if (!isUsCa) return true;\n    return !string.IsNullOrEmpty(a.postalCode)\n        || (!string.IsNullOrEmpty(a.line1) && !string.IsNullOrEmpty(a.city) && !string.IsNullOrEmpty(a.region));\n}\nif (!IsAddressComplete(address))\n    throw new NopException(\"US/CA address is incomplete\");","typeGuard":"static bool IsAddressComplete(AddressLocationInfo a)\n{\n    if (a is null) return false;\n    var isUsCa = string.Equals(a.country, \"US\", StringComparison.OrdinalIgnoreCase)\n              || string.Equals(a.country, \"CA\", StringComparison.OrdinalIgnoreCase);\n    if (!isUsCa) return true;\n    return !string.IsNullOrEmpty(a.postalCode)\n        || (!string.IsNullOrEmpty(a.line1) && !string.IsNullOrEmpty(a.city) && !string.IsNullOrEmpty(a.region));\n}","tryCatchPattern":null,"preventionTips":["Require postal code for US/CA on the address form.","Map nopCommerce StateProvince to the region field reliably.","Validate address completeness before submitting to Avalara.","Reject or prompt for completion when ZIP is missing for US/CA."],"tags":["avalara","address","validation"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}