Routes a payment to Gateway, should return URL for redirection.
973893
def get_gateway_url(self, request):
        
        params = {
            'id': self.get_backend_setting('id'),
            'description': self.get_order_description(self.payment, self.payment.order),
            'amount': self.payment.amount,
            'currency': self.payment.currency,
            'type': 0,  # 0 = show "return" button after finished payment
            'control': self.payment.pk,
            'URL': self.get_URL(self.payment.pk),
            'URLC': self.get_URLC(),
            'api_version': 'dev',
        }

        user_data = {
            'email': None,
            'lang': None,
        }
        signals.user_data_query.send(sender=None, order=self.payment.order, user_data=user_data)

        if user_data['email']:
            params['email'] = user_data['email']

        if user_data['lang'] and user_data['lang'].lower() in self._ACCEPTED_LANGS:
            params['lang'] = user_data['lang'].lower()
        elif self.get_backend_setting('lang', False
                                      ) and self.get_backend_setting('lang').lower() in self._ACCEPTED_LANGS:
            params['lang'] = self.get_backend_setting('lang').lower()

        if self.get_backend_setting('onlinetransfer', False):
            params['onlinetransfer'] = 1
        if self.get_backend_setting('p_email', False):
            params['p_email'] = self.get_backend_setting('p_email')
        if self.get_backend_setting('p_info', False):
            params['p_info'] = self.get_backend_setting('p_info')
        if self.get_backend_setting('tax', False):
            params['tax'] = 1

        gateway_url = self.get_backend_setting('gateway_url', self._GATEWAY_URL)

        if self.get_backend_setting('method', 'get').lower() == 'post':
            return gateway_url, 'POST', params
        elif self.get_backend_setting('method', 'get').lower() == 'get':
            for key in params.keys():
                params[key] = six.text_type(params[key]).encode('utf-8')
            return gateway_url + '?' + urlencode(params), "GET", {}
        else:
            raise ImproperlyConfigured('Dotpay payment backend accepts only GET or POST')
469047
public function actionReturn($gateway)
    {
        if (!$this->module->hasGateway($gateway)) {
            throw new NotFoundHttpException("Unknown payment gateway '{$gateway}'");
        }
        $gateway = $this->module->getGateway($gateway);
        $status = $gateway->callback(Yii::$app->request, $this->paymentId, $this->money, $this->message, $this->payId);
        Payment::setPayStatus($this->paymentId, $status, ['money' => $this->money, 'message' => $this->message, 'pay_id' => $this->payId]);
        return $this->redirect(['/payment/default/return', 'id' => $this->paymentId]);
    }
103709
def forward(self, method, type, path, data=None):
        
        try:
            action = "/{}/{}".format(type, path)
            res = yield from self.http_query(method, action, data=data, timeout=None)
        except aiohttp.ServerDisconnectedError:
            log.error("Connection lost to %s during %s %s", self._id, method, action)
            raise aiohttp.web.HTTPGatewayTimeout()
        return res.json
540248
public function pay($gateway, $params = [])
    {
        $this->payload['biz_content'] = json_encode($params);

        $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway';

        if (class_exists($gateway)) {
            return $this->makePay($gateway);
        }

        throw new InvalidGatewayException("Pay Gateway [{$gateway}] not exists");
    }
117661
private function getRedirectRouteFromRequest()
    {
        $request  = $this->application->getRequest();
        $redirect = $request->getQuery('redirect');
        if ($redirect && $this->routeExists($redirect)) {
            return $redirect;
        }

        $redirect = $request->getPost('redirect');
        if ($redirect && $this->routeExists($redirect)) {
            return $redirect;
        }

        return false;
    }
