def bank_config_inquiry(user, agent, dialer, bank_id):
    print 'Starting bank config inquiry'
    result = {}

    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_BANK_CONFIG_INQUIRY)
    bank_identifier = Bank_Detail.objects.get(bank_id = bank_id).identifier
    url = api_url + '/banks'
    data = {}
    params = {'bank_code':bank_identifier,'initiator_id':"mobile_number:"+str(dialer)}
    request_type = 'GET'

    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, agent.official_detail.bank.id)
    result_text = module_apicaller.api_call(user, agent, transaction_type, dialer,request_type, url, params, data, headers, extra_param)
    result['status'] = module_responsehandler_new.bank_config_inquiry_response(result_text)
    
    # FRom ifsc status and isverification flag we can show the next form to the user
    if result['status'] == constants.BANK_CONFIG_INQUIRY_SUCCESS_STATUS:
        response = str(json.loads(result_text)['message']) 
        result['ifsc_status'] = json.loads(result_text)['data']['ifsc_status']
        result['isverificationavailable'] = json.loads(result_text)['data']['isverificationavailable']
    else:
        
        response = result_text
    result['responseText'] = module_responsehandler_new.get_formatted_response(response)        

    return result
def transaction_search_by_tid(user, agent, dialer, transactionId):
    print "String Transaction Enquary"
    print('Transaction id: ', transactionId)

    result = {}
    url = api_url + '/transactions/' + str(transactionId)
    params = {'initiator_id': 'mobile_number:' + str(dialer)}
    data = {}
    request_type = 'GET'

    transaction_type = Transaction_Type.objects.get(id=constants.TRXN_ENQ)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, constants.BANK_ICICI)
    # Calling the api_call function and passing the necessary parameters
    result_text = module_apicaller.api_call(user, agent, transaction_type,
                                            dialer, request_type, url, params,
                                            data, headers, extra_param)

    if 'status' not in result_text:
        response = result_text
    else:
        result_text_json = json.loads(result_text)
        if result_text_json['response_type_id'] == 70:
            response = module_responsehandler_new.get_formatted_response_data(
                result_text_json['data'])

        elif result_text_json['response_type_id'] == 69:
            response = result_text_json['invalid_params']['tid']
        else:
            response = result_text_json['message']
    result['responseText'] = module_responsehandler_new.get_formatted_response(
        response)
    return result
Esempio n. 3
0
def balance_inquiry(user, agent, dialer):
    print 'Starting balance inquiry'

    result = {}
    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_BALANCE_INQUIRY)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, agent.official_detail.bank.id)
    if agent.official_detail.bank.id == constants.BANK_ICICI:
        result['bank'] = 'Eko'
    elif agent.official_detail.bank.id == constants.PPI:
        result['bank'] = 'Eko'
    else:
        result['bank'] = ''
    result_text = module_switchcaller.switch_caller(user, agent,
                                                    transaction_type, dialer,
                                                    '123', extra_param)

    result['status'] = module_responsehandler_new.balance_inquiry_response(
        result_text)
    result['timestamp'] = str(datetime.datetime.now().strftime("%I:%M:%S %p"))

    if result['status'] == constants.SUCCESS_DISP:
        print 'Parsing balance inquiry response'
        for line in result_text.splitlines():
            if "bal:rs" in line.lower():
                result['balance'] = line[7:]
            if "last okekey" in line.lower():
                result['signature'] = line[12:]
    else:
        pass

    return result
def transaction_search_by_tid(user, agent, dialer, transactionId):
    print "String Transaction Enquary"
    print ('Transaction id: ',transactionId)
    
    result = {}
    url = api_url + '/transactions/' + str(transactionId)
    params = {'initiator_id':'mobile_number:'+str(dialer)}
    data = {}
    request_type = 'GET'

    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_ENQ)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, constants.BANK_ICICI)
    # Calling the api_call function and passing the necessary parameters 
    result_text = module_apicaller.api_call(user, agent, transaction_type, dialer,request_type, url, params, data, headers, extra_param)
    
    if 'status' not in result_text:
        response = result_text
    else:     
        result_text_json = json.loads(result_text)
        if result_text_json['response_type_id'] == 70:
            response = module_responsehandler_new.get_formatted_response_data(result_text_json['data'])

        elif result_text_json['response_type_id'] == 69:
            response = result_text_json['invalid_params']['tid']
        else:
            response = result_text_json['message']    
    result['responseText'] = module_responsehandler_new.get_formatted_response(response)
    return result
