Payment execution.

@return Response
508928
public function executeAction()
    {
        /**
         * The execute action will generate the Redsys
         * checkout form before redirecting
         */
        $formView = $this
            ->redsysManager
            ->processPayment();

        return new Response(
            $this
                ->templatingEngine
                ->render('RedsysBundle:Redsys:process.html.twig', [
                    'redsys_form' => $formView,
                ])
        );
    }
348355
public function getTransactionTotals()
    {
        $request = $this->paystackHttpClient->get(
            Resource::GET_TRANSACTION_TOTALS
        );

        return $this->processResourceRequestResponse($request);
    }
773931
protected function processResponse()
    {
        if ($this->response->isSuccessful()) {
            $this->updateOrderStatus();
            $this->addTransaction();
            $this->redirectSuccess();
        } else if ($this->response->isRedirect()) {
            $this->response->redirect();
        } else {
            $this->controller->redirect('', $this->response->getMessage(), 'warning', true);
        }
    }
360251
public function payments()
    {
        if (!isset($this->payments)) {
            $this->payments = new Services\PaymentsService($this->api_client);
        }

        return $this->payments;
    }
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;
    }
990055
public function execute()
    {
        $lastRealOrder = $this->_checkoutSession->getLastRealOrder();

        if (is_null($lastRealOrder->getPayment())) {
            throw new \Magento\Framework\Exception\NotFoundException(__('No order associated.'));
        }

        $paymentData = $lastRealOrder->getPayment()->getData();

        if ($paymentData['method'] === 'pagseguro_boleto') {
            try {
                $this->orderId = $lastRealOrder->getId();
                if (is_null($this->orderId)) {
                    throw new \Exception("There is no order associated with this session.");
                }

                if (! isset($paymentData['additional_information']['boleto_document'])
                    || ! isset($paymentData['additional_information']['hash'])) {
                    throw new \Exception("Error passing data from checkout page to pagseguro Request Controller");
                }

                $this->order = $this->loadOrder($this->orderId);
                /** @var \UOL\PagSeguro\Model\Direct\BoletoMethod $boleto */
                $boleto = new BoletoMethod(
                    $this->_objectManager->create('Magento\Directory\Api\CountryInformationAcquirerInterface'),
                    $this->_objectManager->create('Magento\Framework\App\Config\ScopeConfigInterface'),
                    $this->_objectManager->create('Magento\Framework\Module\ModuleList'),
                    $this->order,
                    $this->_objectManager->create('UOL\PagSeguro\Helper\Library'),
                    $data = [
                        'sender_document' => $this->helperData()->formatDocument($paymentData['additional_information']['boleto_document']),
                        'sender_hash' => $paymentData['additional_information']['hash'],
                        'order_id' => $this->orderId
                    ]
                );
                $this->placeOrder($boleto, $paymentData['method']);
                return $this->_redirect(sprintf('%s%s', $this->baseUrl(), 'pagseguro/direct/success'));
            } catch (\Exception $exception) {
                if (!is_null($this->order)) {
                    $this->changeOrderHistory('pagseguro_cancelada');
                }
                $this->pagseguroLogger($exception->getMessage());
                $this->clearSession();
                $this->whenError($exception->getMessage());
                return $this->_redirect(sprintf('%s%s', $this->baseUrl(), 'pagseguro/payment/failure'));
            }
        }

        if ($paymentData['method'] === 'pagseguro_online_debit') {
            try {
                $this->orderId = $lastRealOrder->getId();

                if (is_null($this->orderId)) {
                    throw new \Exception("There is no order associated with this session.");
                }
                
                if (!isset($paymentData['additional_information']['online_debit_document'])
                    || ! isset($paymentData['additional_information']['hash'])
                    || ! isset($paymentData['additional_information']['online_debit_bank'])
                    ) {
                    throw new \Exception("Error passing data from checkout page to pagseguro Request Controller");
                }
                $this->order = $this->loadOrder($this->orderId);
                /** @var \UOL\PagSeguro\Model\Direct\DebitMethod $debit */

                $debit = new DebitMethod(
                    $this->_objectManager->create('Magento\Directory\Api\CountryInformationAcquirerInterface'),
                    $this->_objectManager->create('Magento\Framework\App\Config\ScopeConfigInterface'),
                    $this->_objectManager->create('Magento\Framework\Module\ModuleList'),
                    $this->order,
                    $this->_objectManager->create('UOL\PagSeguro\Helper\Library'),
                    $data = [
                        'sender_document' => $this->helperData()->formatDocument($paymentData['additional_information']['online_debit_document']),
                        'sender_hash' => $paymentData['additional_information']['hash'],
                        'bank_name' => $paymentData['additional_information']['online_debit_bank'],
                        'order_id' => $this->orderId
                    ]
                );
                $this->placeOrder($debit, $paymentData['method']);
                return $this->_redirect(sprintf('%s%s', $this->baseUrl(), 'pagseguro/direct/success'));
            } catch (\Exception $exception) {
                $this->pagseguroLogger($exception->getMessage());
                if (!is_null($this->order)) {
                    $this->changeOrderHistory('pagseguro_cancelada');
                }
                $this->clearSession();
                $this->whenError($exception->getMessage());
                return $this->_redirect(sprintf('%s%s', $this->baseUrl(), 'pagseguro/payment/failure'));
            }
        }

         if ($paymentData['method'] === 'pagseguro_credit_card') {
            try {
                $this->orderId = $lastRealOrder->getId();

                if (is_null($this->orderId)) {
                    throw new \Exception("There is no order associated with this session.");
                }

                if (!isset($paymentData['additional_information']['credit_card_document'])
                    || ! isset($paymentData['additional_information']['hash'])
                    || ! isset($paymentData['additional_information']['credit_card_token'])
                    || ! isset($paymentData['additional_information']['credit_card_holder_name'])
                    || ! isset($paymentData['additional_information']['credit_card_holder_birthdate'])
                    || ! isset($paymentData['additional_information']['credit_card_installment'])
                    || ! isset($paymentData['additional_information']['credit_card_installment_value'])
                    ) {
                    throw new \Exception("Error passing data from checkout page to pagseguro Request Controller");
                }
                $this->order = $this->loadOrder($this->orderId);
                /** @var \UOL\PagSeguro\Model\Direct\CreditCardMethod $creditCard */

                $creditCard = new CreditCardMethod(
                    $this->_objectManager->create('Magento\Directory\Api\CountryInformationAcquirerInterface'),
                    $this->_objectManager->create('Magento\Framework\App\Config\ScopeConfigInterface'),
                    $this->_objectManager->create('Magento\Framework\Module\ModuleList'),
                    $this->order,
                    $this->_objectManager->create('UOL\PagSeguro\Helper\Library'),
                    $data = [
                        'sender_document' => $this->helperData()->formatDocument($paymentData['additional_information']['credit_card_document']),
                        'sender_hash' => $paymentData['additional_information']['hash'],
                        'order_id' => $this->orderId,
                        'installment' => [
                            'quantity' => $paymentData['additional_information']['credit_card_installment'],
                            'amount'   => $paymentData['additional_information']['credit_card_installment_value']
                        ],
                        'token' => $paymentData['additional_information']['credit_card_token'],
                        'holder' => [
                            'name'       => $paymentData['additional_information']['credit_card_holder_name'],
                            'birth_date' => $paymentData['additional_information']['credit_card_holder_birthdate'],

                        ]
                    ]
                );
                $this->placeOrder($creditCard, $paymentData['method']);
                return $this->_redirect(sprintf('%s%s', $this->baseUrl(), 'pagseguro/direct/success'));
            } catch (\Exception $exception) {
                $this->pagseguroLogger($exception->getMessage());
                if (!is_null($this->order)) {
                    $this->changeOrderHistory('pagseguro_cancelada');
                }
                $this->clearSession();
                $this->whenError($exception->getMessage());
                return $this->_redirect(sprintf('%s%s', $this->baseUrl(), 'pagseguro/payment/failure'));
            }
        }

        try {
            return $this->_redirect($this->_payment->createPaymentRequest());
        } catch (\Exception $exception) {
            /** @var \Magento\Sales\Model\Order $order */
            $order = $this->_objectManager->create('\Magento\Sales\Model\Order')->load(
                $this->_checkoutSession->getLastRealOrder()->getId()
            );
            /** change payment status in magento */
            $order->addStatusToHistory('pagseguro_cancelada', null, true);
            /** save order */
            $order->save();

            return $this->_redirect('pagseguro/payment/failure');
        }
    }
