{"action":"created","comment":{"url":"https://api.github.com/repos/edx/ecommerce/pulls/comments/77885838","id":77885838,"diff_hunk":"@@ -28,10 +33,27 @@ def process_checkout_complete(sender, order=None, user=None, request=None,  # py\n     if not waffle.switch_is_active('sailthru_enable'):\n         return\n \n+    # get site code\n+    site_code = order.site.siteconfiguration.partner.short_code\n+    if waffle.switch_is_active('sailthru_edx_only') and site_code.lower() != 'edx':\n+        return\n+\n+    # get campaign id from cookies, or saved value in basket\n     message_id = None\n     if request:\n         message_id = request.COOKIES.get('sailthru_bid')\n \n+    if not message_id:\n+        attribute_type, __ = BasketAttributeType.objects.get_or_create(name=BasketAttributeTypeName.SAILTHRU_CAMPAIGN)\n+        saved_id = BasketAttribute.objects.filter(\n+            basket=order.basket,\n+            attribute_type=attribute_type\n+        )\n+        if len(saved_id) > 0:\n+            message_id = saved_id[0].value_text\n+            # don't need it any more\n+            saved_id.delete()","path":"ecommerce/sailthru/signals.py","position":46,"original_position":46,"commit_id":"82b64f32a8ef4fbaca2f53b264a3d84547af749f","original_commit_id":"82b64f32a8ef4fbaca2f53b264a3d84547af749f","user":{"login":"clintonb","id":910510,"avatar_url":"https://avatars.githubusercontent.com/u/910510?v=3","gravatar_id":"","url":"https://api.github.com/users/clintonb","html_url":"https://github.com/clintonb","followers_url":"https://api.github.com/users/clintonb/followers","following_url":"https://api.github.com/users/clintonb/following{/other_user}","gists_url":"https://api.github.com/users/clintonb/gists{/gist_id}","starred_url":"https://api.github.com/users/clintonb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintonb/subscriptions","organizations_url":"https://api.github.com/users/clintonb/orgs","repos_url":"https://api.github.com/users/clintonb/repos","events_url":"https://api.github.com/users/clintonb/events{/privacy}","received_events_url":"https://api.github.com/users/clintonb/received_events","type":"User","site_admin":false},"body":"You should leave it to facilitate debugging.","created_at":"2016-09-07T19:14:24Z","updated_at":"2016-09-07T19:14:24Z","html_url":"https://github.com/edx/ecommerce/pull/933#discussion_r77885838","pull_request_url":"https://api.github.com/repos/edx/ecommerce/pulls/933","_links":{"self":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/comments/77885838"},"html":{"href":"https://github.com/edx/ecommerce/pull/933#discussion_r77885838"},"pull_request":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/933"}}},"pull_request":{"url":"https://api.github.com/repos/edx/ecommerce/pulls/933","id":84341515,"html_url":"https://github.com/edx/ecommerce/pull/933","diff_url":"https://github.com/edx/ecommerce/pull/933.diff","patch_url":"https://github.com/edx/ecommerce/pull/933.patch","issue_url":"https://api.github.com/repos/edx/ecommerce/issues/933","number":933,"state":"open","locked":false,"title":"ECOM-5486 pass sailthru campaign id to Sailthru","user":{"login":"PaulWattenberger","id":10393732,"avatar_url":"https://avatars.githubusercontent.com/u/10393732?v=3","gravatar_id":"","url":"https://api.github.com/users/PaulWattenberger","html_url":"https://github.com/PaulWattenberger","followers_url":"https://api.github.com/users/PaulWattenberger/followers","following_url":"https://api.github.com/users/PaulWattenberger/following{/other_user}","gists_url":"https://api.github.com/users/PaulWattenberger/gists{/gist_id}","starred_url":"https://api.github.com/users/PaulWattenberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaulWattenberger/subscriptions","organizations_url":"https://api.github.com/users/PaulWattenberger/orgs","repos_url":"https://api.github.com/users/PaulWattenberger/repos","events_url":"https://api.github.com/users/PaulWattenberger/events{/privacy}","received_events_url":"https://api.github.com/users/PaulWattenberger/received_events","type":"User","site_admin":false},"body":"Save campaign id in basket (through new BasketAttribute table) and pass to Sailthru on enroll/purchase.\r\n\r\nNew waffle flag added to suppress sending purchases/enrolls for whitelabel sites","created_at":"2016-09-07T17:27:54Z","updated_at":"2016-09-07T19:14:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6054535c4ff4dc2e4e0c42391b33e6bb9263740","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/ecommerce/pulls/933/commits","review_comments_url":"https://api.github.com/repos/edx/ecommerce/pulls/933/comments","review_comment_url":"https://api.github.com/repos/edx/ecommerce/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/ecommerce/issues/933/comments","statuses_url":"https://api.github.com/repos/edx/ecommerce/statuses/82b64f32a8ef4fbaca2f53b264a3d84547af749f","head":{"label":"edx:pwattenberger/ecom-5486","ref":"pwattenberger/ecom-5486","sha":"82b64f32a8ef4fbaca2f53b264a3d84547af749f","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":30175039,"name":"ecommerce","full_name":"edx/ecommerce","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/ecommerce","description":"Django application used to manage edX's product catalog and handle orders for those products.","fork":false,"url":"https://api.github.com/repos/edx/ecommerce","forks_url":"https://api.github.com/repos/edx/ecommerce/forks","keys_url":"https://api.github.com/repos/edx/ecommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/ecommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/ecommerce/teams","hooks_url":"https://api.github.com/repos/edx/ecommerce/hooks","issue_events_url":"https://api.github.com/repos/edx/ecommerce/issues/events{/number}","events_url":"https://api.github.com/repos/edx/ecommerce/events","assignees_url":"https://api.github.com/repos/edx/ecommerce/assignees{/user}","branches_url":"https://api.github.com/repos/edx/ecommerce/branches{/branch}","tags_url":"https://api.github.com/repos/edx/ecommerce/tags","blobs_url":"https://api.github.com/repos/edx/ecommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/ecommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/ecommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/ecommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/ecommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/ecommerce/languages","stargazers_url":"https://api.github.com/repos/edx/ecommerce/stargazers","contributors_url":"https://api.github.com/repos/edx/ecommerce/contributors","subscribers_url":"https://api.github.com/repos/edx/ecommerce/subscribers","subscription_url":"https://api.github.com/repos/edx/ecommerce/subscription","commits_url":"https://api.github.com/repos/edx/ecommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/ecommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/ecommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/ecommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/ecommerce/contents/{+path}","compare_url":"https://api.github.com/repos/edx/ecommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/ecommerce/merges","archive_url":"https://api.github.com/repos/edx/ecommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/ecommerce/downloads","issues_url":"https://api.github.com/repos/edx/ecommerce/issues{/number}","pulls_url":"https://api.github.com/repos/edx/ecommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/ecommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/ecommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/ecommerce/labels{/name}","releases_url":"https://api.github.com/repos/edx/ecommerce/releases{/id}","deployments_url":"https://api.github.com/repos/edx/ecommerce/deployments","created_at":"2015-02-02T06:55:15Z","updated_at":"2016-07-20T07:49:16Z","pushed_at":"2016-09-07T18:33:59Z","git_url":"git://github.com/edx/ecommerce.git","ssh_url":"git@github.com:edx/ecommerce.git","clone_url":"https://github.com/edx/ecommerce.git","svn_url":"https://github.com/edx/ecommerce","homepage":"","size":12094,"stargazers_count":38,"watchers_count":38,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":16,"forks":40,"open_issues":16,"watchers":38,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"c53b3fa594d83b7d35d9c0ebe16520b89bce97db","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":30175039,"name":"ecommerce","full_name":"edx/ecommerce","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/ecommerce","description":"Django application used to manage edX's product catalog and handle orders for those products.","fork":false,"url":"https://api.github.com/repos/edx/ecommerce","forks_url":"https://api.github.com/repos/edx/ecommerce/forks","keys_url":"https://api.github.com/repos/edx/ecommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/ecommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/ecommerce/teams","hooks_url":"https://api.github.com/repos/edx/ecommerce/hooks","issue_events_url":"https://api.github.com/repos/edx/ecommerce/issues/events{/number}","events_url":"https://api.github.com/repos/edx/ecommerce/events","assignees_url":"https://api.github.com/repos/edx/ecommerce/assignees{/user}","branches_url":"https://api.github.com/repos/edx/ecommerce/branches{/branch}","tags_url":"https://api.github.com/repos/edx/ecommerce/tags","blobs_url":"https://api.github.com/repos/edx/ecommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/ecommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/ecommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/ecommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/ecommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/ecommerce/languages","stargazers_url":"https://api.github.com/repos/edx/ecommerce/stargazers","contributors_url":"https://api.github.com/repos/edx/ecommerce/contributors","subscribers_url":"https://api.github.com/repos/edx/ecommerce/subscribers","subscription_url":"https://api.github.com/repos/edx/ecommerce/subscription","commits_url":"https://api.github.com/repos/edx/ecommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/ecommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/ecommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/ecommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/ecommerce/contents/{+path}","compare_url":"https://api.github.com/repos/edx/ecommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/ecommerce/merges","archive_url":"https://api.github.com/repos/edx/ecommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/ecommerce/downloads","issues_url":"https://api.github.com/repos/edx/ecommerce/issues{/number}","pulls_url":"https://api.github.com/repos/edx/ecommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/ecommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/ecommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/ecommerce/labels{/name}","releases_url":"https://api.github.com/repos/edx/ecommerce/releases{/id}","deployments_url":"https://api.github.com/repos/edx/ecommerce/deployments","created_at":"2015-02-02T06:55:15Z","updated_at":"2016-07-20T07:49:16Z","pushed_at":"2016-09-07T18:33:59Z","git_url":"git://github.com/edx/ecommerce.git","ssh_url":"git@github.com:edx/ecommerce.git","clone_url":"https://github.com/edx/ecommerce.git","svn_url":"https://github.com/edx/ecommerce","homepage":"","size":12094,"stargazers_count":38,"watchers_count":38,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":16,"forks":40,"open_issues":16,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/933"},"html":{"href":"https://github.com/edx/ecommerce/pull/933"},"issue":{"href":"https://api.github.com/repos/edx/ecommerce/issues/933"},"comments":{"href":"https://api.github.com/repos/edx/ecommerce/issues/933/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/933/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/933/commits"},"statuses":{"href":"https://api.github.com/repos/edx/ecommerce/statuses/82b64f32a8ef4fbaca2f53b264a3d84547af749f"}}}}
{"actor":{"display_login":"clintonb"}}