Пример #1
0
def external_transfer():
    if request.method == 'POST':
        from_acc = request.form['from_acc']
        to_bank = request.form['to_bank']
        swift = session.query(Banks).filter_by(name=to_bank).first()
        swift_code = swift.swift_code
        to_ext_acc = request.form['to_ext_acc']
        remark = request.form['remark']
        remark += " " + str(swift_code)
        amount = float(request.form['amount'])
        if amount > Getters.getCustomerAccountDetails(from_acc).working_bal:
            flash('Account Balance is Less than Required')
            return redirect(url_for('banking.external_transfer'))
        else:
            TransactionUpdate.externalTransferTransactionUpdate(
                from_acc, to_ext_acc, amount, remark,
                Getters.getSysDate().date)

            # TransactionUpdate.accChargeUpdate('RTGS', from_acc, Getters.getSysDate().date)
            ChargeTransaction(Getters.getSysDate().date,
                              from_acc).charges(TransactionType.RTGS)
            flash('RTGS Successful')
            return redirect(url_for('banking.external_transfer'))
    else:
        record = []
        # fad = From Account Details
        # tad = To Account Details
        fad = None
        tad = None
        return render_template('banking/external_transfer.html',
                               fad=fad,
                               tad=tad,
                               record=record,
                               user=Profile().user_details(),
                               banks=Getters.getBanks())
Пример #2
0
def transfer():
    if request.method == 'POST':
        from_acc = request.form['from_acc']
        to_acc = request.form['to_acc']
        remark = request.form['remark']
        amount = float(request.form['amount'])
        if amount > Getters.getCustomerAccountDetails(from_acc).working_bal:
            flash('The Account ' + from_acc + ' has no overdraft facility ')
            return redirect(url_for('banking.transfer'))
        else:
            TransactionUpdate.transferTransactionUpdate(
                from_acc, to_acc, amount, remark,
                Getters.getSysDate().date)
            # TransactionUpdate.accChargeUpdate('TR', from_acc, Getters.getSysDate().date)
            ChargeTransaction(Getters.getSysDate().date,
                              from_acc).charges(TransactionType.TRANSFER)

            flash('Transfer Successful')
            return redirect(url_for('banking.transfer'))
    else:
        record = []
        fad = None
        tad = None
        return render_template('banking/transfer.html',
                               user=Profile().user_details(),
                               record=record,
                               fad=fad,
                               tad=tad)
Пример #3
0
def external_transfer_search():
    if request.method == 'POST':
        acc_num = int(request.form['from_account'])
        if session.query(Customer).filter_by(acc_number=acc_num).first():
            record = session.query(Customer).filter_by(
                acc_number=acc_num).first()
            return render_template(
                'banking/external_transfer.html',
                record=Getters.getCustomerAccountDetails(acc_num),
                user=Profile().user_details(),
                banks=Getters.getBanks(),
                fad=Getters.getCustomerAccountDetails(acc_num))
        else:
            flash('The Account Number Provided Is NOT In The System')
            record = None
            return render_template('banking/deposits.html',
                                   record=record,
                                   user=Profile().user_details(),
                                   banks=Getters.getBanks())
    else:
        return redirect(url_for('banking.deposits'))
Пример #4
0
def transfer_search():
    if request.method == 'POST':
        from_account = request.form['from_account']
        to_account = request.form['to_account']
        if from_account == to_account:
            flash('The Accounts submitted are the same')
            return redirect(url_for('banking.transfer'))

        if Verify.account_exists(from_account):
            if Verify.account_exists(to_account):
                record = [from_account, to_account]
                return render_template(
                    'banking/transfer.html',
                    user=Profile().user_details(),
                    record=record,
                    fad=Getters.getCustomerAccountDetails(from_account),
                    tad=Getters.getCustomerAccountDetails(to_account))
            else:
                flash('To Account number is not valid')
                return redirect(url_for('banking.transfer'))
        else:
            flash('from account is not valid')
            return redirect(url_for('banking.transfer'))