{"action":"created","comment":{"url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/comments/52175034","id":52175034,"diff_hunk":"@@ -0,0 +1,58 @@\n+<h1>Add Billing info</h1>\n+<%= form_tag subscription_path, method: :post, id: \"payment-form\" do %>\n+  <span class=\"payment-errors\"></span>\n+  <div class=\"form-row\">\n+    <label>\n+      <span>Card Number</span>\n+      <input id=\"number\" type=\"text\" size=\"20\" data-stripe=\"number\"/>\n+    </label>\n+  </div>\n+\n+  <div class=\"form-row\">\n+    <label>\n+      <span>CVC</span>\n+      <input id=\"cvc\" type=\"text\" size=\"4\" data-stripe=\"cvc\"/>\n+    </label>\n+  </div>\n+\n+  <div class=\"form-row\">\n+    <label>\n+      <span>Expiration (MM/YYYY)</span>\n+      <input id=\"exp-month\" type=\"text\" size=\"2\" data-stripe=\"exp-month\"/>\n+    </label>\n+    <span> / </span>\n+    <input id=\"exp-year\" type=\"text\" size=\"4\" data-stripe=\"exp-year\"/>\n+  </div>\n+\n+  <button type=\"submit\">Save Card</button>\n+<% end %>\n+\n+<script type=\"text/javascript\" src=\"https://js.stripe.com/v2/\"></script>\n+<script type=\"text/javascript\">\n+  Stripe.setPublishableKey('<%= Rails.configuration.stripe[:publishable_key] %>');\n+  $(function($) {\n+    $('#payment-form').submit(function(event) {\n+      var $form = $(this);\n+      // Disable the submit button to prevent repeated clicks\n+      $form.find('button').prop('disabled', true);\n+      Stripe.card.createToken($form, stripeResponseHandler);\n+      // Prevent the form from submitting with the default action\n+      return false;\n+    });\n+  });\n+  function stripeResponseHandler(status, response) {\n+    var $form = $('#payment-form');\n+    if (response.error) {\n+      // Show the errors on the form\n+      $form.find('.payment-errors').text(response.error.message);\n+      $form.find('button').prop('disabled', false);\n+    } else {\n+      // response contains id and card, which contains additional card details\n+      var token = response.id;\n+      // Insert the token into the form so it gets submitted to the server\n+      $form.append($('<input type=\"hidden\" name=\"stripeToken\" />').val(token));\n+      // and submit\n+      $form.get(0).submit();\n+    }\n+  };\n+</script>","path":"app/views/subscriptions/new.html.erb","position":58,"original_position":58,"commit_id":"beaf0be8d00b922d4f8f10e8999ae43003aa081c","original_commit_id":"beaf0be8d00b922d4f8f10e8999ae43003aa081c","user":{"login":"fatboypunk","id":1089927,"avatar_url":"https://avatars.githubusercontent.com/u/1089927?v=3","gravatar_id":"","url":"https://api.github.com/users/fatboypunk","html_url":"https://github.com/fatboypunk","followers_url":"https://api.github.com/users/fatboypunk/followers","following_url":"https://api.github.com/users/fatboypunk/following{/other_user}","gists_url":"https://api.github.com/users/fatboypunk/gists{/gist_id}","starred_url":"https://api.github.com/users/fatboypunk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatboypunk/subscriptions","organizations_url":"https://api.github.com/users/fatboypunk/orgs","repos_url":"https://api.github.com/users/fatboypunk/repos","events_url":"https://api.github.com/users/fatboypunk/events{/privacy}","received_events_url":"https://api.github.com/users/fatboypunk/received_events","type":"User","site_admin":false},"body":"I think this form is now the same as the edit form except from the header","created_at":"2016-02-08T14:32:53Z","updated_at":"2016-02-08T14:32:53Z","html_url":"https://github.com/DefactoSoftware/chief-awesome/pull/4#discussion_r52175034","pull_request_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/comments/52175034"},"html":{"href":"https://github.com/DefactoSoftware/chief-awesome/pull/4#discussion_r52175034"},"pull_request":{"href":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/4","id":57379466,"html_url":"https://github.com/DefactoSoftware/chief-awesome/pull/4","diff_url":"https://github.com/DefactoSoftware/chief-awesome/pull/4.diff","patch_url":"https://github.com/DefactoSoftware/chief-awesome/pull/4.patch","issue_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues/4","number":4,"state":"open","locked":false,"title":"[Ready] add stripe integration","user":{"login":"dkhgh","id":4135610,"avatar_url":"https://avatars.githubusercontent.com/u/4135610?v=3","gravatar_id":"","url":"https://api.github.com/users/dkhgh","html_url":"https://github.com/dkhgh","followers_url":"https://api.github.com/users/dkhgh/followers","following_url":"https://api.github.com/users/dkhgh/following{/other_user}","gists_url":"https://api.github.com/users/dkhgh/gists{/gist_id}","starred_url":"https://api.github.com/users/dkhgh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkhgh/subscriptions","organizations_url":"https://api.github.com/users/dkhgh/orgs","repos_url":"https://api.github.com/users/dkhgh/repos","events_url":"https://api.github.com/users/dkhgh/events{/privacy}","received_events_url":"https://api.github.com/users/dkhgh/received_events","type":"User","site_admin":false},"body":"* [x] POC\r\n* [x] write tests\r\n* [x] refactor\r\n* [x] don't create a new customer ALL THE TIME","created_at":"2016-01-27T15:56:10Z","updated_at":"2016-02-08T14:32:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"335658e608634bd2ced592c8602b01a1c3fc8c4d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/4/commits","review_comments_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/4/comments","review_comment_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues/4/comments","statuses_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/statuses/beaf0be8d00b922d4f8f10e8999ae43003aa081c","head":{"label":"DefactoSoftware:hugo/stripe-payments","ref":"hugo/stripe-payments","sha":"beaf0be8d00b922d4f8f10e8999ae43003aa081c","user":{"login":"DefactoSoftware","id":3899757,"avatar_url":"https://avatars.githubusercontent.com/u/3899757?v=3","gravatar_id":"","url":"https://api.github.com/users/DefactoSoftware","html_url":"https://github.com/DefactoSoftware","followers_url":"https://api.github.com/users/DefactoSoftware/followers","following_url":"https://api.github.com/users/DefactoSoftware/following{/other_user}","gists_url":"https://api.github.com/users/DefactoSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/DefactoSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DefactoSoftware/subscriptions","organizations_url":"https://api.github.com/users/DefactoSoftware/orgs","repos_url":"https://api.github.com/users/DefactoSoftware/repos","events_url":"https://api.github.com/users/DefactoSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/DefactoSoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":50189192,"name":"chief-awesome","full_name":"DefactoSoftware/chief-awesome","owner":{"login":"DefactoSoftware","id":3899757,"avatar_url":"https://avatars.githubusercontent.com/u/3899757?v=3","gravatar_id":"","url":"https://api.github.com/users/DefactoSoftware","html_url":"https://github.com/DefactoSoftware","followers_url":"https://api.github.com/users/DefactoSoftware/followers","following_url":"https://api.github.com/users/DefactoSoftware/following{/other_user}","gists_url":"https://api.github.com/users/DefactoSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/DefactoSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DefactoSoftware/subscriptions","organizations_url":"https://api.github.com/users/DefactoSoftware/orgs","repos_url":"https://api.github.com/users/DefactoSoftware/repos","events_url":"https://api.github.com/users/DefactoSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/DefactoSoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DefactoSoftware/chief-awesome","description":"","fork":false,"url":"https://api.github.com/repos/DefactoSoftware/chief-awesome","forks_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/forks","keys_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/teams","hooks_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/hooks","issue_events_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues/events{/number}","events_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/events","assignees_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/assignees{/user}","branches_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/branches{/branch}","tags_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/tags","blobs_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/refs{/sha}","trees_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/statuses/{sha}","languages_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/languages","stargazers_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/stargazers","contributors_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/contributors","subscribers_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/subscribers","subscription_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/subscription","commits_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/commits{/sha}","git_commits_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/commits{/sha}","comments_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/comments{/number}","issue_comment_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues/comments{/number}","contents_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/contents/{+path}","compare_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/merges","archive_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/downloads","issues_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues{/number}","pulls_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls{/number}","milestones_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/milestones{/number}","notifications_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/labels{/name}","releases_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/releases{/id}","deployments_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/deployments","created_at":"2016-01-22T15:23:08Z","updated_at":"2016-01-25T12:58:05Z","pushed_at":"2016-02-08T14:06:50Z","git_url":"git://github.com/DefactoSoftware/chief-awesome.git","ssh_url":"git@github.com:DefactoSoftware/chief-awesome.git","clone_url":"https://github.com/DefactoSoftware/chief-awesome.git","svn_url":"https://github.com/DefactoSoftware/chief-awesome","homepage":null,"size":54,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"development"}},"base":{"label":"DefactoSoftware:development","ref":"development","sha":"09b6c96f2db70d32ae02d9afcd520e720479662e","user":{"login":"DefactoSoftware","id":3899757,"avatar_url":"https://avatars.githubusercontent.com/u/3899757?v=3","gravatar_id":"","url":"https://api.github.com/users/DefactoSoftware","html_url":"https://github.com/DefactoSoftware","followers_url":"https://api.github.com/users/DefactoSoftware/followers","following_url":"https://api.github.com/users/DefactoSoftware/following{/other_user}","gists_url":"https://api.github.com/users/DefactoSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/DefactoSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DefactoSoftware/subscriptions","organizations_url":"https://api.github.com/users/DefactoSoftware/orgs","repos_url":"https://api.github.com/users/DefactoSoftware/repos","events_url":"https://api.github.com/users/DefactoSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/DefactoSoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":50189192,"name":"chief-awesome","full_name":"DefactoSoftware/chief-awesome","owner":{"login":"DefactoSoftware","id":3899757,"avatar_url":"https://avatars.githubusercontent.com/u/3899757?v=3","gravatar_id":"","url":"https://api.github.com/users/DefactoSoftware","html_url":"https://github.com/DefactoSoftware","followers_url":"https://api.github.com/users/DefactoSoftware/followers","following_url":"https://api.github.com/users/DefactoSoftware/following{/other_user}","gists_url":"https://api.github.com/users/DefactoSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/DefactoSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DefactoSoftware/subscriptions","organizations_url":"https://api.github.com/users/DefactoSoftware/orgs","repos_url":"https://api.github.com/users/DefactoSoftware/repos","events_url":"https://api.github.com/users/DefactoSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/DefactoSoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DefactoSoftware/chief-awesome","description":"","fork":false,"url":"https://api.github.com/repos/DefactoSoftware/chief-awesome","forks_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/forks","keys_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/teams","hooks_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/hooks","issue_events_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues/events{/number}","events_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/events","assignees_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/assignees{/user}","branches_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/branches{/branch}","tags_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/tags","blobs_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/refs{/sha}","trees_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/statuses/{sha}","languages_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/languages","stargazers_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/stargazers","contributors_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/contributors","subscribers_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/subscribers","subscription_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/subscription","commits_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/commits{/sha}","git_commits_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/git/commits{/sha}","comments_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/comments{/number}","issue_comment_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues/comments{/number}","contents_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/contents/{+path}","compare_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/merges","archive_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/downloads","issues_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues{/number}","pulls_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls{/number}","milestones_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/milestones{/number}","notifications_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/labels{/name}","releases_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/releases{/id}","deployments_url":"https://api.github.com/repos/DefactoSoftware/chief-awesome/deployments","created_at":"2016-01-22T15:23:08Z","updated_at":"2016-01-25T12:58:05Z","pushed_at":"2016-02-08T14:06:50Z","git_url":"git://github.com/DefactoSoftware/chief-awesome.git","ssh_url":"git@github.com:DefactoSoftware/chief-awesome.git","clone_url":"https://github.com/DefactoSoftware/chief-awesome.git","svn_url":"https://github.com/DefactoSoftware/chief-awesome","homepage":null,"size":54,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/4"},"html":{"href":"https://github.com/DefactoSoftware/chief-awesome/pull/4"},"issue":{"href":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues/4"},"comments":{"href":"https://api.github.com/repos/DefactoSoftware/chief-awesome/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DefactoSoftware/chief-awesome/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/DefactoSoftware/chief-awesome/statuses/beaf0be8d00b922d4f8f10e8999ae43003aa081c"}}}}