def customerenrolmentresendotp_ppi(user, agent, dialer, senderMobile):
    print "Starting PPI customer enrolment resend OTP request"

    result = {}
    data = {
        'initiator_id': dialer,
    }
    url = api_url + '/customers/mobile_number:' + str(senderMobile) + '/otp'
    request_type = "POST"
    params = {}

    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_SENDER_ENROLMENT_RESEND_OTP)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, constants.BANK_ICICI)
    result_text = module_apicaller.api_call(user, agent, transaction_type,
                                            dialer, request_type, url, params,
                                            data, headers, extra_param)
    if 'status' not in result_text:
        response = result_text
    else:
        response = str(json.loads(result_text)['message'])
    result['responseText'] = module_responsehandler_new.get_formatted_response(
        response)

    return result
Esempio n. 6
0
def unknown_status_inquiry(user, agent, dialer, pending_id):
    print 'Starting transaction SoS Inquiry'

    result = {}
    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_SOS_INQUIRY)

    log_obj = Request_Log.objects.get(id=pending_id)
    response_log_obj = Response_Log.objects.get(request_log=log_obj)

    request_text = 'sos*' + str(log_obj.connect_tid)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, agent.official_detail.bank.id)
    result_text = module_switchcaller.switch_caller(user, agent,
                                                    transaction_type, dialer,
                                                    request_text, extra_param)
    result['status'] = module_responsehandler_new.sos_inquiry_response(
        result_text)
    result['pending_id'] = pending_id

    if result['status'] == constants.SOS_RESPONSE_NOT_AVAILABLE_STATUS:
        response_log_obj.response = 'Transaction Failed'
        response_log_obj.response_timestamp = datetime.datetime.now()
        response_log_obj.save(False, True, None)
        result['response_obtained'] = 'Transaction Failed'
    elif result['status'] == constants.SOS_RESPONSE_AVAILABLE_STATUS:
        response_log_obj.response = result_text[4:]
        response_log_obj.response_timestamp = datetime.datetime.now()
        response_log_obj.save(False, True, None)
        result['response_obtained'] = result_text[4:]
    else:
        #do nothing
        pass

    return result
Esempio n. 7
0
def recipientregistration_icici(user, agent, dialer, senderNumber, recipientAccountNo, recipientIfsc, bankId, recipientName, recipientMobile):
    print "Starting ICICI recipient registration"

    result = {}
    # If customer doesnot enter IFSC code of the bank then it gets the code from database.
    
    if (recipientIfsc == None or recipientIfsc == '') and bankId != '-1':
        recipientIfsc = Bank_Detail.objects.get(bank_id = bankId).identifier
        
    # Preparing the URL needed to make API Call with data,headers,and parameters.
    # Add Recipient API is being used
    url = api_url + '/customers/mobile_number:' + str(senderNumber) +'/recipients/acc_ifsc:' + str(recipientAccountNo) + '_' + str(recipientIfsc).lower()
    request_type = 'PUT'
    params = {}
    data = {'recipient_name':recipientName,'initiator_id':dialer,'mobile':recipientMobile,'recipient_type':3}

    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_RECIPIENT_REG)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, constants.BANK_ICICI)
    result_text = module_apicaller.api_call(user, agent, transaction_type, dialer, request_type, url, params, data, headers, extra_param)
    #Using API Caller function to make request to server and get the response. 
    result['status'] = module_responsehandler_new.icici_recipient_registration_response(result_text)         
    
    if result['status'] != constants.UNKNOWN_STATUS: # for the purpose if the result hasn't come from the API then we show the whole result 
        response = str(json.loads(result_text)['message'])      # but if the result is come from the API then we show the message of the API response
        if 'Recipientid' in response:
            response = "Success Now select recipient and perform transaction"  
    else:
        response = result_text
    result['responseText'] = module_responsehandler_new.get_formatted_response(response)
                
    return result
