Пример #1
0
def checkout():

    # list_ids_to_mark_complete=[]
    # print(request.form.keys)
    # for key,val in request.form.items():
    #     print(key)
    #     if key!="contact_num":
    #         list_ids_to_mark_complete.append(int(float(val)))
    # print(list_ids_to_mark_complete)

    benificiary_contact = request.form['contact_num']
    amount_pledged = request.form['amount_pledged']
    contrib_name = request.form['contrib_name']

    # some form validation here

    mobile_issue = False
    if benificiary_contact == "":
        mobile_issue = True

    if not benificiary_contact.isdecimal():
        mobile_issue = True

    if len(benificiary_contact) != 10:
        mobile_issue = True

    if mobile_issue:
        return "Please retry with proper mobile number"

    # if len(list_ids_to_mark_complete)==0:
    #     return "Please go back and click on the check boxes \
    #     to select the requirements you want to fulfill."

    # status,sheet=get_sheet("Details_People")
    # if status==False:
    #     return sheet
    # list_of_requests=(sheet.get_all_values())

    # list_to_be_fulfilled=[]

    # row_count=2
    # for the_request in list_of_requests[1:]:
    #     if int(float(the_request[0])) in list_ids_to_mark_complete:
    #         # first create a dict out of the row

    #         dict_request=convert_list_to_dict(the_request)

    #         list_to_be_fulfilled.append(dict_request)
    #         # sheet.update_cell(row_count, request_status_index+1, "Completed")
    #         # sheet.update_cell(row_count, beneficiary_contact_index+1, str(benificiary_contact))
    #     row_count+=1

    # print(list_to_be_fulfilled)
    dict_order = {
        "contributor_number": str(benificiary_contact),
        "amount_pledged": amount_pledged
    }
    dict_order["contrib_name"] = contrib_name

    # now generate the otp
    return_str = send_otp_sms(str(benificiary_contact).strip())
    dict_order["return_message"] = return_str

    return render_template("otp_payment.html", items=dict_order)
Пример #2
0
from send_otp import send_otp_sms
from validate_phone import validate_phone

phone = '+919804002142'
send_otp_sms(phone)
otp = input('Enter otp :\n')
if (validate_phone(phone, otp)):
    print("Authenticated")
else:
    print("Fake")
Пример #3
0
def checkoutmumbai():

    list_ids_to_mark_complete = []
    print(request.form.keys)
    for key, val in request.form.items():
        print(key)
        if key != "contact_num" and key != "contrib_name" and key != "contrib_type":
            list_ids_to_mark_complete.append(int(float(val)))
    print("to be completed", list_ids_to_mark_complete)

    benificiary_contact = request.form['contact_num']
    contrib_name = request.form['contrib_name']
    contrib_type = request.form['contrib_type']

    # some form validation here

    mobile_issue = False
    if benificiary_contact == "":
        mobile_issue = True

    if not benificiary_contact.isdecimal():
        mobile_issue = True

    if len(benificiary_contact) != 10:
        mobile_issue = True

    if mobile_issue:
        return "Please retry with proper mobile number"

    if len(list_ids_to_mark_complete) == 0:
        return "Please go back and click on the check boxes \
        to select the requirements you want to fulfill."

    status, sheet = get_sheet("Details_People_Mumbai")
    if status == False:
        return sheet
    list_of_requests = (sheet.get_all_values())

    list_to_be_fulfilled = []

    row_count = 2
    for the_request in list_of_requests[1:]:
        if int(float(the_request[0])) in list_ids_to_mark_complete:
            # first create a dict out of the row

            dict_request = convert_list_to_dict(the_request)

            list_to_be_fulfilled.append(dict_request)
            # sheet.update_cell(row_count, request_status_index+1, "Completed")
            # sheet.update_cell(row_count, beneficiary_contact_index+1, str(benificiary_contact))
        row_count += 1

    print(list_to_be_fulfilled)

    dict_order = {"contributor_number": str(benificiary_contact)}
    dict_order["order"] = list_to_be_fulfilled
    dict_order["contrib_name"] = contrib_name
    dict_order["contrib_type"] = contrib_type

    # now generate the otp
    return_str = send_otp_sms(str(benificiary_contact).strip())
    dict_order["return_message"] = return_str

    return render_template("otp_payment_mumbai.html", items=dict_order)