Method to determine how to handle the request.
Uses the currency service to set the active currency
@param  \SS_HTTPRequest $request
@return array
12143
public function process(\SS_HTTPRequest $request)
    {
        if ($identifier = $request->param('ID')) {
            if ($this->currencyService->setActiveCurrency(new Identifier($identifier))) {
                return [
                    'Success' => true
                ];
            }
        }

        return [
            'Success' => false
        ];
    }
101675
public function handleFolders(SS_HTTPRequest $request)
    {
        $result = array();

        foreach (Folder::get() as $folder) {
            $result[] = array(
                'id' => $folder->ID,
                'filename' => $folder->Filename
            );
        }

        $response = new SS_HTTPResponse(
            Convert::array2json($result), 200
        );

        return $response->addHeader('Content-Type', 'application/json');
    }
634318
public function getLocale(HttpRequest $request)
    {
        if ($this->locale) {
            return $this->locale;
        }

        // get locale from language list
        $constraint = new Locale();
        foreach ($request->getLanguages() as $language) {
            if (!$this->validator->validate($language, $constraint)->has(0)) {
                return $language;
            }
        }

        // get default locale
        return $request->getLocale();
    }
1070185
public function edit(SS_HTTPRequest $request)
    {
        // Check form field state
        if ($this->parent->isDisabled() || $this->parent->isReadonly()) {
            return $this->httpError(403);
        }

        // Check item permissions
        $item = $this->getItem();
        if (!$item) {
            return $this->httpError(404);
        }

        $memberID = Member::currentUserID();

        $res = false;
        try {
            // Owner can always delete
            if ($memberID && $item->OwnerID == $memberID) {
                $res = true;
            } else {
                $res = $item->canEditFrontend();
            }
        } catch (Exception $ex) {

        }

        if (!$res) {
            return $this->httpError(403);
        }

        Requirements::css(FRAMEWORK_DIR . '/css/UploadField.css');

        return $this->customise(array(
                'Form' => $this->EditForm()
            ))->renderWith($this->parent->getTemplateFileEdit());
    }
954833
protected function decodeJwtTokenCookie($request)
    {
        return (array) JWT::decode(
            $this->encrypter->decrypt($request->cookie(Passport::cookie())),
            $this->encrypter->getKey(), ['HS256']
        );
    }
747421
public function toArray($request)
    {
        return [
            'id'            => (int) $this->id,
            'author_id'     => $this->author_id,
            'language_code' => $this->language_code,
            'title'         => $this->title,
            'body'          => $this->body,
            'custom_fields' => $this->custom_fields,
            'is_active'     => $this->is_active,
            'created_at'    => $this->created_at->toIso8601String(),
            'updated_at'    => $this->updated_at->toIso8601String(),
        ];
    }
308773
public function detectLocale(HTTPRequest $request)
    {
        // Given multiple canditates, narrow down the final result using the client's preferred languages
        $inputLocales = $request->getHeader('Accept-Language');
        if (empty($inputLocales)) {
            return null;
        }

        // Generate mapping of priority => list of locales at this priority
        // break up string into pieces (languages and q factors)
        preg_match_all(
            '/(?<code>[a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(?<priority>1|0\.[0-9]+))?/i',
            $inputLocales,
            $parsedLocales
        );

        $prioritisedLocales = [];
        if (count($parsedLocales['code'])) {
            // create a list like "en" => 0.8
            $parsedLocales = array_combine($parsedLocales['code'], $parsedLocales['priority']);

            // Generate nested list of priorities => [locales]
            foreach ($parsedLocales as $locale => $priority) {
                $priority = empty($priority) ? "1.0" : (string)floatval($priority);
                if (empty($prioritisedLocales[$priority])) {
                    $prioritisedLocales[$priority] = [];
                }
                $prioritisedLocales[$priority][] = $locale;
            }

            // sort list based on value
            krsort($prioritisedLocales, SORT_NUMERIC);
        }

        // Check each requested locale against loaded locales
        $locales = Locale::getLocales(true);
        foreach ($prioritisedLocales as $priority => $parsedLocales) {
            foreach ($parsedLocales as $browserLocale) {
                foreach ($locales as $localeObj) {
                    /** @var Locale $localeObj */
                    if ($localeObj->isLocale($browserLocale)) {
                        return $localeObj;
                    }
                }
            }
        }
        return null;
    }