def customerenrolment_icici(user, agent, dialer, senderMobile,
                            senderName):  # for the customer enrolemt
    print "Starting ICICI customer enrolment"
    # for customer enrolment "create customer API is used
    result = {}
    # data contains the additional information required
    data = {'name': senderName, 'initiator_id': dialer}
    # url is created for the create customer api
    url = api_url + '/customers/mobile_number:' + str(senderMobile)
    params = {}
    # put request is used in this api call
    request_type = "PUT"

    # obtain the transaction type from the Transaction_Type table in the database
    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_SENDER_ENROLMENT)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, constants.BANK_ICICI)
    #result text store the data returned from the api
    result_text = module_apicaller.api_call(user, agent, transaction_type,
                                            dialer, request_type, url, params,
                                            data, headers, extra_param)
    # obtaining the status from the responsehandler_new
    status = module_responsehandler_new.icici_enrolment_response(result_text)

    result = module_responsehandler_new.get_basic_details(result_text, status)
    # return the result to the html file
    return result
Esempio n. 9
0
def recipient_idividual_inquiry_icici(user, agent, dialer, senderNumber, account_code):
    print "Starting ICICI individual recipient inquiry"
    
    result = {}
    # Preparing the URL needed to make API Call with data,headers,and parameters.
    #Get Recipient API is being used.
    url = api_url + '/customers/mobile_number:' + str(senderNumber) + '/recipients/recipient_id:' +str(account_code)
    data = {}
    params = {'initiator_id':dialer}
    request_type = 'GET'
    response = ''
    
    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_RECIPIENT_INDIVIDUAL_INQUIRY)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, constants.BANK_ICICI)

    #Using API Caller function to make request to server and get the response.

    result_text = module_apicaller.api_call(user, agent, transaction_type, dialer, request_type, url,params, data, headers, extra_param)
    result['status'] = module_responsehandler_new.icici_recipient_individual_inquiry_reponse(result_text)  
    if result['status'] !=  constants.UNKNOWN_STATUS :
        response = 'Name: '+ str(json.loads(result_text)['data']['name']) +'\nAccount: ' + str(json.loads(result_text)['data']['account']) +'\nRecipient Id: '+str(json.loads(result_text)['data']['recipient_id']) 
    else:
        response = result_text    
    result['responseText'] = module_responsehandler_new.get_formatted_response(response)
    return result
Esempio n. 10
0
def account_number_lookup(user, agent, dialer, account_number, bank_id):
    result = {}
    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_ACCOUNT_NUMBER_LOOKUP)
    bank_identifier = Bank_Detail.objects.get(bank_id=bank_id).identifier
    request_text = '837*' + str(account_number) + '*' + str(
        bank_identifier) + '*ABCXYZ'

    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, agent.official_detail.bank.id)
    result_text = module_switchcaller.switch_caller(user, agent,
                                                    transaction_type, dialer,
                                                    request_text, extra_param)
    result[
        'status'] = module_responsehandler_new.account_number_lookup_response(
            result_text)

    if result['status'] == constants.SUCCESS_DISP:
        resp = minidom.parseString(result_text)
        error = resp.getElementsByTagName('errors')
        ifsc_code = resp.getElementsByTagName('ifsc_code')
        name_list = resp.getElementsByTagName('name')
        if len(error) > 0:

            result['recipient_found'] = ''
            result['ifsc_found'] = ''
        elif len(ifsc_code) > 0 and len(name_list) > 0:

            result['recipient_found'] = name_list[0].childNodes[0].nodeValue
            result['ifsc_found'] = ifsc_code[0].childNodes[0].nodeValue
    else:
        result['recipient_found'] = ''
        result['ifsc_found'] = ''

    return result
