def index(request): sessionstore.set_customer(request, None) sessionstore.set_offer(request, None) sessionstore.set_request(request, None) return render_to_response('index.html', { }, context_instance=RequestContext(request))
def create_request(request): credit_req = creditapprovalclient.createCreditRequest() credit_req.amount.amount = request.POST['amount'] credit_req.amount.currency_code = request.POST['currency'] credit_req.customer = sessionstore.get_customer(request) credit_req.duration.years = request.POST['duration'] credit_req.reason = request.POST['reason'] sessionstore.set_request(request, credit_req) return render_to_response('search-warrantors.html', { 'credit_request': credit_req, }, context_instance=RequestContext(request))
def show_warrantor(request): name = request.POST['name'] credit_req = sessionstore.get_request(request) try: warrantor = creditapprovalclient.getCustomerByName(name) except: messages.error(request, 'Customer with name "{name}" not found'.format( name=name)) warrantor = None if warrantor: warrantor = ratingclient.setRating(warrantor) credit_req.warrantors.append(warrantor) sessionstore.set_request(request, credit_req) return render_to_response('search-warrantors.html', { 'credit_request': credit_req, }, context_instance=RequestContext(request))
def update_request(request): credit_req = sessionstore.get_request(request) credit_req.amount.amount = request.POST['amount'] credit_req.amount.currency_code = request.POST['currency'] credit_req.duration.years = request.POST['duration'] credit_req.reason = request.POST['reason'] sessionstore.set_request(request, credit_req) offer = creditapprovalclient.placeCreditRequest(credit_req) if not getattr(offer, 'warrantors', False): offer.request.warrantors = [] sessionstore.set_offer(request, offer) return render_to_response('offer.html', { 'id': offer._offer_id, 'offer': offer, }, context_instance=RequestContext(request))