Skip to content

Commit

Permalink
Update fraud check (#261)
Browse files Browse the repository at this point in the history
* only sending verify v2 fraud_check when set to false

* Bump version: 3.5.0 → 3.5.1
  • Loading branch information
maxkahan committed May 23, 2023
1 parent c0f1a5b commit 896f990
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.5.0
current_version = 3.5.1
commit = True
tag = False

Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 3.5.1
- Updating the internal use of the `fraud_check` parameter in the Vonage Verify V2 API

# 3.5.0
- Adding support for V2 of the Vonage Verify API
- Multiple authentication channels are supported (sms, voice, email, whatsapp, whatsapp interactive messages and silent authentication)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name="vonage",
version="3.5.0",
version="3.5.1",
description="Vonage Server SDK for Python",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion src/vonage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .client import *
from .ncco_builder.ncco import *

__version__ = "3.5.0"
__version__ = "3.5.1"
5 changes: 5 additions & 0 deletions src/vonage/verify2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self, client):
self._auth_type = 'jwt'

def new_request(self, params: dict):
self._remove_unnecessary_fraud_check(params)
try:
params_to_verify = copy.deepcopy(params)
Verify2.VerifyRequest.parse_obj(params_to_verify)
Expand Down Expand Up @@ -61,6 +62,10 @@ def cancel_verification(self, request_id: str):
auth_type=self._auth_type,
)

def _remove_unnecessary_fraud_check(self, params):
if 'fraud_check' in params and params['fraud_check'] != False:
del params['fraud_check']

class VerifyRequest(BaseModel):
brand: str
workflow: List[dict]
Expand Down
7 changes: 7 additions & 0 deletions tests/test_verify2.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,10 @@ def test_cancel_verification_error_not_found():
str(err.value)
== "Not Found: Request 'c11236f4-00bf-4b89-84ba-88b25df97315' was not found or it has been verified already. (https://developer.nexmo.com/api-errors#not-found)"
)


def test_remove_unnecessary_fraud_check():
params = {'brand': 'ACME, Inc', 'workflow': [{'channel': 'sms', 'to': '447700900000'}], 'fraud_check': True}
verify2._remove_unnecessary_fraud_check(params)

assert 'fraud_check' not in params

0 comments on commit 896f990

Please sign in to comment.