Skip to content
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.

Commit

Permalink
Merge pull request #173 from classyllama/feature/AVS-421_100-error-wh…
Browse files Browse the repository at this point in the history
…en-saving-production-credentials

Feature/avs 421 100 error when saving production credentials
  • Loading branch information
rsisco committed Sep 14, 2018
2 parents 1b53f9b + 810de09 commit 1105ce8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Framework/Interaction/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ public function getTaxService(
$scopeType = \Magento\Store\Model\ScopeInterface::SCOPE_STORE
) {
if (is_null($type)) {
$type = $this->config->getLiveMode($storeId) ? Config::API_PROFILE_NAME_PROD : Config::API_PROFILE_NAME_DEV;
$type = $this->config->getLiveMode($storeId, $scopeType)
? Config::API_PROFILE_NAME_PROD : Config::API_PROFILE_NAME_DEV;
}
if (!isset($this->taxServiceSoap[$type])) {
$this->config->createAvaTaxProfile($storeId, $scopeType);
Expand Down
6 changes: 3 additions & 3 deletions Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function __construct(
*/
public function createAvaTaxProfile($storeId, $scopeType = ScopeInterface::SCOPE_STORE)
{
if ($this->getLiveMode($storeId)) {
if ($this->getLiveMode($storeId, $scopeType)) {
$this->avaTaxConfigFactory->create(
[
'name' => self::API_PROFILE_NAME_PROD,
Expand Down Expand Up @@ -546,11 +546,11 @@ public function getLicenseKey($store, $scopeType = ScopeInterface::SCOPE_STORE)
* @param $store
* @return string
*/
public function getCompanyCode($store)
public function getCompanyCode($store, $scopeType = ScopeInterface::SCOPE_STORE)
{
return (string)$this->scopeConfig->getValue(
self::XML_PATH_AVATAX_PRODUCTION_COMPANY_CODE,
ScopeInterface::SCOPE_STORE,
$scopeType,
$store
);
}
Expand Down
5 changes: 3 additions & 2 deletions Observer/ConfigSaveObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ protected function sendPing($scopeId, $scopeType)
}

$message = '';
$type = $this->config->getLiveMode($scopeId, $scopeType) ? Config::API_PROFILE_NAME_PROD : Config::API_PROFILE_NAME_DEV;
$type = $this->config->getLiveMode($scopeId, $scopeType)
? Config::API_PROFILE_NAME_PROD : Config::API_PROFILE_NAME_DEV;
if ($this->checkCredentialsForMode($scopeId, $scopeType, $type)) {
try {
$result = $this->interactionTax->getTaxService($type, $scopeId, $scopeType)->ping();
Expand All @@ -155,7 +156,7 @@ protected function sendPing($scopeId, $scopeType)
} elseif (is_object($result) && $result->getResultCode() == \AvaTax\SeverityLevel::$Success) {
$this->messageManager->addSuccess(
__('Successfully connected to AvaTax using the '
. '<a href="#row_tax_avatax_connection_settings_header">%1 credentials</a>', $type
. '<a href="#row_tax_avatax_connection_settings_header">%1 credentials</a>.', $type
)
);
}
Expand Down

0 comments on commit 1105ce8

Please sign in to comment.