def paymentprocess(messageText, userId):
    if 'field' not in context[userId]:
        pos = extract_preparation(messageText)
        field = extractor.getName(pos)
        context[userId]['field'] = field
        if len(context[userId]) == 2:
            return "Please enter the account number that you want to deposit"

    elif 'number' not in context[userId]:
        pos = extract_preparation(messageText)
        accnum = extractor.getNumber(pos)
        context[userId]['number'] = accnum
        return "What is consumer's name ?"

    elif 'name' not in context[userId]:
        pos = extract_preparation(messageText)
        # print(pos)
        name = extractor.getName(pos)
        context[userId]['name'] = name
        return "What is consumer's address ?"

    elif 'address' not in context[userId]:
        address = messageText
        context[userId]['address'] = address
        if len(context[userId]) == 5:
            return "How much do you prefer to pay \n[consider with LKR]"

    elif 'amount' not in context[userId]:
        pos = extract_preparation(messageText)
        amount = extractor.getNumber(pos)
        if amount == '':
            return "Amount should be a number. Please re-enter it"
        context[userId]['amount'] = float(amount)
        data = transaction_management.getpersonal(userId)
        context[userId]['code'] = verification_key_passer(
            data['email'], data['first_name'])
        return "Please check your email and enter the verification key.."

    else:
        pos = extract_preparation(messageText)
        code = extractor.getNumber(pos)
        if int(code) != context[userId]['code']:
            return "Verification key is invalid. Please re-enter it"
    # print(context[userId])
    boolean, reply, repindx = transaction_management.dopayment(
        userId, context[userId])

    if boolean:
        del context[userId]
    else:
        if repindx == 1 or repindx == 2:
            del context[userId]
        elif repindx == 3:
            del context[userId]['field']
        elif repindx == 4:
            del context[userId]['name'], context[userId]['address']
    print(reply)
    if reply == "Error has occured with the Banking server. Sorry about that!":
        del context[userId]
    return reply
def joinaccprocess(messageText, userId):
    if 'number' not in context[userId]:
        pos = extract_preparation(messageText)
        accnum = extractor.getNumber(pos)
        context[userId]['number'] = accnum
        return "What is your account holding registered name ?"

    elif 'name' not in context[userId]:
        pos = extract_preparation(messageText)
        # print(pos)
        name = extractor.getName(pos)
        context[userId]['name'] = name
        return "What is your NIC ?"

    elif 'nic' not in context[userId]:
        pos = extract_preparation(messageText)
        nic = extractor.getNumber(pos)
        context[userId]['nic'] = nic
    # print(context[userId])
    boolean, reply, repindx = transaction_management.loginaccount(
        userId, context[userId])

    if boolean:
        del context[userId]
    else:
        if repindx == 1:
            del context[userId]
        if repindx == 2:
            del context[userId]['number'], context[userId]['name'], context[
                userId]['nic']

    if reply == "Error has occured with the Banking server. Sorry about that!":
        del context[userId]
    return reply
def complainprocess(messageText, userId):
    if 'branch' not in context[userId]:
        pos = extract_preparation(messageText)
        branch = extractor.getName(pos)
        context[userId]['branch'] = branch
        if len(context[userId]) == 3:
            return "Describe about the Complaint with details !"

    elif 'description' not in context[userId]:
        description = messageText
        context[userId]['description'] = description

    boolean, reply, repindx = transaction_management.reportcomplain(
        context[userId])

    if boolean:
        del context[userId]
    else:
        if repindx == 1:
            del context[userId]
        elif repindx == 2:
            del context[userId]['branch']

    if reply == "Error has occured with the Banking server. Sorry about that!":
        del context[userId]
    return reply
def moneytrasferprocess(messageText, userId):
    if 'number' not in context[userId]:
        pos = extract_preparation(messageText)
        accnum = extractor.getNumber(pos)
        context[userId]['number'] = accnum
        return "What is the Holding account registered name ?"

    elif 'name' not in context[userId]:
        pos = extract_preparation(messageText)
        name = extractor.getName(pos)
        context[userId]['name'] = name
        if len(context[userId]) == 3:
            return "How much do you prefer to transfer \n[consider with LKR]"

    elif 'amount' not in context[userId]:
        pos = extract_preparation(messageText)
        amount = extractor.getNumber(pos)
        if amount == '':
            return "Amount should be a number. Please re-enter it"
        context[userId]['amount'] = float(amount)
        data = transaction_management.getpersonal(userId)
        context[userId]['code'] = verification_key_passer(
            data['email'], data['first_name'])
        return "Please check your email and enter the verification key.."
    else:
        pos = extract_preparation(messageText)
        code = extractor.getNumber(pos)
        if int(code) != context[userId]['code']:
            return "Verification key is invalid. Please re-enter it"

    boolean, reply, repindx = transaction_management.dotransfer(
        userId, context[userId])

    if boolean:
        del context[userId]
    else:
        if repindx == 1:
            del context[userId]
        elif repindx == 2:
            del context[userId]['number'], context[userId]['name']

    if reply == "Error has occured with the Banking server. Sorry about that!":
        del context[userId]
    return reply