Beispiel #1
0
def getInvestmentProfileService(userName):
    try:
        customerDetailsobjs = getCustomerDetailsDB(userName)

        custTaskObj = checkTaskStatusByCustIdAndNameDB(
            customerDetailsobjs[0].id, 'Investment')
        investmentData = False
        if len(custTaskObj) == 0:

            custInvestmentgProfileObjs = getInvestmentProfileDB(
                customerDetailsobjs[0].id)

            investmentData = []
            for custInvestmentgProfileObj in custInvestmentgProfileObjs:

                obj = {
                    'order': custInvestmentgProfileObj.order,
                    'attribute': custInvestmentgProfileObj.attribute,
                    'custresponse': custInvestmentgProfileObj.custresponse,
                    'attributetype': custInvestmentgProfileObj.attributetype
                }

                investmentData.append(obj)

        return investmentData
    except Exception as e:
        logging.error(
            "Error in retreving Investment profile By custID service" + str(e))
        raise
Beispiel #2
0
def getCustomerDetailsService(userName):
    try:
        customerDetailsObj = getCustomerDetailsDB(userName)
        if len(customerDetailsObj) == 1:
            return customerDetailsObj[0]
    except Exception as e:
        logging.error("Error in retrieving customer details service " + str(e))
        raise
Beispiel #3
0
def sendOTPByEmailService(dataObj):
    try:
        otp = generateOTP()
        getOTPByEmail(dataObj['email'], otp)
        customerDetailsobjs = getCustomerDetailsDB(dataObj['custregmobile'])
        updateEmailOTPDB(otp, customerDetailsobjs[0].id)
        updateCustomerEmailDB(dataObj['email'], dataObj['custregmobile'])
    except Exception as e:
        logging.error("Error in sending OTP by email service " + str(e))
        raise
Beispiel #4
0
def saveDocumentsService(userName):
    try:
        customerObj = getCustomerDetailsDB(userName)
        customerObj = customerObj[0]
        
        updateTaskByCustIdAndNameDB(customerObj.id,'Document','C')
            
    except Exception as e:
        logging.error("Error in save documents service "+str(e))
        raise    
Beispiel #5
0
def updateInvestmentProfileService(investmentProfileList, userName):
    try:
        customerDetailsobjs = getCustomerDetailsDB(userName)
        print(investmentProfileList)
        updateInvestmentProfileDB(investmentProfileList,
                                  customerDetailsobjs[0].id)

    except Exception as e:
        logging.error("Error in updating Investment profile service" + str(e))
        raise
def savePersonalProfileService(personal_profile, userName):
    try:
        customerDetailsobjs = getCustomerDetailsDB(userName)
        updateCustomerProfileDB(personal_profile['cust'])
        savePersonalProfileDB(personal_profile['custProfile'],
                              customerDetailsobjs[0].id)
        updateTaskByCustIdAndNameDB(customerDetailsobjs[0].id, 'Personal', 'C')

    except Exception as e:
        logging.error("Error in saving personal profile " + str(e))
        raise
Beispiel #7
0
def saveInvestmentProfileService(investmentProfileList, userName):
    try:
        customerDetailsobjs = getCustomerDetailsDB(userName)
        saveInvestmentProfileDB(investmentProfileList,
                                customerDetailsobjs[0].id)
        updateTaskByCustIdAndNameDB(customerDetailsobjs[0].id, 'Investment',
                                    'C')

    except Exception as e:
        logging.error("Error in saving Investment profile service" + str(e))
        raise
Beispiel #8
0
def validateMobileandSaveService(dataObj, ip, device):
    try:
        customerDetailsobjs = getCustomerDetailsDB(dataObj['custregmobile'])
        if len(customerDetailsobjs) != 0:
            clientDetails = validateClientMobileDB(customerDetailsobjs[0].id,
                                                   ip, device)
            if len(clientDetails) == 0:
                getOTP(dataObj['custcountrycode'] + dataObj['custregmobile'])
                saveCustomerDetailsDB({
                    'custregmobile':
                    dataObj['custregmobile'],
                    'custstatus':
                    'P',
                    'custstatusold':
                    'P',
                    'custcountrycode':
                    dataObj['custcountrycode']
                })
                customerDetailsobjs = getCustomerDetailsDB(
                    dataObj['custregmobile'])
                saveClientMobileService(dataObj, ip, device,
                                        customerDetailsobjs[0].id)
                return True
            else:
                return False
        else:
            getOTP(dataObj['custcountrycode'] + dataObj['custregmobile'])
            saveCustomerDetailsDB({
                'custregmobile': dataObj['custregmobile'],
                'custstatus': 'P',
                'custstatusold': 'P',
                'custcountrycode': dataObj['custcountrycode']
            })
            customerDetailsobjs = getCustomerDetailsDB(
                dataObj['custregmobile'])
            saveClientMobileService(dataObj, ip, device,
                                    customerDetailsobjs[0].id)
            return True
    except Exception as msg:
        logging.error('Error in validating mobile service ' + str(msg))
        raise
