{"action":"created","comment":{"url":"https://api.github.com/repos/gratipay/gratipay.com/pulls/comments/28412379","id":28412379,"diff_hunk":"@@ -0,0 +1,52 @@\n+\"\"\"An endpoint to receive Coinbase's callbacks.\n+\n+Docs: https://developers.coinbase.com/docs/merchants/callbacks\n+\n+\"\"\"\n+\n+import json\n+from decimal import Decimal as D\n+\n+from aspen import Response\n+from gratipay.billing.exchanges import record_exchange, record_exchange_result\n+from gratipay.models.exchange_route import ExchangeRoute\n+from gratipay.models.participant import Participant\n+\n+[---]\n+\n+request.allow('POST')\n+\n+if request.qs.get('secret_key') != website.coinbase_secret_key:\n+    raise Response(401)\n+\n+order = request.body.get('order', None)\n+\n+if order:\n+    # Fetch the participant from the order's 'custom' attribute.\n+    participant = Participant.from_id(int(order['custom']))","path":"www/callbacks/coinbase.spt","position":26,"original_position":26,"commit_id":"b6e13e2331f10e9d307a038b9ffe3a0e07915c79","original_commit_id":"b6e13e2331f10e9d307a038b9ffe3a0e07915c79","user":{"login":"Changaco","id":1581590,"avatar_url":"https://avatars.githubusercontent.com/u/1581590?v=3","gravatar_id":"","url":"https://api.github.com/users/Changaco","html_url":"https://github.com/Changaco","followers_url":"https://api.github.com/users/Changaco/followers","following_url":"https://api.github.com/users/Changaco/following{/other_user}","gists_url":"https://api.github.com/users/Changaco/gists{/gist_id}","starred_url":"https://api.github.com/users/Changaco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Changaco/subscriptions","organizations_url":"https://api.github.com/users/Changaco/orgs","repos_url":"https://api.github.com/users/Changaco/repos","events_url":"https://api.github.com/users/Changaco/events{/privacy}","received_events_url":"https://api.github.com/users/Changaco/received_events","type":"User","site_admin":false},"body":"Should probably `assert participant` here.","created_at":"2015-04-15T11:44:41Z","updated_at":"2015-04-15T11:44:41Z","html_url":"https://github.com/gratipay/gratipay.com/pull/3317#discussion_r28412379","pull_request_url":"https://api.github.com/repos/gratipay/gratipay.com/pulls/3317","_links":{"self":{"href":"https://api.github.com/repos/gratipay/gratipay.com/pulls/comments/28412379"},"html":{"href":"https://github.com/gratipay/gratipay.com/pull/3317#discussion_r28412379"},"pull_request":{"href":"https://api.github.com/repos/gratipay/gratipay.com/pulls/3317"}}},"pull_request":{"url":"https://api.github.com/repos/gratipay/gratipay.com/pulls/3317","id":32646923,"html_url":"https://github.com/gratipay/gratipay.com/pull/3317","diff_url":"https://github.com/gratipay/gratipay.com/pull/3317.diff","patch_url":"https://github.com/gratipay/gratipay.com/pull/3317.patch","issue_url":"https://api.github.com/repos/gratipay/gratipay.com/issues/3317","number":3317,"state":"open","locked":false,"title":"Bitcoin payin","user":{"login":"rohitpaulk","id":3893573,"avatar_url":"https://avatars.githubusercontent.com/u/3893573?v=3","gravatar_id":"","url":"https://api.github.com/users/rohitpaulk","html_url":"https://github.com/rohitpaulk","followers_url":"https://api.github.com/users/rohitpaulk/followers","following_url":"https://api.github.com/users/rohitpaulk/following{/other_user}","gists_url":"https://api.github.com/users/rohitpaulk/gists{/gist_id}","starred_url":"https://api.github.com/users/rohitpaulk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohitpaulk/subscriptions","organizations_url":"https://api.github.com/users/rohitpaulk/orgs","repos_url":"https://api.github.com/users/rohitpaulk/repos","events_url":"https://api.github.com/users/rohitpaulk/events{/privacy}","received_events_url":"https://api.github.com/users/rohitpaulk/received_events","type":"User","site_admin":false},"body":"#1963\r\n\r\n- UI Work\r\n  - [x] Add bitcoin to settings page\r\n  - [x] Create bitcoin-payin page\r\n  - [x] Create coinbase button on request, embed iframe\r\n  - [x] Handle messages from iframe on success/failure\r\n  - [x] Fix how bitcoin payins are shown on the 'history' page\r\n  - [x] Modify receipts to show bitcoin payins too\r\n- [x] Handle coinbase callback\r\n  - [x] Update DB, balance\r\n  - [x] ~~Handle mispayments - overpaid, underpaid.~~ Skip for now, handle via support.\r\n  - [x] Send emails\r\n  - [x] Check for a secret_key\r\n- [x] Handle fees properly\r\n- [x] Handle both sandbox and non-sandbox mode\r\n- Think about security\r\n  - [ ] Do we need identity verification to allow a bitcoin payin?","created_at":"2015-04-05T10:25:29Z","updated_at":"2015-04-15T11:44:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2dbb9664c448cb1b1b63627caa14e66a96f5fde3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gratipay/gratipay.com/pulls/3317/commits","review_comments_url":"https://api.github.com/repos/gratipay/gratipay.com/pulls/3317/comments","review_comment_url":"https://api.github.com/repos/gratipay/gratipay.com/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gratipay/gratipay.com/issues/3317/comments","statuses_url":"https://api.github.com/repos/gratipay/gratipay.com/statuses/b6e13e2331f10e9d307a038b9ffe3a0e07915c79","head":{"label":"gratipay:bitcoin-payin","ref":"bitcoin-payin","sha":"b6e13e2331f10e9d307a038b9ffe3a0e07915c79","user":{"login":"gratipay","id":1744073,"avatar_url":"https://avatars.githubusercontent.com/u/1744073?v=3","gravatar_id":"","url":"https://api.github.com/users/gratipay","html_url":"https://github.com/gratipay","followers_url":"https://api.github.com/users/gratipay/followers","following_url":"https://api.github.com/users/gratipay/following{/other_user}","gists_url":"https://api.github.com/users/gratipay/gists{/gist_id}","starred_url":"https://api.github.com/users/gratipay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gratipay/subscriptions","organizations_url":"https://api.github.com/users/gratipay/orgs","repos_url":"https://api.github.com/users/gratipay/repos","events_url":"https://api.github.com/users/gratipay/events{/privacy}","received_events_url":"https://api.github.com/users/gratipay/received_events","type":"Organization","site_admin":false},"repo":{"id":4521463,"name":"gratipay.com","full_name":"gratipay/gratipay.com","owner":{"login":"gratipay","id":1744073,"avatar_url":"https://avatars.githubusercontent.com/u/1744073?v=3","gravatar_id":"","url":"https://api.github.com/users/gratipay","html_url":"https://github.com/gratipay","followers_url":"https://api.github.com/users/gratipay/followers","following_url":"https://api.github.com/users/gratipay/following{/other_user}","gists_url":"https://api.github.com/users/gratipay/gists{/gist_id}","starred_url":"https://api.github.com/users/gratipay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gratipay/subscriptions","organizations_url":"https://api.github.com/users/gratipay/orgs","repos_url":"https://api.github.com/users/gratipay/repos","events_url":"https://api.github.com/users/gratipay/events{/privacy}","received_events_url":"https://api.github.com/users/gratipay/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gratipay/gratipay.com","description":"Gratitude? Gratipay! Weekly payments to people and teams you believe in.","fork":false,"url":"https://api.github.com/repos/gratipay/gratipay.com","forks_url":"https://api.github.com/repos/gratipay/gratipay.com/forks","keys_url":"https://api.github.com/repos/gratipay/gratipay.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gratipay/gratipay.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gratipay/gratipay.com/teams","hooks_url":"https://api.github.com/repos/gratipay/gratipay.com/hooks","issue_events_url":"https://api.github.com/repos/gratipay/gratipay.com/issues/events{/number}","events_url":"https://api.github.com/repos/gratipay/gratipay.com/events","assignees_url":"https://api.github.com/repos/gratipay/gratipay.com/assignees{/user}","branches_url":"https://api.github.com/repos/gratipay/gratipay.com/branches{/branch}","tags_url":"https://api.github.com/repos/gratipay/gratipay.com/tags","blobs_url":"https://api.github.com/repos/gratipay/gratipay.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gratipay/gratipay.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gratipay/gratipay.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/gratipay/gratipay.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gratipay/gratipay.com/statuses/{sha}","languages_url":"https://api.github.com/repos/gratipay/gratipay.com/languages","stargazers_url":"https://api.github.com/repos/gratipay/gratipay.com/stargazers","contributors_url":"https://api.github.com/repos/gratipay/gratipay.com/contributors","subscribers_url":"https://api.github.com/repos/gratipay/gratipay.com/subscribers","subscription_url":"https://api.github.com/repos/gratipay/gratipay.com/subscription","commits_url":"https://api.github.com/repos/gratipay/gratipay.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/gratipay/gratipay.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/gratipay/gratipay.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/gratipay/gratipay.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/gratipay/gratipay.com/contents/{+path}","compare_url":"https://api.github.com/repos/gratipay/gratipay.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gratipay/gratipay.com/merges","archive_url":"https://api.github.com/repos/gratipay/gratipay.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gratipay/gratipay.com/downloads","issues_url":"https://api.github.com/repos/gratipay/gratipay.com/issues{/number}","pulls_url":"https://api.github.com/repos/gratipay/gratipay.com/pulls{/number}","milestones_url":"https://api.github.com/repos/gratipay/gratipay.com/milestones{/number}","notifications_url":"https://api.github.com/repos/gratipay/gratipay.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gratipay/gratipay.com/labels{/name}","releases_url":"https://api.github.com/repos/gratipay/gratipay.com/releases{/id}","created_at":"2012-06-01T16:01:02Z","updated_at":"2015-04-13T12:41:45Z","pushed_at":"2015-04-15T10:25:54Z","git_url":"git://github.com/gratipay/gratipay.com.git","ssh_url":"git@github.com:gratipay/gratipay.com.git","clone_url":"https://github.com/gratipay/gratipay.com.git","svn_url":"https://github.com/gratipay/gratipay.com","homepage":"https://gratipay.com/","size":81304,"stargazers_count":820,"watchers_count":820,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":260,"mirror_url":null,"open_issues_count":407,"forks":260,"open_issues":407,"watchers":820,"default_branch":"master"}},"base":{"label":"gratipay:master","ref":"master","sha":"5e4e540e534288283fe207048c678272fa717dd6","user":{"login":"gratipay","id":1744073,"avatar_url":"https://avatars.githubusercontent.com/u/1744073?v=3","gravatar_id":"","url":"https://api.github.com/users/gratipay","html_url":"https://github.com/gratipay","followers_url":"https://api.github.com/users/gratipay/followers","following_url":"https://api.github.com/users/gratipay/following{/other_user}","gists_url":"https://api.github.com/users/gratipay/gists{/gist_id}","starred_url":"https://api.github.com/users/gratipay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gratipay/subscriptions","organizations_url":"https://api.github.com/users/gratipay/orgs","repos_url":"https://api.github.com/users/gratipay/repos","events_url":"https://api.github.com/users/gratipay/events{/privacy}","received_events_url":"https://api.github.com/users/gratipay/received_events","type":"Organization","site_admin":false},"repo":{"id":4521463,"name":"gratipay.com","full_name":"gratipay/gratipay.com","owner":{"login":"gratipay","id":1744073,"avatar_url":"https://avatars.githubusercontent.com/u/1744073?v=3","gravatar_id":"","url":"https://api.github.com/users/gratipay","html_url":"https://github.com/gratipay","followers_url":"https://api.github.com/users/gratipay/followers","following_url":"https://api.github.com/users/gratipay/following{/other_user}","gists_url":"https://api.github.com/users/gratipay/gists{/gist_id}","starred_url":"https://api.github.com/users/gratipay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gratipay/subscriptions","organizations_url":"https://api.github.com/users/gratipay/orgs","repos_url":"https://api.github.com/users/gratipay/repos","events_url":"https://api.github.com/users/gratipay/events{/privacy}","received_events_url":"https://api.github.com/users/gratipay/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gratipay/gratipay.com","description":"Gratitude? Gratipay! Weekly payments to people and teams you believe in.","fork":false,"url":"https://api.github.com/repos/gratipay/gratipay.com","forks_url":"https://api.github.com/repos/gratipay/gratipay.com/forks","keys_url":"https://api.github.com/repos/gratipay/gratipay.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gratipay/gratipay.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gratipay/gratipay.com/teams","hooks_url":"https://api.github.com/repos/gratipay/gratipay.com/hooks","issue_events_url":"https://api.github.com/repos/gratipay/gratipay.com/issues/events{/number}","events_url":"https://api.github.com/repos/gratipay/gratipay.com/events","assignees_url":"https://api.github.com/repos/gratipay/gratipay.com/assignees{/user}","branches_url":"https://api.github.com/repos/gratipay/gratipay.com/branches{/branch}","tags_url":"https://api.github.com/repos/gratipay/gratipay.com/tags","blobs_url":"https://api.github.com/repos/gratipay/gratipay.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gratipay/gratipay.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gratipay/gratipay.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/gratipay/gratipay.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gratipay/gratipay.com/statuses/{sha}","languages_url":"https://api.github.com/repos/gratipay/gratipay.com/languages","stargazers_url":"https://api.github.com/repos/gratipay/gratipay.com/stargazers","contributors_url":"https://api.github.com/repos/gratipay/gratipay.com/contributors","subscribers_url":"https://api.github.com/repos/gratipay/gratipay.com/subscribers","subscription_url":"https://api.github.com/repos/gratipay/gratipay.com/subscription","commits_url":"https://api.github.com/repos/gratipay/gratipay.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/gratipay/gratipay.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/gratipay/gratipay.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/gratipay/gratipay.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/gratipay/gratipay.com/contents/{+path}","compare_url":"https://api.github.com/repos/gratipay/gratipay.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gratipay/gratipay.com/merges","archive_url":"https://api.github.com/repos/gratipay/gratipay.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gratipay/gratipay.com/downloads","issues_url":"https://api.github.com/repos/gratipay/gratipay.com/issues{/number}","pulls_url":"https://api.github.com/repos/gratipay/gratipay.com/pulls{/number}","milestones_url":"https://api.github.com/repos/gratipay/gratipay.com/milestones{/number}","notifications_url":"https://api.github.com/repos/gratipay/gratipay.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gratipay/gratipay.com/labels{/name}","releases_url":"https://api.github.com/repos/gratipay/gratipay.com/releases{/id}","created_at":"2012-06-01T16:01:02Z","updated_at":"2015-04-13T12:41:45Z","pushed_at":"2015-04-15T10:25:54Z","git_url":"git://github.com/gratipay/gratipay.com.git","ssh_url":"git@github.com:gratipay/gratipay.com.git","clone_url":"https://github.com/gratipay/gratipay.com.git","svn_url":"https://github.com/gratipay/gratipay.com","homepage":"https://gratipay.com/","size":81304,"stargazers_count":820,"watchers_count":820,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":260,"mirror_url":null,"open_issues_count":407,"forks":260,"open_issues":407,"watchers":820,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gratipay/gratipay.com/pulls/3317"},"html":{"href":"https://github.com/gratipay/gratipay.com/pull/3317"},"issue":{"href":"https://api.github.com/repos/gratipay/gratipay.com/issues/3317"},"comments":{"href":"https://api.github.com/repos/gratipay/gratipay.com/issues/3317/comments"},"review_comments":{"href":"https://api.github.com/repos/gratipay/gratipay.com/pulls/3317/comments"},"review_comment":{"href":"https://api.github.com/repos/gratipay/gratipay.com/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gratipay/gratipay.com/pulls/3317/commits"},"statuses":{"href":"https://api.github.com/repos/gratipay/gratipay.com/statuses/b6e13e2331f10e9d307a038b9ffe3a0e07915c79"}}}}