{"action":"created","comment":{"url":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/comments/31482602","id":31482602,"diff_hunk":"@@ -0,0 +1,66 @@\n+class PaymentsController < ApplicationController\n+  before_action :authenticate_user!, except: [:gift, :create_gift]\n+  before_action :skip_signed_up_users, except: [:gift, :create_gift]\n+  before_action :set_price, except: :create\n+\n+  def new\n+    render layout: 'sign_up_flow'\n+  end\n+\n+  def gift\n+    @gift = Gift.new\n+    render layout: 'sign_up_flow'\n+  end\n+\n+  def create_gift\n+    @gift = Gift.new(gift_params)\n+    @gift.build_coupon\n+    @payment = Payment.new(payment_params)\n+    @payment.email = @gift.your_email\n+    @payment.coupon = found_coupon?\n+    @payment.gift = true\n+    if @gift.valid? && @payment.valid?\n+      ActiveRecord::Base.transaction do\n+        @gift.save\n+        @payment.save(validate: false)","path":"app/controllers/payments_controller.rb","position":25,"original_position":25,"commit_id":"98df7a33364d5f75ca04b079cdf05e656f58c5a4","original_commit_id":"98df7a33364d5f75ca04b079cdf05e656f58c5a4","user":{"login":"siruguri","id":40653,"avatar_url":"https://avatars.githubusercontent.com/u/40653?v=3","gravatar_id":"","url":"https://api.github.com/users/siruguri","html_url":"https://github.com/siruguri","followers_url":"https://api.github.com/users/siruguri/followers","following_url":"https://api.github.com/users/siruguri/following{/other_user}","gists_url":"https://api.github.com/users/siruguri/gists{/gist_id}","starred_url":"https://api.github.com/users/siruguri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siruguri/subscriptions","organizations_url":"https://api.github.com/users/siruguri/orgs","repos_url":"https://api.github.com/users/siruguri/repos","events_url":"https://api.github.com/users/siruguri/events{/privacy}","received_events_url":"https://api.github.com/users/siruguri/received_events","type":"User","site_admin":false},"body":"Yeah, wow, possibly the worst decision made by Julian during that weekend :)\n\nOn Mon, Jun 1, 2015 at 12:36 PM, Sunny Juneja <notifications@github.com>\nwrote:\n\n> In app/controllers/payments_controller.rb\n> <https://github.com/JoyFoodly/joyful_12/pull/5#discussion_r31461437>:\n>\n> > +  def gift\n> > +    @gift = Gift.new\n> > +    render layout: 'sign_up_flow'\n> > +  end\n> > +\n> > +  def create_gift\n> > +    @gift = Gift.new(gift_params)\n> > +    @gift.build_coupon\n> > +    @payment = Payment.new(payment_params)\n> > +    @payment.email = @gift.your_email\n> > +    @payment.coupon = found_coupon?\n> > +    @payment.gift = true\n> > +    if @gift.valid? && @payment.valid?\n> > +      ActiveRecord::Base.transaction do\n> > +        @gift.save\n> > +        @payment.save(validate: false)\n>\n> really need to refactor this. the issue is that validate calls stripe for\n> a token. save and valid? both call validations. perhaps i can memoize the\n> value.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/JoyFoodly/joyful_12/pull/5/files#r31461437>.\n>\n","created_at":"2015-06-01T23:49:42Z","updated_at":"2015-06-01T23:49:42Z","html_url":"https://github.com/JoyFoodly/joyful_12/pull/5#discussion_r31482602","pull_request_url":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/comments/31482602"},"html":{"href":"https://github.com/JoyFoodly/joyful_12/pull/5#discussion_r31482602"},"pull_request":{"href":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/5","id":36560110,"html_url":"https://github.com/JoyFoodly/joyful_12/pull/5","diff_url":"https://github.com/JoyFoodly/joyful_12/pull/5.diff","patch_url":"https://github.com/JoyFoodly/joyful_12/pull/5.patch","issue_url":"https://api.github.com/repos/JoyFoodly/joyful_12/issues/5","number":5,"state":"open","locked":false,"title":"sign up flow","user":{"login":"whatasunnyday","id":1108341,"avatar_url":"https://avatars.githubusercontent.com/u/1108341?v=3","gravatar_id":"","url":"https://api.github.com/users/whatasunnyday","html_url":"https://github.com/whatasunnyday","followers_url":"https://api.github.com/users/whatasunnyday/followers","following_url":"https://api.github.com/users/whatasunnyday/following{/other_user}","gists_url":"https://api.github.com/users/whatasunnyday/gists{/gist_id}","starred_url":"https://api.github.com/users/whatasunnyday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whatasunnyday/subscriptions","organizations_url":"https://api.github.com/users/whatasunnyday/orgs","repos_url":"https://api.github.com/users/whatasunnyday/repos","events_url":"https://api.github.com/users/whatasunnyday/events{/privacy}","received_events_url":"https://api.github.com/users/whatasunnyday/received_events","type":"User","site_admin":false},"body":"Hey @siruguri,\r\n\r\nHere is a list of my TODOs for commit but I think this PR is ready for a review. Most of them are visual. The only bit of \"real work\" is sending emails and I'm not sure if you want to block the request to send emails (like it is currently) or use activejob.\r\n\r\nFix visual errors on forms on account creation and payments\r\nupdate copy on \"\"\r\nupdate image on \"\"\r\nprettify client errors (displayed by Stripe.js, see payments.js.coffee and span#payment-errors.\r\nprettify server errors (displayed by flash[:alert])\r\ncoupon button styling (add welcome message)\r\ncheck mailer to make sure it makes sense\r\nafter gift purchase page or nice message\r\n\r\nadd some feature specs\r\n  -sign in\r\n    with/without payment\r\n    with/without onboarding\r\n  - sign up (so far, controller + model tests are good)\r\n  - buy gift\r\n    signed in\r\n    signed out\r\n\r\nACTUAL WORK: send email after gift purchase\r\n\r\nunit test payment model?\r\nunit test user model?\r\n\r\nset up CI server\r\nset up github branch deploy\r\n","created_at":"2015-05-30T04:54:59Z","updated_at":"2015-06-01T23:49:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"512e2894cc08cd83e086c88fb5969da87aeb8e8c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/5/commits","review_comments_url":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/5/comments","review_comment_url":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JoyFoodly/joyful_12/issues/5/comments","statuses_url":"https://api.github.com/repos/JoyFoodly/joyful_12/statuses/98df7a33364d5f75ca04b079cdf05e656f58c5a4","head":{"label":"JoyFoodly:suf-fixed","ref":"suf-fixed","sha":"98df7a33364d5f75ca04b079cdf05e656f58c5a4","user":{"login":"JoyFoodly","id":7446102,"avatar_url":"https://avatars.githubusercontent.com/u/7446102?v=3","gravatar_id":"","url":"https://api.github.com/users/JoyFoodly","html_url":"https://github.com/JoyFoodly","followers_url":"https://api.github.com/users/JoyFoodly/followers","following_url":"https://api.github.com/users/JoyFoodly/following{/other_user}","gists_url":"https://api.github.com/users/JoyFoodly/gists{/gist_id}","starred_url":"https://api.github.com/users/JoyFoodly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoyFoodly/subscriptions","organizations_url":"https://api.github.com/users/JoyFoodly/orgs","repos_url":"https://api.github.com/users/JoyFoodly/repos","events_url":"https://api.github.com/users/JoyFoodly/events{/privacy}","received_events_url":"https://api.github.com/users/JoyFoodly/received_events","type":"User","site_admin":false},"repo":{"id":14453684,"name":"joyful_12","full_name":"JoyFoodly/joyful_12","owner":{"login":"JoyFoodly","id":7446102,"avatar_url":"https://avatars.githubusercontent.com/u/7446102?v=3","gravatar_id":"","url":"https://api.github.com/users/JoyFoodly","html_url":"https://github.com/JoyFoodly","followers_url":"https://api.github.com/users/JoyFoodly/followers","following_url":"https://api.github.com/users/JoyFoodly/following{/other_user}","gists_url":"https://api.github.com/users/JoyFoodly/gists{/gist_id}","starred_url":"https://api.github.com/users/JoyFoodly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoyFoodly/subscriptions","organizations_url":"https://api.github.com/users/JoyFoodly/orgs","repos_url":"https://api.github.com/users/JoyFoodly/repos","events_url":"https://api.github.com/users/JoyFoodly/events{/privacy}","received_events_url":"https://api.github.com/users/JoyFoodly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JoyFoodly/joyful_12","description":"Joyful 12","fork":false,"url":"https://api.github.com/repos/JoyFoodly/joyful_12","forks_url":"https://api.github.com/repos/JoyFoodly/joyful_12/forks","keys_url":"https://api.github.com/repos/JoyFoodly/joyful_12/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JoyFoodly/joyful_12/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JoyFoodly/joyful_12/teams","hooks_url":"https://api.github.com/repos/JoyFoodly/joyful_12/hooks","issue_events_url":"https://api.github.com/repos/JoyFoodly/joyful_12/issues/events{/number}","events_url":"https://api.github.com/repos/JoyFoodly/joyful_12/events","assignees_url":"https://api.github.com/repos/JoyFoodly/joyful_12/assignees{/user}","branches_url":"https://api.github.com/repos/JoyFoodly/joyful_12/branches{/branch}","tags_url":"https://api.github.com/repos/JoyFoodly/joyful_12/tags","blobs_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/refs{/sha}","trees_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JoyFoodly/joyful_12/statuses/{sha}","languages_url":"https://api.github.com/repos/JoyFoodly/joyful_12/languages","stargazers_url":"https://api.github.com/repos/JoyFoodly/joyful_12/stargazers","contributors_url":"https://api.github.com/repos/JoyFoodly/joyful_12/contributors","subscribers_url":"https://api.github.com/repos/JoyFoodly/joyful_12/subscribers","subscription_url":"https://api.github.com/repos/JoyFoodly/joyful_12/subscription","commits_url":"https://api.github.com/repos/JoyFoodly/joyful_12/commits{/sha}","git_commits_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/commits{/sha}","comments_url":"https://api.github.com/repos/JoyFoodly/joyful_12/comments{/number}","issue_comment_url":"https://api.github.com/repos/JoyFoodly/joyful_12/issues/comments{/number}","contents_url":"https://api.github.com/repos/JoyFoodly/joyful_12/contents/{+path}","compare_url":"https://api.github.com/repos/JoyFoodly/joyful_12/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JoyFoodly/joyful_12/merges","archive_url":"https://api.github.com/repos/JoyFoodly/joyful_12/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JoyFoodly/joyful_12/downloads","issues_url":"https://api.github.com/repos/JoyFoodly/joyful_12/issues{/number}","pulls_url":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls{/number}","milestones_url":"https://api.github.com/repos/JoyFoodly/joyful_12/milestones{/number}","notifications_url":"https://api.github.com/repos/JoyFoodly/joyful_12/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JoyFoodly/joyful_12/labels{/name}","releases_url":"https://api.github.com/repos/JoyFoodly/joyful_12/releases{/id}","created_at":"2013-11-16T19:55:31Z","updated_at":"2015-05-07T16:19:11Z","pushed_at":"2015-05-30T04:54:59Z","git_url":"git://github.com/JoyFoodly/joyful_12.git","ssh_url":"git@github.com:JoyFoodly/joyful_12.git","clone_url":"https://github.com/JoyFoodly/joyful_12.git","svn_url":"https://github.com/JoyFoodly/joyful_12","homepage":"joyful12.com","size":50970,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"JoyFoodly:master","ref":"master","sha":"7a5fdb1263271e6a5650f3020fd699db0ee9ef12","user":{"login":"JoyFoodly","id":7446102,"avatar_url":"https://avatars.githubusercontent.com/u/7446102?v=3","gravatar_id":"","url":"https://api.github.com/users/JoyFoodly","html_url":"https://github.com/JoyFoodly","followers_url":"https://api.github.com/users/JoyFoodly/followers","following_url":"https://api.github.com/users/JoyFoodly/following{/other_user}","gists_url":"https://api.github.com/users/JoyFoodly/gists{/gist_id}","starred_url":"https://api.github.com/users/JoyFoodly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoyFoodly/subscriptions","organizations_url":"https://api.github.com/users/JoyFoodly/orgs","repos_url":"https://api.github.com/users/JoyFoodly/repos","events_url":"https://api.github.com/users/JoyFoodly/events{/privacy}","received_events_url":"https://api.github.com/users/JoyFoodly/received_events","type":"User","site_admin":false},"repo":{"id":14453684,"name":"joyful_12","full_name":"JoyFoodly/joyful_12","owner":{"login":"JoyFoodly","id":7446102,"avatar_url":"https://avatars.githubusercontent.com/u/7446102?v=3","gravatar_id":"","url":"https://api.github.com/users/JoyFoodly","html_url":"https://github.com/JoyFoodly","followers_url":"https://api.github.com/users/JoyFoodly/followers","following_url":"https://api.github.com/users/JoyFoodly/following{/other_user}","gists_url":"https://api.github.com/users/JoyFoodly/gists{/gist_id}","starred_url":"https://api.github.com/users/JoyFoodly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoyFoodly/subscriptions","organizations_url":"https://api.github.com/users/JoyFoodly/orgs","repos_url":"https://api.github.com/users/JoyFoodly/repos","events_url":"https://api.github.com/users/JoyFoodly/events{/privacy}","received_events_url":"https://api.github.com/users/JoyFoodly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JoyFoodly/joyful_12","description":"Joyful 12","fork":false,"url":"https://api.github.com/repos/JoyFoodly/joyful_12","forks_url":"https://api.github.com/repos/JoyFoodly/joyful_12/forks","keys_url":"https://api.github.com/repos/JoyFoodly/joyful_12/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JoyFoodly/joyful_12/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JoyFoodly/joyful_12/teams","hooks_url":"https://api.github.com/repos/JoyFoodly/joyful_12/hooks","issue_events_url":"https://api.github.com/repos/JoyFoodly/joyful_12/issues/events{/number}","events_url":"https://api.github.com/repos/JoyFoodly/joyful_12/events","assignees_url":"https://api.github.com/repos/JoyFoodly/joyful_12/assignees{/user}","branches_url":"https://api.github.com/repos/JoyFoodly/joyful_12/branches{/branch}","tags_url":"https://api.github.com/repos/JoyFoodly/joyful_12/tags","blobs_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/refs{/sha}","trees_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JoyFoodly/joyful_12/statuses/{sha}","languages_url":"https://api.github.com/repos/JoyFoodly/joyful_12/languages","stargazers_url":"https://api.github.com/repos/JoyFoodly/joyful_12/stargazers","contributors_url":"https://api.github.com/repos/JoyFoodly/joyful_12/contributors","subscribers_url":"https://api.github.com/repos/JoyFoodly/joyful_12/subscribers","subscription_url":"https://api.github.com/repos/JoyFoodly/joyful_12/subscription","commits_url":"https://api.github.com/repos/JoyFoodly/joyful_12/commits{/sha}","git_commits_url":"https://api.github.com/repos/JoyFoodly/joyful_12/git/commits{/sha}","comments_url":"https://api.github.com/repos/JoyFoodly/joyful_12/comments{/number}","issue_comment_url":"https://api.github.com/repos/JoyFoodly/joyful_12/issues/comments{/number}","contents_url":"https://api.github.com/repos/JoyFoodly/joyful_12/contents/{+path}","compare_url":"https://api.github.com/repos/JoyFoodly/joyful_12/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JoyFoodly/joyful_12/merges","archive_url":"https://api.github.com/repos/JoyFoodly/joyful_12/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JoyFoodly/joyful_12/downloads","issues_url":"https://api.github.com/repos/JoyFoodly/joyful_12/issues{/number}","pulls_url":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls{/number}","milestones_url":"https://api.github.com/repos/JoyFoodly/joyful_12/milestones{/number}","notifications_url":"https://api.github.com/repos/JoyFoodly/joyful_12/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JoyFoodly/joyful_12/labels{/name}","releases_url":"https://api.github.com/repos/JoyFoodly/joyful_12/releases{/id}","created_at":"2013-11-16T19:55:31Z","updated_at":"2015-05-07T16:19:11Z","pushed_at":"2015-05-30T04:54:59Z","git_url":"git://github.com/JoyFoodly/joyful_12.git","ssh_url":"git@github.com:JoyFoodly/joyful_12.git","clone_url":"https://github.com/JoyFoodly/joyful_12.git","svn_url":"https://github.com/JoyFoodly/joyful_12","homepage":"joyful12.com","size":50970,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/5"},"html":{"href":"https://github.com/JoyFoodly/joyful_12/pull/5"},"issue":{"href":"https://api.github.com/repos/JoyFoodly/joyful_12/issues/5"},"comments":{"href":"https://api.github.com/repos/JoyFoodly/joyful_12/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JoyFoodly/joyful_12/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/JoyFoodly/joyful_12/statuses/98df7a33364d5f75ca04b079cdf05e656f58c5a4"}}}}