def check_loan_status(self): self.redis.hset(self.userid, 'sub_menu', 'loan_status_check') status = GeepNerve(self.reg_sender, 'Marketmoni') status = status.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_status', self.message) return if status[0] == 'LoanDisbursedSuccessfully': msg = 'Ati san lóònù rẹ' elif status[0] in [ 'PendingApproval', 'PendingCustomerConfirmation', 'PendingFIreConfirmation', 'PendingICUConfirmation' ]: msg = "Ìbẹ̀wẹ̀ lóònù rẹ ti ń ní ìlosíwájú" elif status[0] == 'DueForDisbursement': msg = 'Ó ti tó àsìkò láti san lóònu rẹ' else: msg = "O kò yege nínú Ìbẹ̀wẹ̀ lóònù rẹ" msg = msg + "\n\n_Tẹ ódo láti padá sí àsàyàn_" return self.send_message(msg)
def check_loan_status(self): self.redis.hset(self.userid, 'sub_menu', 'loan_status_check') status = GeepNerve(self.reg_sender, 'Farmermoni') status = status.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_status', self.message) return if status[0] == 'LoanDisbursedSuccessfully': msg = 'Your loan don ready ' elif status[0] in [ 'PendingApproval', 'PendingCustomerConfirmation', 'PendingFIreConfirmation', 'PendingICUConfirmation' ]: msg = "We still dey work on your loan" elif status[0] == 'DueForDisbursement': msg = 'Your loan go soon ready ' else: msg = "We no accept your loan application" msg = msg + "\n\n_Make you Press *0* to go back to Menu_" return self.send_message(msg)
def check_loan_status(self): self.redis.hset(self.userid, 'sub_menu', 'loan_status_check') status = GeepNerve(self.reg_sender, 'Farmermoni') status = status.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_status', self.message) return if status[0] == 'LoanDisbursedSuccessfully': msg = 'Akwunyerela gi ego mbinye gi' elif status[0] in [ 'PendingApproval', 'PendingCustomerConfirmation', 'PendingFIreConfirmation', 'PendingICUConfirmation' ]: msg = "Akana ahazi ego mbinye idebanye aha gi" elif status[0] == 'DueForDisbursement': msg = 'Ego mbinye idenyere aha gi eruola mgbe aga akwunyere gi ya' else: msg = "Ego mbinye idebanyere aha gi agaghi nke oma" msg = msg + "\n\n_Pia efu maka ilagachi azu na ebe ibidoro_" return self.send_message(msg)
def check_loan_status(self): self.redis.hset(self.userid, 'sub_menu', 'loan_status_check') status = GeepNerve(self.reg_sender, 'Farmermoni') status = status.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_status', self.message) return if status[0] == 'LoanDisbursedSuccessfully': msg = 'Your loan has been disbursed successfully' elif status[0] in [ 'PendingApproval', 'PendingCustomerConfirmation', 'PendingFIreConfirmation', 'PendingICUConfirmation' ]: msg = "Your loan application is being processed" elif status[0] == 'DueForDisbursement': msg = 'Your loan application is due for disbursement' else: msg = "Your loan application was unsuccessful" msg = msg + "\n\n_Reply *0* to return to Main Menu_" return self.send_message(msg)
def check_amount_owed(self): # self.redis.hset(self.userid, 'sub_menu','loan_status_amount_owed2') amount_owed = GeepNerve(self.reg_sender) amount_owed = amount_owed.check_amount_owed() if not amount_owed: UnknownNumber(self.reg_sender, 'init', 'loan_status', self.message) return msg = """Your are owing *₦{:,}* Type *Hi* to return to Main Menu""".format(amount_owed[0]) return self.send_message(msg)
def greet(self): customer = GeepNerve(self.reg_sender, 'Tradermoni') status = customer.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_upgrade', self.message) return if status[0].lower() in ('disbursed', 'cashedout'): amount_owed = customer.check_amount_owed()[0] if amount_owed == 0: msg = "Tí ó bá jẹ́ bẹ̀, dáhùn pẹ̀lú ati gba ìbéère rẹ. \nA máa ṣisẹ́ lórí lóònù rẹ, o ó sì gba owó nàá sínú àpò owó rẹ." msg += "\n\nTẹ òòdo (0) láti padà sí àsàyàn" else: msg = "dáhùn pẹ̀lú Ó ní iye lóònù báyi {}. Jọ̀wọ́ san owó tí ó kù, kí o tó lẹ́tọ làti gba èyí tí ó kàn.".format(amount_owed) msg += "\n\nTẹ òòdo (0) láti padà sí àsàyàn" else: msg = "Your loan status is *{}*".format(status[0]) msg += "\n\nTẹ òòdo (0) láti padà sí àsàyàn" return self.send_message(msg)
def greet(self): customer = GeepNerve(self.reg_sender, 'Marketmoni') status = customer.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_upgrade', self.message) return if status[0].lower() in ('disbursed', 'cashedout'): amount_owed = customer.check_amount_owed()[0] if amount_owed == 0: msg = "We don receive your request. We go process your loan and you go get your money inside your wallet account" msg += "\n\nMake you Press *0* to go back to Menu" else: msg = "You dey owe {}. Make you pay your current loan before You go fit request for Upgrade".format(amount_owed) msg += "\n\nPress 0 to go back to main menu" else: msg = "Your loan status na *{}*".format(status[0]) msg += "\n\nMake you Press *0* to go back to Menu" return self.send_message(msg)
def greet(self): customer = GeepNerve(self.reg_sender, 'Marketmoni') status = customer.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_upgrade', self.message) return if status[0].lower() in ('disbursed', 'cashedout'): amount_owed = customer.check_amount_owed()[0] if amount_owed == 0: msg = "Your request has been received. \nWe will process your loan and you will get your payment in your Wallet Account" msg += "\n\nPress 0 to go back to main menu" else: msg = "You have a loan balance of {}. Kindly pay your current loan before you request for an Upgrade".format(amount_owed) msg += "\n\nPress 0 to go back to main menu" else: msg = "Your loan status is *{}*".format(status[0]) msg += "\n\nPress 0 to go back to main menu" return self.send_message(msg)
def greet(self): customer = GeepNerve(self.reg_sender, 'Marketmoni') status = customer.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_upgrade', self.message) return if status[0].lower() in ('disbursed', 'cashedout'): amount_owed = customer.check_amount_owed()[0] if amount_owed == 0: msg = "Mun samu bukatun ka/ki. \n. Za muyi aiki akan bashin ka/ki kuma bayan hakan, za’a biya ka kudin a cikin asusun ka." msg += "\n\nDanna 0 domin komawa shafin tsaretsare" else: msg = "Ka/ki na da sauran bashin da za ka/ki biya {}. Ayi kokari a biya sauran bashin kafin bukata bashi na gaba".format(amount_owed) msg += "\n\nDanna 0 domin komawa shafin tsaretsare" else: msg = "Matsayin bashin ka shine *{}*".format(status[0]) msg += "\n\nDanna 0 domin komawa shafin tsaretsare" return self.send_message(msg)
def greet(self): customer = GeepNerve(self.reg_sender, 'Farmermoni') status = customer.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_upgrade', self.message) return if status[0].lower() in ('disbursed', 'cashedout'): amount_owed = customer.check_amount_owed()[0] if amount_owed == 0: msg = "anabatala aririo gi.\nAnyi ga ahazi ego mbinye gi ma zitere gi ego gi na account gi" msg += "\n\nPia efu maka ilagachi azu na ebe ibidoro" else: msg = "enwere ego ina akwubeghi {}. Jisie ike kwuo ugwo gi tupu inata ego nkwalite".format( amount_owed) msg += "\n\nPia efu maka ilagachi azu na ebe ibidoro" else: msg = "Onudu ego mbinye gi bu *{}*".format(status[0]) msg += "\n\nPia efu maka ilagachi azu na ebe ibidoro" return self.send_message(msg)
def save_market(self): self.redis.hset(self.userid, 'sub_menu','') self.redis.hset(self.userid, 'market_address',self.message) # Now set the menu back to main menu self.redis.hset(self.userid, 'menu','main_menu') # Now save all the market info in a DB name = self.redis.hget(self.userid, 'market_name') state = self.redis.hget(self.userid, 'market_state') lga = self.redis.hget(self.userid, 'market_lga') address = self.redis.hget(self.userid, 'market_address') # call a GeepNerve Fubction to save this info in DB GeepNerve('','').new_register(name, state, lga, address) msg = """ Ati gba àwon àláyé ibi ìtajà rẹ sí lẹ̀. Tẹ ódo láti padá sí àsàyàn """ return self.send_message(msg)
def save_market(self): self.redis.hset(self.userid, 'sub_menu', '') self.redis.hset(self.userid, 'market_address', self.message) # Now set the menu back to main menu self.redis.hset(self.userid, 'menu', 'main_menu') # Now save all the market info in a DB name = self.redis.hget(self.userid, 'market_name') state = self.redis.hget(self.userid, 'market_state') lga = self.redis.hget(self.userid, 'market_lga') address = self.redis.hget(self.userid, 'market_address') # call a GeepNerve Fubction to save this info in DB GeepNerve('', '').new_register(name, state, lga, address) msg = """An samu nasarar ajiye bayanan kasuwa. Danna *0* domin komawa shafin tsaretsare """ return self.send_message(msg)
def save_market(self): self.redis.hset(self.userid, 'sub_menu','') self.redis.hset(self.userid, 'market_address',self.message) # Now set the menu back to main menu self.redis.hset(self.userid, 'menu','main_menu') # Now save all the market info in a DB name = self.redis.hget(self.userid, 'market_name') state = self.redis.hget(self.userid, 'market_state') lga = self.redis.hget(self.userid, 'market_lga') address = self.redis.hget(self.userid, 'market_address') # call a GeepNerve Fubction to save this info in DB GeepNerve('','').new_register(name, state, lga, address) msg = """Market details saved successfully. Press *0* to return to Main Menu """ return self.send_message(msg)
def save_market(self): self.redis.hset(self.userid, 'sub_menu', '') self.redis.hset(self.userid, 'market_address', self.message) # Now set the menu back to main menu self.redis.hset(self.userid, 'menu', 'main_menu') # Now save all the market info in a DB name = self.redis.hget(self.userid, 'market_name') state = self.redis.hget(self.userid, 'market_state') lga = self.redis.hget(self.userid, 'market_lga') address = self.redis.hget(self.userid, 'market_address') # call a GeepNerve Fubction to save this info in DB GeepNerve('', '').new_register(name, state, lga, address) msg = """Ihe gwasara ebe ina azu ahia banyere ofuma. Pia efu maka ilagachi azu na ebe ibidoro """ return self.send_message(msg)
def save_market(self): self.redis.hset(self.userid, 'sub_menu', '') self.redis.hset(self.userid, 'market_address', self.message) # Now set the menu back to main menu self.redis.hset(self.userid, 'menu', 'main_menu') # Now save all the market info in a DB name = self.redis.hget(self.userid, 'market_name') state = self.redis.hget(self.userid, 'market_state') lga = self.redis.hget(self.userid, 'market_lga') address = self.redis.hget(self.userid, 'market_address') # call a GeepNerve Fubction to save this info in DB GeepNerve('', '').new_register(name, state, lga, address) msg = """Your market Details don dey saved. Make you press *0* to go back to the main menu """ return self.send_message(msg)
def greet(self): # curframe = inspect.currentframe() # calframe = inspect.getouterframes(curframe, 2) # print('LoanStatus caller name:', calframe[1][3]) self.redis.hset(self.userid, 'sub_menu', 'loan_status_main') status = GeepNerve(self.reg_sender, 'Farmermoni') status = status.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_status', self.message) return if status[0].lower() in ('disbursed', 'cashedout'): customer = GeepNerve(self.reg_sender, 'Farmermoni') loan_details = customer.check_loan_details() loan_amount = '{:,}'.format(loan_details[0]) amount_due = '{:,}'.format(loan_details[1]) amount_paid = '{:,}'.format(loan_details[2]) amount_default = '{:,}'.format(loan_details[3]) # Show date disbursed only when cashout date is empty date_disbursed = loan_details[4].strftime( "%d-%b-%Y" ) if loan_details[5] == None else loan_details[5].strftime( "%d-%b-%Y") msg = """Onodu ego mbinye gi bu *{}* *Nchikota Account* Ego inara: {} Ego ikwesiri ikwu: {} Ego ikwurula: {} Ego foduru: {} Ubochi Ekwesiri ikwu gi ugwo: {} Pia efu maka ilagachi azu na ebe ibidoro """.format(status[0], loan_amount, amount_due, amount_paid, amount_default, date_disbursed) else: msg = "Onudu ego mbinye gi bu *{}*".format(status[0]) msg += "\n\nPia efu maka ilagachi azu na ebe ibidoro" return self.send_message(msg)
def greet(self): # curframe = inspect.currentframe() # calframe = inspect.getouterframes(curframe, 2) # print('LoanStatus caller name:', calframe[1][3]) self.redis.hset(self.userid, 'sub_menu', 'loan_status_main') status = GeepNerve(self.reg_sender, 'Marketmoni') status = status.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_status', self.message) return if status[0].lower() in ('disbursed', 'cashedout'): customer = GeepNerve(self.reg_sender, 'Marketmoni') loan_details = customer.check_loan_details() loan_amount = '{:,}'.format(loan_details[0]) amount_due = '{:,}'.format(loan_details[1]) amount_paid = '{:,}'.format(loan_details[2]) amount_default = '{:,}'.format(loan_details[3]) # Show date disbursed only when cashout date is empty date_disbursed = loan_details[4].strftime( "%d-%b-%Y" ) if loan_details[5] == None else loan_details[5].strftime( "%d-%b-%Y") msg = """Lóònù rẹ jẹ́ *{}* *Àkọ́lé lápaapọ̀* Iye lóònù: {} Iye tó ye kó o san: {} Iye tí o ti san: {} Iye tó kù láti san: {} Ìsanwó (ìgbowó jáde) déètì: {} Tẹ ódo láti padá sí àsàyàn """.format(status[0], loan_amount, amount_due, amount_paid, amount_default, date_disbursed) else: msg = "Lóònù rẹ jẹ́ *{}*".format(status[0]) msg += "\n\nTẹ ódo láti padá sí àsàyàn" return self.send_message(msg)
def greet(self): # curframe = inspect.currentframe() # calframe = inspect.getouterframes(curframe, 2) # print('LoanStatus caller name:', calframe[1][3]) self.redis.hset(self.userid, 'sub_menu', 'loan_status_main') status = GeepNerve(self.reg_sender, 'Farmermoni') status = status.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_status', self.message) return if status[0].lower() in ('disbursed', 'cashedout'): customer = GeepNerve(self.reg_sender, 'Farmermoni') loan_details = customer.check_loan_details() loan_amount = '{:,}'.format(loan_details[0]) amount_due = '{:,}'.format(loan_details[1]) amount_paid = '{:,}'.format(loan_details[2]) amount_default = '{:,}'.format(loan_details[3]) # Show date disbursed only when cashout date is empty date_disbursed = loan_details[4].strftime( "%d-%b-%Y" ) if loan_details[5] == None else loan_details[5].strftime( "%d-%b-%Y") msg = """Your Loan Status na *{}* *Account Summary* Loan Amount: {} Amount wey you suppose don pa: {} Amount wey you don pay: {} Amount wey you dey owe: {} The day you collect the money: {} Make you Press 0 to go back to Menu """.format(status[0], loan_amount, amount_due, amount_paid, amount_default, date_disbursed) else: msg = "Your Loan Status na *{}*".format(status[0]) msg += "\n\nMake you Press 0 to go back to Menu" return self.send_message(msg)
def greet(self): # curframe = inspect.currentframe() # calframe = inspect.getouterframes(curframe, 2) # print('LoanStatus caller name:', calframe[1][3]) self.redis.hset(self.userid, 'sub_menu', 'loan_status_main') status = GeepNerve(self.reg_sender, 'Farmermoni') status = status.check_loan_status() if not status: unknown = UnknownNumber unknown(self.sender, 'init', 'loan_status', self.message) return if status[0].lower() in ('disbursed', 'cashedout'): customer = GeepNerve(self.reg_sender, 'Farmermoni') loan_details = customer.check_loan_details() loan_amount = '{:,}'.format(loan_details[0]) amount_due = '{:,}'.format(loan_details[1]) amount_paid = '{:,}'.format(loan_details[2]) amount_default = '{:,}'.format(loan_details[3]) # Show date disbursed only when cashout date is empty date_disbursed = loan_details[4].strftime( "%d-%b-%Y" ) if loan_details[5] == None else loan_details[5].strftime( "%d-%b-%Y") msg = """matsayin bashin ka/ki shine *{}* *Takaitancen bayani akai* Yawan bashi: {} Kudin da ya kamata an riga an biya: {} Kudin da aka biya: {} Kudin da ya rage za’a biya: {} Ranar da aka baka kudi: {} Danna 0 domin komawa shafin tsaretsare """.format(status[0], loan_amount, amount_due, amount_paid, amount_default, date_disbursed) else: msg = "Matsayin bashin ka shine *{}*".format(status[0]) msg += "\n\nDanna 0 domin komawa shafin tsaretsare" return self.send_message(msg)
def post(self): content = request.json GeepNerve('', '').save_request(str(content)) if not content: return {"status": "Invalid Request"} # Check If user just opted in and send intro message if content['type'] == 'user-event' and content['app'] == os.getenv( "APP_NAME") and content['payload']['type'] == 'opted-in': sender = content['payload']['phone'] message = 'Reply *0* to get started' return self.send_message(sender, message) # Check If user sends message and process if content['type'] == 'message' and content['app'] == os.getenv( "APP_NAME"): sender = content['payload']['sender']['phone'] message = content['payload']['payload']['text'].strip() # language_selected = self.get_language(sender) #language_selected = 'English' language_selected = self.get_language(sender) if language_selected == 'English': product_select = self.get_product(sender) if product_select == 'Tradermoni': from English.Tradermoni import WhatsBot # The import_module allows to import as string # WhatsBot = import_module('English.Tradermoni') # WhatsBot = WhatsBot.WhatsBot elif product_select == 'Marketmoni': # return self.send_message(sender, 'Coming soon...') from English.Marketmoni import WhatsBot elif product_select == 'Farmermoni': # return self.send_message(sender, 'Coming soon...') from English.Farmermoni import WhatsBot else: prod = self.set_english_product(sender, message) if prod in ['Tradermoni', 'Marketmoni', 'Farmermoni']: WhatsBot = import_module( 'English.{}'.format(prod)).WhatsBot message = '0' #switch to Main menu else: return elif language_selected == 'Pidgin': product_select = self.get_product(sender) if product_select == 'Tradermoni': from Pidgin.Tradermoni import WhatsBot # The import_module allows to import as string # WhatsBot = import_module('English.Tradermoni') # WhatsBot = WhatsBot.WhatsBot elif product_select == 'Marketmoni': # return self.send_message(sender, 'Coming soon...') from Pidgin.Marketmoni import WhatsBot elif product_select == 'Farmermoni': # return self.send_message(sender, 'Coming soon...') from Pidgin.Farmermoni import WhatsBot else: prod = self.set_pidgin_product(sender, message) if prod in ['Tradermoni', 'Marketmoni', 'Farmermoni']: WhatsBot = import_module( 'Pidgin.{}'.format(prod)).WhatsBot message = '0' #switch to Main menu else: return elif language_selected == 'Igbo': product_select = self.get_product(sender) if product_select == 'Tradermoni': from Igbo.Tradermoni import WhatsBot # The import_module allows to import as string # WhatsBot = import_module('English.Tradermoni') # WhatsBot = WhatsBot.WhatsBot elif product_select == 'Marketmoni': # return self.send_message(sender, 'Coming soon...') from Igbo.Marketmoni import WhatsBot elif product_select == 'Farmermoni': # return self.send_message(sender, 'Coming soon...') from Igbo.Farmermoni import WhatsBot else: prod = self.set_igbo_product(sender, message) if prod in ['Tradermoni', 'Marketmoni', 'Farmermoni']: WhatsBot = import_module( 'Igbo.{}'.format(prod)).WhatsBot message = '0' #switch to Main menu else: return elif language_selected == 'Yoruba': product_select = self.get_product(sender) if product_select == 'Tradermoni': from Yoruba.Tradermoni import WhatsBot # The import_module allows to import as string # WhatsBot = import_module('English.Tradermoni') # WhatsBot = WhatsBot.WhatsBot elif product_select == 'Marketmoni': # return self.send_message(sender, 'Coming soon...') from Yoruba.Marketmoni import WhatsBot elif product_select == 'Farmermoni': # return self.send_message(sender, 'Coming soon...') from Yoruba.Farmermoni import WhatsBot else: prod = self.set_yoruba_product(sender, message) if prod in ['Tradermoni', 'Marketmoni', 'Farmermoni']: WhatsBot = import_module( 'Yoruba.{}'.format(prod)).WhatsBot message = '0' #switch to Main menu else: return elif language_selected == 'Hausa': product_select = self.get_product(sender) if product_select == 'Tradermoni': from Hausa.Tradermoni import WhatsBot # The import_module allows to import as string # WhatsBot = import_module('English.Tradermoni') # WhatsBot = WhatsBot.WhatsBot elif product_select == 'Marketmoni': # return self.send_message(sender, 'Coming soon...') from Hausa.Marketmoni import WhatsBot elif product_select == 'Farmermoni': # return self.send_message(sender, 'Coming soon...') from Hausa.Farmermoni import WhatsBot else: prod = self.set_hausa_product(sender, message) if prod in ['Tradermoni', 'Marketmoni', 'Farmermoni']: WhatsBot = import_module( 'Hausa.{}'.format(prod)).WhatsBot message = '0' #switch to Main menu else: return else: self.set_language(sender, message) return bot = WhatsBot(sender, message) response = bot.reply() response(sender, message).__str__() # print(dir(r)) return