Esempio n. 11
0
def recipientVerifiaction_icici(user, agent, dialer, senderNumber, recipientAccountNo, recipientIfsc, bankId):
    print "Start ICICI recipient Verification"
    print bankId
    result = {}
    # If customer doesnot enter IFSC code of the bank then it gets the code from database.
    # Get Acc Name Info API is being used.
    if (recipientIfsc == None or recipientIfsc == '') and bankId != '-1':
        recipientIfsc = Bank_Detail.objects.get(bank_id = bankId).identifier
    # Preparing the URL needed to make API Call with data,headers,and parameters.
    url = api_url + '/banks/ifsc:' + str(recipientIfsc).lower() + '/accounts/' + str(recipientAccountNo)
    request_type = 'POST'
    data = {'initiator_id':dialer,'customer_id':senderNumber}
    params = {}

    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_RECIPIENT_REG)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, constants.BANK_ICICI)
    
    #Using API Caller function to make request to server and get the response.

    result_text = module_apicaller.api_call(user, agent, transaction_type, dialer,  request_type, url, params, data, headers, extra_param)
    result['status'] = module_responsehandler_new.recipient_verification_response(result_text)   
    if result['status'] != constants.UNKNOWN_STATUS :
        response = str(json.loads(result_text)['message']) 
    else:
        response = result_text    
    result['responseText'] = module_responsehandler_new.get_formatted_response(response)
    
    if result['status'] == 'RECIPIENT_VERIFIED':
        result['rcpt_name'] = json.loads(result_text)['data']['recipient_name']
        return result
    else:
        return result
def customerenrolmentotpverification_ppi(user, agent, dialer, senderMobile,
                                         otp):
    print "Starting PPI customer enrolment OTP verification"

    result = {}
    data = {
        'id': senderMobile,
        'initiator_id': dialer,
        'id_type': 'mobile_number',
    }
    url = api_url + '/customers/verification/otp:' + str(otp)
    params = {}
    request_type = "PUT"

    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_SENDER_ENROLMENT_VERIFIC)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, constants.BANK_ICICI)
    result_text = module_apicaller.api_call(user, agent, transaction_type,
                                            dialer, request_type, url, params,
                                            data, headers, extra_param)
    status = module_responsehandler_new.ppi_customerotpverification_response(
        result_text)
    result = module_responsehandler_new.get_basic_details(result_text, status)
    return result
def unknown_status_inquiry(user, agent, dialer, pending_id):
    print 'Starting transaction SoS Inquiry'

    result = {}
    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_SOS_INQUIRY)

    log_obj = Request_Log.objects.get(id = pending_id)
    response_log_obj = Response_Log.objects.get(request_log = log_obj)

    request_text = 'sos*' + str(log_obj.connect_tid)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, agent.official_detail.bank.id)
    result_text = module_switchcaller.switch_caller(user, agent, transaction_type, dialer, request_text, extra_param)
    result['status'] = module_responsehandler_new.sos_inquiry_response(result_text)
    result['pending_id'] = pending_id

    if result['status'] == constants.SOS_RESPONSE_NOT_AVAILABLE_STATUS:
        response_log_obj.response = 'Transaction Failed'
        response_log_obj.response_timestamp = datetime.datetime.now()
        response_log_obj.save(False, True, None)
        result['response_obtained'] = 'Transaction Failed'
    elif result['status'] == constants.SOS_RESPONSE_AVAILABLE_STATUS:
        response_log_obj.response = result_text[4:]
        response_log_obj.response_timestamp = datetime.datetime.now()
        response_log_obj.save(False, True, None)
        result['response_obtained'] = result_text[4:]
    else:
        #do nothing
        pass

    return result
