returns current payment instance from session
775610
def set_active_payment
      @payment ||= session[:payment_data][:billing_class].constantize.find(session[:payment_data][:billing_id])
    rescue
      render text: I18n.t('lolita_paypal.wrong_request'), status: 400
    end
924508
def session(self):
        """"""
        if self._session is None:
            from .tcex_session import TcExSession

            self._session = TcExSession(self)
        return self._session
304312
public function getPaymentMethod()
    {
        $session = $this
            ->getRequest()
            ->getSession();

        $payment_methods = GatewayInfo::getSupportedGateways();
        $payment_session = $session->get('Checkout.PaymentMethodID');
        $method = null;

        if (!empty($payment_session) && array_key_exists($payment_session, $payment_methods)) {
            $method = $payment_session;
        } else {
            $default = key($payment_methods);
            $method = $default;
            $session->set('Checkout.PaymentMethodID', $default);
        }

        return $method;
    }
660443
def transaction(self, session=None):
        
        local_session = None
        if session is None:
            local_session = session = self.create_scoped_session()
        try:
            yield session
        finally:
            # Since ``local_session`` was created locally, close it here itself
            if local_session is not None:
                # but wait!
                # http://groups.google.com/group/sqlalchemy/browse_thread/thread/7c1eb642435adde7
                # To workaround this issue with sqlalchemy, we can either:
                #  1) pass the session object explicitly
                #  2) do not close the session at all (bad idea - could lead to memory leaks)
                #
                # Till pypm implements atomic transations in client.installer,
                # we retain this hack (i.e., we choose (2) for now)
                pass
148487
protected function verifyPayment()
    {
        try {

            /** Get the payment ID before session clear **/
            $payment_id = \Session::get('paypal_payment_id');
            /** clear the session payment ID **/
            \Session::forget('paypal_payment_id');
            if (!$this->refId() || !$this->trackingCode()) {
                return false;
            }
            $payment = Payment::get($payment_id, $this->_api_context);
            /** PaymentExecution object includes information necessary **/
            /** to execute a PayPal account payment. **/
            /** The payer_id is added to the request query parameters **/
            /** when the user is redirected from paypal back to your site **/
            $execution = new PaymentExecution();
            $execution->setPayerId($this->refId);
            /**Execute the payment **/
            $result = $payment->execute($execution, $this->_api_context);
            /** dd($result);exit; /** DEBUG RESULT, remove it later **/
            if ($result->getState() == 'approved') {

                /** it's all right **/
                /** Here Write your database logic like that insert record or value in database if you want **/

//            \Session::put('success','Payment success');
                return true;
            }

            return false;
        } catch (\Exception $e) {
            $this->transactionFailed();
            $this->newLog('PaypalException', $e->getMessage());
            throw $e;
        }
    }
307466
private SITransaction getCurrentTransaction() {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "getCurrentTransaction");
        }

        SITransaction currentTransaction = null;

        // Is there a current local transaction?

        if (_localTransaction != null) {

            currentTransaction = _localTransaction.getCurrentTransaction();

        }

        // If not, is there a current global transaction?

        if ((currentTransaction == null) && (_xaResource != null)) {

            currentTransaction = _xaResource.getCurrentTransaction();

        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr
                    .exit(this, TRACE, "getCurrentTransaction",
                            currentTransaction);
        }
        return currentTransaction;

    }
997612
def get_payment_methods(self, **params):
        """"""
        response = self._get('v2', 'payment-methods', params=params)
        return self._make_api_object(response, PaymentMethod)
130767
public function getCurrentSession()
    {
        if (!$this->currentSessionHash) {
            $this->currentSessionHash = $this->controller->getRequest()->getVar($this->getGetVar());

            if (!$this->currentSessionHash) {
                return false;
            }
        }

        $this->session = MultiFormSession::get()->filter([
            "Hash" => $this->currentSessionHash,
            "IsComplete" => 0
        ])->first();

        return $this->session;
    }
1077946
def session(self):
        
        if self._session is None:
            self._session = self.client.create_session()

        return self._session
