コード例 #1
0
def card_order(chat_id, update_id):
    sender = {'sender_id': chat_id, 'user_data': {}}
    commands = [
        'sifariş et', 'faizlər və ödəniş', 'harada keçir', 'geriyə qayıt'
    ]
    text = "Xidmətlərdən birini seçin"
    reply_markup = bot.reply_markup_maker(commands)
    bot.send_message(chat_id, text, reply_markup)
    chat_id, text, update_id = bot.get_last_id_text(
        bot.get_updates(update_id + 1))
    bot.insert_sender(sender)
    while text.lower() == 'kart sifarişi':
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
        sleep(0.5)
    if text.lower() == commands[0]:
        credit_calculator.ask_credit_details(chat_id, update_id)
    elif text.lower() == commands[1]:
        rates_and_payments(chat_id, update_id)
    elif text.lower() == commands[2]:
        message = eligibility
        commands = ["partnyor təklifi", "geriyə qayıt"]
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
        if text.lower() == commands[0]:
            message = 'BirKart taksit kartı partnyorları siyahısına yeni partnyorun əlavə olunması ilə bağlı müraciətinizi aşağıdaki linkdən edə bilərsiniz:' + url_partner
            bot.send_message(chat_id, message, reply_markup=None)
            chat_id, text, update_id = bot.get_last_id_text(
                bot.get_updates(update_id + 1))
        elif text.lower() == commands[1]:
            card_order(chat_id, update_id)
    elif text.lower() == commands[3]:
        bot.menu(chat_id, text, update_id)
コード例 #2
0
def limits(chat_id, update_id):
    sender = {'sender_id': chat_id, 'user_data': {}}
    commands = [
        'maaşa uyğun limit', 'birkart limiti', 'limit artırmaq', 'geriyə'
    ]
    text = "Xidmətlərdən birini seçin"
    reply_markup = bot.reply_markup_maker(commands)
    bot.send_message(chat_id, text, reply_markup)
    chat_id, text, update_id = bot.get_last_id_text(
        bot.get_updates(update_id + 1))
    bot.insert_sender(sender)
    if text.lower() == commands[1]:
        message = "Birkart kredit kartı üzrə limit 100 AZN-dən - 10 000 AZN-ə kimi olur, hər müştərinin maliyyə durumuna uyğun kredit limiti ayrılır."
        commands = ["maaşa görə hesabla", "geriyə"]
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
コード例 #3
0
def cards_info(chat_id, update_id):
    sender = {'sender_id': chat_id,
              'user_data': {}}
    commands = ['birkart taksit', 'birkart cashback', 'birkart miles']
    text = "Xidmətlərdən birini seçin"
    reply_markup = bot.reply_markup_maker(commands)
    bot.send_message(chat_id, text, reply_markup)
    chat_id, text, update_id = bot.get_last_id_text(bot.get_updates(update_id + 1))
    bot.insert_sender(sender)
    while text.lower() == 'kart növləri':
        chat_id, text, update_id = bot.get_last_id_text(bot.get_updates(update_id + 1))
        sleep(0.5)
    if text.lower() == commands[0]:
        message = taksit_info
        commands = ["kart sifarişi", "tariflər və qiymət"]
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
        chat_id, text, update_id = bot.get_last_id_text(bot.get_updates(update_id + 1))
        if text.lower() == commands[0]:
            credit_calculator.ask_credit_details(chat_id, update_id)
        elif text.lower() == commands[1]:
            message = taksit_tarif
            bot.send_message(chat_id, message, reply_markup=None)
    elif text.lower() == commands[1]:
        message = cashback_info
        commands = ["kart sifarişi", "tariflər və qiymət"]
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
        chat_id, text, update_id = bot.get_last_id_text(bot.get_updates(update_id + 1))
        if text.lower() == commands[0]:
            credit_calculator.ask_credit_details(chat_id, update_id)
        elif text.lower() == commands[1]:
            message = cashback_tarif
            bot.send_message(chat_id, message, reply_markup=None)
    elif text.lower() == commands[2]:
        message = miles_info
        commands = ["kart sifarişi", "tariflər və qiymət"]
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
        chat_id, text, update_id = bot.get_last_id_text(bot.get_updates(update_id + 1))
        if text.lower() == commands[0]:
            credit_calculator.ask_credit_details(chat_id, update_id)
        elif text.lower() == commands[1]:
            message = miles_tarif
            bot.send_message(chat_id, message, reply_markup=None)