1343006
public function execute()
    {
        parent::execute();

        $xml = new DOMDocument();
        $hpsTransaction = $xml->createElement('hps:Transaction');
        $hpsPosCreditCPCEdit = $xml->createElement('hps:CreditCPCEdit');
        $hpsPosCreditCPCEdit->appendChild($xml->createElement('hps:GatewayTxnId', $this->transactionId));
        $hpsPosCreditCPCEdit->appendChild($this->service->_hydrateCPCData($this->cpcData, $xml));
        $hpsTransaction->appendChild($hpsPosCreditCPCEdit);

        return $this->service->_submitTransaction($hpsTransaction, 'CreditCPCEdit');
    }
176939
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);
        $this->logger->info("Ecommpay order #{$request->getFirstModel()->getOrder()->getNumber()} have paid");
        throw new HttpResponse('OK');
    }
1356039
public function run()
	{
		$context = $this->getContext();
		$config = $context->getConfig();
		$logger = $context->getLogger();

		/** controller/common/subscription/process/processors
		 * List of processor names that should be executed for subscriptions
		 *
		 * For each subscription a number of processors for different tasks can be executed.
		 * They can for example add a group to the customers' account during the customer
		 * has an active subscribtion.
		 *
		 * @param array List of processor names
		 * @since 2018.04
		 * @category Developer
		 * @see controller/common/subscription/process/payment-status
		 * @see controller/common/subscription/process/payment-days
		 */
		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );

		/** controller/common/subscription/process/payment-status
		 * Minimum payment status that will activate the subscription
		 *
		 * Subscriptions will be activated if the payment status of the order is
		 * at least the configured payment constant. The default payment status
		 * is "authorized" so orders with a payment status of "authorized" (5) and
		 * "received" (6) will cause the subscription to be activated. Lower
		 * payment status values, e.g. "pending" (4) won't activate the subscription.
		 *
		 * @param integer Payment status constant
		 * @since 2018.07
		 * @category Developer
		 * @category User
		 * @see controller/common/subscription/process/processors
		 * @see controller/common/subscription/process/payment-days
		 */
		$status = \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED;
		$status = $config->get( 'controller/common/subscription/process/payment-status', $status );

		/** controller/common/subscription/process/payment-days
		 * Number of days to wait for the payment until subscription is removed
		 *
		 * Subscriptions wait for the confiugrable number of days until the payment
		 * status changes to a valid payment (by default: "authorized" and "received").
		 * If the payment arrives within this time frame, the subscription is activated.
		 * Otherwise, the subscription is removed from the list of subscriptions that
		 * will be checked for activation.
		 *
		 * @param float Number of days
		 * @since 2018.07
		 * @category Developer
		 * @category User
		 * @see controller/common/subscription/process/processors
		 * @see controller/common/subscription/process/payment-status
		 */
		$days = (float) $config->get( 'controller/common/subscription/process/payment-days', 3 );


		$processors = $this->getProcessors( $names );
		$orderManager = \Aimeos\MShop::create( $context, 'order' );
		$manager = \Aimeos\MShop::create( $context, 'subscription' );

		$search = $manager->createSearch( true );
		$expr = [
			$search->compare( '==', 'subscription.datenext', null ),
			$search->getConditions(),
		];
		$search->setConditions( $search->combine( '&&', $expr ) );
		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );

		$date = date( 'Y-m-d H:i:s', time() - 86400 * $days );
		$start = 0;

		do
		{
			$ordBaseIds = $payStatus = [];

			$search->setSlice( $start, 100 );
			$items = $manager->searchItems( $search );

			foreach( $items as $item ) {
				$ordBaseIds[] = $item->getOrderBaseId();
			}

			$orderSearch = $orderManager->createSearch()->setSlice( 0, $search->getSliceSize() );
			$orderSearch->setConditions( $orderSearch->compare( '==', 'order.base.id', $ordBaseIds ) );
			$orderSearch->setSortations( [$orderSearch->sort( '+', 'order.id' )] );

			foreach( $orderManager->searchItems( $orderSearch ) as $orderItem ) {
				$payStatus[$orderItem->getBaseId()] = $orderItem->getPaymentStatus();
			}

			foreach( $items as $item )
			{
				try
				{
					if( isset( $payStatus[$item->getOrderBaseId()] ) && $payStatus[$item->getOrderBaseId()] >= $status )
					{
						foreach( $processors as $processor ) {
							$processor->begin( $item );
						}

						$interval = new \DateInterval( $item->getInterval() );
						$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
					}
					elseif( $item->getTimeCreated() < $date )
					{
						$item->setStatus( 0 );
					}

					$manager->saveItem( $item );
				}
				catch( \Exception $e )
				{
					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
					$logger->log( $e->getTraceAsString() );
				}
			}

			$count = count( $items );
			$start += $count;
		}
		while( $count === $search->getSliceSize() );
	}
