@return string

@throws PaymentOrderNotFoundException
@throws CurrencyNotSupportedException
19029
public function processPayment()
    {
        $gestpayMethod = new GestpayMethod();

        /*
         * At this point, order must be created given a cart, and placed in PaymentBridge.
         *
         * So, $this->paymentBridge->getOrder() must return an object
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderLoad(
                $this->paymentBridge,
                $gestpayMethod
            );

        /*
         * Order Not found Exception must be thrown just here.
         */
        if (!$this->paymentBridge->getOrder()) {
            throw new PaymentOrderNotFoundException();
        }

        /*
         * Order exists right here.
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderCreated(
                $this->paymentBridge,
                $gestpayMethod
            );

        return $this->gestpayEncrypter->encryptedUrl();
    }
568209
public function getPayload()
    {
        $payload = $this->getService('com:subscriptions.domain.payment.payload', array(

           'order_id' => $this->orderId,
           'description' => $this->_package->name,
           'amount' => $this->getItemAmountAfterDiscount(),
           'tax_amount' => $this->getTaxAmount(),
           'payment_method' => $this->getPaymentMethod(),
           'currency' => $this->currency,

        ));

        if ($this->_package->recurring) {
            $payload->setRecurring(1, $this->_package->billingPeriod, AnDomainAttributeDate::getInstance()->getDate(DATE_FORMAT_ISO_EXTENDED));
        }

        return $payload;
    }
147567
public function getQrString()
    {
        if (!$this->swift) {
            $swift = (new IBANtoBIC($this->getIBAN()))->getBIC();
            if (is_null($swift)) {
                throw new QrPaymentException("The 'swift' option is required, please use 'setSwift(string)'", QrPaymentException::ERR_MISSING_REQUIRED_OPTION);
            }
            $this->swift = $swift;
        }

        $data = implode("\t", [
            0 => $this->internalId, // payment identifier (can be anything)
            1 => '1', // count of payments
            2 => implode("\t", [
                true, // regular payment
                round($this->amount, 2),
                $this->currency,
                $this->getDueDate()->format('Ymd'),
                $this->variableSymbol,
                $this->constantSymbol,
                $this->specificSymbol,
                '', // variable symbol, constant symbol and specific symbol in SEPA format (empty because the 3 previous are already defined)
                $this->comment,
                '1', // one target account
                $this->getIBAN(),
                $this->swift,
                '0', // standing order
                '0', // direct debit
                // can also contain other elements in this order: the payee's name, the payee's address (line 1), the payee's address (line 2)
            ]),
        ]);

        // get the crc32 of the string in binary format and prepend it to the data
        $hashedData = strrev(hash('crc32b', $data, true)) . $data;
        $xzBinary = $this->getXzBinary();

        // we need to get raw lzma1 compressed data with parameters LC=3, LP=0, PB=2, DICT_SIZE=128KiB
        $xzProcess = proc_open("${xzBinary} '--format=raw' '--lzma1=lc=3,lp=0,pb=2,dict=128KiB' '-c' '-'", [
            0 => [
                'pipe',
                'r',
            ],
            1 => [
                'pipe',
                'w',
            ],
        ], $xzProcessPipes);
        assert(is_resource($xzProcess));

        fwrite($xzProcessPipes[0], $hashedData);
        fclose($xzProcessPipes[0]);

        $pipeOutput = stream_get_contents($xzProcessPipes[1]);
        fclose($xzProcessPipes[1]);
        proc_close($xzProcess);

        // we need to strip the EOF data and prepend 4 bytes of data, first 2 bytes define document type, the other 2
        // define the length of original string, all the magic below does that
        $hashedData = bin2hex("\x00\x00" . pack('v', strlen($hashedData)) . $pipeOutput);

        $base64Data = '';
        for ($i = 0; $i < strlen($hashedData); $i++) {
            $base64Data .= str_pad(base_convert($hashedData[$i], 16, 2), 4, '0', STR_PAD_LEFT);
        }

        $length = strlen($base64Data);

        $controlDigit = $length % 5;
        if ($controlDigit > 0) {
            $count = 5 - $controlDigit;
            $base64Data .= str_repeat('0', $count);
            $length += $count;
        }

        $length = $length / 5;

        $hashedData = str_repeat('_', $length);

        // convert the resulting binary data (5 bits at a time) according to table from specification
        for ($i = 0; $i < $length; $i++) {
            $hashedData[$i] = '0123456789ABCDEFGHIJKLMNOPQRSTUV'[bindec(substr($base64Data, $i * 5, 5))];
        }

        if (!$hashedData) {
            throw new QrPaymentException('Failed to calculate hash due to unknown error.', QrPaymentException::ERR_FAILED_TO_CALCULATE_HASH);
        }

        // and that's it, this totally-not-crazy-overkill-format-that-allows-you-to-sell-your-proprietary-solution
        // process is done
        return $hashedData;
    }
766793
protected function getPaymentDateOrder()
    {
        // Take date of last payment as payment date.
        $paymentDate = null;
        foreach ($this->source->getStatusHistoryCollection() as $statusChange) {
            /** @var \Mage_Sales_Model_Order_Status_History $statusChange */
            if (!$paymentDate || $this->isPaidStatus($statusChange->getStatus())) {
                $createdAt = substr($statusChange->getCreatedAt(), 0, strlen('yyyy-mm-dd'));
                if (!$paymentDate || $createdAt < $paymentDate) {
                    $paymentDate = $createdAt;
                }
            }
        }
        return $paymentDate;
    }