def updateCustPersonalProfileService(custPersonalProfileUpdatedata, userName):
    try:
        customerDetailsobjs = getCustomerDetailsDB(userName)
        print(custPersonalProfileUpdatedata['custProfile'])
        updateCustomerProfileDB(custPersonalProfileUpdatedata['cust'])
        updatecustPersonalProfileDB(
            custPersonalProfileUpdatedata['custProfile'],
            customerDetailsobjs[0].id)

    except Exception as e:
        logging.error("Error in updating Personal Profile service" + str(e))
        raise
Beispiel #10
0
def resendOTPService(dataObj):
    try:
        if dataObj['otpType'] == 'mobile':
            reSendOTP(dataObj['custcountrycode'] + dataObj['custregmobile'])
        elif dataObj['otpType'] == 'email':
            otp = generateOTP()
            getOTPByEmail(dataObj['email'], otp)
            customerDetailsobjs = getCustomerDetailsDB(
                dataObj['custregmobile'])
            updateEmailOTPDB(otp, customerDetailsobjs[0].id)
    except Exception as e:
        logging.error("Error in resending OTP service " + str(e))
        raise
Beispiel #11
0
def verifyOTPByEmailService(dataObj):
    try:
        customerDetailsobjs = getCustomerDetailsDB(dataObj['custregmobile'])

        clientList = validateClientOTPByEmailDB(dataObj['otp'],
                                                customerDetailsobjs[0].id)
        if len(clientList) != 0:
            return True
        else:
            return False
    except Exception as e:
        logging.error("Error in verifyting OTP by email" + str(e))
        raise
Beispiel #12
0
def validateClientPasswordService(dataObj):
    try:
        customerDetailsobjs = getCustomerDetailsDB(dataObj['custregmobile'])

        clientList = validateClientPasswordDB(dataObj['password'],
                                              customerDetailsobjs[0].id)
        if len(clientList) != 0:
            return True
        else:
            return False
    except Exception as e:
        logging.error("Error in validating client credentials service " +
                      str(e))
        raise
Beispiel #13
0
def saveClientPasswordService(dataObj, userName):
    try:
        customerDetailsobjs = getCustomerDetailsDB(userName)

        custRegistrationObj = getCustRegistrationDB(customerDetailsobjs[0].id)
        if custRegistrationObj.password == 'None':
            saveClientPasswordDB(dataObj, customerDetailsobjs[0].id)

            custObj = {'custregmobile': userName, 'customerStatus': 'R'}
            updateCustomerDetailsDB(custObj)

            custTasksObjs = getCustTasksByCustIdDB(customerDetailsobjs[0].id)
            if len(custTasksObjs) != 3:
                profileTaskStatusList = []
                obj = {
                    'custid': customerDetailsobjs[0].id,
                    'taskname': 'Personal',
                    'status': 'P',
                    'tasktype': 'P'
                }
                profileTaskStatusList.append(obj)
                obj = {
                    'custid': customerDetailsobjs[0].id,
                    'taskname': 'Investment',
                    'status': 'P',
                    'tasktype': 'P'
                }
                profileTaskStatusList.append(obj)
                obj = {
                    'custid': customerDetailsobjs[0].id,
                    'taskname': 'Document',
                    'status': 'P',
                    'tasktype': 'D'
                }
                profileTaskStatusList.append(obj)
                updateCustTaskStatusDB(profileTaskStatusList)
        else:
            saveClientPasswordDB(dataObj, customerDetailsobjs[0].id)

    except Exception as e:
        logging.error("Error in saving client password service " + str(e))
        raise
