@param BasketElementInterface $basketElement
@param BasketInterface        $basket

@return Response
185647
public function renderFinalReviewBasketElementAction(BasketElementInterface $basketElement, BasketInterface $basket)
    {
        $action = sprintf('%s:renderFinalReviewBasketElement', $basketElement->getProductProvider()->getBaseControllerName());

        $response = $this->forward($action, [
            'basketElement' => $basketElement,
            'basket' => $basket,
        ]);

        if ($this->get('kernel')->isDebug()) {
            $response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
                $basketElement->getProductCode(),
                $basketElement->getProductId(),
                $action,
                $response->getContent()
            ));
        }

        return $response;
    }
327400
public static function checkResponse($transactionId, $responseCode, $responseText, $item)
    {
        $e = self::getException($transactionId, $responseCode, $responseText, $item);

        if ($e != null) {
            throw $e;
        }
    }
453544
protected function executeAction(ObjectInterface $object, AbstractRepositoryService $service)
    {
        if (is_a($object, EzPlatformObject::class)) {
            /** @var EzPlatformObject $object */
            switch ($object->getAction()) {
                case Action::CREATEORUPDATE:
                    return $service->createOrUpdate($object);
                case Action::DELETE:
                    return $service->remove($object);
                case Action::SKIP:
                default:
            }
        } else {
            return $service->createOrUpdate($object);
        }

        return;
    }
1060392
public function postRemoveAction(ServerRequestInterface $request, Tree $tree): ResponseInterface
    {
        $xref = $request->get('xref', '');

        $cart = Session::get('cart', []);
        unset($cart[$tree->name()][$xref]);
        Session::put('cart', $cart);

        $url = route('module', [
            'module' => $this->name(),
            'action' => 'Show',
            'ged'    => $tree->name(),
        ]);

        return redirect($url);
    }
974262
public function sendStockReminder($basketContents, $subject = null)
    {
        $send = false;

        $articleList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
        $articleList->loadStockRemindProducts($basketContents);

        // nothing to remind?
        if ($articleList->count()) {
            $shop = $this->_getShop();

            //set mail params (from, fromName, smtp... )
            $this->_setMailParams($shop);
            $lang = \OxidEsales\Eshop\Core\Registry::getLang();

            $smarty = $this->_getSmarty();
            $this->setViewData("articles", $articleList);

            // Process view data array through oxOutput processor
            $this->_processViewArray();

            $this->setRecipient($shop->oxshops__oxowneremail->value, $shop->oxshops__oxname->getRawValue());
            $this->setFrom($shop->oxshops__oxowneremail->value, $shop->oxshops__oxname->getRawValue());
            $this->setBody($smarty->fetch(Registry::getConfig()->getTemplatePath($this->_sReminderMailTemplate, false)));
            $this->setAltBody("");
            $this->setSubject(($subject !== null) ? $subject : $lang->translateString('STOCK_LOW'));

            $send = $this->send();
        }

        return $send;
    }
1295267
public function reserveBasket(\OxidEsales\Eshop\Application\Model\Basket $oBasket)
    {
        if (!$this->isAdmin()) {
            $this->_reserveArticles($this->_basketDifference($oBasket));
        }
    }
460794
public static function BasketInSession()
    {
        /** @var Request $request */
        $request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();

        return $request->getSession()->has(self::SESSION_KEY_NAME);
    }
424558
function (scope, element, attrs) {

					SubscriptionService.queryEntity(scope.target, scope.type).success( function(response){


						scope.posting = false;

						scope.count = response.length;
						var jElement = angular.element(element[0]);
						jElement.html(scope.count);

					}).error(function(err){
						throw err;
					})

				}
1229673
public function renderFormBasketElementAction(FormView $formView, BasketElementInterface $basketElement, BasketInterface $basket)
    {
        $provider = $this->get('sonata.product.pool')->getProvider($basketElement->getProduct());

        return $this->render(sprintf('%s:form_basket_element.html.twig', $provider->getBaseControllerName()), [
            'formView' => $formView,
            'basketElement' => $basketElement,
            'basket' => $basket,
        ]);
    }