コード例 #4
0
def requirements_menu(chat_id, update_id):
    sender = {'sender_id': chat_id, 'user_data': {}}
    commands = ['kimlər ala bilər', 'hansı sənədlər ', 'birkart ala bilərəm']
    text = "Xidmətlərdən birini seçin"
    reply_markup = bot.reply_markup_maker(commands)
    bot.send_message(chat_id, text, reply_markup)
    chat_id, text, update_id = bot.get_last_id_text(
        bot.get_updates(update_id + 1))
    bot.insert_sender(sender)
    while text.lower() == 'tələblər və sənədlər':
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
        sleep(0.5)
    if text.lower() == commands[0]:
        message = who_are_eligible
        commands = ["kart sifarişi", "sənəd siyahısı"]
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
        if text.lower() == commands[0]:
            credit_calculator.ask_credit_details(chat_id, update_id)
        elif text.lower() == commands[1]:
            message = documents_list
            commands = ["kart sifarişi"]
            reply_markup = bot.reply_markup_maker(commands)
            bot.send_message(chat_id, message, reply_markup)
            chat_id, text, update_id = bot.get_last_id_text(
                bot.get_updates(update_id + 1))
            if text.lower() == commands[0]:
                credit_calculator.ask_credit_details(chat_id, update_id)
    if text.lower() == commands[1]:
        message = documents_list
        commands = ["kart sifarişi"]
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
        if text.lower() == commands[0]:
            credit_calculator.ask_credit_details(chat_id, update_id)
    if text.lower() == commands[2]:
        #needs edit
        credit_calculator.ask_credit_details(chat_id, update_id)
コード例 #5
0
def interest_rates(chat_id, update_id):
    sender = {'sender_id': chat_id, 'user_data': {}}
    commands = ['nağdlaşma', 'partnyor mağazalar', 'digər mağazalar', 'geriyə']
    text = "Xidmətlərdən birini seçin"
    reply_markup = bot.reply_markup_maker(commands)
    bot.send_message(chat_id, text, reply_markup)
    chat_id, text, update_id = bot.get_last_id_text(
        bot.get_updates(update_id + 1))
    bot.insert_sender(sender)
    if text.lower() == commands[1]:
        message = "Partnyor mağazalar -  BirKartla partnyor olduğumuz mağazalarda əməliyyat aparıb, faizsiz taksitlə ödəniş edə bilərsiz. Partnyor mağazalar siyahısı ilə tanış ola bilərsiniz : https://birkart.az/harada-kecerlidir?search=&category=&taksit=0&taksit2=18/&%20"
        commands = ["geriyə"]
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
    if text.lower() == commands[2]:
        message = other_shops
        commands = ["geriyə"]
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
    if text.lower() == commands[3]:
        rates_and_payments(chat_id, update_id)
コード例 #6
0
def payments(chat_id, update_id):
    sender = {'sender_id': chat_id, 'user_data': {}}
    commands = ['ödəniş hesablama', 'borc öyrənmə', 'borcun ödənişi', 'geriyə']
    text = "Xidmətlərdən birini seçin"
    reply_markup = bot.reply_markup_maker(commands)
    bot.send_message(chat_id, text, reply_markup)
    chat_id, text, update_id = bot.get_last_id_text(
        bot.get_updates(update_id + 1))
    bot.insert_sender(sender)
    if text.lower() == commands[0]:
        message = payment_calculate + cabinet_url
        bot.send_message(chat_id, message, reply_markup=None)
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
    if text.lower() == commands[1]:
        commands = ['cif nədir', 'geriyə']
        message = "BirKart üzrə borcunuzu öyrənmək üçün şəxsi kabinetinizə daxil olun. CİF kodunuzu daxil edərək, borcunuzu öyrənə bilərsiniz. https://birkart.az/cabinet/&%20"
        reply_markup = bot.reply_markup_maker(commands)
        bot.send_message(chat_id, message, reply_markup)
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
        if text.lower() == commands[0]:
            message = cif
            commands = ['geriyə']
            reply_markup = bot.reply_markup_maker(commands)
            bot.send_message(chat_id, message, reply_markup)
            chat_id, text, update_id = bot.get_last_id_text(
                bot.get_updates(update_id + 1))
            if text.lower() == commands[0]:
                payments(chat_id, update_id)
        if text.lower() == commands[1]:
            payments(chat_id, update_id)
    if text.lower() == commands[2]:
        message = "Linkə daxil olub borcu ödəyə bilərsiniz : https://pay.kapitalbank.az/"
        bot.send_message(chat_id, message, reply_markup=None)
    if text.lower() == commands[3]:
        card_order(chat_id, update_id)
