/** * Get address service by type and cache instances by type to avoid duplicate instantiation * * @param string $type * @param $storeId * @return AddressServiceSoap */ public function getAddressService($type = null, $storeId = null) { if (is_null($type)) { $type = $this->config->getLiveMode() ? Config::API_PROFILE_NAME_PROD : Config::API_PROFILE_NAME_DEV; } if (!isset($this->addressServiceSoap[$type])) { $this->config->createAvaTaxProfile($storeId); $this->addressServiceSoap[$type] = $this->addressServiceSoapFactory->create(['configurationName' => $type]); } return $this->addressServiceSoap[$type]; }
/** * Get tax service by type and cache instances by type to avoid duplicate instantiation * * @param null $type * @param $storeId * @param $scopeType * @return TaxServiceSoap */ public function getTaxService($type = null, $storeId = null, $scopeType = \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { if (is_null($type)) { $type = $this->config->getLiveMode() ? Config::API_PROFILE_NAME_PROD : Config::API_PROFILE_NAME_DEV; } if (!isset($this->taxServiceSoap[$type])) { $this->config->createAvaTaxProfile($storeId, $scopeType); $this->taxServiceSoap[$type] = $this->taxServiceSoapFactory->create(['configurationName' => $type]); } return $this->taxServiceSoap[$type]; }