def get_payment_url(request): """ After all authentication, get the URL to start the payment flow. """ try: # Re-use the view decorator. user_can_simulate(lambda r: None)(request) can_simulate = True except PermissionDenied: can_simulate = False if can_simulate: return reverse('pay.super_simulate') else: request.session['payment_start'] = time.time() return reverse('pay.wait_to_start')
def get_payment_url(request): """ After all authentication, get the URL to start the payment flow. """ try: # Re-use the view decorator. user_can_simulate(lambda r: None)(request) can_simulate = True except PermissionDenied: can_simulate = False if settings.FAKE_PAYMENTS: return reverse('pay.fakepay') elif can_simulate: return reverse('pay.super_simulate') else: return reverse('pay.wait_to_start')
def get_wait_url(request): """ Get the URL to wait for the start of payment. This is essentially the start of payment but we may need to wait until the transaction is ready. """ try: # Re-use the view decorator. user_can_simulate(lambda r: None)(request) can_simulate = True except PermissionDenied: can_simulate = False if can_simulate: return reverse('pay.super_simulate') else: request.session['payment_start'] = time.time() return reverse('pay.wait_to_start')
def execute_view(self): request = HttpRequest() request.session = self.session # Wrap a fake view in the decorator then execute it. user_can_simulate(lambda r: None)(request)