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)
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)
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)
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)
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)
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()
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()
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)
def process_exception(self, request, exception): # We'll log the exceptions too with more severity. log_cef(exception.__class__.__name__, request, severity=8)
def process_request(self, request): # Log all requests to cef. log_cef("webpay:request", request, severity=2)
def process_request(self, request): # Log all requests to cef. log_cef('webpay:request', request)
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)
def log_redirect(request, step, dest): log_cef('Buyer was attempting %s redirecting to: %s' % (step, dest), request)