Returns the gateway associated with this customer.

@return GatewayInterface|null
344513
public function getGateway()
    {
        if (null === $this->_gateway) {
            $this->_gateway = Commerce::getInstance()->getGateways()->getGatewayById($this->gatewayId);
        }

        return $this->_gateway;
    }
1223858
protected function getStackedClient()
	{
		$sessionReject = $this->bound('session.reject') ? $this['session.reject'] : null;

		$client = with(new \Stack\Builder)
						->push('Fly\Cookie\Guard', $this['encrypter'])
						->push('Fly\Cookie\Queue', $this['cookie'])
						->push('Fly\Session\Middleware', $this['session'], $sessionReject);

		$this->mergeCustomMiddlewares($client);

		return $client->resolve($this);
	}
1198037
public function getGateways()
    {
        $gateways = array();
        foreach ($this->supported_gateways as $gateway) {
            $class = 'AktiveMerchant\\Billing\\Gateways\\' . $gateway;
            $gateways[Inflect::underscore($gateway)] = $class::$display_name;
        }

        return $gateways;
    }
233812
public function client()
	{
		if (isset($this->client)) {
			return $this->client ? $this->client : null;
		}
		
		$client_id = $this->clientId();
		if (!$client_id) {
			$this->client = false;
			return null;
		}
		
		$client = $this->fetchClient($client_id);
		if ($client) {
			$this->client = $client;
		}
		else {
			$this->client = false;
		}
		
		return $this->client ? $this->client : null;
	}
57582
protected function getHttpClient()
    {
        $stack = HandlerStack::create();

        $stack->push(Middleware::retry(function ($retries, RequestInterface $request, ResponseInterface $response = null, TransferException $exception = null) {
            $parsed = $this->parseResponse($response->getBody());

            // Be aware that this gateway validation error responses may be an HTTP 500 code.
            return $retries < 3 && ($exception instanceof ConnectException ||
                (
                    $response->getStatusCode() >= 500 &&
                    isset($parsed['error']['code']) &&
                    !in_array($parsed['error']['code'], array_keys($this->errorCodeMap))
                )
            );
        }, function ($retries) {
            return (int) pow(2, $retries) * 1000;
        }));

        return new GuzzleClient(['handler' => $stack]);
    }
1054099
public function getGateway($id)
    {
        if (!array_key_exists($id, $this->_gateways)) {
            throw new InvalidParamException("Unknown gateway '{$id}'.");
        }
        if (!is_object($this->_gateways[$id])) {
            $this->_gateways[$id] = $this->createGateway($id, $this->_gateways[$id]);
        }
        return $this->_gateways[$id];
    }
402132
public function getApiClient()
    {
        $stack = HandlerStack::create();

        $middleware = new Oauth1([
            'consumer_key' => $this->configuration->getConsumerKey(),
            'consumer_secret' => $this->configuration->getConsumerSecret(),
            'token' => $this->configuration->getToken(),
            'token_secret' => $this->configuration->getTokenSecret()
        ]);
        $stack->push($middleware);

        $client = new Client([
            'base_uri' => $this->configuration->getBaseUri(),
            'handler' => $stack,
            'auth' => 'oauth',
            'headers' => [
                'Content-Type' => 'application/json',
            ],
            'http_errors' => $this->configuration->getHttpErrors(),
        ]);

        return $client;
    }
217873
public function getCustomer(ConnectionInterface $con = null)
    {
        if ($this->aCustomer === null && ($this->customer_id !== null)) {
            $this->aCustomer = CustomerQuery::create()->findPk($this->customer_id, $con);
            /* The following can be used additionally to
                guarantee the related object contains a reference
                to this object.  This level of coupling may, however, be
                undesirable since it could result in an only partially populated collection
                in the referenced object.
                $this->aCustomer->addCustomerCustomerGroups($this);
             */
        }

        return $this->aCustomer;
    }