1369908
public function process()
	{
		$view = $this->getView();

		try
		{
			$context = $this->_getContext();
			$basketCtrl = Controller_Frontend_Factory::createController( $context, 'basket' );

			// only start if there's something to do
			if( ( $serviceId = $view->param( 'c-payment-option', null ) ) !== null )
			{
				$serviceCtrl = Controller_Frontend_Factory::createController( $context, 'service' );

				$attributes = $view->param( 'c-payment/' . $serviceId, array() );
				$errors = $serviceCtrl->checkServiceAttributes( 'payment', $serviceId, $attributes );

				foreach( $errors as $key => $msg )
				{
					if( $msg === null ) {
						unset( $errors[$key] );
					}
				}

				if( count( $errors ) === 0 ) {
					$basketCtrl->setService( 'payment', $serviceId, $attributes );
				} else {
					$view->standardStepActive = 'payment';
				}

				$view->paymentError = $errors;
			}


			parent::process();


			// Test if payment service is available
			$services = $basketCtrl->get()->getServices();
			if( !isset( $view->standardStepActive ) && !array_key_exists( 'payment', $services ) )
			{
				$view->standardStepActive = 'payment';
				return false;
			}
		}
		catch( Exception $e )
		{
			$view->standardStepActive = 'payment';
			throw $e;
		}
	}
