def index(): info = PaymentInfo('1.00', 'Test transfer', utils.ref_731('123')) urls = {'cancel': url_for('cancel', _external=True), 'reject': url_for('reject', _external=True), 'return': url_for('finish', _external=True)} payment = provider(info, urls) return render_template('form.html', payment=payment)
def index(): info = PaymentInfo('1.00', 'Test transfer', utils.ref_731('123')) urls = { 'cancel': url_for('cancel', _external=True), 'reject': url_for('reject', _external=True), 'return': url_for('finish', _external=True) } payment = provider(info, urls) return render_template('form.html', payment=payment)
def payment(): bank = request.args.get('bank', None) # Do some basic error checking if not bank or bank not in app.providers: return redirect(url_for('index')) # Set up payment information (amount, description and reference no.) payment_info = PaymentInfo('6.66', u'Payment infö', ref_731('123456')) # Set up return urls urls = {'return': url_for('finish', _external=True)} # Do bank-specific handling (ie. Tupas/SOLO has extra return urls) if bank.startswith('tupas'): urls['reject'] = url_for('finish', result='cancel', _external=True) urls['cancel'] = url_for('finish', result='reject', _external=True) # Save bank id in session (comes in handy when processing returns) session['bank'] = bank return render_template('form.html', payment=app.providers[bank](payment_info, urls))