Skip to content

(For Jintae or Gary) Add session level decision. #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 13, 2018

Conversation

mjouahri
Copy link
Contributor

@mjouahri mjouahri commented Feb 9, 2018

Purpose:

  • Adds support for the session level decisions.

Technical overview:

  • Updates data model to reflect the new decision.

Testing Plan

  • Expanded and added unit tests and run them locally.

Deployment

  • Publish to Maven
  • Github release

@mjouahri mjouahri self-assigned this Feb 9, 2018
@jintaekim20
Copy link

jintaekim20 commented Feb 11, 2018

Mohammed, can you also update get_decisions and related code to include sessions? Also, please consider updating README.md and CHANGES.md.

Note: https://siftscience.com/developers/docs/python/decisions-api/decisions-list

sift/client.py Outdated
user_id: id of user
session_id: id of session
properties:
decision_id: decision to apply to user

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess decision_id here is "decision to apply to session" (and that the same comment in apply_order_decision should be changed accordingly.)

For example, in the unit test, decision_id used was session_looks_bad_ato.

@@ -522,6 +528,42 @@ def test_apply_decision_to_order_ok(self):
assert(response.http_status_code == 200)
assert(response.body['entity']['type'] == 'order')

def test_apply_decision_to_session_ok(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick question: no need to test failed cases?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that test_apply_decision_to_session does test with no session_id. I think it's enough to change the name of test_apply_decision_to_session.

'{' \
'"data": [' \
'{' \
'"id": "block_user",' \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, it's a very minor nit, but id, name, and description do not match the entity type, though it isn't really related to what the test case is supposed to test.

'"name" : "Block user",' \
'"description": "user has a different billing and shipping addresses",' \
'"entity_type": "session",' \
'"abuse_type": "legacy",' \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we only have session decision associated with account_takeover today. Its logic may change in the future, and it isn't really related to the test case, either, so you may leave it as is now. It just doesn't look real.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree that it would be nice to change this to account_takeover to reflect a correct integration pattern

Copy link

@jintaekim20 jintaekim20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of very minor nits, which you may end up not fixing it, but otherwise looks good to me.

@garylee1
Copy link

garylee1 commented Feb 12, 2018

please also update CHANGES.md and version.py

@garylee1
Copy link

LGTM

@mjouahri mjouahri merged commit 884b8b0 into master Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants