Call the payment method of the payment module of the given order

@param OrderPaymentEvent $event

@throws \RuntimeException if no payment module can be found.
343473
public function pay(OrderPaymentEvent $event)
    {
        $order = $event->getOrder();

        /* call pay method */
        if (null === $paymentModule = ModuleQuery::create()->findPk($order->getPaymentModuleId())) {
            throw new \RuntimeException(
                Translator::getInstance()->trans(
                    "Failed to find a payment Module with ID=%mid for order ID=%oid",
                    [
                        "%mid" => $order->getPaymentModuleId(),
                        "%oid" => $order->getId()
                    ]
                )
            );
        }

        $paymentModuleInstance = $paymentModule->getPaymentModuleInstance($this->container);

        $response = $paymentModuleInstance->pay($order);

        if (null !== $response && $response instanceof Response) {
            $event->setResponse($response);
        }
    }
1191152
@SuppressWarnings("unused")
    @Override
    public void onPaymentSuccess(String razorpayPaymentID) {
        try {
            Toast.makeText(this, "Payment Successful: " + razorpayPaymentID, Toast.LENGTH_SHORT).show();
        } catch (Exception e) {
            Log.e(TAG, "Exception in onPaymentSuccess", e);
        }
    }
1126851
public function createOrderCouponByCoupon(OrderCouponOnApplyEvent $event)
    {
        $orderCoupon = $this
            ->couponToOrderCouponTransformer
            ->createOrderCouponByCoupon(
                $event->getOrder(),
                $event->getCoupon()
            );

        $event->setOrderCoupon($orderCoupon);
    }
205497
public function sendConfirmationEmail(OrderEvent $event)
    {
        if ($event->getOrder()->getPaymentModuleId() === Cheque::getModuleId()) {

            if ($event->getOrder()->isPaid()) {

                $order = $event->getOrder();

                $this->mailer->sendEmailToCustomer(
                    'order_confirmation_cheque',
                    $order->getCustomer(),
                    [
                        'order_id' => $order->getId(),
                        'order_ref' => $order->getRef()
                    ]
                );
            }
        }
    }
476917
public static function SetExecutePaymentInterrupt($bActive)
    {
        if ($bActive) {
            $_SESSION[TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG] = '1';
        } else {
            if (array_key_exists(TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG, $_SESSION)) {
                $_SESSION[TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG] = '0';
                unset($_SESSION[TdbShopPaymentHandler::CONTINUE_PAYMENT_EXECUTION_FLAG]);
            }
        }
    }
692683
public void order_orderId_pay_POST(Long orderId, OvhPayWithPaymentMethod paymentMethod) throws IOException {
		String qPath = "/me/order/{orderId}/pay";
		StringBuilder sb = path(qPath, orderId);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "paymentMethod", paymentMethod);
		exec(qPath, "POST", sb.toString(), o);
	}
1180817
public function trigger($event)
    {
        if ($this->has($event)) {
            return call_user_func($this->listeners[$event]);
        } else {
            throw new RuntimeException(sprintf(
                'Cannot trigger non-existing event "%s"', $event
            ));
        }
    }
1032824
public function setPaymentMethod($method)
    {
        try {
            if ($method instanceof PagSeguroDirectPaymentMethods) {
                $this->paymentMethod = $method;
            } else {
                $this->paymentMethod = new PagSeguroDirectPaymentMethods($method);
            }
        } catch (Exception $e) {
            die($e->getMessage());
        }
    }