1254932
public function processPayment()
    {
        $bankwireMethod = $this
            ->methodFactory
            ->create();

        /**
         * 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,
                $bankwireMethod
            );

        /**
         * 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,
                $bankwireMethod
            );

        /**
         * Payment paid done.
         *
         * Paid process has ended ( No matters result )
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderDone(
                $this->paymentBridge,
                $bankwireMethod
            );

        return $this;
    }
1147248
public function processAction()
    {
        try {
            /** @var \OxidEsales\PayPalModule\Core\Request $request */
            $request = oxNew(\OxidEsales\PayPalModule\Core\Request::class);
            $action = $request->getRequestParameter('action');

            $order = $this->getEditObject();

            /** @var \OxidEsales\PayPalModule\Model\Action\OrderActionFactory $actionFactory */
            $actionFactory = oxNew(\OxidEsales\PayPalModule\Model\Action\OrderActionFactory::class, $request, $order);
            $action = $actionFactory->createAction($action);

            $action->process();
        } catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) {
            $this->_aViewData["error"] = $exception->getMessage();
        }
    }
955038
public function execute() {
        // Get the request parameters
        $params = $this->getRequest()->getParams();

        // Get the quote
        $quote = $this->checkoutSession->getQuote();

        // Check for guest user quote
        if ($this->customerSession->isLoggedIn() === false)
        {
            $quote = $this->helper->prepareGuestQuote($quote);
        }
        
        // Send the charge request
        $success = $this->tokenChargeService->sendApplePayChargeRequest($params, $quote);

        // If charge is successful, create order
        if ($success) {
            $orderId = $this->createOrder($quote);
        }

        return $this->resultJsonFactory->create()->setData([
            'status' => $success
        ]);
    }
64839
public function execute()
    {
        $aClientConfig   = [
            'base_uri'        => $this->sBaseUri,
            'verify'          => !(Environment::is(Environment::ENV_DEV) || Environment::is(Environment::ENV_TEST)),
            'allow_redirects' => Environment::not(Environment::ENV_TEST),
            'http_errors'     => Environment::not(Environment::ENV_TEST),
        ];
        $aRequestOptions = [
            'headers' => $this->aHeaders,
        ];

        $this->compile($aClientConfig, $aRequestOptions);

        $oClient = Factory::factory('HttpClient', '', $aClientConfig);

        return Factory::factory(
            'HttpResponse',
            '',
            $oClient->request(static::HTTP_METHOD, $this->sPath, $aRequestOptions)
        );
    }
1237093
public function request()
    {
        $this->getTransactions();
        if (! is_null($this->_PagSeguroPaymentList->getTransactions())) {

            foreach ($this->_PagSeguroPaymentList->getTransactions() as $payment) {
                if (! $this->addPayment($this->decryptOrderById($payment), $payment))
                    continue;
            }
        }
        return $this->_arrayPayments;
    }
250313
public function paymentSuccessful() {
    if ($this->requestMethod->getTransactionSuccessfulCode() != NULL) {
      return $this->requestMethod->getTransactionSuccessfulCode() == $this->notifyParams['gcResultPayment'];
    }

    return FALSE;
  }
1015181
public function execute()
    {
        $this->getFields();
        $this->getPagination();
        $this->getHighlight();
        $this->getSuggest();
        $this->getAggregations();
        $this->getSort();
        $this->getPayload();

        $params = [
            'index' => Utils::findKey($this->options, 'index', false) ?: $this->proxy->getIndex()->getName(),
            'type' => Utils::findKey($this->options, 'type', false) ?: $this->proxy->getType(),
            'body' => $this->payload
        ];

        return new Response($this->proxy->getModel(), $this->proxy->getClient()->search($params));
    }