/**
  * @return bool
  */
 protected function _useMercadoEnvios()
 {
     if (empty($this->_useMercadoEnvios)) {
         $quote = $this->shipmentHelper->getQuote();
         $shippingMethod = $quote->getShippingAddress()->getShippingMethod();
         $this->_useMercadoEnvios = $this->shipmentHelper->isMercadoEnviosMethod($shippingMethod);
     }
     return $this->_useMercadoEnvios;
 }
 /**
  * @return int|null
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function _getDataAllowedMethods()
 {
     if (empty($this->_methods) && !empty($this->_request)) {
         $quote = $this->_helperCarrierData->getQuote();
         $shippingAddress = $quote->getShippingAddress();
         if (empty($shippingAddress)) {
             return null;
         }
         $postcode = $shippingAddress->getPostcode();
         try {
             $dimensions = $this->_helperCarrierData->getDimensions($this->_helperCarrierData->getAllItems($this->_request->getAllItems()));
         } catch (\Exception $e) {
             $this->_methods = self::INVALID_METHOD;
             return null;
         }
         $clientId = $this->_scopeConfig->getValue(\MercadoPago\Core\Helper\Data::XML_PATH_CLIENT_ID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
         $clientSecret = $this->_scopeConfig->getValue(\MercadoPago\Core\Helper\Data::XML_PATH_CLIENT_SECRET, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
         $mp = $this->_mpHelper->getApiInstance($clientId, $clientSecret);
         $params = ["dimensions" => $dimensions, "zip_code" => $postcode];
         $freeMethod = $this->_helperCarrierData->getFreeMethod($this->_request);
         if (!empty($freeMethod)) {
             $params['free_method'] = $freeMethod;
         }
         $response = $mp->get("/shipping_options", $params);
         if ($response['status'] == 200) {
             $this->_methods = $response['response']['options'];
         } else {
             if (isset($response['response']['message'])) {
                 $this->_registry->register('mercadoenvios_msg', $response['response']['message']);
             }
             $this->_methods = self::INVALID_METHOD;
             $this->_helperCarrierData->log('Request params: ', $params);
             $this->_helperCarrierData->log('Error response API: ', $response);
         }
     }
     return $this->_methods;
 }