Retrieved basket associated with $customer from session.

@param CustomerInterface $customer

@return BasketInterface|null
321304
protected function getFromSession(CustomerInterface $customer)
    {
        $basket = $this->session->get($this->getSessionVarName($customer));

        if ($basket && !$basket->isEmpty()) {
            return $basket;
        }

        return $this->session->get($this->getSessionVarName());
    }
292937
public function getCustomerByExtUid($customerExtUid)
    {
        /** @var CustomerFbApi $response */
        $response = $this->call(new Request('customer.get', array('customer_ext_uid' => $customerExtUid)), 'DVelopment\FastBill\Model\CustomerFbApi');
        $customers = $response->getResponse()->getCustomers();

        return reset($customers);
    }
721840
public function get( ServerRequestInterface $request, ResponseInterface $response )
	{
		$view = $this->getView();

		try
		{
			$relId = $view->param( 'relatedid' );
			$ref = ( $inc = $view->param( 'include' ) ) ? explode( ',', $inc ) : [];

			$cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'customer' );
			$items = $cntl->uses( $ref )->get()->getListItems( $ref );

			if( $relId === null )
			{
				$view->items = $items;
				$view->total = count( $items );
			}
			else
			{
				$view->items = isset( $items[$relId] ) ? $items[$relId] : null;
				$view->total = empty( $view->items ) ? 0 : 1;
			}

			$status = 200;
		}
		catch( \Aimeos\Controller\Frontend\Customer\Exception $e )
		{
			$status = 403;
			$view->errors = $this->getErrorDetails( $e, 'controller/frontend' );
		}
		catch( \Aimeos\MShop\Exception $e )
		{
			$status = 404;
			$view->errors = $this->getErrorDetails( $e, 'mshop' );
		}
		catch( \Exception $e )
		{
			$status = 500;
			$view->errors = $this->getErrorDetails( $e );
		}

		return $this->render( $response, $view, $status );
	}
371777
public function setCustomer($customer)
    {
        $this->data->customer = new stdClass;
        $this->data->customer = $customer;

        return $this;
    }
379208
public function update($customer)
    {
        $customerId = "";

        if (is_array($customer)) {
            $customerId = $customer["id"];
        }
        elseif (is_object($customer)) {
            $customerId = $customer->id;
        }

        return $this->client->put("/customers/" . rawurlencode($customerId), $customer, null);
    }
1202723
public function saveCustomer(Customer $customer): bool
    {
        if ($customer->id) {
            $record = CustomerRecord::findOne($customer->id);

            if (!$record) {
                throw new Exception(Craft::t('commerce-stripe', 'No customer exists with the ID “{id}”',
                    ['id' => $customer->id]));
            }
        } else {
            $record = new CustomerRecord();
        }

        $record->userId = $customer->userId;
        $record->gatewayId = $customer->gatewayId;
        $record->reference = $customer->reference;
        $record->response = $customer->response;

        $customer->validate();

        if (!$customer->hasErrors()) {
            // Save it!
            $record->save(false);

            // Now that we have a record ID, save it on the model
            $customer->id = $record->id;

            return true;
        }

        return false;
    }
387967
public function getFor(Customer $customer, $subscriptionId, array $parameters = [])
    {
        $this->parentId = $customer->id;

        return parent::rest_read($subscriptionId, $parameters);
    }
76980
public function get($customerId, $optParams = array()) {
      $params = array('customerId' => $customerId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('get', array($params));
      if ($this->useObjects()) {
        return new Customer($data);
      } else {
        return $data;
      }
    }
1214514
public function expandCustomerTransferWithProductListIds(CustomerTransfer $customerTransfer): CustomerTransfer
    {
        if ($this->hasCustomerTransferProductLists($customerTransfer)) {
            return $customerTransfer;
        }

        $companyUserTransfer = $customerTransfer->getCompanyUserTransfer();

        if ($companyUserTransfer === null || $companyUserTransfer->getCompany() === null) {
            return $customerTransfer;
        }

        $productListCollectionTransfer = $this->productListReader->getProductListCollectionByIdCompanyId(
            $companyUserTransfer->getCompany()
        );

        $this->addProductListsToCustomerTransfer($customerTransfer, $productListCollectionTransfer);

        return $customerTransfer;
    }
812595
protected function getCart(ShopInterface $shop, ClientInterface $client = null, $sessionId, $currency)
    {
        $cart = $this->repository->findCart($client, $sessionId, $shop);

        if (null === $cart) {
            $cart = $this->createCart($shop, $client);
        } else {
            $this->updateCart($cart, $client, $currency);
        }

        return $cart;
    }
793539
public Customer createCustomer(Customer customer) {
        if(getCustomer(customer.getEmail()) != null){
            return customerRepository.save(customer);
        }
        return null;
    }
809750
public function load($id = null)
    {
        if(is_null($id) && Mage::getSingleton('customer/session')->isLoggedIn()) {
            $this->customer = Mage::getSingleton('customer/session')->getCustomer();
        } else if(is_int($id)) {
            $this->customer = Mage::getModel('customer/customer')->load($id);
            
            // TODO: Implement
        }

        if(!$this->customer->getId()) {
            return $this;
        }

        if(!($socialconnectLid = $this->customer->getInchooSocialconnectTid()) ||
                !($socialconnectTtoken = $this->customer->getInchooSocialconnectTtoken())) {
            return $this;
        }

        $this->setAccessToken($socialconnectTtoken);
        $this->_load();

        return $this;
    }
19735
protected function createCart(ShopInterface $shop, ClientInterface $client = null)
    {
        $cart = $this->initResource();
        $cart->setShop($shop);
        $cart->setClient($client);

        $this->createResource($cart);

        return $cart;
    }
1198105
public function findUserBasket($basket_id, User $user, $requireOwner)
    {
        $dql = 'SELECT b
            FROM Phraseanet:Basket b
            LEFT JOIN b.elements e
            WHERE b.id = :basket_id';

        $query = $this->_em->createQuery($dql);
        $query->setParameters(['basket_id' => $basket_id]);

        $basket = $query->getOneOrNullResult();

        if (null === $basket) {
            throw new NotFoundHttpException($this->trans('Basket is not found'));
        }

        /* @var Basket $basket */
        if ($basket->getUser()->getId() != $user->getId()) {
            $participant = false;

            if ($basket->getValidation() && !$requireOwner) {
                try {
                    $basket->getValidation()->getParticipant($user);
                    $participant = true;
                } catch (\Exception $e) {

                }
            }
            if (!$participant) {
                throw new AccessDeniedHttpException($this->trans('You have not access to this basket'));
            }
        }

        return $basket;
    }
26021
public function deleteCustomer($customer_id)
    {
        $response = $this->client->delete('customers/' . $customer_id);
        return json_decode($response->getBody())->customer;
    }
1234620
private function getAddressFromCustomer($customer, $addressType = 'billing')
    {
        /** @var CustomerAddressInterface $address */
        $address = $this->customerAddressFactory->create();

        foreach ($customer->getData() as $key => $value) {
            if (strpos($key, $addressType) === 0) {
                $key = explode('.', $key);
                $key = array_pop($key);

                $address->setData($key, $value);
            }
        }

        return $address;
    }
687419
public function getCustomer($customerId)
    {
        //retrieve customer, set customer attributes
        $customerModel = $this->customerResource->get($customerId);
        if ($customerModel instanceof \Exception) {
            throw $customerModel;
        }

        $this->_setAttributes($customerModel);
        $this->setDeletable(true);

        return $this;
    }