Beispiel #1
0
 def wrapper(request, *args, **kw):
     step = func.func_name
     if not request.session.get('uuid'):
         log_cef('No UUID in session, not verified', request)
         raise PermissionDenied
     if request.session.get('uuid_needs_pin_reset'):
         return get_reset_step(request, step) or func(request, *args, **kw)
     return get_standard_step(request, step) or func(request, *args, **kw)
Beispiel #2
0
    def wrapper(request, *args, **kwargs):
        step = func.func_name
        if not request.session.get('uuid'):
            log_cef('No UUID in session, not verified', request)
            raise PermissionDenied

        locked_step = get_locked_step(request, step)
        if locked_step is False:  # Purposefully using is to not match None.
            if request.session.get('uuid_needs_pin_reset'):
                return get_reset_step(request, step) or func(
                    request, *args, **kwargs)
            return get_standard_step(request, step) or func(
                request, *args, **kwargs)
        return locked_step or func(request, *args, **kwargs)
Beispiel #3
0
    def wrapper(request, *args, **kwargs):
        step = func.func_name
        if not request.session.get('uuid'):
            log_cef('No UUID in session, not verified', request, severity=7)
            raise PermissionDenied

        locked_step = get_locked_step(request, step)
        if locked_step is False:  # Purposefully using is to not match None.
            if request.session.get('uuid_needs_pin_reset'):
                return get_reset_step(request, step) or func(request, *args,
                                                             **kwargs)
            return get_standard_step(request, step) or func(request, *args,
                                                            **kwargs)
        return locked_step or func(request, *args, **kwargs)
Beispiel #4
0
    def wrapper(request, *args, **kwargs):
        step = func.func_name
        if not request.session.get('uuid'):
            # This is just a warning for developers trying to use webpay if
            # they haven't set their settings correctly.
            if (not request.session.keys() and settings.SESSION_COOKIE_SECURE
                    and settings.DEBUG):
                log.warning('No session data. '
                            'Try setting SESSION_COOKIE_SECURE to False')
            log_cef('No UUID in session, not verified', request, severity=7)
            raise PermissionDenied

        locked_step = get_locked_step(request, step)
        if locked_step is False:  # Purposefully using is to not match None.
            if request.session.get('uuid_needs_pin_reset'):
                return get_reset_step(request, step) or func(request, *args,
                                                             **kwargs)
            return get_standard_step(request, step) or func(request, *args,
                                                            **kwargs)
        return locked_step or func(request, *args, **kwargs)
Beispiel #5
0
    def wrapper(request, *args, **kwargs):
        step = func.func_name
        if not request.session.get('uuid'):
            # This is just a warning for developers trying to use webpay if
            # they haven't set their settings correctly.
            if (not request.session.keys() and settings.SESSION_COOKIE_SECURE
                    and settings.DEBUG):
                log.warning('No session data. '
                            'Try setting SESSION_COOKIE_SECURE to False')
            log_cef('No UUID in session, not verified', request, severity=7)
            raise PermissionDenied

        locked_step = get_locked_step(request, step)
        if locked_step is False:  # Purposefully using is to not match None.
            if request.session.get('uuid_needs_pin_reset'):
                return get_reset_step(request, step) or func(
                    request, *args, **kwargs)
            return get_standard_step(request, step) or func(
                request, *args, **kwargs)
        return locked_step or func(request, *args, **kwargs)
Beispiel #6
0
def transaction_status(request, transaction_uuid):
    """
    Given a Solitude transaction UUID, return its status.

    This returns a NULL URL for compatibility with another view that
    redirects to begin payment.
    """
    if request.session.get("trans_id") != transaction_uuid:
        log.info(
            "Cannot get transaction status for {t}; session: {s}".format(t=transaction_uuid, s=repr(request.session))
        )
        info = "Transaction query string param {t} did not match " "transaction in session".format(t=transaction_uuid)
        log_cef(info, request, severity=7)
        return HttpResponseForbidden()

    try:
        trans = client.get_transaction(transaction_uuid)
        return {"status": trans["status"], "url": None, "provider": PROVIDERS_INVERTED[trans["provider"]]}
    except ObjectDoesNotExist:
        log.info("Cannot get transaction status; not found: {t}".format(t=transaction_uuid))
        return HttpResponseNotFound()
