taxjar / taxjar-magento2-extension

Magento 2 Sales Tax Extension by TaxJar
http://www.taxjar.com/guides/integrations/magento2/
Open Software License 3.0
22 stars 30 forks source link

fix: Config scoped address validation #312

Closed sethobey closed 2 years ago

sethobey commented 2 years ago

Context

EU-based merchant with US storeview observed an issue with address validation. Address validation feature was disabled globally, but should've been enabled for the US storeview's scope.

Description

Adds request parameter value for address validation scope configuration. Address validation requests in checkout will pass the current store code to the backend which is used to find the current store scope ID in a WebAPI request.

Customer address validation in Adminhtml will still defer to the global scope's configuration value.

Performance

Bug fix

Testing

  1. Observed successful checkout address validation for store with address validation enabled while global address validation disabled.
  2. Observed bypassed checkout address validation for store with disabled global address validation config
  3. Observed bypassed customer address validation in adminhtml due to feature being disabled in global config

Versions

Citizen4our commented 2 years ago

Hello also here needed to use 'mage/url' for build url, because some magento instances might be using 'example.com/us/' in US store for example

sethobey commented 2 years ago

Hello also here needed to use 'mage/url' for build url, because some magento instances might be using 'example.com/us/' in US store for example

Hi @Citizen4our, this pull request is for addressing a specific internal issue which as far as I know, did not involve any issues with base url.

For what it's worth, I think I understand what you are suggesting, but it isn't clear to me how that would be implemented here.

Our address validation core is already in use in the frontend and backend admin areas with the same WebAPI URI. I've only added an optional store_name parameter here for frontend address validation to allow scoping frontend requests and enabling/disabling address validation for individual scopes which should work regardless of store URL structure.

I considered passing the URI to the address validation core component, but that would've resulted in greater refactor which is undesirable since we've just recently squashed numerous outstanding JS-related address validation bugs.

If this hasn't addressed (😄) your concern, please feel free to open a new issue here to describe the request or change you're suggesting in greater detail.

Thanks!