1263180
public function format()
    {
        $negative = $this->isNegative();
        $value = $this->getValue();
        $amount = $negative ? -$value : $value;
        $thousands = $this->currency->getThousandsSeparator();
        $decimals = $this->currency->getDecimalMark();
        $prefix = $this->currency->getPrefix();
        $suffix = $this->currency->getSuffix();
        $value = number_format($amount, $this->currency->getPrecision(), $decimals, $thousands);

        return ($negative ? '-' : '') . $prefix . $value . $suffix;
    }
1318532
protected function prepareRequestOrderPayment()
    {
        $requestOrderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
        $request = $this->getRequest();

        $requestPaymentSetter = $this->getOrderPaymentSetter();
        $requestPaymentSetter->setRequest($request);
        $requestPaymentSetter->setRequestOrderPayment($requestOrderPayment);

        $requestOrderPayment = $requestPaymentSetter->getRequestOrderPayment();

        return $requestOrderPayment;
    }
913078
public function &GetPaymentHandler()
    {
        $oPaymentHandler = $this->GetFromInternalCache('oOrderPaymentHandler');
        if (is_null($oPaymentHandler)) {
            $oPaymentMethod = $this->GetFieldShopPaymentMethod();
            if ($oPaymentMethod) {
                $aParameter = array();
                $oPaymentParameterList = $this->GetFieldShopOrderPaymentMethodParameterList();
                while ($oParam = $oPaymentParameterList->Next()) {
                    $aParameter[$oParam->fieldName] = $oParam->fieldValue;
                }
                try {
                    $oPaymentHandler = $this->getShopPaymentHandlerFactory()->createPaymentHandler($oPaymentMethod->fieldShopPaymentHandlerId, $this->fieldCmsPortalId, $aParameter);
                    $this->SetInternalCache('oOrderPaymentHandler', $oPaymentHandler);
                } catch (ConfigurationException $e) {
                    $this->getLogger()->error(
                        sprintf('Unable to create payment handler: %s', $e->getMessage()),
                        [
                            'paymentHandlerId' => $oPaymentMethod->fieldShopPaymentHandlerId,
                            'portalId' => $this->fieldCmsPortalId,
                        ]
                    );
                }
            }
        }

        return $oPaymentHandler;
    }
237389
public function validatePayment()
    {
        $oSession = $this->_getContainer()->getSession();
        $oConfig = $this->_getContainer()->getConfig();

        //Don't do anything with order remark if we not under Amazon Pay
        if ((string)$oSession->getVariable('amazonOrderReferenceId') === ''
            || (string)$oConfig->getRequestParameter('paymentid') !== 'bestitamazon'
        ) {
            return parent::validatePayment();
        }

        // order remark
        $sOrderRemark = (string)$oConfig->getRequestParameter('order_remark', true);

        if ($sOrderRemark !== '') {
            $oSession->setVariable('ordrem', $sOrderRemark);
        } else {
            $oSession->deleteVariable('ordrem');
        }

        return parent::validatePayment();
    }
116738
public function PostProcessExternalPaymentHandlerHook()
    {
        $bPaymentTransmitOk = parent::PostProcessExternalPaymentHandlerHook();
        if ($bPaymentTransmitOk) {
            $oGlobal = TGlobal::instance();
            $aUserData = $oGlobal->GetUserData();
            $bPaymentTransmitOk = $this->GetTransactionStatus($aUserData['PAYID']);
        }

        return $bPaymentTransmitOk;
    }