360914
public function handle($request, Closure $next)
    {
        // Remove session from user if current currency do not exist
        if(null !== Session::get('currency_code')) {
            $currency = $this->curRep->findByCode(Session::get('currency_code'));
            if(is_null($currency)) {
                Session::remove('currency_code');
                Session::remove('currency_symbol');
            }
        }

        if (null === $request->get('currency_code') && null !== Session::get('currency_code')) {
            return $next($request);
        }

        $currencyCode = $request->get('currency_code');

        if (null === $currencyCode) {
            $configCurrency = $this->repository->getValueByKey('general_site_currency');
            $siteCurrencyModel = $this->curRep->find($configCurrency);

            $currencyCode = $siteCurrencyModel->code;
            $currencySymbol = $siteCurrencyModel->symbol;
        } else {
            $siteCurrencyModel = $this->curRep->findByCode($currencyCode);
            $currencySymbol = $siteCurrencyModel->symbol;
        }

        $sessionCode = Session::get('currency_code', $currencyCode);

        // If cart has any product then re calculate the price and save it into db
        if (null !== $sessionCode && $sessionCode !== $currencyCode) {
            $model = $this->curRep->findByCode($currencyCode);

            $products = Cart::all();

            if ($products->count() > 0) {
                foreach ($products as $product) {
                    // Re calculate and set the price

                    $productModel = $this->productRepository->findBySlug($product->slug());
                    $productAttributes = $productModel->getAttributes();
                    $qty = $product->qty();

                    $newPrice = $productAttributes['price'] * $model->conversion_rate;
                    $product->price($newPrice);

                    $isTaxEnabled = $this->repository->getValueByKey('tax_enabled');

                    if ($isTaxEnabled && $productModel->is_taxable) {
                        $percentage = $this->repository->getValueByKey('tax_percentage');
                        $taxAmount = ($percentage * $productAttributes['price'] / 100) * $qty;

                        $newTax = $taxAmount * $model->conversion_rate;
                        $product->tax($newTax);
                    }
                    // Re calculate and set the price

                    // Re calculate and set the line total
                    $newPLineTotla = $newPrice * $qty * $model->conversion_rate;
                    $product->lineTotal($newPLineTotla);
                }
            }
        }

        Session::put('currency_code', $currencyCode);
        Session::put('currency_symbol', $currencySymbol);

        return $next($request);
    }
972534
private function _convertGetCompetitivePricingForSKU($request) {

        $parameters = array();
        $parameters['Action'] = 'GetCompetitivePricingForSKU';
        if ($request->isSetSellerId()) {
            $parameters['SellerId'] =  $request->getSellerId();
        }
        if ($request->isSetMWSAuthToken()) {
            $parameters['MWSAuthToken'] =  $request->getMWSAuthToken();
        }
        if ($request->isSetMarketplaceId()) {
            $parameters['MarketplaceId'] =  $request->getMarketplaceId();
        }
        if ($request->isSetSellerSKUList()) {
            $SellerSKUListGetCompetitivePricingForSKURequest = $request->getSellerSKUList();
            foreach  ($SellerSKUListGetCompetitivePricingForSKURequest->getSellerSKU() as $SellerSKUSellerSKUListIndex => $SellerSKUSellerSKUList) {
                $parameters['SellerSKUList' . '.' . 'SellerSKU' . '.'  . ($SellerSKUSellerSKUListIndex + 1)] =  $SellerSKUSellerSKUList;
            }
        }

        return $parameters;
    }
