def display_details(self):
     print("The details are :")
     print("-----------------")
     self.__cust_details=Func.get_customer_details(self.__cid)
     print("Name : "+ self.__cust_details[0])
     print("Gender : "+ self.__cust_details[1])
     print("Age : "+ str(self.__cust_details[2]))
     print("Phone : "+ str(self.__cust_details[3]))
 def display_details(self):
     print("The details are :")
     print("-----------------")
     self.__cust_details = Func.get_customer_details(self.__cid)
     print("Name : " + self.__cust_details[0])
     print("Gender : " + self.__cust_details[1])
     print("Age : " + str(self.__cust_details[2]))
     print("Phone : " + str(self.__cust_details[3]))
    def make_payment(self):
        while True:
            try:
                while True:
                    try:
                        acc_no = input("Enter account number: ").upper()
                        acc_details = Func.get_saving_details(acc_no)
                        if acc_details is not None and acc_details[
                                1] != self.__cid:
                            raise CustomExceptions.InvalidPaymentAccount()
                        if acc_details:
                            break
                    except CustomExceptions.InvalidPaymentAccount as e:
                        print(e)
                amount = input("Enter amount: ")
                validatations.validatePaymentAmount(amount)
                validatations.validateMinimumBal(acc_details[2], amount)
                break
            except CustomExceptions.InvalidPaymentAmountException as e:
                print(e)
            except CustomExceptions.MinimumBalanceException as e:
                print(e)
                print("You can withdraw upto " + str(acc_details[2] - 1000) +
                      " only")
                print("Please select another account")

        while True:
            try:
                captcha = self.generate_captcha()
                entered_captcha = input(
                    "Enter the Captcha as shown {} : ".format(captcha))
                if (entered_captcha == captcha):
                    descr = input("Enter Description: ")
                    pid = Func.make_payment(acc_no, int(amount), descr,
                                            acc_details)
                    if pid:
                        print("Your payment was successful with payment ID " +
                              str(pid))
                        print("Balance left in your Account is Rs. " +
                              str(acc_details[2] - int(amount)))
                    break
                else:
                    raise CustomExceptions.InvalidCaptchaException()
            except CustomExceptions.InvalidCaptchaException as e:
                print(e)
 def update_details(self):
     choice = input("Do you want to update your age, PAN or phone? Press 'Y' or 'N': ")
     if choice.upper()=="Y":
         while True:
             age = input("Enter new age. Press Enter to skip ")
             if Func.update_customer_age(self.__cid, age):
                 break
         while True:
             phone = input("Enter new phone. Press Enter to skip ")
             if Func.update_customer_phone(self.__cid, phone):
                 break
         while True and self.__cust_details[4] is None:
             pan = input("Enter new PAN. Press Enter to skip ")
             if Func.update_customer_pan(self.__cid, pan, self.__cust_details[0]):
                 break
         cust_details=Func.get_customer_details(self.__cid)
         print("Updated age: "+str(cust_details[2]))
         print("Updated phone: "+str(cust_details[3]))
         print("Successfully updated")
     choice = input("Do you want to open a FD? Press 'Y' or 'N': ")
     if choice.upper()=='Y':
         OpenFD(self.__cid)
 def update_details(self):
     choice = input("Do you want to update your age, PAN or phone? Press 'Y' or 'N': ")
     if choice.upper() == "Y":
         while True:
             age = input("Enter new age. Press Enter to skip ")
             if Func.update_customer_age(self.__cid, age):
                 break
         while True:
             phone = input("Enter new phone. Press Enter to skip ")
             if Func.update_customer_phone(self.__cid, phone):
                 break
         while True and self.__cust_details[4] is None:
             pan = input("Enter new PAN. Press Enter to skip ")
             if Func.update_customer_pan(self.__cid, pan, self.__cust_details[0]):
                 break
         cust_details = Func.get_customer_details(self.__cid)
         print("Updated age: " + str(cust_details[2]))
         print("Updated phone: " + str(cust_details[3]))
         print("Successfully updated")
     choice = input("Do you want to open a FD? Press 'Y' or 'N': ")
     if choice.upper() == "Y":
         OpenFD(self.__cid)
    def make_payment(self):
        while True:
            try:
                while True:
                    try:
                        acc_no=input("Enter account number: ").upper()
                        acc_details=Func.get_saving_details(acc_no)
                        if acc_details is not None and acc_details[1]!=self.__cid:
                            raise CustomExceptions.InvalidPaymentAccount()
                        if acc_details:
                            break
                    except CustomExceptions.InvalidPaymentAccount as e:
                        print(e)
                amount=input("Enter amount: ")
                validatations.validatePaymentAmount(amount)
                validatations.validateMinimumBal(acc_details[2], amount)
                break
            except CustomExceptions.InvalidPaymentAmountException as e:
                print(e)
            except CustomExceptions.MinimumBalanceException as e:
                print(e)
                print("You can withdraw upto "+str(acc_details[2]-1000)+" only")
                print("Please select another account")
 
        while True:
            try:
                captcha=self.generate_captcha()
                entered_captcha=input("Enter the Captcha as shown {} : ".format(captcha))
                if(entered_captcha==captcha):
                    descr=input("Enter Description: ")
                    pid=Func.make_payment(acc_no, int(amount), descr, acc_details)
                    if pid:
                        print("Your payment was successful with payment ID "+str(pid));
                        print("Balance left in your Account is Rs. "+str(acc_details[2]-int(amount)));
                    break
                else:
                    raise CustomExceptions.InvalidCaptchaException()
            except CustomExceptions.InvalidCaptchaException as e:
                print(e)
 def login(self):
     while self.__cid is None:
         cid = input("Enter customer Id: ")
         pwd = input("Enter password: ")
         self.__cid = Func.login(cid, pwd)
 def login(self):
     while self.__cid is None:
         cid = input("Enter customer Id: ")
         pwd = input("Enter password: ")
         self.__cid = Func.login(cid, pwd)