Perform the authorize call for the order

@param float $authorizationAmount amount to authorize from the buyer

@return string amazonAuthorizationId amazon generated authorization rest
id reference
349453
private function _authorizeOrderAmount($authorizationAmount)
    {
        $response = $this->callStepAndCheckForException(
            'authorizeOrderAmount',
            array($authorizationAmount, $this->currencyCode)
        );
        
        $this->printResponseToWebpage(
            "printAuthorizeResponse", array($response)
        );
        
        return getAmazonAuthorizationIdFromAuthorizeResponse($response);
    }
1113386
public function getAuthorization(string $authCorpId, string $permanentCode)
    {
        $params = [
            'auth_corpid' => $authCorpId,
            'permanent_code' => $permanentCode,
        ];

        return $this->httpPostJson('cgi-bin/service/get_auth_info', $params);
    }
1014688
public function captureOrderAmount($captureAmount, $amazonAuthorizationId)
    {
        $captureRequest = new OffAmazonPaymentsService_Model_CaptureRequest();
        $captureRequest->setSellerId($this->_sellerId);
        $captureRequest->setAmazonAuthorizationId($amazonAuthorizationId);
        $captureRequest->setCaptureReferenceId($this->_captureReferenceId);
        $captureRequest->setCaptureAmount(new OffAmazonPaymentsService_Model_Price());
        $captureRequest->getCaptureAmount()->setAmount($captureAmount);
        $captureRequest->getCaptureAmount()->setCurrencyCode($this->_service->getMerchantValues()->getCurrency());
         
        return $this->_service->capture($captureRequest);
    }
1354673
public function newAuthorizeRequest($owner, $owner_id, $options)
  {
    return $this->authServer->getGrantType('authorization_code')->newAuthoriseRequest($owner, $owner_id, $options);
  }
122701
public function checkAuthorization($authorization, $client_id, $access_token) {
        $instance = new checkAuthorization($this, $this->getUserAgent(), $authorization, $client_id, $access_token);
        return $instance;
    }
635945
public function processAuthorization(oxOrder $oOrder, stdClass $oAuthorizationDetails)
    {
        $oAuthorizationStatus = $oAuthorizationDetails->AuthorizationStatus;

        //Update Order with primary response info
        $oOrder->assign(array('oxtransstatus' => 'AMZ-Authorize-'.$oAuthorizationStatus->State));
        $oOrder->save();

        // Handle Declined response
        if ($oAuthorizationStatus->State === 'Declined'
            && $this->getConfig()->getConfigParam('sAmazonMode') === bestitAmazonPay4OxidClient::OPTIMIZED_FLOW
        ) {
            switch ($oAuthorizationStatus->ReasonCode) {
                case "InvalidPaymentMethod":
                    /** @var bestitAmazonPay4Oxid_oxEmail $oEmail */
                    $oEmail = $this->getObjectFactory()->createOxidObject('oxEmail');
                    $oEmail->sendAmazonInvalidPaymentEmail($oOrder);
                    break;
                case "AmazonRejected":
                    /** @var bestitAmazonPay4Oxid_oxEmail $oEmail */
                    $oEmail = $this->getObjectFactory()->createOxidObject('oxEmail');
                    $oEmail->sendAmazonRejectedPaymentEmail($oOrder);
                    $this->closeOrderReference($oOrder, array(), false);
                    break;
                default:
                    $this->closeOrderReference($oOrder, array(), false);
            }
        }

        //Authorize handling was selected Direct Capture after Authorize and Authorization status is Open
        if ($oAuthorizationStatus->State === 'Open'
            && $this->getConfig()->getConfigParam('sAmazonCapture') === 'DIRECT'
        ) {
            $this->capture($oOrder);
        }
    }
1077839
public function getAuthorizationEndpoint()
    {
        // Parse the endpoint.
        $parsedEndpoint = collect(parse_url($this->endpoint));

        // Return auth url.
        return $parsedEndpoint->get('scheme').'://'.$parsedEndpoint->get('host').'/authorization/api/';
    }
269461
public function authorize($oOrder = null, $aRequestParameters = array(), $blForceSync = false)
    {
        $sMode = $this->getConfig()->getConfigParam('sAmazonMode');
        $aRequestParameters['transaction_timeout'] =
            ($sMode === bestitAmazonPay4OxidClient::BASIC_FLOW || $blForceSync) ? 0 : 1440;

        $oData = $this->_callOrderRequest(
            'authorize',
            $oOrder,
            $aRequestParameters,
            array(
                'amazon_order_reference_id',
                'authorization_amount',
                'currency_code',
                'authorization_reference_id',
                'seller_authorization_note'
            ),
            $blProcessable
        );

        //Update Order info
        if ($blProcessable === true
            && isset($oData->AuthorizeResult->AuthorizationDetails->AuthorizationStatus->State)
        ) {
            $oDetails = $oData->AuthorizeResult->AuthorizationDetails;
            $oOrder->assign(array(
                'bestitamazonauthorizationid' => $oDetails->AmazonAuthorizationId,
                'oxtransstatus' => 'AMZ-Authorize-'.$oDetails->AuthorizationStatus->State
            ));
            $oOrder->save();
        }

        return $oData;
    }