153271
public function get( ServerRequestInterface $request, ResponseInterface $response )
	{
		$view = $this->getView();

		try
		{
			$ref = $view->param( 'include', ['media', 'price', 'text'] );

			if( is_string( $ref ) ) {
				$ref = explode( ',', $ref );
			}

			$cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'service' )->uses( $ref );
			$basketCntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'basket' );
			$basket = $basketCntl->get();

			if( ( $id = $view->param( 'id' ) ) != '' )
			{
				$provider = $cntl->getProvider( $id );

				if( $provider->isAvailable( $basket ) === true )
				{
					$view->attributes = [$id => $provider->getConfigFE( $basket )];
					$view->prices = [$id => $provider->calcPrice( $basket )];
					$view->items = $provider->getServiceItem();
					$view->total = 1;
				}
			}
			else
			{
				$attributes = $prices = $items = [];
				$cntl->type( $view->param( 'filter/cs_type' ) );

				foreach( $cntl->getProviders() as $id => $provider )
				{
					if( $provider->isAvailable( $basket ) === true )
					{
						$attributes[$id] = $provider->getConfigFE( $basket );
						$prices[$id] = $provider->calcPrice( $basket );
						$items[$id] = $provider->getServiceItem();
					}
				}

				$view->attributes = $attributes;
				$view->prices = $prices;
				$view->items = $items;
				$view->total = count( $items );
			}

			$status = 200;
		}
		catch( \Aimeos\MShop\Exception $e )
		{
			$status = 404;
			$view->errors = $this->getErrorDetails( $e, 'mshop' );
		}
		catch( \Exception $e )
		{
			$status = 500;
			$view->errors = $this->getErrorDetails( $e );
		}

		/** client/jsonapi/service/standard/template
		 * Relative path to the service JSON API template
		 *
		 * The template file contains the code and processing instructions
		 * to generate the result shown in the JSON API body. The
		 * configuration string is the path to the template file relative
		 * to the templates directory (usually in client/jsonapi/templates).
		 *
		 * You can overwrite the template file configuration in extensions and
		 * provide alternative templates. These alternative templates should be
		 * named like the default one but with the string "standard" replaced by
		 * an unique name. You may use the name of your project for this. If
		 * you've implemented an alternative client class as well, "standard"
		 * should be replaced by the name of the new class.
		 *
		 * @param string Relative path to the template creating the body for the GET method of the JSON API
		 * @since 2017.03
		 * @category Developer
		 */
		$tplconf = 'client/jsonapi/service/standard/template';
		$default = 'service/standard';

		$body = $view->render( $view->config( $tplconf, $default ) );

		return $response->withHeader( 'Allow', 'GET,OPTIONS' )
			->withHeader( 'Cache-Control', 'max-age=300' )
			->withHeader( 'Content-Type', 'application/vnd.api+json' )
			->withBody( $view->response()->createStreamFromString( $body ) )
			->withStatus( $status );
	}
547335
protected function storeInSession(BasketInterface $basket)
    {
        $this->session->set($this->getSessionVarName($basket->getCustomer()), $basket);
    }
1255676
private function listBasketElement(Request $request, BasketElement $basket_element)
    {
        $ret = [
            'basket_element_id' => $basket_element->getId(),
            'order'             => $basket_element->getOrd(),
            'record'            => $this->listRecord($request, $basket_element->getRecord($this->app)),
            'validation_item'   => null != $basket_element->getBasket()->getValidation(),
        ];

        if ($basket_element->getBasket()->getValidation()) {
            $choices = [];
            $agreement = null;
            $note = '';

            /** @var ValidationData $validationData */
            foreach ($basket_element->getValidationDatas() as $validationData) {
                $participant = $validationData->getParticipant();
                $user = $participant->getUser();
                $choices[] = [
                    'validation_user' => [
                        'usr_id'         => $user->getId(),
                        'usr_name'       => $user->getDisplayName(),
                        'confirmed'      => $participant->getIsConfirmed(),
                        'can_agree'      => $participant->getCanAgree(),
                        'can_see_others' => $participant->getCanSeeOthers(),
                        'readonly'       => $user->getId() != $this->getAuthenticatedUser()->getId(),
                        'user'           => $this->listUser($user),
                    ],
                    'agreement'       => $validationData->getAgreement(),
                    'updated_on'      => $validationData->getUpdated()->format(DATE_ATOM),
                    'note'            => null === $validationData->getNote() ? '' : $validationData->getNote(),
                ];

                if ($user->getId() == $this->getAuthenticatedUser()->getId()) {
                    $agreement = $validationData->getAgreement();
                    $note = null === $validationData->getNote() ? '' : $validationData->getNote();
                }

                $ret['validation_choices'] = $choices;
            }

            $ret['agreement'] = $agreement;
            $ret['note'] = $note;
        }

        return $ret;
    }
