public function getAllowedAddressCountries()
    {
        $allowedShippingCountries    = $this->getAllowedShippingCountries();
        $allowedShippingCountriesMap = array_map(
            function ($country) {
                return $country['country'];
            },
            $allowedShippingCountries
        );

        $allowedAddressCountries = [];
        foreach ($this->mainShipHelper->getMageShippingCountries() as $addressCountry) {
            $state  = array_search($addressCountry, $allowedShippingCountriesMap, true);
            $states = $state !== false ? $allowedShippingCountries[$state]['state'] : ['All'];

            $allowedAddressCountries[] =
                [
                    'country' => $addressCountry,
                    'state'   => $states
                ];
        }

        return $allowedAddressCountries;
    }
public function getAllowedAddressCountries()
    {
        $allowedShippingCountries    = $this->getAllowedShippingCountries();
        $allowedShippingCountriesMap = array_map(
            function ($country) {
                return $country['country'];
            },
            $allowedShippingCountries
        );

        $allowedAddressCountries = [];
        foreach ($this->mainShipHelper->getMageShippingCountries() as $addressCountry) {
            $state  = array_search($addressCountry, $allowedShippingCountriesMap, true);
            $states = $state !== false ? $allowedShippingCountries[$state]['state'] : ['All'];

            $allowedAddressCountries[] =
                [
                    'country' => $addressCountry,
                    'state'   => $states
                ];
        }

        return $allowedAddressCountries;
    }
public function getAllowedAddressCountries ( ) { $ allowedShippingCountries = $ this -> getAllowedShippingCountries ( ) ; $ allowedShippingCountriesMap = array_map ( function ( $ country ) { return $ country [ 'country' ] ; } , $ allowedShippingCountries ) ; $ allowedAddressCountries = [ ] ; foreach ( $ this -> mainShipHelper -> getMageShippingCountries ( ) as $ addressCountry ) { $ state = array_search ( $ addressCountry , $ allowedShippingCountriesMap , true ) ; $ states = $ state !== false ? $ allowedShippingCountries [ $ state ] [ 'state' ] : [ 'All' ] ; $ allowedAddressCountries [ ] = [ 'country' => $ addressCountry , 'state' => $ states ] ; } return $ allowedAddressCountries ; }
Returns Merchant API ready array of Country, State pairs of
allowed addresses by Magento

@return array() - array(['country'=>'US', 'state'=> 'All'], [...])
Returns Merchant API ready array of Country State pairs of allowed addresses by Magento