Call PayPal DoDirectPayment method.
775829
def doDirectPayment(self, params):
        """"""
        defaults = {"method": "DoDirectPayment", "paymentaction": "Sale"}
        required = ["creditcardtype",
                    "acct",
                    "expdate",
                    "cvv2",
                    "ipaddress",
                    "firstname",
                    "lastname",
                    "street",
                    "city",
                    "state",
                    "countrycode",
                    "zip",
                    "amt",
                    ]
        nvp_obj = self._fetch(params, required, defaults)
        if nvp_obj.flag:
            raise PayPalFailure(nvp_obj.flag_info, nvp=nvp_obj)
        # @@@ Could check cvv2match / avscode are both 'X' or '0'
        # qd = django.http.QueryDict(nvp_obj.response)
        # if qd.get('cvv2match') not in ['X', '0']:
        #   nvp_obj.set_flag("Invalid cvv2match: %s" % qd.get('cvv2match')
        # if qd.get('avscode') not in ['X', '0']:
        #   nvp_obj.set_flag("Invalid avscode: %s" % qd.get('avscode')
        return nvp_obj
1044835
public function processPaymentAction()
    {
        $order = $this->checkRequest();

        return $this->getDebugPayment()->processCallback($order, $this->getCurrentRequest()->get('action'));
    }
436632
def call(self, method, params, callback=None):
        """"""
        self._wait_for_connect()
        self.ddp_client.call(method, params, callback=callback)
