Ejemplo n.º 1
0
 /**
  * Get consumer by consumer_id for a given token.
  *
  * @param int $consumerId
  * @return \Magento\Framework\Oauth\ConsumerInterface
  * @throws \Magento\Framework\Oauth\Exception
  */
 protected function _getConsumer($consumerId)
 {
     $consumer = $this->_consumerFactory->create()->load($consumerId);
     if (!$consumer->getId()) {
         throw new \Magento\Framework\Oauth\Exception('A consumer with the ID %1 does not exist', [$consumerId]);
     }
     return $consumer;
 }
Ejemplo n.º 2
0
 /**
  * Load consumer by id.
  *
  * @param int $consumerId
  * @return ConsumerModel
  * @throws \Magento\Integration\Exception
  */
 protected function _loadConsumerById($consumerId)
 {
     $consumer = $this->_consumerFactory->create()->load($consumerId);
     if (!$consumer->getId()) {
         throw new \Magento\Integration\Exception(__("Consumer with ID '%1' does not exist.", $consumerId));
     }
     return $consumer;
 }
Ejemplo n.º 3
0
 /**
  * Get Token Consumer
  *
  * @return \Magento\Integration\Model\Oauth\Consumer
  */
 public function getConsumer()
 {
     if (!$this->getData('consumer')) {
         $consumer = $this->_consumerFactory->create()->load($this->getConsumerId());
         $this->setData('consumer', $consumer);
     }
     return $this->getData('consumer');
 }