Beispiel #14
0
def checkSubscriptionExpirationService(userName):
    try:
        customerObj = getCustomerDetailsDB(userName)
        customerObj = customerObj[0]
       
            
        custSubscriptionObjs = getCustSubscriptionByStatusAndCustIdDB(customerObj.id,'A')
        
        for custSubscriptionObj in custSubscriptionObjs:
            utc=pytz.UTC
            
            expirationDt = custSubscriptionObj.servexpdt.replace(tzinfo=utc) 
            presentDt = datetime.datetime.now().replace(tzinfo=utc) 
            if presentDt<expirationDt:
                
                return True
            else:
                
                updateCustSubscriptionStatusDB(customerObj.id,'E') 
                return False  
    except Exception as e:
        logging.error("Error in checking subscription expiration "+str(e))
        raise
def getcustPersonalProfileService(userName):
    try:
        customerDetailsobjs = getCustomerDetailsDB(userName)

        custTaskObj = checkTaskStatusByCustIdAndNameDB(
            customerDetailsobjs[0].id, 'Personal')
        custPersonalProfileData = False
        print(customerDetailsobjs[0].id)
        print(len(custTaskObj))
        if len(custTaskObj) == 0:

            custPersonalProfileObjs = getcustPersonalProfileDB(
                customerDetailsobjs[0].id)

            custPersonalProfileData = []
            for custPersoanlProfileObj in custPersonalProfileObjs:
                obj = {
                    'order': custPersoanlProfileObj.order,
                    'attribute': custPersoanlProfileObj.attribute,
                    'custresponse': custPersoanlProfileObj.custresponse,
                    'attributetype': custPersoanlProfileObj.attributetype
                }

                custPersonalProfileData.append(obj)
        elif len(custTaskObj) != 0:
            custMblandEmail = Customer.objects.get(
                id=customerDetailsobjs[0].id)
            custPersonalProfileData = {
                "custregmobile": custMblandEmail.custregmobile,
                "custemail": custMblandEmail.custemail
            }

        return custPersonalProfileData
    except Exception as e:
        logging.error(
            "Error in retrieving Personal profile By custID service" + str(e))
        raise
Beispiel #16
0
def saveSubscriptionService(subscriptionDetils,userName):
    try:
        
        customerObj = getCustomerDetailsDB(userName)
        customerObj = customerObj[0]
        
        servsigneddt=datetime.datetime.now()
        
      
        for servid in subscriptionDetils['servidList']:
            
            servexpdt= servsigneddt+datetime.timedelta(365)
            servexpdt = servsigneddt + datetime.timedelta(0,600)
            
            obj = {
                'custid':customerObj.id,
                'servid':servid,
                'servsigneddt':servsigneddt,
                'servexpdt':servexpdt,
                'servstatus':'A'    
            }
            
            saveSubscriptionDetailsDB(obj)

            custSubscriptionObj = getCustSubscriptionByServIDAndCustIdDB(customerObj.id,servid,'A')
            
            if len(custSubscriptionObj) == 1:
                custSubscriptionObj = custSubscriptionObj[0]
            
            obj = {
                'custid':customerObj.id,
                'servid':servid,
                'custsubid':custSubscriptionObj.id,
                'paymentmod':subscriptionDetils['paymentmod'],
                'paygateway':subscriptionDetils['paygateway'],
                'payamount':subscriptionDetils['payamount'],
                'payreference': subscriptionDetils['payreference']
            }
            savePaymentDetailsDB(obj)
            
            custPaymentObj = getCustPaymentByIDsDB(customerObj.id,servid,custSubscriptionObj.id)
            if len(custPaymentObj) == 1:
                custPaymentObj = custPaymentObj[0]
            
            updateCustSubscriptionPaymentIDDB(custSubscriptionObj.id,custPaymentObj.id)
            
        if customerObj.custstatus == 'R' and customerObj.custstatusold == 'P':
            dataObj ={
                'custregmobile':userName,
                'customerStatus':'S'
            }
            updateCustomerDetailsDB(dataObj)
        elif customerObj.custstatus == 'E' and customerObj.custstatusold == 'S' :
            dataObj ={
                'custregmobile':userName,
                'customerStatus':'S'
                }
            updateCustomerDetailsDB(dataObj)
        elif customerObj.custstatus == 'E' and customerObj.custstatusold == 'I' :
            dataObj ={
                'custregmobile':userName,
                'customerStatus':'I'
                }
            updateCustomerDetailsDB(dataObj)
            
    except Exception as e:
        logging.error("Error in saving subscription service "+str(e))
        raise