Beispiel #7
0
def transaction_status(request, transaction_uuid):
    """
    Given a Solitude transaction UUID, return its status.

    This returns a NULL URL for compatibility with another view that
    redirects to begin payment.
    """
    if request.session.get('trans_id') != transaction_uuid:
        log.info('Cannot get transaction status for {t}; session: {s}'
                 .format(t=transaction_uuid, s=repr(request.session)))
        info = ('Transaction query string param {t} did not match '
                'transaction in session'.format(t=transaction_uuid))
        log_cef(info, request, severity=7)
        return HttpResponseForbidden()

    try:
        trans = client.get_transaction(transaction_uuid)
        return {'status': trans['status'], 'url': None}
    except ObjectDoesNotExist:
        log.info('Cannot get transaction status; not found: {t}'
                 .format(t=transaction_uuid))
        return HttpResponseNotFound()
Beispiel #8
0
def transaction_status(request, transaction_uuid):
    """
    Given a Solitude transaction UUID, return its status.

    This returns a NULL URL for compatibility with another view that
    redirects to begin payment.
    """
    if request.session.get('trans_id') != transaction_uuid:
        log.info('Cannot get transaction status for {t}; session: {s}'
                 .format(t=transaction_uuid, s=repr(request.session)))
        info = ('Transaction query string param {t} did not match '
                'transaction in session'.format(t=transaction_uuid))
        log_cef(info, request, severity=7)
        return HttpResponseForbidden()

    try:
        trans = client.get_transaction(transaction_uuid)
        return {'status': trans['status'], 'url': None}
    except ObjectDoesNotExist:
        log.info('Cannot get transaction status; not found: {t}'
                 .format(t=transaction_uuid))
        return HttpResponseNotFound()
Beispiel #9
0
def log_redirect(request, step, dest):
    msg = 'Buyer was attempting %s redirecting to: %s' % (step, dest)
    log.info('enforce_sequence: %s' % msg)
    log_cef(msg, request, severity=7)
Beispiel #10
0
 def process_exception(self, request, exception):
     # We'll log the exceptions too with more severity.
     log_cef(exception.__class__.__name__, request, severity=8)
Beispiel #11
0
 def process_request(self, request):
     # Log all requests to cef.
     log_cef("webpay:request", request, severity=2)
Beispiel #12
0
def log_redirect(request, step, dest):
    msg = 'Buyer was attempting %s redirecting to: %s' % (step, dest)
    log.info('enforce_sequence: %s' % msg)
    log_cef(msg, request, severity=7)
Beispiel #13
0
 def process_request(self, request):
     # Log all requests to cef.
     log_cef('webpay:request', request)
Beispiel #14
0
 def process_exception(self, request, exception):
     # We'll log the exceptions too with more severity.
     log_cef(exception.__class__.__name__, request, severity=8)
Beispiel #15
0
 def process_request(self, request):
     # Log all requests to cef.
     log_cef('webpay:request', request)
Beispiel #16
0
 def wrapper(request, *args, **kw):
     if not request.session.get('uuid'):
         log_cef('No UUID in session, not verified', request, severity=7)
         raise PermissionDenied
     return f(request, *args, **kw)
Beispiel #17
0
 def wrapper(request, *args, **kw):
     if not request.session.get('uuid'):
         log_cef('No UUID in session, not verified', request, severity=7)
         raise PermissionDenied
     return f(request, *args, **kw)
Beispiel #18
0
def log_redirect(request, step, dest):
    log_cef('Buyer was attempting %s redirecting to: %s' % (step, dest),
            request)