93723
public function transactionsAction(Request $request)
    {
        $dataArray = [
            'html'    => '',
            'success' => 0,
        ];

        $filters = null;
        // filters means the transaction table had a column sort or filter submission or pagination, otherwise its a fresh page load
        if ($request->request->has('filters')) {
            foreach ($request->request->get('filters') as $filter) {
                if (in_array($filter['name'], ['dateTo', 'dateFrom']) && !empty($filter['value'])) {
                    $filter['value']        = new \DateTime($filter['value']);
                    list($hour, $min, $sec) = 'dateTo' == $filter['name'] ? [23, 59, 59] : [00, 00, 00];
                    $filter['value']->setTime($hour, $min, $sec);
                }
                if (!empty($filter['value'])) {
                    $filters[$filter['name']] = $filter['value'];
                }
            }
        }
        $page     = isset($filters['page']) && !empty($filters['page']) ? $filters['page'] : 1;
        $objectId = InputHelper::clean($request->request->get('objectId'));
        if (empty($objectId)) {
            return $this->sendJsonResponse($dataArray);
        }

        $contactClient = $this->checkContactClientAccess($objectId, 'view');
        if ($contactClient instanceof Response) {
            return $this->sendJsonResponse($dataArray);
        }

        $order = [
            'date_added',
            'DESC',
        ];

        if (isset($filters['orderby']) && !empty($filters['orderby'])) {
            $order[0] = $filters['orderby'];
        }
        if (isset($filters['orderbydir']) && !empty($filters['orderbydir'])) {
            $order[1] = $filters['orderbydir'];
        }

        $transactions = $this->getEngagements($contactClient, $filters, $order, $page);

        $dataArray['html']    = $this->renderView(
            'MauticContactClientBundle:Transactions:list.html.php',
            [
                'page'          => $page,
                'contactClient' => $contactClient,
                'transactions'  => $transactions,
                'order'         => $order,
            ]
        );
        $dataArray['success'] = 1;
        $dataArray['total']   = $transactions['total'];

        return $this->sendJsonResponse($dataArray);
    }
548247
private function detectCharset(ServerRequestInterface $request)
    {
        $accept = $request->getHeaderLine('Accept-Charset');

        return $this->negotiateHeader($accept, new CharsetNegotiator(), $this->charsets);
    }
471713
public function parse($request)
    {
        $object = clone $this->requestObject;
        $invalidValues = [];

        foreach ($this->propertyParsers as $propertyParser) {
            try {
                $this->setProperty($request, $object, $propertyParser);
            } catch (InvalidValueException $e) {
                $invalidValues[$propertyParser->getName()] = $e->getMessage();
            }
        }
        $this->checkIfRequestIsValidOrThrowException($invalidValues);

        return $object;
    }
778385
public function viewAction(Request $request)
    {
        $token = $this->getHttpRequestVerifier()->verify($request);

        $status = new BinaryMaskStatusRequest($token);

        $this->getPayum()->getPayment($token->getPaymentName())->execute($status);

        return array(
            'status' => $status,
        );
    }
590037
private function _convertSetBillingAgreementDetails($request) {
    
    	$parameters = array();
    	$parameters['Action'] = 'SetBillingAgreementDetails';
    	if ($request->isSetSellerId()) {
    		$parameters['SellerId'] =  $request->getSellerId();
    	}
    	if ($request->isSetAmazonBillingAgreementId()) {
    		$parameters['AmazonBillingAgreementId'] =  $request->getAmazonBillingAgreementId();
    	}
    	if ($request->isSetBillingAgreementAttributes()) {
    		$billingAgreementAttributessetBillingAgreementDetailsRequest = $request->getBillingAgreementAttributes();
    		if ($billingAgreementAttributessetBillingAgreementDetailsRequest->isSetPlatformId()) {
    			$parameters['BillingAgreementAttributes' . '.' . 'PlatformId'] =  $billingAgreementAttributessetBillingAgreementDetailsRequest->getPlatformId();
    		}
    		if ($billingAgreementAttributessetBillingAgreementDetailsRequest->isSetSellerNote()) {
    			$parameters['BillingAgreementAttributes' . '.' . 'SellerNote'] =  $billingAgreementAttributessetBillingAgreementDetailsRequest->getSellerNote();
    		}
    		if ($billingAgreementAttributessetBillingAgreementDetailsRequest->isSetSellerBillingAgreementAttributes()) {
    			$sellerBillingAgreementAttributesbillingAgreementAttributes = $billingAgreementAttributessetBillingAgreementDetailsRequest->getSellerBillingAgreementAttributes();
    			if ($sellerBillingAgreementAttributesbillingAgreementAttributes->isSetSellerBillingAgreementId()) {
    				$parameters['BillingAgreementAttributes' . '.' . 'SellerBillingAgreementAttributes' . '.' . 'SellerBillingAgreementId'] =  $sellerBillingAgreementAttributesbillingAgreementAttributes->getSellerBillingAgreementId();
    			}
    			if ($sellerBillingAgreementAttributesbillingAgreementAttributes->isSetStoreName()) {
    				$parameters['BillingAgreementAttributes' . '.' . 'SellerBillingAgreementAttributes' . '.' . 'StoreName'] =  $sellerBillingAgreementAttributesbillingAgreementAttributes->getStoreName();
    			}
    			if ($sellerBillingAgreementAttributesbillingAgreementAttributes->isSetCustomInformation()) {
    				$parameters['BillingAgreementAttributes' . '.' . 'SellerBillingAgreementAttributes' . '.' . 'CustomInformation'] =  $sellerBillingAgreementAttributesbillingAgreementAttributes->getCustomInformation();
    			}
    		}
    	}
    
    	return $parameters;
    }