396389
def get_referenced_object(self):
        

        if self._BunqMeTab is not None:
            return self._BunqMeTab

        if self._BunqMeTabResultResponse is not None:
            return self._BunqMeTabResultResponse

        if self._BunqMeFundraiserResult is not None:
            return self._BunqMeFundraiserResult

        if self._Card is not None:
            return self._Card

        if self._CardDebit is not None:
            return self._CardDebit

        if self._DraftPayment is not None:
            return self._DraftPayment

        if self._FeatureAnnouncement is not None:
            return self._FeatureAnnouncement

        if self._IdealMerchantTransaction is not None:
            return self._IdealMerchantTransaction

        if self._Invoice is not None:
            return self._Invoice

        if self._ScheduledPayment is not None:
            return self._ScheduledPayment

        if self._ScheduledPaymentBatch is not None:
            return self._ScheduledPaymentBatch

        if self._ScheduledInstance is not None:
            return self._ScheduledInstance

        if self._MasterCardAction is not None:
            return self._MasterCardAction

        if self._BankSwitchServiceNetherlandsIncomingPayment is not None:
            return self._BankSwitchServiceNetherlandsIncomingPayment

        if self._Payment is not None:
            return self._Payment

        if self._PaymentBatch is not None:
            return self._PaymentBatch

        if self._RequestInquiryBatch is not None:
            return self._RequestInquiryBatch

        if self._RequestInquiry is not None:
            return self._RequestInquiry

        if self._RequestResponse is not None:
            return self._RequestResponse

        if self._RewardRecipient is not None:
            return self._RewardRecipient

        if self._RewardSender is not None:
            return self._RewardSender

        if self._ShareInviteBankInquiryBatch is not None:
            return self._ShareInviteBankInquiryBatch

        if self._ShareInviteBankInquiry is not None:
            return self._ShareInviteBankInquiry

        if self._ShareInviteBankResponse is not None:
            return self._ShareInviteBankResponse

        if self._SofortMerchantTransaction is not None:
            return self._SofortMerchantTransaction

        if self._TabResultInquiry is not None:
            return self._TabResultInquiry

        if self._TabResultResponse is not None:
            return self._TabResultResponse

        if self._TransferwiseTransfer is not None:
            return self._TransferwiseTransfer

        raise exception.BunqException(self._ERROR_NULL_FIELDS)
614390
public function getShopCurrency()
    {
        if ((null === ($curr = $this->getRequestParameter('cur')))) {
            if (null === ($curr = $this->getRequestParameter('currency'))) {
                $curr = $this->getSession()->getVariable('currency');
            }
        }

        return (int) $curr;
    }
1129996
function Session() {
    var self = this;

    if (instance) {
      return instance;
    }
    instance = this;

    this.wallets = [];

    return getSession().then(function(response) {
      // Assign the session data to ourself.
      lodash.assign(self, response.data);

      switch (self.plugin.header.kind) {
        case 'applet': self.plugin = new Applet(self.plugin, self.id); break;
        case 'servlet': self.plugin = new Servlet(self.plugin, self.id); break;
      };

      $rootScope.$emit('Local/Initialized', 'session');
      return self;
    
    }).catch(function(error) {
      throw new ApiError(error);

    });

    // Get our session data.
    function getSession() {
      var request = {
       method: 'GET',
       url: '/session/' + apiHelpers.sessionId()
      };

      return new ApiMessage(request).send();
    };
  }
651854
def _get_authenticated_session(self):
        
        session = requests.Session()
        session.auth = self.auth
        return session
81214
def get_instance(self, payload):
        
        return BalanceInstance(self._version, payload, account_sid=self._solution['account_sid'], )
1047519
def get_payment_request(self, cart, request):
        
        try:
            self.charge(cart, request)
            thank_you_url = OrderModel.objects.get_latest_url()
            js_expression = 'window.location.href="{}";'.format(thank_you_url)
            return js_expression
        except (KeyError, stripe.error.StripeError) as err:
            raise ValidationError(err)
391242
def get(self, session):
        ''''''
        request = TOPRequest('taobao.aftersale.get')
        self.create(self.execute(request, session))
        return self.after_sales
433183
def get_mirrored(cls, session):
        
        return cls.find(session,
                        where=(cls.local == False,))