{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/payments-ui/pulls/comments/30492292","id":30492292,"diff_hunk":"@@ -27,5 +29,34 @@ var fields = [\n   }\n ];\n \n-var root = React.createElement(CardDetails, {fields: fields});\n-React.render(root, document.getElementById('view'));\n+var braintreeFormId = 'braintree-form';\n+\n+var token = $.ajax({\n+  data: {},\n+  method: 'post',\n+  url: '/braintree/token/generate/',\n+  dataType: 'json',\n+}).then(function(data) {\n+\n+  var root = React.createElement(CardDetails, {\n+    // The field data for building up the form\n+    // in react.\n+    fields: fields,\n+    // All of these just end up as HTML attrs on our form.\n+    'data-token': data.token,\n+    'id': braintreeFormId,\n+    'method': 'post',\n+    // TODO update this with a real endpoint.\n+    'action': '/braintree/',\n+  });\n+\n+  React.render(root, document.getElementById('view'));\n+\n+  $('#braintree-form').on('submit', function(e) {\n+    e.preventDefault();\n+    braintree.setup($(this).data('token'), 'custom', {","path":"public/js/main.js","position":39,"original_position":39,"commit_id":"6cbd52b21aa86e935ac6819cff9f3f3c87e97a5d","original_commit_id":"6cbd52b21aa86e935ac6819cff9f3f3c87e97a5d","user":{"login":"muffinresearch","id":1514,"avatar_url":"https://avatars.githubusercontent.com/u/1514?v=3","gravatar_id":"","url":"https://api.github.com/users/muffinresearch","html_url":"https://github.com/muffinresearch","followers_url":"https://api.github.com/users/muffinresearch/followers","following_url":"https://api.github.com/users/muffinresearch/following{/other_user}","gists_url":"https://api.github.com/users/muffinresearch/gists{/gist_id}","starred_url":"https://api.github.com/users/muffinresearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muffinresearch/subscriptions","organizations_url":"https://api.github.com/users/muffinresearch/orgs","repos_url":"https://api.github.com/users/muffinresearch/repos","events_url":"https://api.github.com/users/muffinresearch/events{/privacy}","received_events_url":"https://api.github.com/users/muffinresearch/received_events","type":"User","site_admin":false},"body":"Yeah, I'd imagine all the form submit hooks will move inside react completely at some point. ","created_at":"2015-05-18T09:22:02Z","updated_at":"2015-05-18T09:22:02Z","html_url":"https://github.com/mozilla/payments-ui/pull/38#discussion_r30492292","pull_request_url":"https://api.github.com/repos/mozilla/payments-ui/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/mozilla/payments-ui/pulls/comments/30492292"},"html":{"href":"https://github.com/mozilla/payments-ui/pull/38#discussion_r30492292"},"pull_request":{"href":"https://api.github.com/repos/mozilla/payments-ui/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/payments-ui/pulls/38","id":35537464,"html_url":"https://github.com/mozilla/payments-ui/pull/38","diff_url":"https://github.com/mozilla/payments-ui/pull/38.diff","patch_url":"https://github.com/mozilla/payments-ui/pull/38.patch","issue_url":"https://api.github.com/repos/mozilla/payments-ui/issues/38","number":38,"state":"open","locked":false,"title":"Hook form up to braintree (fixes #35)","user":{"login":"muffinresearch","id":1514,"avatar_url":"https://avatars.githubusercontent.com/u/1514?v=3","gravatar_id":"","url":"https://api.github.com/users/muffinresearch","html_url":"https://github.com/muffinresearch","followers_url":"https://api.github.com/users/muffinresearch/followers","following_url":"https://api.github.com/users/muffinresearch/following{/other_user}","gists_url":"https://api.github.com/users/muffinresearch/gists{/gist_id}","starred_url":"https://api.github.com/users/muffinresearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muffinresearch/subscriptions","organizations_url":"https://api.github.com/users/muffinresearch/orgs","repos_url":"https://api.github.com/users/muffinresearch/repos","events_url":"https://api.github.com/users/muffinresearch/events{/privacy}","received_events_url":"https://api.github.com/users/muffinresearch/received_events","type":"User","site_admin":false},"body":"This is all quite lightweight but uses jquery and braintree-web to:\r\n* Show a spinner as everything loads.\r\n* Get the client token\r\n* Show the form\r\n* Tokenise the form with braintree \r\n* Get ready to send this on to our service.\r\n\r\nWe'll clean this up and modularize it all a bit more as we flesh out the rest of the infrastructure etc.","created_at":"2015-05-15T18:18:03Z","updated_at":"2015-05-18T09:22:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc42b0c90a70f266ba2e0303ebbabee192c9fe40","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/payments-ui/pulls/38/commits","review_comments_url":"https://api.github.com/repos/mozilla/payments-ui/pulls/38/comments","review_comment_url":"https://api.github.com/repos/mozilla/payments-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/payments-ui/issues/38/comments","statuses_url":"https://api.github.com/repos/mozilla/payments-ui/statuses/6cbd52b21aa86e935ac6819cff9f3f3c87e97a5d","head":{"label":"muffinresearch:hookup-form-to-braintree","ref":"hookup-form-to-braintree","sha":"6cbd52b21aa86e935ac6819cff9f3f3c87e97a5d","user":{"login":"muffinresearch","id":1514,"avatar_url":"https://avatars.githubusercontent.com/u/1514?v=3","gravatar_id":"","url":"https://api.github.com/users/muffinresearch","html_url":"https://github.com/muffinresearch","followers_url":"https://api.github.com/users/muffinresearch/followers","following_url":"https://api.github.com/users/muffinresearch/following{/other_user}","gists_url":"https://api.github.com/users/muffinresearch/gists{/gist_id}","starred_url":"https://api.github.com/users/muffinresearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muffinresearch/subscriptions","organizations_url":"https://api.github.com/users/muffinresearch/orgs","repos_url":"https://api.github.com/users/muffinresearch/repos","events_url":"https://api.github.com/users/muffinresearch/events{/privacy}","received_events_url":"https://api.github.com/users/muffinresearch/received_events","type":"User","site_admin":false},"repo":{"id":34340899,"name":"payments-ui","full_name":"muffinresearch/payments-ui","owner":{"login":"muffinresearch","id":1514,"avatar_url":"https://avatars.githubusercontent.com/u/1514?v=3","gravatar_id":"","url":"https://api.github.com/users/muffinresearch","html_url":"https://github.com/muffinresearch","followers_url":"https://api.github.com/users/muffinresearch/followers","following_url":"https://api.github.com/users/muffinresearch/following{/other_user}","gists_url":"https://api.github.com/users/muffinresearch/gists{/gist_id}","starred_url":"https://api.github.com/users/muffinresearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muffinresearch/subscriptions","organizations_url":"https://api.github.com/users/muffinresearch/orgs","repos_url":"https://api.github.com/users/muffinresearch/repos","events_url":"https://api.github.com/users/muffinresearch/events{/privacy}","received_events_url":"https://api.github.com/users/muffinresearch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/muffinresearch/payments-ui","description":"The payments frontend interface","fork":true,"url":"https://api.github.com/repos/muffinresearch/payments-ui","forks_url":"https://api.github.com/repos/muffinresearch/payments-ui/forks","keys_url":"https://api.github.com/repos/muffinresearch/payments-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/muffinresearch/payments-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/muffinresearch/payments-ui/teams","hooks_url":"https://api.github.com/repos/muffinresearch/payments-ui/hooks","issue_events_url":"https://api.github.com/repos/muffinresearch/payments-ui/issues/events{/number}","events_url":"https://api.github.com/repos/muffinresearch/payments-ui/events","assignees_url":"https://api.github.com/repos/muffinresearch/payments-ui/assignees{/user}","branches_url":"https://api.github.com/repos/muffinresearch/payments-ui/branches{/branch}","tags_url":"https://api.github.com/repos/muffinresearch/payments-ui/tags","blobs_url":"https://api.github.com/repos/muffinresearch/payments-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/muffinresearch/payments-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/muffinresearch/payments-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/muffinresearch/payments-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/muffinresearch/payments-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/muffinresearch/payments-ui/languages","stargazers_url":"https://api.github.com/repos/muffinresearch/payments-ui/stargazers","contributors_url":"https://api.github.com/repos/muffinresearch/payments-ui/contributors","subscribers_url":"https://api.github.com/repos/muffinresearch/payments-ui/subscribers","subscription_url":"https://api.github.com/repos/muffinresearch/payments-ui/subscription","commits_url":"https://api.github.com/repos/muffinresearch/payments-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/muffinresearch/payments-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/muffinresearch/payments-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/muffinresearch/payments-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/muffinresearch/payments-ui/contents/{+path}","compare_url":"https://api.github.com/repos/muffinresearch/payments-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/muffinresearch/payments-ui/merges","archive_url":"https://api.github.com/repos/muffinresearch/payments-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/muffinresearch/payments-ui/downloads","issues_url":"https://api.github.com/repos/muffinresearch/payments-ui/issues{/number}","pulls_url":"https://api.github.com/repos/muffinresearch/payments-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/muffinresearch/payments-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/muffinresearch/payments-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/muffinresearch/payments-ui/labels{/name}","releases_url":"https://api.github.com/repos/muffinresearch/payments-ui/releases{/id}","created_at":"2015-04-21T17:12:10Z","updated_at":"2015-05-13T13:54:48Z","pushed_at":"2015-05-15T18:17:17Z","git_url":"git://github.com/muffinresearch/payments-ui.git","ssh_url":"git@github.com:muffinresearch/payments-ui.git","clone_url":"https://github.com/muffinresearch/payments-ui.git","svn_url":"https://github.com/muffinresearch/payments-ui","homepage":null,"size":109,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"79dd65bc7bffda5c31d5b2720165f9b4818935d3","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":34340650,"name":"payments-ui","full_name":"mozilla/payments-ui","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/payments-ui","description":"The payments frontend interface","fork":false,"url":"https://api.github.com/repos/mozilla/payments-ui","forks_url":"https://api.github.com/repos/mozilla/payments-ui/forks","keys_url":"https://api.github.com/repos/mozilla/payments-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/payments-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/payments-ui/teams","hooks_url":"https://api.github.com/repos/mozilla/payments-ui/hooks","issue_events_url":"https://api.github.com/repos/mozilla/payments-ui/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/payments-ui/events","assignees_url":"https://api.github.com/repos/mozilla/payments-ui/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/payments-ui/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/payments-ui/tags","blobs_url":"https://api.github.com/repos/mozilla/payments-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/payments-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/payments-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/payments-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/payments-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/payments-ui/languages","stargazers_url":"https://api.github.com/repos/mozilla/payments-ui/stargazers","contributors_url":"https://api.github.com/repos/mozilla/payments-ui/contributors","subscribers_url":"https://api.github.com/repos/mozilla/payments-ui/subscribers","subscription_url":"https://api.github.com/repos/mozilla/payments-ui/subscription","commits_url":"https://api.github.com/repos/mozilla/payments-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/payments-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/payments-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/payments-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/payments-ui/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/payments-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/payments-ui/merges","archive_url":"https://api.github.com/repos/mozilla/payments-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/payments-ui/downloads","issues_url":"https://api.github.com/repos/mozilla/payments-ui/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/payments-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/payments-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/payments-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/payments-ui/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/payments-ui/releases{/id}","created_at":"2015-04-21T17:07:06Z","updated_at":"2015-05-08T16:52:02Z","pushed_at":"2015-05-15T18:18:04Z","git_url":"git://github.com/mozilla/payments-ui.git","ssh_url":"git@github.com:mozilla/payments-ui.git","clone_url":"https://github.com/mozilla/payments-ui.git","svn_url":"https://github.com/mozilla/payments-ui","homepage":null,"size":11608,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":13,"forks":2,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/payments-ui/pulls/38"},"html":{"href":"https://github.com/mozilla/payments-ui/pull/38"},"issue":{"href":"https://api.github.com/repos/mozilla/payments-ui/issues/38"},"comments":{"href":"https://api.github.com/repos/mozilla/payments-ui/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/payments-ui/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/payments-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/payments-ui/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/payments-ui/statuses/6cbd52b21aa86e935ac6819cff9f3f3c87e97a5d"}}}}