def lobby(request): sess = request.session trans = None if request.GET.get('req'): # If it returns a response there was likely # an error and we should return it. res = process_pay_req(request) if isinstance(res, http.HttpResponse): return res elif settings.TEST_PIN_UI: # This won't get you very far but it lets you create/enter PINs # and stops a traceback after that. request.session['trans_id'] = trans_id() elif not sess.get('is_simulation', False): try: trans = solitude.get_transaction(request.session.get('trans_id')) except ObjectDoesNotExist: if request.session.get('trans_id'): log.info('Attempted to restart non-existent transaction {0}' .format(request.session.get('trans_id'))) return _error(request, msg='req is required') pin_form = VerifyPinForm() if sess.get('uuid'): auth_utils.update_session(request, sess.get('uuid')) # Before we continue with the buy flow, let's save some # time and get the transaction configured via Bango in the # background. log.info('configuring transaction {0} from lobby' .format(request.session.get('trans_id'))) tasks.configure_transaction(request, trans=trans) redirect_url = check_pin_status(request) if redirect_url is not None: return http.HttpResponseRedirect(redirect_url) # If the buyer closed the trusted UI during reset flow, we want to unset # the reset pin flag. They can hit the forgot pin button if they still # don't remember their pin. if sess.get('uuid_needs_pin_reset'): solitude.set_needs_pin_reset(sess['uuid'], False) sess['uuid_needs_pin_reset'] = False if sess.get('is_simulation', False): sim_req = sess['notes']['pay_request']['request']['simulate'] log.info('Starting simulate %s for %s' % (sim_req, sess['notes']['issuer_key'])) return render(request, 'pay/simulate.html', { 'simulate': sim_req }) return render(request, 'pay/lobby.html', { 'action': reverse('pin.verify'), 'form': pin_form, 'title': _('Enter Pin') })
def lobby(request): sess = request.session trans = None if request.GET.get('req'): # If it returns a response there was likely # an error and we should return it. res = process_pay_req(request) if isinstance(res, http.HttpResponse): return res elif settings.TEST_PIN_UI: # This won't get you very far but it lets you create/enter PINs # and stops a traceback after that. sess['trans_id'] = trans_id() elif not sess.get('is_simulation', False): try: trans = solitude.get_transaction(sess.get('trans_id')) except ObjectDoesNotExist: if sess.get('trans_id'): log.info( 'Attempted to restart non-existent transaction {0}'.format( sess.get('trans_id'))) return _error(request, msg='req is required') pin_form = VerifyPinForm() if sess.get('uuid'): auth_utils.update_session(request, sess.get('uuid'), False) # Before we continue with the buy flow, let's save some # time and get the transaction configured via Bango in the # background. log.info('configuring transaction {0} from lobby'.format( sess.get('trans_id'))) tasks.configure_transaction(request, trans=trans) redirect_url = check_pin_status(request) if redirect_url is not None: return http.HttpResponseRedirect('{0}?next={1}'.format( reverse('pay.bounce'), redirect_url)) # If the buyer closed the trusted UI during reset flow, we want to unset # the reset pin flag. They can hit the forgot pin button if they still # don't remember their pin. if sess.get('uuid_needs_pin_reset'): solitude.set_needs_pin_reset(sess['uuid'], False) sess['uuid_needs_pin_reset'] = False if sess.get('is_simulation', False): sim_req = sess['notes']['pay_request']['request']['simulate'] log.info('Starting simulate %s for %s' % (sim_req, sess['notes']['issuer_key'])) return render(request, 'pay/simulate.html', {'simulate': sim_req}) return render(request, 'pay/lobby.html', { 'action': reverse('pin.verify'), 'form': pin_form, 'title': _('Enter Pin') })
def lobby(request): sess = request.session have_jwt = bool(request.GET.get('req')) log.info('starting from JWT? {have_jwt}'.format(have_jwt=have_jwt)) if have_jwt: # If it returns a response there was likely # an error and we should return it. res = process_pay_req(request) if isinstance(res, http.HttpResponse): return res elif settings.TEST_PIN_UI: # This won't get you very far but it lets you create/enter PINs # and stops a traceback after that. sess['trans_id'] = trans_id() pin_form = VerifyPinForm() if sess.get('uuid'): auth_utils.update_session(request, sess.get('uuid'), False, request.session.get('logged_in_user', None)) redirect_url = check_pin_status(request) if redirect_url is not None: return http.HttpResponseRedirect( '{0}?next={1}'.format(reverse('pay.bounce'), redirect_url) ) # If the buyer closed the trusted UI during reset flow, we want to unset # the reset pin flag. They can hit the forgot pin button if they still # don't remember their pin. if sess.get('uuid_needs_pin_reset'): try: solitude.set_needs_pin_reset(sess['uuid'], False) except ResourceModified: return system_error(request, code=msg.RESOURCE_MODIFIED) sess['uuid_needs_pin_reset'] = False if sess.get('is_simulation', False): sim_req = sess['notes']['pay_request']['request']['simulate'] log.info('Starting simulate %s for %s' % (sim_req, sess['notes']['issuer_key'])) return render(request, 'pay/simulate.html', { 'simulate': sim_req }) return render(request, 'pay/lobby.html', { 'action': reverse('pin.verify'), 'form': pin_form, 'title': _('Enter Pin'), 'track_cancel': { 'action': 'pin cancel', 'label': 'Pin Entry Page', }, })
def lobby(request): sess = request.session have_jwt = bool(request.GET.get('req')) log.info('starting from JWT? {have_jwt}'.format(have_jwt=have_jwt)) if have_jwt: # If it returns a response there was likely # an error and we should return it. res = process_pay_req(request) if isinstance(res, http.HttpResponse): return res elif settings.TEST_PIN_UI: # This won't get you very far but it lets you create/enter PINs # and stops a traceback after that. sess['trans_id'] = trans_id() pin_form = VerifyPinForm() if sess.get('uuid'): auth_utils.update_session(request, sess.get('uuid'), False) redirect_url = check_pin_status(request) if redirect_url is not None: return http.HttpResponseRedirect('{0}?next={1}'.format( reverse('pay.bounce'), redirect_url)) # If the buyer closed the trusted UI during reset flow, we want to unset # the reset pin flag. They can hit the forgot pin button if they still # don't remember their pin. if sess.get('uuid_needs_pin_reset'): try: solitude.set_needs_pin_reset(sess['uuid'], False) except ResourceModified: return system_error(request, code=msg.RESOURCE_MODIFIED) sess['uuid_needs_pin_reset'] = False if sess.get('is_simulation', False): sim_req = sess['notes']['pay_request']['request']['simulate'] log.info('Starting simulate %s for %s' % (sim_req, sess['notes']['issuer_key'])) return render(request, 'pay/simulate.html', {'simulate': sim_req}) return render( request, 'pay/lobby.html', { 'action': reverse('pin.verify'), 'form': pin_form, 'title': _('Enter Pin'), 'track_cancel': { 'action': 'pin cancel', 'label': 'Pin Entry Page', }, })
def lobby(request): sess = request.session have_jwt = bool(request.GET.get("req")) log.info("starting from JWT? {have_jwt}".format(have_jwt=have_jwt)) if have_jwt: # If it returns a response there was likely # an error and we should return it. res = process_pay_req(request) if isinstance(res, http.HttpResponse): return res elif settings.TEST_PIN_UI: # This won't get you very far but it lets you create/enter PINs # and stops a traceback after that. sess["trans_id"] = trans_id() pin_form = VerifyPinForm() if sess.get("uuid"): auth_utils.update_session(request, sess.get("uuid"), False) redirect_url = check_pin_status(request) if redirect_url is not None: return http.HttpResponseRedirect("{0}?next={1}".format(reverse("pay.bounce"), redirect_url)) # If the buyer closed the trusted UI during reset flow, we want to unset # the reset pin flag. They can hit the forgot pin button if they still # don't remember their pin. if sess.get("uuid_needs_pin_reset"): try: solitude.set_needs_pin_reset(sess["uuid"], False) except ResourceModified: return system_error(request, code=msg.RESOURCE_MODIFIED) sess["uuid_needs_pin_reset"] = False if sess.get("is_simulation", False): sim_req = sess["notes"]["pay_request"]["request"]["simulate"] log.info("Starting simulate %s for %s" % (sim_req, sess["notes"]["issuer_key"])) return render(request, "pay/simulate.html", {"simulate": sim_req}) return render( request, "pay/lobby.html", { "action": reverse("pin.verify"), "form": pin_form, "title": _("Enter Pin"), "track_cancel": {"action": "pin cancel", "label": "Pin Entry Page"}, }, )
def lobby(request): if request.GET.get('req'): # If it returns a response there was likely # an error and we should return it. res = process_pay_req(request) if isinstance(res, http.HttpResponse): return res elif settings.TEST_PIN_UI: # This won't get you very far but it lets you create/enter PINs # and stops a traceback after that. request.session['trans_id'] = uuid.uuid4() elif not 'notes' in request.session: # A JWT was not passed in and no JWT is in the session. return _error(request, msg='req is required') pin_form = VerifyPinForm() sess = request.session if sess.get('uuid'): auth_utils.update_session(request, sess.get('uuid')) redirect_url = check_pin_status(request) if redirect_url is not None: return http.HttpResponseRedirect(redirect_url) # If the buyer closed the trusted UI during reset flow, we want to unset # the reset pin flag. They can hit the forgot pin button if they still # don't remember their pin. if sess.get('uuid_needs_pin_reset'): solitude.set_needs_pin_reset(sess['uuid'], False) sess['uuid_needs_pin_reset'] = False if sess.get('is_simulation', False): sim_req = sess['notes']['pay_request']['request']['simulate'] log.info('Starting simulate %s for %s' % (sim_req, sess['notes']['issuer_key'])) return render(request, 'pay/simulate.html', {'simulate': sim_req}) return render(request, 'pay/lobby.html', { 'action': reverse('pin.verify'), 'form': pin_form, 'title': _('Enter Pin') })
try: trans = solitude.get_transaction(sess.get('trans_id')) except (ObjectDoesNotExist, HttpClientError), exc: if sess.get('trans_id'): log.info('Attempted to restart non-existent transaction ' '{trans}; exc={exc}' .format(trans=sess.get('trans_id'), exc=exc)) return system_error(request, code=msg.BAD_REQUEST) log.info('Re-used existing transaction ID: {tx}' .format(tx=sess.get('trans_id'))) pin_form = VerifyPinForm() if sess.get('uuid'): auth_utils.update_session(request, sess.get('uuid'), False) # Before we continue with the buy flow, let's save some # time and get the transaction configured via Bango in the # background. log.info('configuring transaction {0} from lobby' .format(sess.get('trans_id'))) if not tasks.configure_transaction(request, trans=trans): log.error('Configuring transaction failed.') redirect_url = check_pin_status(request) if redirect_url is not None: return http.HttpResponseRedirect( '{0}?next={1}'.format(reverse('pay.bounce'), redirect_url) )