298736
public function processPaypalSale(Transaction $transaction, $delivery=null, $credtCard=null)
    {
        
        $totals = $this->calculateTotals($transaction, $delivery);
  
        $this->paypalToken();
        
        if(is_null($credtCard)){
            $paymentMehod = array("payment_method" => "paypal");
        }else{
            $paymentMehod = array(
            "payment_method" => "credit_card",
            "funding_instruments" => array(
                array(
                  "credit_card" => $credtCard
                )
              )
            );
        }
        
        $returnValues = array();
        foreach ($transaction->getItems() as $productPurchase) {
            $sub = array();
            $sub['quantity'] = $productPurchase->getQuantity();
            if($productPurchase->getProduct() instanceof Product){
                $sub['name'] = $productPurchase->getProduct()->getName();
                $sub['price'] = number_format($productPurchase->getProduct()->getPrice(), 2);
            }elseif($productPurchase->getAdvert() instanceof Advert){
                $sub['name'] = $productPurchase->getAdvert()->getTitle();
                $sub['price'] = number_format($this->advertUnitPrice, 2);
            }
            
            $sub['sku'] = $productPurchase->getId();
            $sub['currency'] = "EUR";
            $returnValues[] = $sub;
        }
        
        $host = $this->paypalFactory->getHost();
        $url = $host.'/v1/payments/payment';
        $payment = array(
                        'intent' => 'sale',
                        'payer' => $paymentMehod,
                        'transactions' => array (array(
                                        'amount' => array(
                                                'total' => number_format($totals['amount'], 2),
                                                'currency' => 'EUR',
                                                'details' =>  array(
                                                    "subtotal" => number_format($totals['amount_clean'], 2),
                                                    "tax" => number_format($totals['vat'], 2),
                                                    "shipping" => $totals['delivery_expenses']
                                                  )
                                                ),
                                        'description' => 'payment using a PayPal account',
                                        "item_list" => array (
                                                "items" => $returnValues
                                                ),
                                        )),
                        'redirect_urls' => array (
                                'return_url' => $this->paypalFactory->getReturnUrl(),
                                'cancel_url' => $this->paypalFactory->getCancelUrl()
                        )
                    );

        $json = json_encode($payment);
        $json_resp = $this->paypalCall('POST', $url, $json);
               
        if(!is_null($credtCard)){
            if($json_resp['state'] == 'approved'){
                 //UPDATE TRANSACTION
                $pm = $this->manager->getRepository('EcommerceBundle:PaymentMethod')->findOneBySlug('paypal-direct-payment');
                $transaction->setStatus(Transaction::STATUS_PAID);
                $transaction->setPaymentMethod($pm);
                $transaction->setPaymentDetails(json_encode($json_resp));
                $this->manager->persist($transaction);
                $this->manager->flush();
                
                //confirmation payment
                $answer = new \stdClass();
                $answer->redirectUrl = $this->router->generate('ecommerce_checkout_confirmationpayment');

                return $answer;
            }else{
                //cancel payment
                $answer = new \stdClass();
                $answer->redirectUrl = $this->paypalFactory->getCancelUrl();

                return $answer;
            }
        }else{
            //UPDATE TRANSACTION
            $pm = $this->manager->getRepository('EcommerceBundle:PaymentMethod')->findOneBySlug('paypal');
            $transaction->setStatus(Transaction::STATUS_PENDING);
            $transaction->setPaymentMethod($pm);
            $transaction->setPaymentDetails(json_encode($json_resp));
            $this->manager->persist($transaction);
            $this->manager->flush();


            foreach ($json_resp['links'] as $link) {
                    if($link['rel'] == 'execute'){
                            $payment_execute_url = $link['href'];
                            $payment_execute_method = $link['method'];
                    }elseif($link['rel'] == 'approval_url'){
                            $payment_approval_url = $link['href'];
                            $payment_approval_method = $link['method'];
                    }
            }

            $answer = new \stdClass();
            $answer->redirectUrl = $payment_approval_url;

            return $answer;
        }
        
    }
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();
    }