def account_number_lookup(user, agent, dialer, account_number, bank_id):
    result = {}
    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_ACCOUNT_NUMBER_LOOKUP)
    bank_identifier = Bank_Detail.objects.get(bank_id = bank_id).identifier
    request_text = '837*' + str(account_number) + '*' + str(bank_identifier) + '*ABCXYZ'
    
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, agent.official_detail.bank.id)
    result_text = module_switchcaller.switch_caller(user, agent, transaction_type, dialer, request_text, extra_param)
    result['status'] = module_responsehandler_new.account_number_lookup_response(result_text)
    
    if result['status'] == constants.SUCCESS_DISP:
        resp = minidom.parseString(result_text)
        error = resp.getElementsByTagName('errors')
        ifsc_code = resp.getElementsByTagName('ifsc_code')
        name_list = resp.getElementsByTagName('name')
        if len(error) > 0:
            
            result['recipient_found'] = ''
            result['ifsc_found'] = ''
        elif len(ifsc_code) > 0 and len(name_list) > 0:
            
            result['recipient_found'] = name_list[0].childNodes[0].nodeValue
            result['ifsc_found'] = ifsc_code[0].childNodes[0].nodeValue
    else:
        result['recipient_found'] = ''
        result['ifsc_found'] = ''

    return result
def balance_inquiry(user, agent, dialer):
    print 'Starting balance inquiry'

    result = {}
    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_BALANCE_INQUIRY)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, agent.official_detail.bank.id)
    if agent.official_detail.bank.id == constants.BANK_ICICI:
        result['bank'] = 'Eko'
    elif agent.official_detail.bank.id == constants.PPI:
        result['bank'] = 'Eko'
    else:
        result['bank'] = ''
    result_text = module_switchcaller.switch_caller(user, agent, transaction_type, dialer, '123', extra_param)

    result['status'] = module_responsehandler_new.balance_inquiry_response(result_text)
    result['timestamp'] = str(datetime.datetime.now().strftime("%I:%M:%S %p"))

    if result['status'] == constants.SUCCESS_DISP:
        print 'Parsing balance inquiry response'
        for line in result_text.splitlines():
            if "bal:rs" in line.lower():
                result['balance'] = line[7:]
            if "last okekey" in line.lower():
                result['signature'] = line[12:]
    else:
        pass

    return result
Esempio n. 16
0
def recipientInquiry_icici(user, agent, dialer, senderNumber):
    print "Starting ICICI recipient list inquiry"
    result = {}
    # Preparing the URL needed to make API Call with data,headers,and parameters.
    # Get All Recipients API is being used

    request_type = "GET"
    data = {}
    params = {'initiator_id':dialer}
    url = api_url+'/customers/mobile_number:'+str(senderNumber)+'/recipients'

    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_REGISTERED_RECIPIENT_INQUIRY)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, constants.BANK_ICICI)
    result_text = module_apicaller.api_call(user, agent, transaction_type, dialer, request_type, url, params, data, headers, extra_param)  
    recipient_list = []
    count = 0 
    sender_name = ""    
    sender_aadhaar = ""
    wallet_limit = ""
    remaining_wallet_limit=""
    bc_limit=""
    remaining_bc_limit=""
    aadhaar_status=""
    status = module_responsehandler_new.icici_recipient_list_inquiry_reponse(result_text)
    
    get_customer_url = api_url+'/customers/mobile_number:'+str(senderNumber)
    get_customer = module_apicaller.api_call(user, agent, transaction_type, dialer, request_type, get_customer_url, params, data, headers, extra_param)
    if 'status' in get_customer:
        get_customer_json = json.loads(get_customer)
        result['wallet_limit']= 10000
        result['remaining_wallet_limit'] = str(get_customer_json['data']['limit'][1]['remaining'])
        result['bc_limit']= 50000
        result['remaining_bc_limit'] = str(get_customer_json['data']['limit'][0]['remaining'])
        result['aadhaar_status']=aadhaar_status
        result['sender_name'] = str(get_customer_json['data']['name'])
        result['sender_aadhaar'] = ""
    else:
        response = get_customer
    if status != constants.UNKNOWN_STATUS:
            
        get_recipient_json = json.loads(result_text)

        if get_recipient_json['response_type_id'] == constants.NO_RECIPIENT:  #if response_type_id is 22 then there is no recipient
            result['recipients'] = recipient_list
            result['recipient_count'] = count  
        else:                                               # else recipients present and show the list of recipients
            result['recipients'] = get_recipient_json['data']['recipient_list']
            result['recipient_count'] = len(get_recipient_json['data']['recipient_list'])
    result['status'] = status
    if result['status'] != constants.UNKNOWN_STATUS :
        response = str(json.loads(result_text)['message']) 
    else:
        response = result_text    
    result['responseText'] = module_responsehandler_new.get_formatted_response(response)
    return result
