@param string $subscriptionExtUid

@return \DVelopment\FastBill\Model\Subscription
2361
public function getSubscriptionByExtUid($subscriptionExtUid)
    {
        /** @var SubscriptionFbApi $response */
        $response = $this->call(new Request('subscription.get', array('subscription_ext_uid' => $subscriptionExtUid)), 'DVelopment\FastBill\Model\SubscriptionFbApi');
        $subscriptions = $response->getResponse()->getSubscriptions();

        return reset($subscriptions);
    }
416666
public function subscribe($destination, $subscriptionId = null, $ack = 'auto', $selector = null, array $header = [])
    {
        return $this->client->sendFrame(
            $this->getProtocol()->getSubscribeFrame($destination, $subscriptionId, $ack, $selector)->addHeaders($header)
        );
    }
751310
public function unserialize($subscription): self
    {
        $data = json_decode($subscription, true);

        $this->operationName = $data['operation_name'];
        $this->channel = $data['channel'];
        $this->args = $data['args'];
        $this->context = $this->contextSerializer()->unserialize(
            $data['context']
        );
        $this->query = AST::fromArray(
            unserialize($data['query'])
        );

        return $this;
    }
888465
public function listByCustomer($customerId)
    {
        $service = $this->getService();
        $response = $service->request('customers/' . (int)$customerId . '/subscriptions', 'GET');
        $responseArray = $this->getResponseArray($response);

        if (!$this->isError()) {
            $this->_data = $this->_normalizeResponseArray($responseArray);
        } else {
            $this->_data = array();
        }

        return $this;
    }
858189
public function newSubscription(string $subscription, string $plan): SubscriptionBuilder
    {
        return new SubscriptionBuilder($this, $subscription, $plan);
    }
1087226
public function getClub($id)
    {
        try {
            return $this->service->getClub($id);
        } catch (ServiceException $e) {
            throw new ClientException('[SERVICE] ' . $e->getMessage());
        }
    }
515301
public function get($adClientId, $adUnitId, $optParams = array()) {
      $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('get', array($params));
      if ($this->useObjects()) {
        return new AdUnit($data);
      } else {
        return $data;
      }
    }
731107
public Subscription getSubscription(String subscriptionId) throws Exception {
    // [START pubsub_get_subscription]
    try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
      ProjectSubscriptionName subscriptionName =
          ProjectSubscriptionName.of(projectId, subscriptionId);
      Subscription subscription = subscriptionAdminClient.getSubscription(subscriptionName);
      return subscription;
    }
    // [END pubsub_get_subscription]
  }
1021821
protected function endSubscription($subscriptionId = null)
    {
        if (!$subscriptionId) {
            $subscriptionId = $this->subscriptions->getLast()->getSubscriptionId();
        }
        if (!isset($this->subscriptions[$subscriptionId])) {
            throw new InvalidArgumentException(sprintf('%s is no active subscription!', $subscriptionId));
        }
        $subscription = $this->subscriptions[$subscriptionId];
        $this->getClient()->sendFrame(
            $this->getProtocol()->getUnsubscribeFrame(
                $subscription->getDestination(),
                $subscription->getSubscriptionId()
            )
        );
        IdGenerator::releaseId($subscription->getSubscriptionId());

        unset($this->subscriptions[$subscription->getSubscriptionId()]);

        if ($this->subscriptions->count() == 0) {
            return true;
        }
        return false;
    }
989885
private function parseSubscription($subscription)
    {
        /** @var SubscriptionInterface $subscriptionItem */
        $subscriptionItem = $this->subscriptionFactory->create();

        foreach ($subscription->getData() as $key => $value) {
            $subscriptionItem->setData($key, $value);
        }

        return $subscriptionItem;
    }
89201
protected function cancelSubscription($subscriptionId)
    {
        $subscription = $this->getSubscriptionById($subscriptionId);

        if ($subscription && (! $subscription->cancelled() || $subscription->onGracePeriod())) {
            $subscription->markAsCancelled();
        }

        return new Response('Webhook Handled', 200);
    }
88891
public function subscribed($subscription = 'default', $planId = null)
    {
        $subscription = $this->subscription($subscription);

        if (is_null($subscription)) {
            return false;
        }

        if (is_null($planId)) {
            return $subscription->isActive();
        }

        if ($planId == $subscription->plan_id and $subscription->isActive()) {
            return true;
        }

        return false;
    }
541247
public function forSubscription($subscriptionId)
    {
        $service = $this->getService();

        // events for a subscription
        $response = $service->request('subscriptions/' . $subscriptionId . '/events', 'GET', NULL, $this->getParams());

        $responseArray = $this->getResponseArray($response);

        if (!$this->isError()) {
            $this->_data = $this->_normalizeResponseArray($responseArray);
        } else {
            $this->_data = array();
        }

        return $this;
    }
883900
public function cancelSubscription($subscriptionId)
    {
        return $this->client->subscriptions->cancelFor($this, $subscriptionId, $this->getPresetOptions());
    }
1107763
public function setQuantityAllocation($subscriptionId, $componentId)
    {
        $service       = $this->getService();
        $rawData       = $this->getRawData(array('component' => $this->_params));
        $response      = $service->request('subscriptions/' . (int)$subscriptionId . '/components/' . (int)$componentId, 'PUT', $rawData);
        $responseArray = $this->getResponseArray($response);

        if (!$this->isError()) {
            $this->_data = $responseArray['component'];
        } else {
            $this->_data = array();
        }

        return $this;
    }
201119
public function listSubscription($id)
    {
        $service = $this->getService();

        $response      = $service->request('subscriptions/' . (int)$id . '/components', 'GET');
        $responseArray = $this->getResponseArray($response);

        if (!$this->isError()) {
            $this->_data = $this->_normalizeResponseArray($responseArray);
        } else {
            $this->_data = array();
        }

        return $this;
    }
766239
public function createReference($userId)
    {
        $myUserId = $userId;
        if(is_array($userId) && array_key_exists('id', $userId)){
            $myUserId = $userId['id'];
        }
        return 'SU:' . $myUserId;
    }