def setUp(self): self.browser = webdriver.Firefox() category = Category(name="salary", type="income") category.save() account = Account(name="savings") account.save() income = Income(category=category, account=account, notes="October 2015 salary", amount=100000, date=datetime.datetime.now()) income.save()
def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) category = Category(name="others", type="expense") category.save() account = Account(name="savings") account.save() expense = Expense(category=category, account=account, notes="gift", amount=1000, date=datetime.datetime.now()) expense.save()
def create_account(): if not session.get('user_id'): return redirect(url_for('login')) if request.method == 'POST': ws_cust_id = request.form['ws_cust_id'] ws_acct_id = get_random_alphaNumeric_string(9) ws_acct_type = request.form['ws_acct_type'] ws_acct_balance = int(request.form['ws_acct_balance']) if ws_acct_balance <= 0: flash("Account creation Failed due to negative amount!", "danger") return redirect(url_for('create_account')) ws_acct_crdate = datetime.now() ws_acct_lasttrdate = datetime.now() ws_acct_duration = 0 ws_status = 'CREATED' account = Account.objects(ws_cust_id=ws_cust_id, ws_acct_type=ws_acct_type) if account: flash( "Current User already have this type of account please try other", "danger") return redirect(url_for('create_account')) account = Account(ws_cust_id=ws_cust_id, ws_acct_id=ws_acct_id, ws_acct_type=ws_acct_type, ws_acct_balance=ws_acct_balance, ws_acct_crdate=ws_acct_crdate, ws_message='CREATED', ws_acct_lasttrdate=ws_acct_lasttrdate, ws_acct_duration=ws_acct_duration, ws_status=ws_status) account.save() transactions = Transactions( ws_tnsc_id=get_random_alphaNumeric_string(8), ws_acct_id=ws_acct_id, ws_desc='Deposit', ws_amt=ws_acct_balance, ws_trxn_date=datetime.now()) transactions.save() flash("Account creation initiated successfully!", "success") return redirect('/accounts/' + ws_acct_id) return render_template("account_management/create_account.html")
def create_account(): if not session.get('username'): return redirect(url_for('login')) if request.method == "POST": customer_id = request.form["CustomerId"] account_id = request.form['AccountId'] account_type = request.form["Account"] deposit_amount = request.form["DepositAmount"] temp = User.objects(customer_ssn_id=customer_id) if temp: account = Account(account_id=account_id,customer_ssn_id=customer_id, account_type=account_type, deposit_amount= deposit_amount) account.save() flash("You are successfully registered!","success") return redirect(url_for('index')) else: flash("Oops!!No such customer exist!!Register first","danger") return redirect(url_for('register')) return render_template("acccountcreate.html")
def create_account(): if not session.get('username'): return redirect(url_for('login')) form = AccountForm() customer_Id = form.customerId.data account_type = form.account_type.data deposit = form.deposit.data customer = Customer() if customer_Id: classess = list( Customer.objects.aggregate(*[{ '$lookup': { 'from': 'account', 'localField': 'customerId', 'foreignField': 'customerId', 'as': 'r1' } }, { '$match': { 'customerId': customer_Id } }])) print(classess) if classess: acc = Account(customerId=customer_Id, account_type=account_type, deposit=deposit) acc.save() flash("Account created", 'success') return redirect(url_for('create_account')) else: flash("account not found") return render_template("create_account.html", title="Create Account", account_management=True, form=form)
def create_account(): data = request.get_json() account = Account(**data) if Account.find_account(data['username']) is not None: abort(400, f"Username '{data['username']}' is already taken") elif Account.find_account(data['email']) is not None: abort(400, f"Email '{data['email']}' is already taken") try: return account.save().to_dict() except Exception as e: current_app.logger.error(e) abort(400, "could not create account")