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 29 forks source link

Unable to disconnect with Sandbox mode enabled #337

Closed greezlu closed 1 year ago

greezlu commented 1 year ago

Prerequisites

Description

Steps to Reproduce

  1. Connect to TaxJar account.
  2. Enter sandbox key.
  3. Enable Sandbox mode.
  4. Disconnect from TaxJar account.

Expected Result

Successful disconnect with ability to connect.

Actual Result

Account is disconnected. But connect button is not visible.

Screenshot bug

Explanation

Problem appears here: Taxjar\SalesTax\Block\Adminhtml\Enabled::isConnected()

That method returns bool depending on this answer: Taxjar\SalesTax\Model\Configuration::getApiKey()

Method getApiKey() return sandbox key in case if Sandbox mode was enabled.

But Disconnect action is not removing Sandbox API key. So main problem is here: Taxjar\SalesTax\Controller\Adminhtml\Config\Disconnect::execute()

Because Disconnect action class is not clearing Sandbox API key and not disabling Sandbox mode. Please fix this. Thank you.

Versions

sethobey commented 1 year ago

@greezlu Thank you for the detailed issue report! We will be sure to include a fix in the next release 👍

To anyone experiencing this issue, this error can be resolved by clearing the TaxJar sandbox API key value using the CLI command: bin/magento config:set tax/taxjar/sandbox_apikey ''

Edit: Will also require command bin/magento config:set tax/taxjar/sandbox 0 to ensure Sandbox mode is not enabled, because although removing sandbox API key will resolve UI error, sandbox mode enabled will prevent re-connecting to TaxJar later.