Exemplo n.º 1
0
 def test_card_incorrect(self):
     self.assertFalse(card.check_card('79927398710'))
     self.assertFalse(card.check_card('79927398711'))
     self.assertFalse(card.check_card('79927398712'))
     self.assertFalse(card.check_card('79927398714'))
     self.assertFalse(card.check_card('79927398715'))
     self.assertFalse(card.check_card('79927398716'))
     self.assertFalse(card.check_card('79927398717'))
     self.assertFalse(card.check_card('79927398718'))
     self.assertFalse(card.check_card('79927398719'))
Exemplo n.º 2
0
def login(account):
    if not account:
        return True

    else:
        print('\nYou have successfully logged in!')
        while True:
            print('1. Show Account Info\n2. Show Balance\n3. Deposit Money\n4. Withdraw Money\n5. Do Transfer\n6. Close Account\n7. Log Out\n8.Transactions\n9.Show Mini Statement\n0. Exit')
            choice = input()
            if choice == '1':
                account_number, name, age, card_number, pin, balance = db.get_account_info(account)[0]
                print(f'Name: {name}\nAge: {age}\nAccount Number: {account_number}\nCard Number: {card_number}\nBalance: {balance}\n')
            elif choice == '2':
                tr.balance(account)
            elif choice == '3':
                amount = int(input('Enter the amount you want to add: '))
                if amount < 100:
                    print('Amount must be more than Rs 99')
                elif amount > 500000:
                    print('Cannot add more than Rs 5,00,000')
                else:
                    tr.add_income(account, amount)
                    cur_bal = db.get_bal(account)
                    print(f'{amount} has been credited\nYour current balance now is: {cur_bal[0]}')
            elif choice == '4':
                amount = int(input('Enter the amount you want to take: '))
                tr.sub_income(account, amount)
                cur_bal = db.get_bal(account)
                print(f'{amount} has been debited\nYour current balance now is: {cur_bal[0]}')
            elif choice == '5':
                tr.do_transfer(account)
            elif choice == '6':
                check = cd.check_card()
                if check:
                    tr.del_account(check)
                    return True
            elif choice == '7':
                print('You have successfully logged out!')
                return True
            elif choice == '8':
                db.transaction_details(account)
            elif choice == '9':
                db.show_mini(account)
            elif choice == '0':
                return False
Exemplo n.º 3
0
def main_menu():
    while True:
        print('\n1. Create an account\n2. Log into account\n3. Show all accounts\n0. Exit')
        choice = input()
        if choice == '1':
            cd.create_card()
            continue
        elif choice == '2':
            loggedin = mn.login(cd.check_card())
            if loggedin:
                continue
            else:
                stop()
                break
        elif choice == '3':
            db.show_details()
        elif choice == '0':
            stop()
            break
Exemplo n.º 4
0
 def test_card_correct_11_digits(self):
     self.assertTrue(card.check_card('79927398713'))
Exemplo n.º 5
0
 def test_card_correct_15_digits(self):
     self.assertTrue(card.check_card('370594756527911'))
     self.assertTrue(card.check_card('379451233726940'))
     self.assertTrue(card.check_card('341377872063524'))
     self.assertTrue(card.check_card('376766310514015'))
     self.assertTrue(card.check_card('375692442227519'))
Exemplo n.º 6
0
 def test_card_correct_16_digits(self):
     self.assertTrue(card.check_card('4929134138580797'))
     self.assertTrue(card.check_card('4152651010436721'))
     self.assertTrue(card.check_card('4539667947868665'))
     self.assertTrue(card.check_card('4024007164776170'))
     self.assertTrue(card.check_card('4485154991816266'))
     self.assertTrue(card.check_card('5443972305885927'))
     self.assertTrue(card.check_card('5114869172331548'))
     self.assertTrue(card.check_card('5578916533101687'))
     self.assertTrue(card.check_card('5406733474061897'))
     self.assertTrue(card.check_card('5419564871798376'))
     self.assertTrue(card.check_card('6011395236301055'))
     self.assertTrue(card.check_card('6011432269128210'))
     self.assertTrue(card.check_card('6011636118723985'))
     self.assertTrue(card.check_card('6011631220718007'))
     self.assertTrue(card.check_card('6011856166915099'))