def store_customer(): form = CustomerForm() if form.validate(): given_name = form.data['given_name'] family_name = form.data['family_name'] address_line_one = form.data['address_line_one'] city = form.data['city'] postcode = form.data['postcode'] email = form.data['email'] mobile = form.data['mobile'] now = datetime.datetime.now() # Store customer in session sid = session['sid'] # Store email in session session['email'] = email # Store plan in session jamlaApp = Jamla() jamla = jamlaApp.load(src=app.config['JAMLA_PATH']) if jamlaApp.sku_exists(request.args.get('plan')): wants = request.args.get('plan') session['plan'] = wants print "##################" con = sqlite3.connect(app.config["DB_FULL_PATH"]) cur = con.cursor() cur.execute( "INSERT INTO person VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (sid, now, given_name, family_name, address_line_one, city, postcode, email, mobile, wants, 'null', 'null', False)) con.commit() con.close() if jamlaApp.requires_instantpayment(session['package']): return redirect( url_for('up_front', _scheme='https', _external=True, sid=sid, package=wants, fname=given_name)) if jamlaApp.requires_subscription(session['package']): return redirect(url_for('establish_mandate')) return redirect(url_for('thankyou', _scheme='https', _external=True)) else: return "Oops, there was an error processing that form, please go back and try again."
def store_customer(): form = CustomerForm() if form.validate(): given_name = form.data["given_name"] family_name = form.data["family_name"] address_line_one = form.data["address_line_one"] city = form.data["city"] postcode = form.data["postcode"] email = form.data["email"] mobile = form.data["mobile"] now = datetime.datetime.now() # Store customer in session sid = session["sid"] # Store email in session session["email"] = email # Store plan in session jamlaApp = Jamla() jamla = get_jamla() jamlaApp.load(jamla=jamla) if jamlaApp.sku_exists(request.args.get("plan")): wants = request.args.get("plan") session["plan"] = wants db = get_db() db.execute( "INSERT INTO person VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", ( sid, now, given_name, family_name, address_line_one, city, postcode, email, mobile, wants, "null", "null", False, ), ) db.commit() # Store note to seller in session if there is one note_to_seller = form.data["note_to_seller"] session["note_to_seller"] = note_to_seller if jamlaApp.requires_instantpayment(session["package"]): return redirect( url_for( "views.up_front", _scheme="https", _external=True, sid=sid, package=wants, fname=given_name, )) if jamlaApp.requires_subscription(session["package"]): # Check if in iframe if form.data["is_iframe"] == "True": insideIframe = True else: insideIframe = False return redirect( url_for("views.establish_mandate", inside_iframe=insideIframe)) return redirect( url_for("views.thankyou", _scheme="https", _external=True)) else: return "Oops, there was an error processing that form, please go back and try again."