コード例 #7
0
def rates_and_payments(chat_id, update_id):
    sender = {'sender_id': chat_id, 'user_data': {}}
    commands = ['ödənişlər', 'faizlər', 'limitlər', 'geriyə qayıt']
    text = "Xidmətlərdən birini seçin"
    reply_markup = bot.reply_markup_maker(commands)
    bot.send_message(chat_id, text, reply_markup)
    chat_id, text, update_id = bot.get_last_id_text(
        bot.get_updates(update_id + 1))
    bot.insert_sender(sender)
    while text.lower() == 'faizlər və ödəniş':
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
        sleep(0.5)
    if text.lower() == commands[0]:
        payments(chat_id, update_id)
    elif text.lower() == commands[1]:
        interest_rates(chat_id, update_id)
    elif text.lower() == commands[2]:
        limits(chat_id, update_id)
    elif text.lower() == commands[3]:
        card_order(chat_id, update_id)
コード例 #8
0
def ask_credit_calculator_details(chat_id, update_id, step=0):
    """Ask credit details (credit_assurance, credit_months, credit_amount)
    from user and calculate (final_amount)
    """
    new_values = {'$set': {}}
    sender = {'sender_id': chat_id, 'user_data': {}}
    # bot.back_to_menu(chat_id,update_id)
    message = "Kredit sifarişi blokuna daxil olmusunuz. Təminatlıdır?"
    commands = ["Təminatlıdır", "Təminatlı Deyil", "Geriyə qayıt"]
    reply_markup = bot.reply_markup_maker(commands)
    bot.send_message(chat_id, message, reply_markup)
    chat_id, text, update_id = bot.get_last_id_text(
        bot.get_updates(update_id + 1))
    bot.insert_sender(sender)
    while text.lower() == 'kredit':
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
        sleep(0.5)
    if text == commands[0]:
        new_values['$set']['user_data.credit_assurance'] = True
        sender = bot.update_sender(sender, new_values)
        print('True')
    elif text == commands[1]:
        new_values['$set']['user_data.credit_assurance'] = False
        sender = bot.update_sender(sender, new_values)
        print('False')
    elif text == commands[2]:
        bot.menu(chat_id, text, update_id)
        return
    print(text)
    message = "Kredit müddəti neçə aydır?"
    commands = ['12', '24', '36', 'Geriyə qayıt']
    reply_markup = bot.reply_markup_maker(commands)
    bot.send_message(chat_id, message, reply_markup)
    chat_id, text, update_id = bot.get_last_id_text(
        bot.get_updates(update_id + 1))
    while text == "Təminatlıdır":
        chat_id, text, update_id = bot.get_last_id_text(
            bot.get_updates(update_id + 1))
        sleep(0.5)
    if text in commands:
        if text == commands[3]:
            bot.menu(chat_id, text, update_id)
        else:
            new_values['$set']['user_data.credit_months'] = text
            sender = bot.update_sender(sender, new_values)
            message = "Kredit məbləği nə qədərdir?"
            bot.send_message(chat_id, message, reply_markup=None)
            chat_id, text, update_id = bot.get_last_id_text(
                bot.get_updates(update_id + 1))
            while text == "Kredit məbləği nə qədərdir?":
                chat_id, text, update_id = bot.get_last_id_text(
                    bot.get_updates(update_id + 1))
                sleep(0.5)
            if text:
                new_values['$set']['user_data.credit_amount'] = text
                sender = bot.update_sender(sender, new_values)
                calculated_credit = credit_calculator(
                    sender['user_data']['credit_assurance'],
                    int(sender['user_data']['credit_months']), int(text))
                new_values['$set'][
                    'user_data.credit_monthly'] = calculated_credit['monthly']
                new_values['$set'][
                    'user_data.credit_final_amount'] = calculated_credit[
                        'final_amount']
                sender = bot.update_sender(sender, new_values)
                print(calculated_credit)
                monthly = calculated_credit['monthly']
                final_amount = str(calculated_credit['final_amount'])
                message = f'{final_amount} məbləğində sifarişiniz qeydə alındı. Rəsmiləşdirmək istəyirsiniz?'
                commands = ["Bəli", "Xeyr"]
                reply_markup = bot.reply_markup_maker(commands)
                bot.send_message(chat_id, message, reply_markup)
                chat_id, text, update_id = bot.get_last_id_text(
                    bot.get_updates(update_id + 1))
                if text == commands[0]:
                    print('beli')
                    ask_credit_details(chat_id, update_id)
                    return
                else:
                    bot.menu(chat_id, text, update_id)