295015
function paypal_init() {
    $nvp = (MODULE_PAYMENT_PAYPALWPP_APIPASSWORD != '' && MODULE_PAYMENT_PAYPALWPP_APISIGNATURE != '') ? true : false;
    $ec = ($nvp && $_GET['type'] == 'ec') ? true : false;
    if (MODULE_PAYMENT_PAYPALDP_MERCHANT_COUNTRY == 'UK' && !$ec) {
      $doPayPal = new paypal_curl(array('mode' => 'payflow',
                                        'user' =>   trim(MODULE_PAYMENT_PAYPALWPP_PFUSER),
                                        'vendor' => trim(MODULE_PAYMENT_PAYPALWPP_PFVENDOR),
                                        'partner'=> trim(MODULE_PAYMENT_PAYPALWPP_PFPARTNER),
                                        'pwd' =>    trim(MODULE_PAYMENT_PAYPALWPP_PFPASSWORD),
                                        'server' => MODULE_PAYMENT_PAYPALDP_SERVER));
      $doPayPal->_endpoints = array('live'    => 'https://payflowpro.paypal.com/transaction',
                                    'sandbox' => 'https://pilot-payflowpro.paypal.com/transaction');
    } else {
      $doPayPal = new paypal_curl(array('mode' => 'nvp',
                                        'user' => trim(MODULE_PAYMENT_PAYPALWPP_APIUSERNAME),
                                        'pwd' =>  trim(MODULE_PAYMENT_PAYPALWPP_APIPASSWORD),
                                        'signature' => trim(MODULE_PAYMENT_PAYPALWPP_APISIGNATURE),
                                        'version' => '61.0',
                                        'server' => MODULE_PAYMENT_PAYPALDP_SERVER));
      $doPayPal->_endpoints = array('live'    => 'https://api-3t.paypal.com/nvp',
                                    'sandbox' => 'https://api-3t.sandbox.paypal.com/nvp');
    }

    // set logging options
    $doPayPal->_logDir = $this->_logDir;
    $doPayPal->_logLevel = $this->_logLevel;

    // set proxy options if configured
    if (CURL_PROXY_REQUIRED == 'True' && CURL_PROXY_SERVER_DETAILS != '') {
      $proxy_tunnel_flag = (defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE') ? false : true;
      $doPayPal->setCurlOption(CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
      $doPayPal->setCurlOption(CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
      $doPayPal->setCurlOption(CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
    }

    // transaction processing mode
    $doPayPal->_trxtype = (MODULE_PAYMENT_PAYPALDP_TRANSACTION_MODE == 'Auth Only') ? 'A' : 'S';

    return $doPayPal;
  }
251456
protected function call(Request $request) {
		$response = $request->execute();
		if (!$response->isSuccess()) {
			self::debug("Error in PayPal call", $response);			
			throw new PayPal_Exception_InvalidResponse("Error " . $response->status() . " in PayPal call (". $response->body() .")");
		}
		$res = json_decode($response->body());
		
		if (isset($res->error)) {
			self::error("Error in PayPal call: " . print_r($res, true));			
			throw new PayPal_Exception_InvalidResponse('PayPal: ' . $res->error_description . ' [' . $res->error . 
					'] while calling ' . $request->uri());
		}
		return $res;
	}
1217906
public static function onActivate()
    {
        // add additional field to order
        self::addOrderTable();

        // create orders payments table
        self::addOrderPaymentsTable();

        // payment comments
        self::addOrderPaymentsCommentsTable();

        self::addMissingFieldsOnUpdate();
        self::ensureCorrectFieldsEncodingOnUpdate();

        // adding record to oxPayment table
        self::addPaymentMethod();

        // enabling PayPal payment method
        self::enablePaymentMethod();

        // enable PayPal RDF
        self::enablePayPalRDFA();
    }
874842
def start_payment(reservation_key)
      path = "reservation/#{reservation_key}/payment"
      result = call(path, http_method: :post)
      if result.code.to_i == 200
        return true
      else
        raise ShakeTheCounterError.new "Payment failed"
      end
    end
460146
public function handleRequest()
    {
        $requestHandled = false;
        $requestId = md5(microtime(true));

        $request = $this->getPayPalRequest();
        $logger = $this->getLogger();
        $logger->setTitle("IPN Request by PayPal");
        $logger->log([
            'Request ID' => $requestId,
            'GET parameters' => $request->getGet(),
            'POST parameters' => $request->getPost()
        ]);

        $requestValid = $this->requestValid();

        if ($requestValid) {
            $lang = $this->getPayPalConfig()->getLang();

            $processor = $this->getProcessor();
            $processor->setRequest($request);
            $processor->setLang($lang);

            $requestHandled = $processor->process();
        }

        $logger->setTitle("IPN Process result");
        $logger->log([
            'Request ID' => $requestId,
            'Result' => $requestHandled
        ]);
    }
113833
public function setAdaptivePaymentsOptions()
    {
        if ($this->mode == 'sandbox') {
            $this->config['api_url'] = 'https://svcs.sandbox.paypal.com/AdaptivePayments';
            $this->config['gateway_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
        } else {
            $this->config['api_url'] = 'https://svcs.paypal.com/AdaptivePayments';
            $this->config['gateway_url'] = 'https://www.paypal.com/cgi-bin/webscr';
        }
        $this->config['notify_url'] = config('paypal.notify_url');
    }
1056572
public function getCallBackResponse($methodName)
    {
        $this->setParameter("METHOD", $methodName);

        $curl = $this->getCurl();
        $curl->setParameters($this->getParameters());
        $request = $curl->getQuery();

        $this->log($request, 'Callback response from eShop to PayPal');

        return $request;
    }
524970
function in_special_checkout() {
    if ((defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') &&
             !empty($_SESSION['paypal_ec_token']) &&
             !empty($_SESSION['paypal_ec_payer_id']) &&
             !empty($_SESSION['paypal_ec_payer_info'])) {
      $this->flagDisablePaymentAddressChange = true;
      return true;
    }
  }
1092590
public function initializeUserForCallBackPayPalUser($payPalData)
    {
        // setting mode..
        $this->callBackUser = true;

        // setting data..
        $street = $this->splitShipToStreetPayPalUser($payPalData['SHIPTOSTREET']);

        // setting object id as it is requested later while processing user object
        $this->setId(\OxidEsales\Eshop\Core\UtilsObject::getInstance()->generateUID());

        $this->oxuser__oxstreet = new \OxidEsales\Eshop\Core\Field($street['street']);
        $this->oxuser__oxstreetnr = new \OxidEsales\Eshop\Core\Field($street['streetnr']);
        $this->oxuser__oxcity = new \OxidEsales\Eshop\Core\Field($payPalData['SHIPTOCITY']);
        $this->oxuser__oxzip = new \OxidEsales\Eshop\Core\Field($payPalData['SHIPTOZIP']);

        $country = oxNew(\OxidEsales\Eshop\Application\Model\Country::class);
        $countryId = $country->getIdByCode($payPalData["SHIPTOCOUNTRY"]);
        $this->oxuser__oxcountryid = new \OxidEsales\Eshop\Core\Field($countryId);

        $stateId = '';
        if (isset($payPalData["SHIPTOSTATE"])) {
            $state = oxNew(\OxidEsales\Eshop\Application\Model\State::class);
            $stateId = $state->getIdByCode($payPalData["SHIPTOSTATE"], $countryId);
        }
        $this->oxuser__oxstateid = new \OxidEsales\Eshop\Core\Field($stateId);
    }
710307
public function callback(Request $request, &$paymentId, &$money, &$message, &$payId)
    {
        $return = $request->get();
        unset($return['gateway']);
        $paymentId = $return['out_trade_no'];
        $payId = $return['trade_no'];
        $money = $return['total_fee'];
        $message = $return['trade_status'];
        return $this->getResponse($return);
    }
648906
public function makePaymentUsingExistingPaymentMethod($accountID, $paymentMethodID, $amount)
    {
        return $this->httpHelper->post("/accounts/" . intval($accountID) . "/transactions/payments", [
            'payment_method_id' => intval($paymentMethodID),
            'amount' => trim($amount),
            'auto_apply' => true,
        ]);
    }
825041
private function validatePaymentMethodSpecific ()
	{
		$this->validate( 'paymentMethod' );
		switch ( $this->getPaymentMethod() ) {
			case 'ideal':
				$this->validate( 'issuer' );
				if ( $this->getCurrency() != 'EUR' )
					throw new InvalidRequestException( "Cardgate : iDeal only accepts EUR" );
				break;
			case 'mistercash':
				if ( $this->getCurrency() != 'EUR' )
					throw new InvalidRequestException( "Cardgate : Bancontact/Mistercash only accepts EUR" );
				break;
		}
	}
473442
public function processPayment(PaylandsMethod $paymentMethod)
    {
        /*
         * 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,
                $paymentMethod
            );

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

        /*
         * Try to make the payment transaction
         */
        try {
            $this->paylandsApiAdapter->validateCard($paymentMethod);

            $this->paylandsEventDispatcher->notifyCardValid($paymentMethod);

            if (!$paymentMethod->isOnlyTokenizeCard()) {
                $this->paylandsApiAdapter->createTransaction($paymentMethod);
            }

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

            if (PaylandsMethod::STATUS_OK !== $paymentMethod->getPaymentStatus()) {
                throw new PaymentException(sprintf('Order %s could not be paid',
                    $paymentMethod->getPaymentResult()['order']['uuid']
                ));
            }

            /*
             * Payment paid successfully.
             *
             * Paid process has ended successfully
             */
            $this
                ->paymentEventDispatcher
                ->notifyPaymentOrderSuccess(
                    $this->paymentBridge,
                    $paymentMethod
                );
        } catch (PaymentException $e) {
            /*
             * Payment paid failed.
             *
             * Paid process has ended failed
             */
            $this
                ->paymentEventDispatcher
                ->notifyPaymentOrderFail(
                    $this->paymentBridge,
                    $paymentMethod
                );

            throw $e;
        }

        return $this;
    }
512014
def approve_paypal_payment_url(opts = {})
      if opts.is_a?(Symbol) || opts.is_a?(String)
        warn "[DEPRECATION] use approve_paypal_payment_url(:type => #{opts})"
        opts = {:type => opts}
      end
      return nil if self['payKey'].nil?

      if ['mini', 'light'].include?(opts[:type].to_s)
        "#{@paypal_base_url}/webapps/adaptivepayment/flow/pay?expType=#{opts[:type]}&paykey=#{self['payKey']}"
      else
        base = @paypal_base_url
        base = base + "/#{opts[:country]}" if opts[:country]
        "#{base}/webscr?cmd=_ap-payment&paykey=#{self['payKey']}"
      end
    end