Esempio n. 1
0
def testverifysms(global_data):
    sms_validation = SMSVerification(global_data["apikey"])
    verify_sms_variables = {
        'key': global_data["apikey"],
        'tran_id': 'UNIQUE_TRANS_ID',
        'otp': 'OTP_RECEIVED',
    }
    result = json.loads(sms_validation.verify_sms(verify_sms_variables))
    if (global_data["apikey"] == 'YOUR_API_KEY'):
        assert result['error'] == "API key not found."
    else:
        assert result['error'] == "Invalid OTP."
Esempio n. 2
0
def testsendsms(global_data):
    sms_validation = SMSVerification(global_data["apikey"])
    sms_verification_variables = {
        # 'key': global_data["apikey"],
        'tel': '+123456789',
        'country_code': 'US',
        'mesg': 'Hi, your OTP is <otp>.',
        'otp_timeout': 3600,
    }
    result = json.loads(sms_validation.send_sms(sms_verification_variables))
    if (global_data["apikey"] == 'YOUR_API_KEY'):
        assert result['error'] == "API key not found."
    else:
        assert result['error'] == "Invalid phone number."
Esempio n. 3
0
def testfunctionexist():
    sms_validation = SMSVerification(global_data["apikey"])
    errors = []
    functions_list = ['send_sms', 'verify_sms']
    for x in range(len(functions_list)):
        # assert hasattr(SMSVerification, functions_list[x]) == True, "Function did not exist."
        # if (hasattr(SMSVerification, functions_list[x]) == False):
        if (hasattr(sms_validation, functions_list[x]) == False):
            errors.append("Function " + functions_list[x] + " did not exist.")
    # assert no error message has been registered, else print messages
    assert not errors, "errors occured:\n{}".format("\n".join(errors))
Esempio n. 4
0
 # Here is example of send feecback of either approve or reject this particular order.
"""
feedback_variables = {
    'key': api_key,
    'id': '20180705-WISXW2',
    # Three actions available: APPROVE, REJECT, REJECT_BLACKLIST
    'action': 'APPROVE',
    'notes': 'This is for testing purpose.',
}
print(Order.feedback(feedback_variables))
"""
 # Here is example of verify the valid order by send the SMS to customer.
"""
sms_verification_variables = {
    'key': api_key,
    'tel': '+15616288674',
    'country_code': 'US',
    'mesg': 'Your OTP for the transaction is <otp>.',
    'otp_timeout': 3600,
}
print(SMSVerification.send_sms(sms_verification_variables))
"""
 # Here is example of check the SMS verification result of the particular order.
"""
verify_sms_variables = {
    'key': api_key,
    'tran_id': 'UNIQUE_TRANS_ID',
    'otp': 'OTP_RECEIVED',
}
print(SMSVerification.verify_sms(verify_sms_variables))
Esempio n. 5
0
    'id': '20180705-WISXW2',
    'id_type': 'FraudLabsPro::FLP_ID'
}
print(fraud_validation.get_transaction(get_transaction_variables))
"""
 # Here is example of send feecback of either approve or reject this particular order.
"""
feedback_variables = {
    'id': '20180705-WISXW2',
    # Three actions available: APPROVE, REJECT, REJECT_BLACKLIST
    'action': 'APPROVE',
    'notes': 'This is for testing purpose.',
}
print(fraud_validation.feedback(feedback_variables))

sms_validation = SMSVerification(api_key)
"""
 # Here is example of verify the valid order by send the SMS to customer.
"""
sms_verification_variables = {
    'tel': '+15616288674',
    'country_code': 'US',
    'mesg': 'Your OTP for the transaction is <otp>.',
    'otp_timeout': 3600,
}
print(sms_validation.send_sms(sms_verification_variables))
"""
 # Here is example of check the SMS verification result of the particular order.
"""
verify_sms_variables = {
    'tran_id': 'UNIQUE_TRANS_ID',