def moneytransfer_icici(user, agent, dialer, recipientAccountCode, senderNumber, amount, transactionMode, ifscTransaction):
    print "Starting ICICI money transfer"
    
    
    result = {}
    url = api_url + '/transactions'
    # preparing the data required for the transaction
    data={ 'recipient_id':recipientAccountCode,
            'amount':amount,
            'currency':'INR',
            'customer_id':senderNumber,
            'initiator_id':dialer,
            'client_ref_id':str(datetime.datetime.now().strftime("%I:%M:%S %p")),
            'state':1,
            # 'pintwin':okekey,
            'channel':transactionMode
      
            }
            
    request_type='POST'        
    params = {}

    # Obtaining the transaction type from the Transaction_Type table in the database
    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_MONEY_TRANSFER)
    # Preparing the extra praameters required for making the logs
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, constants.BANK_ICICI)
    # API call is made through api_call function present in the module_apicaller
    result_text = module_apicaller.api_call(user, agent, transaction_type, dialer,request_type, url, params, data, headers,extra_param)
    # logs are added
    
    response = ''
    
    result['status'] = module_responsehandler_new.icici_moneytransfer_response(result_text)
    
    if result['status'] == constants.UNKNOWN_STATUS: # this is for the purpose if the response doesnot come from the API due to any reason
        response = result_text
    else:
        # if the 'status' is 'incorrect pin' then we have to show him the last okkey
        # we set the value of okkey in the result dictionary and send it to the html file in which it is shown on the frontend
        if result['status'] == constants.INCORRECT_PIN_STATUS:
            result['okekey'] = str(json.loads(result_text)['data']['last_used_okekey'])
            response = str(json.loads(result_text)['message'])
        elif result['status'] == constants.SUCCESS_DISP:
            # if the 'status' is 'success' the we have to show him the 'amount' and the 'transaction id'
            result['amount'] = str(json.loads(result_text)['data']['amount'])
            result['okekey'] = str(json.loads(result_text)['data']['last_used_okekey'])
            result['balance'] = str(json.loads(result_text)['data']['balance'])+'0'
            response = response = str(json.loads(result_text)['message'])+'\nTid: '+ str(json.loads(result_text)['data']['tid']) +'\nLast Okkey Used: ' + str(json.loads(result_text)['data']['last_used_okekey']) 
        else:
            response = str(json.loads(result_text)['message'])
            
        # we format the response through 'get_formatted_response' function 
    result['responseText'] = module_responsehandler_new.get_formatted_response(response)    
    result['timestamp'] = str(datetime.datetime.now().strftime("%I:%M:%S %p"))
    return result
def booklet_registration(user, agent, dialer, booklet, key1, key2):
    print 'Starting booklet registration'

    result = {}
    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_BOOKLET_REGISTRATION)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, agent.official_detail.bank.id)
    request_text = booklet + '*' + key1 + '*' + key2
    result_text = module_switchcaller.switch_caller(user, agent, transaction_type, dialer, request_text, extra_param)

    result['status'] = module_responsehandler_new.booklet_registration_response(result_text)
    print result['status']

    return result