663617
public function authorize(Varien_Object $payment, $amount)
    {
        parent::authorize($payment, $amount);
        $payment->setLastTransId($this->getTransactionId())->setIsTransactionPending(true);

        /** @var Mage_Sales_Model_Order $order */
        $order = $payment->getOrder();
        $amount = $order->getGrandTotal();

        // check if a zero auth should be done for this order
        $useZeroAuth = (bool)Mage::helper('adyen')->getConfigData('use_zero_auth', null, $order->getStoreId());
        $zeroAuthDateField = Mage::helper('adyen')->getConfigData(
            'base_zero_auth_on_date', null,
            $order->getStoreId()
        );

        if ($useZeroAuth) { // zero auth should be used
            // only orders that are scheduled to be captured later than
            // the auth valid period use zero auth
            // the period is 7 days since this works for most payment methods
            $scheduledDate = strtotime($order->getData($zeroAuthDateField));
            if ($scheduledDate > strtotime("+7 days")) { // scheduled date is higher than now + 7 days
                $amount = 0; // set amount to 0 for zero auth
            }
        }

        /*
         * ReserveOrderId for this quote so payment failed notification
         * does not interfere with new successful orders
         */
        $incrementId = $order->getIncrementId();
        $quoteId = $order->getQuoteId();
        $quote = Mage::getModel('sales/quote')
            ->load($quoteId)
            ->setReservedOrderId($incrementId)
            ->save();

        // by zero authentication payment is authorised when api responds is succesfull
        if ($order->getGrandTotal() == 0) {
            $payment->setIsTransactionPending(false);
        }

        /*
         * Do not send a email notification when order is created.
         * Only do this on the AUHTORISATION notification.
         * For Boleto and Multibanco send it on order creation
         */
        if (!in_array($this->getCode(), array('adyen_boleto', 'adyen_multibanco'))) {
            $order->setCanSendNewEmailFlag(false);
        }

        if ($this->getCode() == 'adyen_boleto' || $this->getCode() == 'adyen_cc' || substr(
            $this->getCode(), 0,
            14
        ) == 'adyen_oneclick' || $this->getCode() == 'adyen_sepa' || $this->getCode() == 'adyen_apple_pay' || $this->getCode() == 'adyen_multibanco') {
            if (substr($this->getCode(), 0, 14) == 'adyen_oneclick') {
                // set payment method to adyen_oneclick otherwise backend can not view the order
                $payment->setMethod("adyen_oneclick");

                $recurringDetailReference = $payment->getAdditionalInformation("recurring_detail_reference");

                // load agreement based on reference_id (option to add an index on reference_id in database)
                $agreement = Mage::getModel('sales/billing_agreement')->load($recurringDetailReference, 'reference_id');

                // agreement could be a empty object
                if ($agreement && $agreement->getAgreementId() > 0 && $agreement->isValid()) {
                    $agreement->addOrderRelation($order);
                    $agreement->setIsObjectChanged(true);
                    $order->addRelatedObject($agreement);
                    $message = Mage::helper('adyen')->__(
                        'Used existing billing agreement #%s.',
                        $agreement->getReferenceId()
                    );

                    $comment = $order->addStatusHistoryComment($message);
                    $order->addRelatedObject($comment);
                }
            }

            $_authorizeResponse = $this->_processRequest($payment, $amount, "authorise");
        }

        return $this;
    }
