32 private $regionFactory;
37 private $regionCodes = [];
47 $this->scopeConfig = $scopeConfig;
48 $this->regionFactory = $regionFactory;
64 'domain' => $this->getPublicDomain(
$store),
65 'shipFromAddress' => [
69 'provinceCode' => $this->getRegionCodeById(
75 'corporateAddress' => [
79 'provinceCode' => $this->getRegionCodeById(
95 private function getRegionCodeById($regionId)
97 if (!isset($this->regionCodes[$regionId])) {
98 $this->regionCodes[$regionId] = $this->regionFactory->create()->load($regionId)->getCode();
101 return $this->regionCodes[$regionId];
111 private function getConfigValue(
$value, StoreInterface
$store)
113 return $this->scopeConfig->getValue(
126 private function getPublicDomain(StoreInterface
$store)
128 $baseUrl =
$store->getBaseUrl();
129 $domain = parse_url($baseUrl, PHP_URL_HOST);
130 if (\
function_exists(
'checkdnsrr') &&
false === \checkdnsrr($domain)) {
__construct(ScopeConfigInterface $scopeConfig, RegionFactory $regionFactory)
const XML_PATH_STORE_COUNTRY_ID
const XML_PATH_STORE_REGION_ID
const XML_PATH_STORE_CITY
const XML_PATH_STORE_ADDRESS1
const XML_PATH_STORE_ADDRESS2