{"action":"created","comment":{"url":"https://api.github.com/repos/pmcguane/barista/pulls/comments/69289344","id":69289344,"diff_hunk":"@@ -0,0 +1,56 @@\n+class CheckoutsController < ApplicationController\n+  TRANSACTION_SUCCESS_STATUSES = [\n+      Braintree::Transaction::Status::Authorizing,\n+      Braintree::Transaction::Status::Authorized,\n+      Braintree::Transaction::Status::Settled,\n+      Braintree::Transaction::Status::SettlementConfirmed,\n+      Braintree::Transaction::Status::SettlementPending,\n+      Braintree::Transaction::Status::Settling,\n+      Braintree::Transaction::Status::SubmittedForSettlement,\n+  ]\n+\n+  def new\n+    @client_token = Braintree::ClientToken.generate\n+  end\n+\n+  def show\n+    @transaction = Braintree::Transaction.find(params[:id])\n+    @result = _create_result_hash(@transaction)\n+  end\n+\n+  def create\n+    amount = params[\"amount\"] # In production you should not take amounts directly from clients\n+    nonce = params[\"payment_method_nonce\"]\n+\n+    result = Braintree::Transaction.sale(\n+        amount: amount,\n+        payment_method_nonce: nonce,\n+    )\n+\n+    if result.success? || result.transaction\n+      redirect_to checkout_path(result.transaction.id)\n+    else\n+      error_messages = result.errors.map { |error| \"Error: #{error.code}: #{error.message}\" }\n+      flash[:error] = error_messages\n+      redirect_to new_checkout_path\n+    end\n+  end\n+\n+  def _create_result_hash(transaction)\n+    status = transaction.status\n+\n+    if TRANSACTION_SUCCESS_STATUSES.include? status\n+      result_hash = {\n+          :header => \"Sweet Success!\",\n+          :icon => \"success\",\n+          :message => \"Your test transaction has been successfully processed. See the Braintree API response and try again.\"\n+      }\n+    else\n+      result_hash = {\n+          :header => \"Transaction Failed\",","path":"app/controllers/checkouts_controller.rb","position":50,"original_position":50,"commit_id":"8a11759c03452fbbeed18370b803a2745e0b61d3","original_commit_id":"8a11759c03452fbbeed18370b803a2745e0b61d3","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Use the new Ruby 1.9 hash syntax.<br>Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.","created_at":"2016-07-01T12:05:43Z","updated_at":"2016-07-01T12:05:43Z","html_url":"https://github.com/pmcguane/barista/pull/8#discussion_r69289344","pull_request_url":"https://api.github.com/repos/pmcguane/barista/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/pmcguane/barista/pulls/comments/69289344"},"html":{"href":"https://github.com/pmcguane/barista/pull/8#discussion_r69289344"},"pull_request":{"href":"https://api.github.com/repos/pmcguane/barista/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/pmcguane/barista/pulls/8","id":70964837,"html_url":"https://github.com/pmcguane/barista/pull/8","diff_url":"https://github.com/pmcguane/barista/pull/8.diff","patch_url":"https://github.com/pmcguane/barista/pull/8.patch","issue_url":"https://api.github.com/repos/pmcguane/barista/issues/8","number":8,"state":"open","locked":false,"title":"standard location names","user":{"login":"pmcguane","id":1862557,"avatar_url":"https://avatars.githubusercontent.com/u/1862557?v=3","gravatar_id":"","url":"https://api.github.com/users/pmcguane","html_url":"https://github.com/pmcguane","followers_url":"https://api.github.com/users/pmcguane/followers","following_url":"https://api.github.com/users/pmcguane/following{/other_user}","gists_url":"https://api.github.com/users/pmcguane/gists{/gist_id}","starred_url":"https://api.github.com/users/pmcguane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmcguane/subscriptions","organizations_url":"https://api.github.com/users/pmcguane/orgs","repos_url":"https://api.github.com/users/pmcguane/repos","events_url":"https://api.github.com/users/pmcguane/events{/privacy}","received_events_url":"https://api.github.com/users/pmcguane/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-22T01:04:35Z","updated_at":"2016-07-01T12:05:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bed04f91af0e75663c323e84cd58790d4608141f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pmcguane/barista/pulls/8/commits","review_comments_url":"https://api.github.com/repos/pmcguane/barista/pulls/8/comments","review_comment_url":"https://api.github.com/repos/pmcguane/barista/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pmcguane/barista/issues/8/comments","statuses_url":"https://api.github.com/repos/pmcguane/barista/statuses/8a11759c03452fbbeed18370b803a2745e0b61d3","head":{"label":"pmcguane:master","ref":"master","sha":"8a11759c03452fbbeed18370b803a2745e0b61d3","user":{"login":"pmcguane","id":1862557,"avatar_url":"https://avatars.githubusercontent.com/u/1862557?v=3","gravatar_id":"","url":"https://api.github.com/users/pmcguane","html_url":"https://github.com/pmcguane","followers_url":"https://api.github.com/users/pmcguane/followers","following_url":"https://api.github.com/users/pmcguane/following{/other_user}","gists_url":"https://api.github.com/users/pmcguane/gists{/gist_id}","starred_url":"https://api.github.com/users/pmcguane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmcguane/subscriptions","organizations_url":"https://api.github.com/users/pmcguane/orgs","repos_url":"https://api.github.com/users/pmcguane/repos","events_url":"https://api.github.com/users/pmcguane/events{/privacy}","received_events_url":"https://api.github.com/users/pmcguane/received_events","type":"User","site_admin":false},"repo":{"id":41617616,"name":"barista","full_name":"pmcguane/barista","owner":{"login":"pmcguane","id":1862557,"avatar_url":"https://avatars.githubusercontent.com/u/1862557?v=3","gravatar_id":"","url":"https://api.github.com/users/pmcguane","html_url":"https://github.com/pmcguane","followers_url":"https://api.github.com/users/pmcguane/followers","following_url":"https://api.github.com/users/pmcguane/following{/other_user}","gists_url":"https://api.github.com/users/pmcguane/gists{/gist_id}","starred_url":"https://api.github.com/users/pmcguane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmcguane/subscriptions","organizations_url":"https://api.github.com/users/pmcguane/orgs","repos_url":"https://api.github.com/users/pmcguane/repos","events_url":"https://api.github.com/users/pmcguane/events{/privacy}","received_events_url":"https://api.github.com/users/pmcguane/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pmcguane/barista","description":"Ruby on Rails side of the Coffee App","fork":false,"url":"https://api.github.com/repos/pmcguane/barista","forks_url":"https://api.github.com/repos/pmcguane/barista/forks","keys_url":"https://api.github.com/repos/pmcguane/barista/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pmcguane/barista/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pmcguane/barista/teams","hooks_url":"https://api.github.com/repos/pmcguane/barista/hooks","issue_events_url":"https://api.github.com/repos/pmcguane/barista/issues/events{/number}","events_url":"https://api.github.com/repos/pmcguane/barista/events","assignees_url":"https://api.github.com/repos/pmcguane/barista/assignees{/user}","branches_url":"https://api.github.com/repos/pmcguane/barista/branches{/branch}","tags_url":"https://api.github.com/repos/pmcguane/barista/tags","blobs_url":"https://api.github.com/repos/pmcguane/barista/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pmcguane/barista/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pmcguane/barista/git/refs{/sha}","trees_url":"https://api.github.com/repos/pmcguane/barista/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pmcguane/barista/statuses/{sha}","languages_url":"https://api.github.com/repos/pmcguane/barista/languages","stargazers_url":"https://api.github.com/repos/pmcguane/barista/stargazers","contributors_url":"https://api.github.com/repos/pmcguane/barista/contributors","subscribers_url":"https://api.github.com/repos/pmcguane/barista/subscribers","subscription_url":"https://api.github.com/repos/pmcguane/barista/subscription","commits_url":"https://api.github.com/repos/pmcguane/barista/commits{/sha}","git_commits_url":"https://api.github.com/repos/pmcguane/barista/git/commits{/sha}","comments_url":"https://api.github.com/repos/pmcguane/barista/comments{/number}","issue_comment_url":"https://api.github.com/repos/pmcguane/barista/issues/comments{/number}","contents_url":"https://api.github.com/repos/pmcguane/barista/contents/{+path}","compare_url":"https://api.github.com/repos/pmcguane/barista/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pmcguane/barista/merges","archive_url":"https://api.github.com/repos/pmcguane/barista/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pmcguane/barista/downloads","issues_url":"https://api.github.com/repos/pmcguane/barista/issues{/number}","pulls_url":"https://api.github.com/repos/pmcguane/barista/pulls{/number}","milestones_url":"https://api.github.com/repos/pmcguane/barista/milestones{/number}","notifications_url":"https://api.github.com/repos/pmcguane/barista/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pmcguane/barista/labels{/name}","releases_url":"https://api.github.com/repos/pmcguane/barista/releases{/id}","deployments_url":"https://api.github.com/repos/pmcguane/barista/deployments","created_at":"2015-08-30T05:19:14Z","updated_at":"2016-06-04T10:49:50Z","pushed_at":"2016-07-01T12:05:25Z","git_url":"git://github.com/pmcguane/barista.git","ssh_url":"git@github.com:pmcguane/barista.git","clone_url":"https://github.com/pmcguane/barista.git","svn_url":"https://github.com/pmcguane/barista","homepage":null,"size":21257,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":8,"forks":1,"open_issues":8,"watchers":0,"default_branch":"master"}},"base":{"label":"pmcguane:hound","ref":"hound","sha":"aab3bb86c1f3c4b3d9cd46f397f6baae8b141905","user":{"login":"pmcguane","id":1862557,"avatar_url":"https://avatars.githubusercontent.com/u/1862557?v=3","gravatar_id":"","url":"https://api.github.com/users/pmcguane","html_url":"https://github.com/pmcguane","followers_url":"https://api.github.com/users/pmcguane/followers","following_url":"https://api.github.com/users/pmcguane/following{/other_user}","gists_url":"https://api.github.com/users/pmcguane/gists{/gist_id}","starred_url":"https://api.github.com/users/pmcguane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmcguane/subscriptions","organizations_url":"https://api.github.com/users/pmcguane/orgs","repos_url":"https://api.github.com/users/pmcguane/repos","events_url":"https://api.github.com/users/pmcguane/events{/privacy}","received_events_url":"https://api.github.com/users/pmcguane/received_events","type":"User","site_admin":false},"repo":{"id":41617616,"name":"barista","full_name":"pmcguane/barista","owner":{"login":"pmcguane","id":1862557,"avatar_url":"https://avatars.githubusercontent.com/u/1862557?v=3","gravatar_id":"","url":"https://api.github.com/users/pmcguane","html_url":"https://github.com/pmcguane","followers_url":"https://api.github.com/users/pmcguane/followers","following_url":"https://api.github.com/users/pmcguane/following{/other_user}","gists_url":"https://api.github.com/users/pmcguane/gists{/gist_id}","starred_url":"https://api.github.com/users/pmcguane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmcguane/subscriptions","organizations_url":"https://api.github.com/users/pmcguane/orgs","repos_url":"https://api.github.com/users/pmcguane/repos","events_url":"https://api.github.com/users/pmcguane/events{/privacy}","received_events_url":"https://api.github.com/users/pmcguane/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pmcguane/barista","description":"Ruby on Rails side of the Coffee App","fork":false,"url":"https://api.github.com/repos/pmcguane/barista","forks_url":"https://api.github.com/repos/pmcguane/barista/forks","keys_url":"https://api.github.com/repos/pmcguane/barista/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pmcguane/barista/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pmcguane/barista/teams","hooks_url":"https://api.github.com/repos/pmcguane/barista/hooks","issue_events_url":"https://api.github.com/repos/pmcguane/barista/issues/events{/number}","events_url":"https://api.github.com/repos/pmcguane/barista/events","assignees_url":"https://api.github.com/repos/pmcguane/barista/assignees{/user}","branches_url":"https://api.github.com/repos/pmcguane/barista/branches{/branch}","tags_url":"https://api.github.com/repos/pmcguane/barista/tags","blobs_url":"https://api.github.com/repos/pmcguane/barista/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pmcguane/barista/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pmcguane/barista/git/refs{/sha}","trees_url":"https://api.github.com/repos/pmcguane/barista/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pmcguane/barista/statuses/{sha}","languages_url":"https://api.github.com/repos/pmcguane/barista/languages","stargazers_url":"https://api.github.com/repos/pmcguane/barista/stargazers","contributors_url":"https://api.github.com/repos/pmcguane/barista/contributors","subscribers_url":"https://api.github.com/repos/pmcguane/barista/subscribers","subscription_url":"https://api.github.com/repos/pmcguane/barista/subscription","commits_url":"https://api.github.com/repos/pmcguane/barista/commits{/sha}","git_commits_url":"https://api.github.com/repos/pmcguane/barista/git/commits{/sha}","comments_url":"https://api.github.com/repos/pmcguane/barista/comments{/number}","issue_comment_url":"https://api.github.com/repos/pmcguane/barista/issues/comments{/number}","contents_url":"https://api.github.com/repos/pmcguane/barista/contents/{+path}","compare_url":"https://api.github.com/repos/pmcguane/barista/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pmcguane/barista/merges","archive_url":"https://api.github.com/repos/pmcguane/barista/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pmcguane/barista/downloads","issues_url":"https://api.github.com/repos/pmcguane/barista/issues{/number}","pulls_url":"https://api.github.com/repos/pmcguane/barista/pulls{/number}","milestones_url":"https://api.github.com/repos/pmcguane/barista/milestones{/number}","notifications_url":"https://api.github.com/repos/pmcguane/barista/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pmcguane/barista/labels{/name}","releases_url":"https://api.github.com/repos/pmcguane/barista/releases{/id}","deployments_url":"https://api.github.com/repos/pmcguane/barista/deployments","created_at":"2015-08-30T05:19:14Z","updated_at":"2016-06-04T10:49:50Z","pushed_at":"2016-07-01T12:05:25Z","git_url":"git://github.com/pmcguane/barista.git","ssh_url":"git@github.com:pmcguane/barista.git","clone_url":"https://github.com/pmcguane/barista.git","svn_url":"https://github.com/pmcguane/barista","homepage":null,"size":21257,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":8,"forks":1,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pmcguane/barista/pulls/8"},"html":{"href":"https://github.com/pmcguane/barista/pull/8"},"issue":{"href":"https://api.github.com/repos/pmcguane/barista/issues/8"},"comments":{"href":"https://api.github.com/repos/pmcguane/barista/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/pmcguane/barista/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/pmcguane/barista/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pmcguane/barista/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/pmcguane/barista/statuses/8a11759c03452fbbeed18370b803a2745e0b61d3"}}}}
{"actor":{"display_login":"houndci-bot"}}