1097214
public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
    {
        $payoneRefundTransfer = new PayoneRefundTransfer();

        $orderTransfer = new OrderTransfer();
        $orderTransfer->fromArray($orderEntity->toArray(), true);

        $refundTransfer = $this->getFactory()
            ->getRefundFacade()
            ->calculateRefund($orderItems, $orderEntity);

        $payoneRefundTransfer->setAmount($refundTransfer->getAmount() * -1);

        $paymentPayoneEntity = $orderEntity->getSpyPaymentPayones()->getFirst();

        $payonePaymentTransfer = new PayonePaymentTransfer();
        $payonePaymentTransfer->fromArray($paymentPayoneEntity->toArray(), true);

        $payoneRefundTransfer->setPayment($payonePaymentTransfer);
        $payoneRefundTransfer->setUseCustomerdata(PayoneApiConstants::USE_CUSTOMER_DATA_YES);
        $payoneRefundTransfer->setOrder($this->getOrderTransfer($orderEntity));

        $narrativeText = $this->getFactory()->getConfig()->getNarrativeText($orderItems, $orderEntity, $data);
        $payoneRefundTransfer->setNarrativeText($narrativeText);

        $this->getFacade()->refundPayment($payoneRefundTransfer);

        return [];
    }
1038377
public function withPaymentMethod($paymentMethod)
    {
        $this->paymentMethod = $paymentMethod;
        if ($paymentMethod instanceof EBTCardData && $paymentMethod->serialNumber !== null) {
            $this->transactionModifier = TransactionModifier::VOUCHER;
        }
        return $this;
    }
1330078
public function onPostStateChange(OrderEvent $event)
    {
        $order = $event->getOrder();
        $cart  = $this->provider->getCart();
        if ($order->getId() === $cart->getId() && $order->getType() !== OrderTypes::TYPE_CART) {
            $this->provider->clearCart();
        }
    }
1181004
public function createOrderCouponsByCartCoupons(OrderOnCreatedEvent $event)
    {
        $this
            ->cartCouponToOrderTransformer
            ->createOrderCouponsByCartCoupons(
                $event->getCart(),
                $event->getOrder()
            );
    }
925649
protected function _actionXpayment($context)
    {
        $data = $context->data;
        $package = $this->getItem();
        $gateway = $this->getService('com:subscriptions.controller.subscription')->getGateway();

        try {

            $payload = $this->order->getPayload();
            $confirm = route('option=com_subscriptions&view=signup&action=confirm&xpayment=true&id='.$package->id, true);
            $cancel = route('option=com_subscriptions&view=signup&action=cancel&xpayment=true&id='.$package->id, true);
            $url = $gateway->getAuthorizationURL($payload, $confirm, $cancel);
            $context->response->setRedirect($url, AnHttpResponse::SEE_OTHER);

        } catch (Exception $error) {
            throw new RuntimeException($error->getMessage());
        }
    }
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;
    }
191618
public function onCallbackSuccess($order, $data = null)
    {
        $paymentId  = is_array($data) ? $data['paymentId'] : $data->paymentId;

        $payerId    = is_array($data) ? $data['PayerID'] : $data->PayerID;

        $this->statusCode = 'failed';

        $this->detail = sprintf('Payment failed. Ref: %s', $paymentId);

        // Begin paypal
        try {

            $this->setContext();

            $payment = Payment::get($paymentId, $this->apiContext);
            
            $execution = new PaymentExecution();

            $execution->setPayerId($payerId);

            $payment->execute($execution, $this->apiContext);

            $payment = Payment::get($paymentId, $this->apiContext);

            $this->statusCode = 'completed';

            $this->transactionId = $payment->id;

            $this->detail = 'Success';

        } catch (PayPalConnectionException $e) {

            $response = json_decode($e->getData());

            throw new GatewayException(
                sprintf(
                    '%s: %s',
                    $response->name,
                    isset($response->message) ? $response->message : 'Paypal payment Failed.'
                ),
                1001,
                $e
            );

        } catch (\Exception $e) {

            throw new GatewayException(
                $e->getMessage(),
                1000,
                $e
            );

        }
    }