{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/34339224","id":34339224,"diff_hunk":"@@ -0,0 +1,51 @@\n+\"\"\"\n+This file contains utility functions which will responsible for sending emails.\n+\"\"\"\n+import logging\n+\n+from django.conf import settings\n+from django.contrib.auth.models import User\n+from django.core.mail import send_mail\n+from django.utils.translation import ugettext as _\n+\n+from edxmako.shortcuts import render_to_string\n+from microsite_configuration import microsite\n+from openedx.core.djangoapps.user_api.accounts.api import get_account_settings\n+from xmodule.modulestore.django import modulestore\n+\n+\n+log = logging.getLogger(__name__)\n+\n+\n+def send_credit_notifications(username, course_key, email_type=\"credit_eligibility\"):\n+    \"\"\"\n+    Sends email to the user if he/she became eligible for the course.\n+    \"\"\"\n+    user = None\n+    try:\n+        user = User.objects.get(username=username)\n+    except User.DoesNotExist:\n+        log.debug('No user with %s exist', username)","path":"openedx/core/djangoapps/credit/email_utils.py","position":28,"original_position":28,"commit_id":"c678653443e496932002797b95a5a5708b3697e8","original_commit_id":"c678653443e496932002797b95a5a5708b3697e8","user":{"login":"zubair-arbi","id":5072991,"avatar_url":"https://avatars.githubusercontent.com/u/5072991?v=3","gravatar_id":"","url":"https://api.github.com/users/zubair-arbi","html_url":"https://github.com/zubair-arbi","followers_url":"https://api.github.com/users/zubair-arbi/followers","following_url":"https://api.github.com/users/zubair-arbi/following{/other_user}","gists_url":"https://api.github.com/users/zubair-arbi/gists{/gist_id}","starred_url":"https://api.github.com/users/zubair-arbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zubair-arbi/subscriptions","organizations_url":"https://api.github.com/users/zubair-arbi/orgs","repos_url":"https://api.github.com/users/zubair-arbi/repos","events_url":"https://api.github.com/users/zubair-arbi/events{/privacy}","received_events_url":"https://api.github.com/users/zubair-arbi/received_events","type":"User","site_admin":false},"body":"If no user found here than don't need to process further.","created_at":"2015-07-10T09:23:04Z","updated_at":"2015-07-10T09:23:04Z","html_url":"https://github.com/edx/edx-platform/pull/8849#discussion_r34339224","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/8849","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/34339224"},"html":{"href":"https://github.com/edx/edx-platform/pull/8849#discussion_r34339224"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/8849"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/8849","id":39564660,"html_url":"https://github.com/edx/edx-platform/pull/8849","diff_url":"https://github.com/edx/edx-platform/pull/8849.diff","patch_url":"https://github.com/edx/edx-platform/pull/8849.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/8849","number":8849,"state":"open","locked":false,"title":"credit eligibility and payment receipt email","user":{"login":"ahsan-ul-haq","id":7567613,"avatar_url":"https://avatars.githubusercontent.com/u/7567613?v=3","gravatar_id":"","url":"https://api.github.com/users/ahsan-ul-haq","html_url":"https://github.com/ahsan-ul-haq","followers_url":"https://api.github.com/users/ahsan-ul-haq/followers","following_url":"https://api.github.com/users/ahsan-ul-haq/following{/other_user}","gists_url":"https://api.github.com/users/ahsan-ul-haq/gists{/gist_id}","starred_url":"https://api.github.com/users/ahsan-ul-haq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahsan-ul-haq/subscriptions","organizations_url":"https://api.github.com/users/ahsan-ul-haq/orgs","repos_url":"https://api.github.com/users/ahsan-ul-haq/repos","events_url":"https://api.github.com/users/ahsan-ul-haq/events{/privacy}","received_events_url":"https://api.github.com/users/ahsan-ul-haq/received_events","type":"User","site_admin":false},"body":"WIP. Add new fields in the `CreditProvider ` model which will save the custom text that providers wanted to add in the credit eligibility email notification and credit payment receipt email.\r\n\r\n@awais786 @zubair-arbi @aamir-khan @wedaly \r\n\r\nECOM-1796\r\nECOM-1525","created_at":"2015-07-09T09:38:16Z","updated_at":"2015-07-10T09:23:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"037ce032a346f86d929aad8a7176a67756dfa340","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/8849/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/8849/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/8849/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/c678653443e496932002797b95a5a5708b3697e8","head":{"label":"edx:ahsan/ECOM-1525-credit-eligibility-email-notification-updated","ref":"ahsan/ECOM-1525-credit-eligibility-email-notification-updated","sha":"c678653443e496932002797b95a5a5708b3697e8","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":"The Open edX platform, the software that powers edX!","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-07-10T09:09:13Z","pushed_at":"2015-07-10T09:07:37Z","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://open.edx.org/","size":2063792,"stargazers_count":2035,"watchers_count":2035,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1179,"mirror_url":null,"open_issues_count":157,"forks":1179,"open_issues":157,"watchers":2035,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"1e380815d9b8a1d7fcbe4b2e456404f635ec98bf","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":"The Open edX platform, the software that powers edX!","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-07-10T09:09:13Z","pushed_at":"2015-07-10T09:07:37Z","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://open.edx.org/","size":2063792,"stargazers_count":2035,"watchers_count":2035,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1179,"mirror_url":null,"open_issues_count":157,"forks":1179,"open_issues":157,"watchers":2035,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/8849"},"html":{"href":"https://github.com/edx/edx-platform/pull/8849"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/8849"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/8849/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/8849/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/8849/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/c678653443e496932002797b95a5a5708b3697e8"}}}}