1171785
public function get()
    {
        $customer = null;
        $user = null;

        if (true === $this->securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
            // user is authenticated
            $user = $this->securityContext->getToken()->getUser();

            if (!$user instanceof UserInterface) {
                throw new \RuntimeException('User must be an instance of Symfony\Component\Security\Core\User\UserInterface');
            }

            $customer = $this->customerManager->findOneBy([
                'user' => $user->getId(),
            ]);
        }

        if (!$customer) {
            $basket = $this->getBasket();

            if ($basket && $basket->getCustomer()) {
                $customer = $basket->getCustomer();
            }
        }

        if (!$customer) {
            $customer = $this->customerManager->create();
        }

        if (!$customer->getLocale()) {
            $customer->setLocale($this->locale);
        }

        if ($user && $customer) {
            $customer->setUser($user);
        }

        return $customer;
    }
926843
protected function setGateway($gateway = null)
    {
        $deferred = new Deferred();

        $buildParams = function ($gateway) use ($deferred) {
            $params = [
                'v'        => self::GATEWAY_VERSION,
                'encoding' => $this->encoding,
            ];

            $query         = http_build_query($params);
            $this->gateway = trim($gateway, '/').'/?'.$query;

            $deferred->resolve($this->gateway);
        };

        if (is_null($gateway)) {
            $this->http->get('gateway')->then(function ($response) use ($buildParams) {
                $buildParams($response->url);
            }, function ($e) use ($buildParams) {
                // Can't access the API server so we will use the default gateway.
                $buildParams('wss://gateway.discord.gg');
            });
        } else {
            $buildParams($gateway);
        }

        $deferred->promise()->then(function ($gateway) {
            $this->logger->info('gateway retrieved and set', ['gateway' => $gateway]);
        }, function ($e) {
            $this->logger->error('error obtaining gateway', ['e' => $e->getMessage()]);
        });

        return $deferred->promise();
    }
434981
public function getSubscription()
    {
        if ($this->getGateway() instanceof GatewayInterface) {
            return $this->getGateway()->getSubscriptionByReference($this->getSubscriptionReference());
        }

        throw new RuntimeException('Gateway is not set');
    }
721193
private function getParentId()
    {
        $posted = $this->appRequest->getPostValue();
        if (isset($posted['customer'][ABlock::TMPL_FLDGRP][ABlock::TMPL_FIELD_PARENT_MLM_ID])) {
            $mlmId = $posted['customer'][ABlock::TMPL_FLDGRP][ABlock::TMPL_FIELD_PARENT_MLM_ID];
            $found = $this->daoDwnlCust->getByMlmId($mlmId);
            if ($found) {
                $result = $found->getCustomerRef();
            }
        } else {
            $result = null;
        }
        return $result;
    }
1013899
protected static function createOmnipayGateway(string $gatewayClassName): GatewayInterface
    {
        $craftClient = Craft::createGuzzleClient();
        $adapter = new Client($craftClient);
        $httpClient = new OmnipayClient($adapter);

        return Omnipay::create($gatewayClassName, $httpClient);
    }
747157
protected function getCustomer()
    {
        if (null === $this->customer) {
            $this->customer = $this->getSession() ? $this->getSession()->getCustomerUser() : null;
        }

        return $this->customer;
    }
849000
public function get()
    {
        if ($this->cart instanceof CartInterface) {
            return $this->cart;
        }

        $customer = $this
            ->customerWrapper
            ->get();

        $cartFromCustomer = $this->getCustomerCart($customer);
        $cartFromSession = $this
            ->cartSessionWrapper
            ->get();

        $this->cart = $this
            ->resolveCarts(
                $customer,
                $cartFromCustomer,
                $cartFromSession
            );

        $this
            ->cartEventDispatcher
            ->dispatchCartLoadEvents($this->cart);

        return $this->cart;
    }
861353
private function getProvider()
    {
        if (version_compare(\Illuminate\Foundation\Application::VERSION, '5.0', '<')) {
            $provider = 'Larabookir\Gateway\GatewayServiceProviderLaravel4';
        } else {
            $provider = 'Larabookir\Gateway\GatewayServiceProviderLaravel5';
        }

        return new $provider($this->app);
    }
392077
public function getConnector() {
        if (!$this->connector) {
            $mapping = $this->dao->getMapping();
            $this->connector = ConnectionPool::getConnector($mapping['connection']);
        }
        return $this->connector;
    }