def booklet_inquiry(user, agent, dialer):
    print 'Starting booklet inquiry'

    result = {}
    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_BOOKLET_INQUIRY)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, agent.official_detail.bank.id)
    result_text = module_switchcaller.switch_caller(user, agent, transaction_type, dialer, 'okekeyinfo', extra_param)

    result['status'] = module_responsehandler_new.booklet_inquiry_response(result_text)
    if result['status'] == constants.BOOKLET_INQUIRY_SUCCESS_STATUS:
        line_list = result_text.split('\n')
        result['booklet_number'] = line_list[0].split('\r')[0].split(':')[1]
        result['signature_count'] = line_list[1].split('\r')[0].split(':')[1]
        result['last_used'] = line_list[2].split('\r')[0].split(':')[1]

    return result
def post_agreement_consent(user, agent, dialer):
    print 'Starting post_agreement_consent'

    result = {}
    transaction_type = Transaction_Type.objects.get(id = constants.TRXN_AGREEMENT_CONSENT)
    extra_param = module_helper.prepare_extra_transaction_param(transaction_type, agent.official_detail.bank.id)
    result_text = module_switchcaller.switch_caller(user, agent, transaction_type, dialer, '24733', extra_param)

    result['status'] = module_responsehandler_new.post_agreement_consent_response(result_text)
    result['timestamp'] = str(datetime.datetime.now().strftime("%I:%M:%S %p"))

    if result['status'] == constants.SUCCESS_DISP:
        print 'Agreement has been successfully signed'
    else:
        pass

    return result
Esempio n. 21
0
def booklet_registration(user, agent, dialer, booklet, key1, key2):
    print 'Starting booklet registration'

    result = {}
    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_BOOKLET_REGISTRATION)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, agent.official_detail.bank.id)
    request_text = booklet + '*' + key1 + '*' + key2
    result_text = module_switchcaller.switch_caller(user, agent,
                                                    transaction_type, dialer,
                                                    request_text, extra_param)

    result[
        'status'] = module_responsehandler_new.booklet_registration_response(
            result_text)
    print result['status']

    return result
def senderInquiry_ppi(user, agent, dialer, senderNumber):
    print "Starting PPI sender inquiry"

    request_text = senderNumber
    url = api_url + '/customers/mobile_number:' + str(
        request_text)  # required url
    params = {'initiator_id': dialer}
    data = {}
    request_type = "GET"

    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_SENDER_INQUIRY)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, constants.BANK_ICICI)
    result_text = module_apicaller.api_call(user, agent, transaction_type,
                                            dialer, request_type, url, params,
                                            data, headers, extra_param)
    result = module_responsehandler_new.extract_response_and_other_config(
        result_text)
    return result
Esempio n. 23
0
def booklet_inquiry(user, agent, dialer):
    print 'Starting booklet inquiry'

    result = {}
    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_BOOKLET_INQUIRY)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, agent.official_detail.bank.id)
    result_text = module_switchcaller.switch_caller(user, agent,
                                                    transaction_type, dialer,
                                                    'okekeyinfo', extra_param)

    result['status'] = module_responsehandler_new.booklet_inquiry_response(
        result_text)
    if result['status'] == constants.BOOKLET_INQUIRY_SUCCESS_STATUS:
        line_list = result_text.split('\n')
        result['booklet_number'] = line_list[0].split('\r')[0].split(':')[1]
        result['signature_count'] = line_list[1].split('\r')[0].split(':')[1]
        result['last_used'] = line_list[2].split('\r')[0].split(':')[1]

    return result
Esempio n. 24
0
def post_agreement_consent(user, agent, dialer):
    print 'Starting post_agreement_consent'

    result = {}
    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_AGREEMENT_CONSENT)
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, agent.official_detail.bank.id)
    result_text = module_switchcaller.switch_caller(user, agent,
                                                    transaction_type, dialer,
                                                    '24733', extra_param)

    result[
        'status'] = module_responsehandler_new.post_agreement_consent_response(
            result_text)
    result['timestamp'] = str(datetime.datetime.now().strftime("%I:%M:%S %p"))

    if result['status'] == constants.SUCCESS_DISP:
        print 'Agreement has been successfully signed'
    else:
        pass

    return result
