From 14e9889ade2d6deccf1089f57a573ccc9a3daa1d Mon Sep 17 00:00:00 2001 From: 0xSachinK <0xsachink@gmail.com> Date: Tue, 4 Jun 2024 20:58:26 +0530 Subject: [PATCH 1/2] Allow merchant email for registration --- src/venmo/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/venmo/api.py b/src/venmo/api.py index 352b23b..17263d0 100644 --- a/src/venmo/api.py +++ b/src/venmo/api.py @@ -59,7 +59,7 @@ def alert_on_slack(error_code, email_raw_content="", log_subject=False): ) return response.status_code -def validate_email(email_raw_content): +def validate_email(email_raw_content, circuit_type): # Ensure the email is from the domain if not re.search(fr'{FROM_EMAIL_ADDRESS}', email_raw_content): @@ -99,7 +99,7 @@ def validate_email(email_raw_content): return False, error_code # Ensure the email is not a send to merchant email - if re.search(SEND_TO_MERCHANT_EMAIL_BODY_SUBSTR, email_raw_content): + if circuit_type == "send" and re.search(SEND_TO_MERCHANT_EMAIL_BODY_SUBSTR, email_raw_content): error_code = Error.ErrorCodes.INVALID_EMAIL alert_on_slack(error_code, email_raw_content, log_subject=True) return False, error_code @@ -152,7 +152,7 @@ def genproof_email(email_data: Dict): ) # Validate email - valid_email, error_code = validate_email(email_raw_data) + valid_email, error_code = validate_email(email_raw_data, circuit_type) if not valid_email: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, From bbadb0dc8100063a85eef9265e8c28aaec9b42f0 Mon Sep 17 00:00:00 2001 From: 0xSachinK <0xsachink@gmail.com> Date: Tue, 4 Jun 2024 22:52:14 +0530 Subject: [PATCH 2/2] Remove check --- src/venmo/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/venmo/api.py b/src/venmo/api.py index 17263d0..7a48bce 100644 --- a/src/venmo/api.py +++ b/src/venmo/api.py @@ -99,7 +99,7 @@ def validate_email(email_raw_content, circuit_type): return False, error_code # Ensure the email is not a send to merchant email - if circuit_type == "send" and re.search(SEND_TO_MERCHANT_EMAIL_BODY_SUBSTR, email_raw_content): + if re.search(SEND_TO_MERCHANT_EMAIL_BODY_SUBSTR, email_raw_content): error_code = Error.ErrorCodes.INVALID_EMAIL alert_on_slack(error_code, email_raw_content, log_subject=True) return False, error_code