@param string $id
@param array  $headers

@throws Exception

@return array|string
549256
public function logout(string $id, array $headers = [])
    {
        $url = $this->url('portal_sessions/%s/logout', $id);

        return $this->post($url, [], $headers);
    }
1297948
public function chargeAddonAtTermEnd(string $id, array $data, array $headers = [])
    {
        $url = $this->url('subscriptions/%s/charge_addon_at_term_end', $id);

        return $this->post($url, $data, $headers);
    }
113066
public function addChargeItem(string $id, array $data, array $headers = [])
    {
        $url = $this->url('invoices/%s/add_charge', $id);

        return $this->post($url, $data, $headers);
    }
1074722
public function addIdHeader($name, $ids = null)
    {
        $this->storeHeader($name, $this->factory->createIdHeader($name, $ids));
    }
1005129
public function in($id, array $ids)
    {
        $url = $this->buildUrlByMethodName(
            'getInUrl',
            [
                'id' => $id,
                'ids' => implode(',', $ids),
            ]
        );

        $response = $this->resolveApiUrl($url);

        return $response['result'];
    }
634941
public function display(Exception $exception, string $id, int $code, array $headers)
    {
        return redirect()->guest('auth/login');
    }
668096
public function setId($id)
    {
        if (!$this->setHeaderFieldModel($this->getIdField(), $id)) {
            $this->headers->addIdHeader($this->getIdField(), $id);
        }
        $this->id = $id;

        return $this;
    }
147072
public function updateContact(string $id, array $data, array $headers = [])
    {
        $url = $this->url('customers/%s/update_contact', $id);

        return $this->post($url, $data, $headers);
    }
636870
public function activate(string $id, array $data, array $headers = [])
    {
        $url = $this->url('portal_sessions/%s/activate', $id);

        return $this->post($url, $data, $headers);
    }
973645
public function removeScheduledResumption(string $id, array $data = [], array $headers = [])
    {
        $url = $this->url('subscriptions/%s/remove_scheduled_resumption', $id);

        return $this->post($url, $data, $headers);
    }
789507
public function show($id)
    {
        $apiRequest = RequestFactory::create();

        $resource = new GetResource(
            $this->serializer,
            $apiRequest->getFields(),
            $apiRequest->getIncludedRelationships()
        );

        $find = $this->findResourceCallable($id);

        return $this->addHeaders($resource->get($id, get_class($this->getDataModel()), $find));
    }
1177618
public function load($id, array $parameters = [], array $headers = [])
    {
        $data = $this->getApi()->getCompany($id, $this->parseQueryParameters($parameters), $headers);

        return $this->getFactory()->create($data);
    }
973
public function reactivate(string $id, array $data, array $headers = [])
    {
        $url = $this->url('subscriptions/%s/reactivate', $id);

        return $this->post($url, $data, $headers);
    }
1130961
public function pause(string $id, array $data = [], array $headers = [])
    {
        $url = $this->url('subscriptions/%s/pause', $id);

        return $this->post($url, $data, $headers);
    }
902748
public function stopDunning(string $id, array $headers = [])
    {
        $url = $this->url('invoices/%s/stop_dunning', $id);

        return $this->post($url, [], $headers);
    }
325534
public function changeBillingDate(string $id, array $data, array $headers = [])
    {
        $url = $this->url('customers/%s/change_billing_date', $id);

        return $this->post($url, $data, $headers);
    }
1279992
public function in($id, array $ids)
    {
        $allParents = $this->getHierarchy($id);

        /**
         * To increase the efficiency, we can index the results of the parent.
         */
        $allParentsIndexed = [];
        foreach ($allParents as $parent) {
            $allParentsIndexed[$parent->getId()] = $parent;
        }

        foreach ($ids as $possibleParentId) {
            if (isset($allParentsIndexed[$possibleParentId])) {
                return true;
            }
        }

        return false;
    }