Esempio n. 25
0
def bank_config_inquiry(user, agent, dialer, bank_id):
    print 'Starting bank config inquiry'
    result = {}

    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_BANK_CONFIG_INQUIRY)
    bank_identifier = Bank_Detail.objects.get(bank_id=bank_id).identifier
    url = api_url + '/banks'
    data = {}
    params = {
        'bank_code': bank_identifier,
        'initiator_id': "mobile_number:" + str(dialer)
    }
    request_type = 'GET'

    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, agent.official_detail.bank.id)
    result_text = module_apicaller.api_call(user, agent, transaction_type,
                                            dialer, request_type, url, params,
                                            data, headers, extra_param)
    result['status'] = module_responsehandler_new.bank_config_inquiry_response(
        result_text)

    # FRom ifsc status and isverification flag we can show the next form to the user
    if result['status'] == constants.BANK_CONFIG_INQUIRY_SUCCESS_STATUS:
        response = str(json.loads(result_text)['message'])
        result['ifsc_status'] = json.loads(result_text)['data']['ifsc_status']
        result['isverificationavailable'] = json.loads(
            result_text)['data']['isverificationavailable']
    else:

        response = result_text
    result['responseText'] = module_responsehandler_new.get_formatted_response(
        response)

    return result
def moneytransfer_icici(user, agent, dialer, recipientAccountCode,
                        senderNumber, amount, transactionMode,
                        ifscTransaction):
    print "Starting ICICI money transfer"

    result = {}
    url = api_url + '/transactions'
    # preparing the data required for the transaction
    data = {
        'recipient_id': recipientAccountCode,
        'amount': amount,
        'currency': 'INR',
        'customer_id': senderNumber,
        'initiator_id': dialer,
        'client_ref_id': str(datetime.datetime.now().strftime("%I:%M:%S %p")),
        'state': 1,
        # 'pintwin':okekey,
        'channel': transactionMode
    }

    request_type = 'POST'
    params = {}

    # Obtaining the transaction type from the Transaction_Type table in the database
    transaction_type = Transaction_Type.objects.get(
        id=constants.TRXN_MONEY_TRANSFER)
    # Preparing the extra praameters required for making the logs
    extra_param = module_helper.prepare_extra_transaction_param(
        transaction_type, constants.BANK_ICICI)
    # API call is made through api_call function present in the module_apicaller
    result_text = module_apicaller.api_call(user, agent, transaction_type,
                                            dialer, request_type, url, params,
                                            data, headers, extra_param)
    # logs are added

    response = ''

    result['status'] = module_responsehandler_new.icici_moneytransfer_response(
        result_text)

    if result[
            'status'] == constants.UNKNOWN_STATUS:  # this is for the purpose if the response doesnot come from the API due to any reason
        response = result_text
    else:
        # if the 'status' is 'incorrect pin' then we have to show him the last okkey
        # we set the value of okkey in the result dictionary and send it to the html file in which it is shown on the frontend
        if result['status'] == constants.INCORRECT_PIN_STATUS:
            result['okekey'] = str(
                json.loads(result_text)['data']['last_used_okekey'])
            response = str(json.loads(result_text)['message'])
        elif result['status'] == constants.SUCCESS_DISP:
            # if the 'status' is 'success' the we have to show him the 'amount' and the 'transaction id'
            result['amount'] = str(json.loads(result_text)['data']['amount'])
            result['okekey'] = str(
                json.loads(result_text)['data']['last_used_okekey'])
            result['balance'] = str(
                json.loads(result_text)['data']['balance']) + '0'
            response = response = str(
                json.loads(result_text)['message']) + '\nTid: ' + str(
                    json.loads(result_text)['data']
                    ['tid']) + '\nLast Okkey Used: ' + str(
                        json.loads(result_text)['data']['last_used_okekey'])
        else:
            response = str(json.loads(result_text)['message'])

        # we format the response through 'get_formatted_response' function
    result['responseText'] = module_responsehandler_new.get_formatted_response(
        response)
    result['timestamp'] = str(datetime.datetime.now().strftime("%I:%M:%S %p"))
    return result