{"action":"created","comment":{"url":"https://api.github.com/repos/ryankbales/myflix/pulls/comments/32023806","id":32023806,"diff_hunk":"@@ -1,16 +1,33 @@\n class UsersController < ApplicationController\n-  before_filter :require_user, only: [:show]\n+  before_action :require_user, only: [:show]\n   def new\n     @user = User.new\n   end\n \n   def create\n     @user = User.new(user_params)\n-    if @user.save\n-      process_invitation\n-      AppMailer.send_welcome_email(@user).deliver\n-      redirect_to sign_in_path\n+    if @user.valid?\n+      token = params[:stripeToken]\n+\n+      charge = StripeWrapper::Charge.create({\n+        amount: 999,\n+        currency: \"usd\",\n+        source: token,\n+        description: \"Sign up charge for #{@user.email}\"\n+      })\n+\n+      if charge.successful?\n+        @user.save\n+        process_invitation\n+        AppMailer.send_welcome_email(@user).deliver\n+        flash[:success] = \"You are registered with MyFlix.  Please sign in now.\"\n+        redirect_to sign_in_path\n+      else\n+        flash[:error] = charge.error_message\n+        render :new\n+      end\n     else\n+      flash[:error] = \"Invalid user information. Please check the errors below.\"","path":"app/controllers/users_controller.rb","position":35,"original_position":35,"commit_id":"5ed0264143a5683e95f2b06e38c4375c96018d7a","original_commit_id":"5ed0264143a5683e95f2b06e38c4375c96018d7a","user":{"login":"ryankbales","id":2401893,"avatar_url":"https://avatars.githubusercontent.com/u/2401893?v=3","gravatar_id":"","url":"https://api.github.com/users/ryankbales","html_url":"https://github.com/ryankbales","followers_url":"https://api.github.com/users/ryankbales/followers","following_url":"https://api.github.com/users/ryankbales/following{/other_user}","gists_url":"https://api.github.com/users/ryankbales/gists{/gist_id}","starred_url":"https://api.github.com/users/ryankbales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryankbales/subscriptions","organizations_url":"https://api.github.com/users/ryankbales/orgs","repos_url":"https://api.github.com/users/ryankbales/repos","events_url":"https://api.github.com/users/ryankbales/events{/privacy}","received_events_url":"https://api.github.com/users/ryankbales/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2015-06-09T15:13:21Z","updated_at":"2015-06-09T15:13:21Z","html_url":"https://github.com/ryankbales/myflix/pull/12#discussion_r32023806","pull_request_url":"https://api.github.com/repos/ryankbales/myflix/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/ryankbales/myflix/pulls/comments/32023806"},"html":{"href":"https://github.com/ryankbales/myflix/pull/12#discussion_r32023806"},"pull_request":{"href":"https://api.github.com/repos/ryankbales/myflix/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/ryankbales/myflix/pulls/12","id":36677245,"html_url":"https://github.com/ryankbales/myflix/pull/12","diff_url":"https://github.com/ryankbales/myflix/pull/12.diff","patch_url":"https://github.com/ryankbales/myflix/pull/12.patch","issue_url":"https://api.github.com/repos/ryankbales/myflix/issues/12","number":12,"state":"open","locked":false,"title":"Staging","user":{"login":"ryankbales","id":2401893,"avatar_url":"https://avatars.githubusercontent.com/u/2401893?v=3","gravatar_id":"","url":"https://api.github.com/users/ryankbales","html_url":"https://github.com/ryankbales","followers_url":"https://api.github.com/users/ryankbales/followers","following_url":"https://api.github.com/users/ryankbales/following{/other_user}","gists_url":"https://api.github.com/users/ryankbales/gists{/gist_id}","starred_url":"https://api.github.com/users/ryankbales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryankbales/subscriptions","organizations_url":"https://api.github.com/users/ryankbales/orgs","repos_url":"https://api.github.com/users/ryankbales/repos","events_url":"https://api.github.com/users/ryankbales/events{/privacy}","received_events_url":"https://api.github.com/users/ryankbales/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-01T22:20:27Z","updated_at":"2015-06-09T15:13:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bfa37c1d817216cc2ef9911330e53c1483bc8ff3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ryankbales/myflix/pulls/12/commits","review_comments_url":"https://api.github.com/repos/ryankbales/myflix/pulls/12/comments","review_comment_url":"https://api.github.com/repos/ryankbales/myflix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ryankbales/myflix/issues/12/comments","statuses_url":"https://api.github.com/repos/ryankbales/myflix/statuses/5ed0264143a5683e95f2b06e38c4375c96018d7a","head":{"label":"ryankbales:staging","ref":"staging","sha":"5ed0264143a5683e95f2b06e38c4375c96018d7a","user":{"login":"ryankbales","id":2401893,"avatar_url":"https://avatars.githubusercontent.com/u/2401893?v=3","gravatar_id":"","url":"https://api.github.com/users/ryankbales","html_url":"https://github.com/ryankbales","followers_url":"https://api.github.com/users/ryankbales/followers","following_url":"https://api.github.com/users/ryankbales/following{/other_user}","gists_url":"https://api.github.com/users/ryankbales/gists{/gist_id}","starred_url":"https://api.github.com/users/ryankbales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryankbales/subscriptions","organizations_url":"https://api.github.com/users/ryankbales/orgs","repos_url":"https://api.github.com/users/ryankbales/repos","events_url":"https://api.github.com/users/ryankbales/events{/privacy}","received_events_url":"https://api.github.com/users/ryankbales/received_events","type":"User","site_admin":false},"repo":{"id":30804392,"name":"myflix","full_name":"ryankbales/myflix","owner":{"login":"ryankbales","id":2401893,"avatar_url":"https://avatars.githubusercontent.com/u/2401893?v=3","gravatar_id":"","url":"https://api.github.com/users/ryankbales","html_url":"https://github.com/ryankbales","followers_url":"https://api.github.com/users/ryankbales/followers","following_url":"https://api.github.com/users/ryankbales/following{/other_user}","gists_url":"https://api.github.com/users/ryankbales/gists{/gist_id}","starred_url":"https://api.github.com/users/ryankbales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryankbales/subscriptions","organizations_url":"https://api.github.com/users/ryankbales/orgs","repos_url":"https://api.github.com/users/ryankbales/repos","events_url":"https://api.github.com/users/ryankbales/events{/privacy}","received_events_url":"https://api.github.com/users/ryankbales/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ryankbales/myflix","description":"Tealeaf Lesson 3 App Clone","fork":false,"url":"https://api.github.com/repos/ryankbales/myflix","forks_url":"https://api.github.com/repos/ryankbales/myflix/forks","keys_url":"https://api.github.com/repos/ryankbales/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ryankbales/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ryankbales/myflix/teams","hooks_url":"https://api.github.com/repos/ryankbales/myflix/hooks","issue_events_url":"https://api.github.com/repos/ryankbales/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/ryankbales/myflix/events","assignees_url":"https://api.github.com/repos/ryankbales/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/ryankbales/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/ryankbales/myflix/tags","blobs_url":"https://api.github.com/repos/ryankbales/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ryankbales/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ryankbales/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/ryankbales/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ryankbales/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/ryankbales/myflix/languages","stargazers_url":"https://api.github.com/repos/ryankbales/myflix/stargazers","contributors_url":"https://api.github.com/repos/ryankbales/myflix/contributors","subscribers_url":"https://api.github.com/repos/ryankbales/myflix/subscribers","subscription_url":"https://api.github.com/repos/ryankbales/myflix/subscription","commits_url":"https://api.github.com/repos/ryankbales/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/ryankbales/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/ryankbales/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/ryankbales/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/ryankbales/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/ryankbales/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ryankbales/myflix/merges","archive_url":"https://api.github.com/repos/ryankbales/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ryankbales/myflix/downloads","issues_url":"https://api.github.com/repos/ryankbales/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/ryankbales/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/ryankbales/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/ryankbales/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ryankbales/myflix/labels{/name}","releases_url":"https://api.github.com/repos/ryankbales/myflix/releases{/id}","created_at":"2015-02-14T18:14:44Z","updated_at":"2015-05-06T22:11:33Z","pushed_at":"2015-06-09T06:38:19Z","git_url":"git://github.com/ryankbales/myflix.git","ssh_url":"git@github.com:ryankbales/myflix.git","clone_url":"https://github.com/ryankbales/myflix.git","svn_url":"https://github.com/ryankbales/myflix","homepage":null,"size":3780,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ryankbales:master","ref":"master","sha":"cbac02099a3941abf25e029d2f0602bb3dfad90b","user":{"login":"ryankbales","id":2401893,"avatar_url":"https://avatars.githubusercontent.com/u/2401893?v=3","gravatar_id":"","url":"https://api.github.com/users/ryankbales","html_url":"https://github.com/ryankbales","followers_url":"https://api.github.com/users/ryankbales/followers","following_url":"https://api.github.com/users/ryankbales/following{/other_user}","gists_url":"https://api.github.com/users/ryankbales/gists{/gist_id}","starred_url":"https://api.github.com/users/ryankbales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryankbales/subscriptions","organizations_url":"https://api.github.com/users/ryankbales/orgs","repos_url":"https://api.github.com/users/ryankbales/repos","events_url":"https://api.github.com/users/ryankbales/events{/privacy}","received_events_url":"https://api.github.com/users/ryankbales/received_events","type":"User","site_admin":false},"repo":{"id":30804392,"name":"myflix","full_name":"ryankbales/myflix","owner":{"login":"ryankbales","id":2401893,"avatar_url":"https://avatars.githubusercontent.com/u/2401893?v=3","gravatar_id":"","url":"https://api.github.com/users/ryankbales","html_url":"https://github.com/ryankbales","followers_url":"https://api.github.com/users/ryankbales/followers","following_url":"https://api.github.com/users/ryankbales/following{/other_user}","gists_url":"https://api.github.com/users/ryankbales/gists{/gist_id}","starred_url":"https://api.github.com/users/ryankbales/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryankbales/subscriptions","organizations_url":"https://api.github.com/users/ryankbales/orgs","repos_url":"https://api.github.com/users/ryankbales/repos","events_url":"https://api.github.com/users/ryankbales/events{/privacy}","received_events_url":"https://api.github.com/users/ryankbales/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ryankbales/myflix","description":"Tealeaf Lesson 3 App Clone","fork":false,"url":"https://api.github.com/repos/ryankbales/myflix","forks_url":"https://api.github.com/repos/ryankbales/myflix/forks","keys_url":"https://api.github.com/repos/ryankbales/myflix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ryankbales/myflix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ryankbales/myflix/teams","hooks_url":"https://api.github.com/repos/ryankbales/myflix/hooks","issue_events_url":"https://api.github.com/repos/ryankbales/myflix/issues/events{/number}","events_url":"https://api.github.com/repos/ryankbales/myflix/events","assignees_url":"https://api.github.com/repos/ryankbales/myflix/assignees{/user}","branches_url":"https://api.github.com/repos/ryankbales/myflix/branches{/branch}","tags_url":"https://api.github.com/repos/ryankbales/myflix/tags","blobs_url":"https://api.github.com/repos/ryankbales/myflix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ryankbales/myflix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ryankbales/myflix/git/refs{/sha}","trees_url":"https://api.github.com/repos/ryankbales/myflix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ryankbales/myflix/statuses/{sha}","languages_url":"https://api.github.com/repos/ryankbales/myflix/languages","stargazers_url":"https://api.github.com/repos/ryankbales/myflix/stargazers","contributors_url":"https://api.github.com/repos/ryankbales/myflix/contributors","subscribers_url":"https://api.github.com/repos/ryankbales/myflix/subscribers","subscription_url":"https://api.github.com/repos/ryankbales/myflix/subscription","commits_url":"https://api.github.com/repos/ryankbales/myflix/commits{/sha}","git_commits_url":"https://api.github.com/repos/ryankbales/myflix/git/commits{/sha}","comments_url":"https://api.github.com/repos/ryankbales/myflix/comments{/number}","issue_comment_url":"https://api.github.com/repos/ryankbales/myflix/issues/comments{/number}","contents_url":"https://api.github.com/repos/ryankbales/myflix/contents/{+path}","compare_url":"https://api.github.com/repos/ryankbales/myflix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ryankbales/myflix/merges","archive_url":"https://api.github.com/repos/ryankbales/myflix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ryankbales/myflix/downloads","issues_url":"https://api.github.com/repos/ryankbales/myflix/issues{/number}","pulls_url":"https://api.github.com/repos/ryankbales/myflix/pulls{/number}","milestones_url":"https://api.github.com/repos/ryankbales/myflix/milestones{/number}","notifications_url":"https://api.github.com/repos/ryankbales/myflix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ryankbales/myflix/labels{/name}","releases_url":"https://api.github.com/repos/ryankbales/myflix/releases{/id}","created_at":"2015-02-14T18:14:44Z","updated_at":"2015-05-06T22:11:33Z","pushed_at":"2015-06-09T06:38:19Z","git_url":"git://github.com/ryankbales/myflix.git","ssh_url":"git@github.com:ryankbales/myflix.git","clone_url":"https://github.com/ryankbales/myflix.git","svn_url":"https://github.com/ryankbales/myflix","homepage":null,"size":3780,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ryankbales/myflix/pulls/12"},"html":{"href":"https://github.com/ryankbales/myflix/pull/12"},"issue":{"href":"https://api.github.com/repos/ryankbales/myflix/issues/12"},"comments":{"href":"https://api.github.com/repos/ryankbales/myflix/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/ryankbales/myflix/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/ryankbales/myflix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ryankbales/myflix/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/ryankbales/myflix/statuses/5ed0264143a5683e95f2b06e38c4375c96018d7a"}}}}