{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/22463583","id":22463583,"diff_hunk":"@@ -352,8 +351,15 @@ def register_code_redemption(request, registration_code):\n         course = get_course_by_id(getattr(course_registration, 'course_id'), depth=0)\n         if reg_code_is_valid and not reg_code_already_redeemed:\n             #now redeem the reg code.\n-            RegistrationCodeRedemption.create_invoice_generated_registration_redemption(course_registration, request.user)\n-            CourseEnrollment.enroll(request.user, course.id)\n+            redemption = RegistrationCodeRedemption.create_invoice_generated_registration_redemption(course_registration, request.user)\n+\n+            kwargs = {}\n+            if course_registration.mode_slug is not None:\n+                kwargs['mode'] = course_registration.mode_slug\n+\n+            redemption.course_enrollment = CourseEnrollment.enroll(request.user, course.id, **kwargs)","path":"lms/djangoapps/shoppingcart/views.py","position":20,"original_position":20,"commit_id":"1b932f6df8332cf6934bebb97dc8ff064beffaed","original_commit_id":"1b932f6df8332cf6934bebb97dc8ff064beffaed","user":{"login":"wedaly","id":2948394,"avatar_url":"https://avatars.githubusercontent.com/u/2948394?v=3","gravatar_id":"","url":"https://api.github.com/users/wedaly","html_url":"https://github.com/wedaly","followers_url":"https://api.github.com/users/wedaly/followers","following_url":"https://api.github.com/users/wedaly/following{/other_user}","gists_url":"https://api.github.com/users/wedaly/gists{/gist_id}","starred_url":"https://api.github.com/users/wedaly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wedaly/subscriptions","organizations_url":"https://api.github.com/users/wedaly/orgs","repos_url":"https://api.github.com/users/wedaly/repos","events_url":"https://api.github.com/users/wedaly/events{/privacy}","received_events_url":"https://api.github.com/users/wedaly/received_events","type":"User","site_admin":false},"body":"I know this isn't part of your PR, but I'm wondering if we're being careful enough with this call.  In particular:\r\n\r\n1) Are we handling all the exceptions this might raise?\r\n2) Should we be passing `check_access=True` to prevent users from enrolling outside of the enrollment period?  Or are we explicitly ignoring these constraints for redeem codes?  (that may be a question for product)","created_at":"2015-01-05T14:44:39Z","updated_at":"2015-01-05T14:44:39Z","html_url":"https://github.com/edx/edx-platform/pull/6374#discussion_r22463583","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/6374","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/22463583"},"html":{"href":"https://github.com/edx/edx-platform/pull/6374#discussion_r22463583"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6374"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/6374","id":26563455,"html_url":"https://github.com/edx/edx-platform/pull/6374","diff_url":"https://github.com/edx/edx-platform/pull/6374.diff","patch_url":"https://github.com/edx/edx-platform/pull/6374.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/6374","number":6374,"state":"open","locked":false,"title":"Enable redeem codes for Verified Cert Courses","user":{"login":"stephensanchez","id":235752,"avatar_url":"https://avatars.githubusercontent.com/u/235752?v=3","gravatar_id":"","url":"https://api.github.com/users/stephensanchez","html_url":"https://github.com/stephensanchez","followers_url":"https://api.github.com/users/stephensanchez/followers","following_url":"https://api.github.com/users/stephensanchez/following{/other_user}","gists_url":"https://api.github.com/users/stephensanchez/gists{/gist_id}","starred_url":"https://api.github.com/users/stephensanchez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephensanchez/subscriptions","organizations_url":"https://api.github.com/users/stephensanchez/orgs","repos_url":"https://api.github.com/users/stephensanchez/repos","events_url":"https://api.github.com/users/stephensanchez/events{/privacy}","received_events_url":"https://api.github.com/users/stephensanchez/received_events","type":"User","site_admin":false},"body":"Enables redeem codes for verified courses.\r\n\r\n* White label logic - Hiding Coupon Creation and Setting the Minimum price if the course is not White Label.\r\n* Generating Redeem Codes is restricted to a new admin role 'sales_admin'. \r\n* Must have \"financial_admin\" or \"sales_admin\" to view the e-commerce tab\r\n* redeem code URL now available without \"ENABLE_SHOPPING_CART\" feature flag\r\n* Redeem Codes are now aware of \"mode_slug\", and will register students for the appropriate course mode.\r\n\r\n@wedaly @dianakhuang Take a look when able\r\n@chrisndodge Let me know if these changes seem reasonable to you. Based on these changes, we will need to give everyone that currently has \"financial_admin\" privileges for white label courses to have \"sales_admin\" privileges in order to let them continue to create Redeem Codes.  I will also create a separate PR to change the \"registration_codes_sale_email.txt\" template based on the ENABLE_SHOPPING_CART feature flag. Currently, that template is very shopping cart specific. ","created_at":"2014-12-24T16:19:54Z","updated_at":"2015-01-05T14:44:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"01d77290f36351bae522a566748438a39ee1a909","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/6374/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/6374/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/{number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/6374/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/1b932f6df8332cf6934bebb97dc8ff064beffaed","head":{"label":"edx:sanchez/enable_redeem_codes","ref":"sanchez/enable_redeem_codes","sha":"1b932f6df8332cf6934bebb97dc8ff064beffaed","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":10391073,"name":"edx-platform","full_name":"edx/edx-platform","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/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-01-05T14:21:04Z","pushed_at":"2015-01-05T14:41:03Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1559368,"stargazers_count":1648,"watchers_count":1648,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":949,"mirror_url":null,"open_issues_count":148,"forks":949,"open_issues":148,"watchers":1648,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"7d8a977990c206b2b8d6e4adb3314873b6ee3d25","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":10391073,"name":"edx-platform","full_name":"edx/edx-platform","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/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-01-05T14:21:04Z","pushed_at":"2015-01-05T14:41:03Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1559368,"stargazers_count":1648,"watchers_count":1648,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":949,"mirror_url":null,"open_issues_count":148,"forks":949,"open_issues":148,"watchers":1648,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6374"},"html":{"href":"https://github.com/edx/edx-platform/pull/6374"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/6374"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/6374/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6374/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/6374/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/1b932f6df8332cf6934bebb97dc8ff064beffaed"}}}}