1176821
def get_gateway_url(self, request):
        

        grant_type = self.get_backend_setting('grant_type', 'client_credentials')
        if grant_type == 'client_credentials':
            client_id = self.get_backend_setting('client_id')
            client_secret = self.get_backend_setting('client_secret')
            url = "{gateway_url}pl/standard/user/oauth/authorize?" \
                  "grant_type={grant_type}&" \
                  "client_id={client_id}&" \
                  "client_secret={client_secret}".format(gateway_url=self._GATEWAY_URL,
                                                         grant_type=grant_type, client_id=client_id,
                                                         client_secret=client_secret)
        elif grant_type == 'trusted_merchant':
            raise ImproperlyConfigured('grant_type not yet supported')
        else:
            raise ImproperlyConfigured('grant_type should be one of: "trusted_merchant", "client_credentials"')

        response = requests.get(url)
        assert response.status_code == 200

        response_data = response.json()
        access_token = response_data['access_token']
        token_type = response_data['token_type']

        headers = {"Authorization": "{token_type} {access_token}".format(
            token_type=token_type.title(), access_token=access_token)}

        pos_id = self.get_backend_setting('pos_id', None)

        user_data = {
            'email': None,
            'lang': None,
        }

        signals.user_data_query.send(
            sender=None, order=self.payment.order, user_data=user_data)

        if not user_data['email']:
            raise ImproperlyConfigured

        buyer_info = dict(  # dane kupującego
            email=user_data['email'],
        )

        if user_data['lang'] and user_data['lang'].lower() in self._ACCEPTED_LANGS:
            buyer_info['language'] = user_data['lang'].lower()
        elif self.get_backend_setting('lang', False
                                      ) and (self.get_backend_setting('lang').lower() in self._ACCEPTED_LANGS):
            buyer_info['language'] = six.text_type(self.get_backend_setting('lang').lower())

        customer_id = user_data.get('id', None)
        if customer_id:
            buyer_info['extCustomerId'] = customer_id

        customer_first_name = user_data.get('first_name', None)
        if customer_first_name:
            buyer_info['firstName'] = customer_first_name

        customer_last_name = user_data.get('last_name', None)
        if customer_last_name:
            buyer_info['last_Namme'] = customer_last_name

        customer_phone = user_data.get('phone', None)
        if customer_phone:
            buyer_info['phone'] = customer_phone

        current_site = getpaid_utils.get_domain(request)
        use_ssl = self.get_backend_setting('ssl_return', True)

        notify_url = "http{}://{}{}".format(
            's' if use_ssl else '',
            current_site,
            reverse('getpaid:payu_rest:confirm')
        )

        params = dict(
            customerIp=getpaid_utils.get_ip_address(request),
            merchantPosId=pos_id,
            description=self.get_order_description(self.payment, self.payment.order),
            currencyCode=self.payment.currency.upper(),
            totalAmount=str(int(self.payment.amount * 100)),
            buyer=buyer_info,
            products=[dict(
                name='Payment #{} from {}'.format(self.payment.pk, current_site),
                unitPrice=str(int(self.payment.amount * 100)),
                quantity="1",
                # ### optional:
                # virtual=True,
                # listingDate='',
            )],

            # ### optional:
            notifyUrl=notify_url,
            extOrderId=str(self.payment.pk),
            # validityTime='',
            # additionalDescription='',
            continueUrl='http://127.0.0.1:8000/',
            # payMethods=None,
        )

        order_url = "{gateway_url}api/v2_1/orders".format(gateway_url=self._GATEWAY_URL)

        order_register = requests.post(order_url, json=params, headers=headers, allow_redirects=False)
        order_register_data = order_register.json()
        status = order_register_data.get('status', {}).get('statusCode', '')
        if status != 'SUCCESS':
            logger.error('Houston, we have a problem with this payment trajectory: {}'.format(status))
            return reverse('getpaid:failure-fallback', kwargs=dict(pk=self.payment.pk)), 'GET', {}
        final_url = order_register_data.get('redirectUri')

        return final_url, 'GET', {}
636725
def get_default_redirect(self, rule, method, values, query_args):
        
        assert self.map.redirect_defaults
        for r in self.map._rules_by_endpoint[rule.endpoint]:
            # every rule that comes after this one, including ourself
            # has a lower priority for the defaults.  We order the ones
            # with the highest priority up for building.
            if r is rule:
                break
            if r.provides_defaults_for(rule) and r.suitable_for(values, method):
                values.update(r.defaults)
                domain_part, path = r.build(values)
                return self.make_redirect_url(path, query_args, domain_part=domain_part)
363772
def get_redirect_url(self, request, callback, parameters=None):
        """"""
        args = self.get_redirect_args(request, callback=callback)
        additional = parameters or {}
        args.update(additional)
        params = urlencode(args)
        return '{0}?{1}'.format(self.authorization_url, params)
611521
def gateway(self):
        """"""
        url = 'https://tccna.honeywell.com/WebAPI/emea/api/v1/gateway'

        response = requests.get(url, headers=self._headers())
        response.raise_for_status()

        return response.json()
1059066
def resolve_redirection(self, request, context):
        """"""
        current_page = context['current_page']
        lang = context['lang']
        if current_page.redirect_to_url:
            return HttpResponsePermanentRedirect(current_page.redirect_to_url)

        if current_page.redirect_to:
            return HttpResponsePermanentRedirect(
                current_page.redirect_to.get_url_path(lang))
449034
def geturl_req(url):
    """"""
    request = urllib.request.Request(url)
    request.add_header('Authorization', 'token %s' % API_TOKEN)
    try:
        response_url = urllib.request.urlopen(request).geturl()
        return response_url
    except urllib.error.HTTPError:
        exception()
        sys.exit(0)
477709
def get(self, url: StrOrURL, *, allow_redirects: bool=True,
            **kwargs: Any) -> '_RequestContextManager':
        """"""
        return _RequestContextManager(
            self._request(hdrs.METH_GET, url,
                          allow_redirects=allow_redirects,
                          **kwargs))
856105
def retrieve(payment_id):
        
        http_client = HttpClient()
        response, __ = http_client.get(routes.url(routes.PAYMENT_RESOURCE, resource_id=payment_id))
        return resources.Payment(**response)
51304
def follow_redirects(url):
        
        opener = urllib2.build_opener(urllib2.HTTPRedirectHandler)
        return opener.open(url).url
74808
def route(self, uri, methods=frozenset({'GET'}), host=None,
              strict_slashes=False, stream=False, websocket=False):
        '''
        '''

        # Fix case where the user did not prefix the URL with a /
        # and will probably get confused as to why it's not working
        if not uri.startswith('/'):
            uri = '/' + uri

        def response(handler):
            if websocket:
                handler.is_websocket = True
            elif stream:
                handler.is_stream = True
            self.router.add(uri=uri, methods=methods, handler=handler,
                            host=host, strict_slashes=strict_slashes)
            return handler

        return response
230540
def get(self, url, **kwargs):
        
        """

        kwargs.setdefault('allow_redirects', True)
        return self.request('GET', url, **kwargs)
1188663
def get(self, path, query=None, redirects=True):
        
        return self.request('GET', path, query, None, redirects)