189136
public static function getPaymentFinalCurrencyValue($orderAmount) {

        // Get the object manager
        $manager = \Magento\Framework\App\ObjectManager::getInstance();
         
        // Load the gateway config and get the gateway payment currency
        $gatewayPaymentCurrency = $manager->create('CheckoutCom\Magento2\Gateway\Config\Config')->getPaymentCurrency();

        // Get the storoe id
        $storeId = $manager->create('Magento\Checkout\Model\Session')->getQuote()->getStoreId();

        // Get the user currency display
        $quote = $manager->create('Magento\Checkout\Model\Session')->getQuote();
        $order = $manager->create('Magento\Checkout\Model\Session')->getLastRealOrder();
        if ($quote) {
            $userCurrencyCode = $quote->getQuoteCurrencyCode();
        }
        else if ($order) {
            $userCurrencyCode = $quote->getOrderCurrencyCode();
        }
        else {
            $userCurrencyCode = $manager->create('Magento\Store\Model\StoreManagerInterface')->getStore($storeId)->getCurrentCurrencyCode();
        }

        // Load the store currency
        $storeBaseCurrencyCode = $manager->create('Magento\Store\Model\StoreManagerInterface')->getStore($storeId)->getBaseCurrency()->getCode(); 
 
        // Test the store and gateway config conditions
        if ($gatewayPaymentCurrency == self::BASE_CURRENCY) {

            if ($userCurrencyCode == $storeBaseCurrencyCode) {

                // Convert the user currency amount to base currency amount
                $finalAmount = $orderAmount / $manager->create('Magento\Directory\Model\CurrencyFactory')->create()->load($storeBaseCurrencyCode)->getAnyRate($userCurrencyCode);      
            }
            else {
                $finalAmount = $orderAmount;        
            }

        }
        elseif ($gatewayPaymentCurrency == self::ORDER_CURRENCY) {

            if ($userCurrencyCode != $storeBaseCurrencyCode) {

                $finalAmount = $orderAmount * $manager->create('Magento\Directory\Model\CurrencyFactory')->create()->load($storeBaseCurrencyCode)->getAnyRate($userCurrencyCode);            
            } else {
                // Convert the base amount to user currency amount
                $finalAmount = $orderAmount;        
            }
        }
        else {

            if ($userCurrencyCode != $gatewayPaymentCurrency) {
                // We have a specific currency to use for the payment
                $finalAmount = $orderAmount * $manager->create('Magento\Directory\Model\CurrencyFactory')->create()->load($userCurrencyCode)->getAnyRate($gatewayPaymentCurrency);
            } else {
               
               $finalAmount = $orderAmount * $manager->create('Magento\Directory\Model\CurrencyFactory')->create()->load($storeBaseCurrencyCode)->getAnyRate($gatewayPaymentCurrency);
            }
        }

        return $finalAmount;
    }
973691
public function chargeAuthorization($body)
    {
        $request = $this->paystackHttpClient->post(
            Resource::CHARGE_AUTHORIZATION,
            [
                'body'  => is_array($body) ? $this->toJson($body) : $body,
            ]
        );

        return $this->processResourceRequestResponse($request);
    }
1306141
private function authorization_from($response)
  {
      if (isset($response['TRANSACTIONID'])) {
          return $response['TRANSACTIONID'];
      }
      if (isset($response['AUTHORIZATIONID'])) {
          return $response['AUTHORIZATIONID'];
      }
      if (isset($response['REFUNDTRANSACTIONID'])) {
          return $response['REFUNDTRANSACTIONID'];
      }

      return false;
  }
688016
public function completeAuthorizationRequest(AuthorizationRequest $authRequest, ResponseInterface $response)
    {
        return $this->enabledGrantTypes[$authRequest->getGrantTypeId()]
            ->completeAuthorizationRequest($authRequest)
            ->generateHttpResponse($response);
    }
818236
public function getAuthorizationBearer() {
        $allHeaders = array_change_key_case(parent::getHeaders(), CASE_UPPER);

        if (array_key_exists('AUTHORIZATION', $allHeaders)) {
            if (preg_match('/Bearer\s(\S+)/', $allHeaders['AUTHORIZATION'], $matches)) {
                return $matches[1];
            }
        } else {
            throw new \Exception(ExceptionMessages::AUTH_BEARER_NOT_FOUND);
        }
    }
1308437
public function authorize($amount = null)
    {
        if (is_null($amount)) {
            $amount = $this->getAmount()->total;
        }
        $path = sprintf('/%s/%s?payment_id=%s&amount=%s', self::SIMULATOR_PATH, 'authorize', $this->getId(), $amount);
        $response = $this->httpRequest($path, Requests::GET);

        if (empty($response)) {
            return true;
        }

        return false;
    }
197289
public function mapPaymentToPreAuthorization(SpyPaymentPayone $paymentEntity): AuthorizationContainerInterface
    {
        $preAuthorizationContainer = new PreAuthorizationContainer();
        $preAuthorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $preAuthorizationContainer);
        $preAuthorizationContainer = $this->mapEmail($paymentEntity, $preAuthorizationContainer);
        $preAuthorizationContainer = $this->mapAmount($paymentEntity, $preAuthorizationContainer);
        $preAuthorizationContainer = $this->mapBusinessRelation($preAuthorizationContainer);

        return $preAuthorizationContainer;
    }
426793
function DoAuthorization($txnID, $amount = 0, $currency = 'USD', $entity = 'Order') {
    $values['TRANSACTIONID'] = $txnID;
    $values['AMT'] = number_format($amount, 2, '.', ',');
    $values['TRANSACTIONENTITY'] = $entity;
    $values['CURRENCYCODE'] = $currency;
    return $this->_request($values, 'DoAuthorization');
  }