1359297
protected function _checkIPN( $baseManager, $basket, $additional )
	{
		$attrManager = MShop_Factory::createManager( $this->_getContext(), 'order/base/service/attribute' );

		if( $this->_getConfigValue( array( 'paypalexpress.AccountEmail' ) ) !== $additional['receiver_email'] )
		{
			$msg = sprintf( 'PayPal Express: Wrong receiver email "%1$s"', $additional['receiver_email'] );
			throw new MShop_Service_Exception( $msg );
		}

		$price = $basket->getPrice();
		$amount = $price->getValue() + $price->getCosts();
		if( $amount != $additional['payment_amount'] )
		{
			$msg = sprintf( 'PayPal Express: Wrong payment amount "%1$s" for order ID "%2$s"', $additional['payment_amount'], $additional['invoice'] );
			throw new MShop_Service_Exception( $msg );
		}

		$search = $attrManager->createSearch();
		$expr = array(
			$search->compare( '==', 'order.base.service.attribute.code', $additional['txn_id'] ),
			$search->compare( '==', 'order.base.service.attribute.value', $additional['payment_status'] ),
		);

		$search->setConditions( $search->combine( '&&', $expr ) );
		$results = $attrManager->searchItems( $search );

		if ( ( $attr = reset( $results ) ) !== false )
		{
			$msg = sprintf( 'PayPal Express: Duplicate transaction with ID "%1$s" and status "%2$s" ', $additional['txn_id'], $additional['txn_status'] );
			throw new MShop_Service_Exception( $msg );
		}
	}
424929
private function listBaskets()
    {
        /** @var BasketRepository $repo */
        $repo = $this->app['repo.baskets'];

        return array_map(function (Basket $basket) {
            return $this->listBasket($basket);
        }, $repo->findActiveByUser($this->getAuthenticatedUser()));
    }
1245632
public function tobasket(
        $sProductId = null,
        $dAmount = null,
        $aSelectList = null,
        $aPersistentParameters = null,
        $blOverride = false
    ) {
        $oContainer = $this->_getContainer();
        $oConfig = $oContainer->getConfig();
        $isAmazonPay = (bool)$oConfig->getRequestParameter('bestitAmazonPayIsAmazonPay');
        $sReturn = null;

        if ($isAmazonPay === true) {
            $oContainer->getBasketUtil()->setQuickCheckoutBasket();
            $sAmazonOrderReferenceId = $oConfig->getRequestParameter('amazonOrderReferenceId');
            $sAccessToken = $oConfig->getRequestParameter('access_token');
            $sReturn = 'user?fnc=amazonLogin&redirectCl=user&amazonOrderReferenceId='.$sAmazonOrderReferenceId
                .'&access_token='.$sAccessToken;
        }

        $sDefaultReturn = $this->_parentToBasket(
            $sProductId,
            $dAmount,
            $aSelectList,
            $aPersistentParameters,
            $blOverride
        );

        if ($isAmazonPay === true) {
            $oSession = $oContainer->getSession();
            $oSession->setVariable('blAddedNewItem', false);
            $oSession->setVariable('isAmazonPayQuickCheckout', true);
            return $sReturn;
        }

        return $sDefaultReturn;
    }
257718
private function listBasketContent(Request $request, Basket $basket)
    {
        return array_map(function (BasketElement $element) use ($request) {
            return $this->listBasketElement($request, $element);
        }, iterator_to_array($basket->getElements()));
    }
953397
public function setBasketDescriptionAction(Request $request, Basket $basket)
    {
        $basket->setDescription($request->get('description'));

        /** @var EntityManager $em */
        $em = $this->app['orm.em'];
        $em->persist($basket);
        $em->flush();

        return Result::create($request, ["basket" => $this->listBasket($basket)])->createResponse();
    }