664413
protected function getCurrencyArgument()
    {
        // Get the user entered value
        $value = preg_replace('/\s+/', '', $this->argument('currency'));

        // Return all currencies if requested
        if ($value === 'all') {
            return array_keys($this->currencies);
        }

        return explode(',', $value);
    }
1054134
public function getFormattedTotalOrderSum()
    {
        return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($this->oxorder__oxtotalordersum->value, $this->getOrderCurrency());
    }
522672
public function getPayPalPaymentCosts()
    {
        $amount = 0.0;

        $paymentCost = $this->getCosts('oxpayment');
        if ($paymentCost) {
            $amount = $this->isCalculationModeNetto() ? $paymentCost->getNettoPrice() : $paymentCost->getBruttoPrice();
        }

        return $amount;
    }
1343624
public function request()
    {
        //load payments by date
        $this->getPagSeguroAbandoned();

        if ($this->_PagSeguroPaymentList->getTransactions()) {
            foreach ($this->_PagSeguroPaymentList->getTransactions() as $payment) {
                date_default_timezone_set('UTC');
                $order = \UOL\PagSeguro\Helper\Data::getReferenceDecryptOrderID($payment->getReference());
                $order = $this->_order->load($order);
                if ($this->getStoreReference() == \UOL\PagSeguro\Helper\Data::getReferenceDecrypt(
                        $payment->getReference())
                ) {
                    if (!is_null($this->_session->getData('store_id'))) {
                        array_push($this->_arrayPayments, $this->build($payment, $order));
                    }
                    if ($order) {
                        array_push($this->_arrayPayments, $this->build($payment, $order));
                    }
                }
            }
        }
        date_default_timezone_set($this->_timezone->getConfigTimezone());

        return $this->_arrayPayments;
    }
1194260
protected function userPayment()
    {
        $ReturningParams = Input::get('ReturningParams');
        $ReturningParams = $this->decrypt($ReturningParams);

        $paramsArray = explode(",", $ReturningParams);
        $Amount = $paramsArray[0];
        $SaleOrderId = $paramsArray[1];
        $RefId = $paramsArray[2];
        $ResCode = $paramsArray[3];
        $ResMessage = $paramsArray[4];
        $PayGateTranID = $paramsArray[5];
        $RRN = $paramsArray[6];
        $LastFourDigitOfPAN = $paramsArray[7];


        $this->trackingCode = $PayGateTranID;
        $this->cardNumber = $LastFourDigitOfPAN;
        $this->refId = $RefId;


        if ($ResCode == '0' || $ResCode == '00') {
            return true;
        }

        $this->transactionFailed();
        $this->newLog($ResCode, $ResMessage . " - " . AsanpardakhtException::getMessageByCode($ResCode));
        throw new AsanpardakhtException($ResCode);
    }
1221616
public function getPaymentMethodInstance()
    {
        if (is_null($this->_paymentMethodInstance)) {
            $methodCode = $this->getMethodCode();
            if ($this->getMethodCode() == 'adyen_oneclick') {
                $referenceId = $this->getReferenceId();
                $methodInstanceName = $methodCode . "_" . $referenceId;
            } else {
                $methodInstanceName = $methodCode;
            }

            $this->_paymentMethodInstance = Mage::helper('payment')->getMethodInstance($methodInstanceName);

            if (!$this->_paymentMethodInstance) {
                $this->_paymentMethodInstance = Mage::helper('payment')->getMethodInstance($this->getMethodCode());
            }
        }

        if ($this->_paymentMethodInstance) {
            $this->_paymentMethodInstance->setStore($this->getStoreId());
        }

        return $this->_paymentMethodInstance;
    }
748743
public function getOrderPaymentSetter()
    {
        if (is_null($this->payPalIPNPaymentSetter)) {
            $payPalIPNPaymentSetter = oxNew(\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::class);
            $this->setOrderPaymentSetter($payPalIPNPaymentSetter);
        }

        return $this->payPalIPNPaymentSetter;
    }
265499
public function orderFormAction()
    {
        return $this->render(
            'SuluSalesOrderBundle:Template:order.form.html.twig',
            array(
                'systemUser' => $this->getSystemUserArray(),
                'termsOfPayment' => $this->getTermsArray(self::$termsOfPaymentEntityName),
                'termsOfDelivery' => $this->getTermsArray(self::$termsOfDeliveryEntityName),
                'orderStatus' => $this->getOrderStatus(),
                'currencies' => $this->getCurrencies($this->getUser()->getLocale()),
                'customerId' => Account::TYPE_CUSTOMER,
            )
        );
    }