def changepin(uid, num): upfile = open('userpass.txt', 'r+') details = list(upfile) ans = '' for i in details: if uid in i: old = gp.getpass('Enter Old Pin: ') if old in i[4:]: new = gp.getpass('Enter New Pin: ') retype = gp.getpass('Re-type New Pin: ') if new == retype: details.remove(i) details.append(uid + ' ' + new + '\n') print 'PIN Changed.' for j in range(len(details)): ans += details[j] upfile.seek(0) upfile.write(ans) msg = "Your IBS ATM pin has been changed. If you don't recognize this activity, Contact Bank." + '\n --Regards,\n IBS Bank.' #Use your login phone number and password of Way2sms #num is the Customer phone number sendsms.send('___________', '___________', int(num), msg) else: print 'Try Again !\n' changepin(uid) else: print 'Old PIN Mismatch. Try Next time.' break
def withdraw(uid, amount, num): wfile = open('balance.txt', 'r+') log = open('transac_log.txt', 'a') details = list(wfile) ans = '' for i in details: if uid in i: tempbal = int(i[4:]) if amount < tempbal: tempbal -= amount details.remove(i) details.append(str(uid) + ' ' + str(tempbal) + '\n') for j in range(len(details)): ans += details[j] print '\nProcessing...' sleep(2) wfile.seek(0) wfile.write(ans) print '\nCollect your Cash.' sleep(1) t = datetime.now().strftime('%Y-%m-%d %H:%M:%S') st = uid + ' ' + t + ' Rs.' + str(amount) + ' ATM WDL\n' log.write(st) msg = 'Your account is debited with Rs.' + str( amount) + '\n --Regards,\n IBS Bank.' #Use your login phone number and password of Way2sms #num is the Customer phone number sendsms.send('___________', '___________', int(num), msg) break else: print '\n\tInsufficient Balance.\n'
def deposit(uid, amount, num): dfile = open('balance.txt', 'r+') log = open('transac_log.txt', 'a') details = list(dfile) ans = '' for i in details: if uid in i: tempbal = int(i[4:]) print('\nInsert your cash.') sleep(2) tempbal += amount details.remove(i) details.append(str(uid) + ' ' + str(tempbal) + '\n') for j in range(len(details)): ans += details[j] print '\nProcessing...' sleep(2) dfile.seek(0) dfile.write(ans) print '\nAmount Deposited.' sleep(1) t = datetime.now().strftime('%Y-%m-%d %H:%M:%S') st = uid + ' ' + t + ' Rs.' + str(amount) + ' CASH DEPOSIT\n' log.write(st) msg = 'Your account is credited with Rs.' + str( amount) + '\n --Regards,\n IBS Bank.' #Use your login phone number and password of Way2sms #num is the Customer phone number sendsms.send('___________', '___________', int(num), msg) break
def sendAll(sender, message): sndr_name = '' for name in venmo_database: if venmo_database[name] == int(sender): sndr_name = name for name in venmo_database: if venmo_database[name] != int(sender): msg = sndr_name.capitalize() + ': ' + message sendsms.send(venmo_database[name], msg) time.sleep(0.5)
def do(str): print(str) if str == 'send': sendsms.send('14088939075', 'hi') elif str == 'receive': receivesms.do()
def charge(amount, user, message, sender): query = 'venmo charge ' + str(user) + ' ' + amount + ' "' + message + '"' output = subprocess.check_output(query, shell=True) print(query) sendsms.send(sender, output)