1136202
protected function getData(Request $request)
    {
        return [
            'style' => $request->get('style'),
            'type' => $request->get('type', $this->container->getParameter('sulu_media.collection.type.default')),
            'parent' => $request->get('parent'),
            'locale' => $this->getRequestParameter($request, 'locale', true),
            'title' => $request->get('title'),
            'description' => $request->get('description'),
            'changer' => $request->get('changer'),
            'creator' => $request->get('creator'),
            'changed' => $request->get('changed'),
            'created' => $request->get('created'),
        ];
    }
438316
private function _convertAuthorize($request) {
        
        $parameters = array();
        $parameters['Action'] = 'Authorize';
        if ($request->isSetSellerId()) {
            $parameters['SellerId'] =  $request->getSellerId();
        }
        if ($request->isSetAmazonOrderReferenceId()) {
            $parameters['AmazonOrderReferenceId'] =  $request->getAmazonOrderReferenceId();
        }
        if ($request->isSetAuthorizationReferenceId()) {
            $parameters['AuthorizationReferenceId'] =  $request->getAuthorizationReferenceId();
        }
        if ($request->isSetAuthorizationAmount()) {
            $authorizationAmount = $request->getAuthorizationAmount();
            if ($authorizationAmount->isSetAmount()) {
                $parameters['AuthorizationAmount' . '.' . 'Amount'] =  $authorizationAmount->getAmount();
            }
            if ($authorizationAmount->isSetCurrencyCode()) {
                $parameters['AuthorizationAmount' . '.' . 'CurrencyCode'] =  $authorizationAmount->getCurrencyCode();
            }
        }
        if ($request->isSetSellerAuthorizationNote()) {
            $parameters['SellerAuthorizationNote'] =  $request->getSellerAuthorizationNote();
        }
        if ($request->isSetOrderItemCategories()) {
            $orderItemCategories = $request->getOrderItemCategories();
            foreach  ($orderItemCategories->getOrderItemCategory() as $orderItemCategoryIndex => $orderItemCategory) {
                $parameters['OrderItemCategories' . '.' . 'OrderItemCategory' . '.'  . ($orderItemCategoryIndex + 1)] =  $orderItemCategory;
            }
        }
        if ($request->isSetTransactionTimeout()) {
            $parameters['TransactionTimeout'] =  $request->getTransactionTimeout();
        }
        if ($request->isSetCaptureNow()) {
            $parameters['CaptureNow'] =  $request->getCaptureNow() ? "true" : "false";
        }
        if ($request->isSetSoftDescriptor()) {
            $parameters['SoftDescriptor'] =  $request->getSoftDescriptor();
        }

        return $parameters;
    }
588227
public function index(SS_HTTPRequest $request)
    {
        $this->customise(
            array(
            'Title'     => _t('Users.Register', 'Register'),
            'MetaTitle' => _t('Users.Register', 'Register'),
            'Form'      => $this->RegisterForm(),
            )
        );

        $this->extend("updateIndexAction");

        return $this->renderWith(
            array(
            "Users_Register",
            "Users",
            "Page"
            )
        );
    }