{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/contributions-frontend/pulls/comments/77502286","id":77502286,"diff_hunk":"@@ -139,6 +140,25 @@ object MessageCopyTest extends TestTrait {\n   )\n }\n \n+object PaymentMethodTest extends TestTrait {\n+\n+  def name = \"PaymentMethodTest\"\n+\n+  def slug = \"paymentMethods\"\n+\n+  case class PaymentMethodVariantData(paymentMethods: Set[String]) extends VariantData\n+\n+  object PaymentMethodVariantData {\n+    implicit val format: Format[PaymentMethodVariantData] = Json.format[PaymentMethodVariantData]\n+  }\n+\n+  def variants = NonEmptyList(\n+    makeVariant(\"Control\", \"control\", 1, PaymentMethodVariantData(Set(\"CARD\"))),","path":"app/views/support/ABTest.scala","position":43,"original_position":43,"commit_id":"23ab8f8290a663b0f0d2e3ae525fce1264d93906","original_commit_id":"23ab8f8290a663b0f0d2e3ae525fce1264d93906","user":{"login":"markjamesbutler","id":406099,"avatar_url":"https://avatars.githubusercontent.com/u/406099?v=3","gravatar_id":"","url":"https://api.github.com/users/markjamesbutler","html_url":"https://github.com/markjamesbutler","followers_url":"https://api.github.com/users/markjamesbutler/followers","following_url":"https://api.github.com/users/markjamesbutler/following{/other_user}","gists_url":"https://api.github.com/users/markjamesbutler/gists{/gist_id}","starred_url":"https://api.github.com/users/markjamesbutler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markjamesbutler/subscriptions","organizations_url":"https://api.github.com/users/markjamesbutler/orgs","repos_url":"https://api.github.com/users/markjamesbutler/repos","events_url":"https://api.github.com/users/markjamesbutler/events{/privacy}","received_events_url":"https://api.github.com/users/markjamesbutler/received_events","type":"User","site_admin":false},"body":"paymentMethods could be a trait with Card and PayPal as case objects to give compile time safety instead of using Strings.","created_at":"2016-09-05T10:33:33Z","updated_at":"2016-09-05T10:33:33Z","html_url":"https://github.com/guardian/contributions-frontend/pull/85#discussion_r77502286","pull_request_url":"https://api.github.com/repos/guardian/contributions-frontend/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/guardian/contributions-frontend/pulls/comments/77502286"},"html":{"href":"https://github.com/guardian/contributions-frontend/pull/85#discussion_r77502286"},"pull_request":{"href":"https://api.github.com/repos/guardian/contributions-frontend/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/contributions-frontend/pulls/85","id":83436339,"html_url":"https://github.com/guardian/contributions-frontend/pull/85","diff_url":"https://github.com/guardian/contributions-frontend/pull/85.diff","patch_url":"https://github.com/guardian/contributions-frontend/pull/85.patch","issue_url":"https://api.github.com/repos/guardian/contributions-frontend/issues/85","number":85,"state":"open","locked":false,"title":"Paypal react","user":{"login":"pvighi","id":15324270,"avatar_url":"https://avatars.githubusercontent.com/u/15324270?v=3","gravatar_id":"","url":"https://api.github.com/users/pvighi","html_url":"https://github.com/pvighi","followers_url":"https://api.github.com/users/pvighi/followers","following_url":"https://api.github.com/users/pvighi/following{/other_user}","gists_url":"https://api.github.com/users/pvighi/gists{/gist_id}","starred_url":"https://api.github.com/users/pvighi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pvighi/subscriptions","organizations_url":"https://api.github.com/users/pvighi/orgs","repos_url":"https://api.github.com/users/pvighi/repos","events_url":"https://api.github.com/users/pvighi/events{/privacy}","received_events_url":"https://api.github.com/users/pvighi/received_events","type":"User","site_admin":false},"body":"If you update your local contributions.private.conf you should be able to run this locally.\r\nThe only thing that will not work is the redirection back to contributions frontend after a paypal payment. To make this work just change the variable baseReturnUrl in the configuration to an externally accessible url that points to your local machine. I use [ngrok](https://ngrok.com/) to get a url that points to my local instance of contributions frontend.\r\n\r\nMain PayPal flow:\r\n\r\n1. A contributor clicks on the PayPal button\r\n2. An ajax request is posted to [contributions-frontend]/paypal/auth specifying the amount and countryGroup\r\n3. The approvalUrl returned in the response is used to redirect the contributor to PayPal to authorize the payment\r\n4. After the payment is authorized paypal will redirect the user to [contributions-frontend]//paypal/[countryGroup]/execute passing payment & payer ids as parameters\r\n5. A PayPal API call is executed to finally execute the payment passing payer and payment ids, if everything goes well metadata about the contribution is stored in the db (but not the result of the payment) and the user is redirected to the thank you page\r\n6. When the payment is finalized a webhook is triggered in paypal that will POST to [contributions-frontend]/paypal/hook. This will store additional data about the payment result\r\n","created_at":"2016-08-31T11:40:55Z","updated_at":"2016-09-05T10:33:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f8aa74b3a972797163b01c8e34df40183d2f9f6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/guardian/contributions-frontend/pulls/85/commits","review_comments_url":"https://api.github.com/repos/guardian/contributions-frontend/pulls/85/comments","review_comment_url":"https://api.github.com/repos/guardian/contributions-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/contributions-frontend/issues/85/comments","statuses_url":"https://api.github.com/repos/guardian/contributions-frontend/statuses/23ab8f8290a663b0f0d2e3ae525fce1264d93906","head":{"label":"guardian:paypal-react","ref":"paypal-react","sha":"23ab8f8290a663b0f0d2e3ae525fce1264d93906","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":62709527,"name":"contributions-frontend","full_name":"guardian/contributions-frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/contributions-frontend","description":"a home of our own","fork":false,"url":"https://api.github.com/repos/guardian/contributions-frontend","forks_url":"https://api.github.com/repos/guardian/contributions-frontend/forks","keys_url":"https://api.github.com/repos/guardian/contributions-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/contributions-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/contributions-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/contributions-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/contributions-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/contributions-frontend/events","assignees_url":"https://api.github.com/repos/guardian/contributions-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/contributions-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/contributions-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/contributions-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/contributions-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/contributions-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/contributions-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/contributions-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/contributions-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/contributions-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/contributions-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/contributions-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/contributions-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/contributions-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/contributions-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/contributions-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/contributions-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/contributions-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/contributions-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/contributions-frontend/merges","archive_url":"https://api.github.com/repos/guardian/contributions-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/contributions-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/contributions-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/contributions-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/contributions-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/contributions-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/contributions-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/contributions-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/contributions-frontend/deployments","created_at":"2016-07-06T09:39:10Z","updated_at":"2016-08-03T09:59:45Z","pushed_at":"2016-09-05T10:18:47Z","git_url":"git://github.com/guardian/contributions-frontend.git","ssh_url":"git@github.com:guardian/contributions-frontend.git","clone_url":"https://github.com/guardian/contributions-frontend.git","svn_url":"https://github.com/guardian/contributions-frontend","homepage":"https://contribute.theguardian.com/","size":1770,"stargazers_count":1,"watchers_count":1,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"4613321e57fb2f068769e66786ae1af6135fa46a","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":62709527,"name":"contributions-frontend","full_name":"guardian/contributions-frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/contributions-frontend","description":"a home of our own","fork":false,"url":"https://api.github.com/repos/guardian/contributions-frontend","forks_url":"https://api.github.com/repos/guardian/contributions-frontend/forks","keys_url":"https://api.github.com/repos/guardian/contributions-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/contributions-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/contributions-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/contributions-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/contributions-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/contributions-frontend/events","assignees_url":"https://api.github.com/repos/guardian/contributions-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/contributions-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/contributions-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/contributions-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/contributions-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/contributions-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/contributions-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/contributions-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/contributions-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/contributions-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/contributions-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/contributions-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/contributions-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/contributions-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/contributions-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/contributions-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/contributions-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/contributions-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/contributions-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/contributions-frontend/merges","archive_url":"https://api.github.com/repos/guardian/contributions-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/contributions-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/contributions-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/contributions-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/contributions-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/contributions-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/contributions-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/contributions-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/contributions-frontend/deployments","created_at":"2016-07-06T09:39:10Z","updated_at":"2016-08-03T09:59:45Z","pushed_at":"2016-09-05T10:18:47Z","git_url":"git://github.com/guardian/contributions-frontend.git","ssh_url":"git@github.com:guardian/contributions-frontend.git","clone_url":"https://github.com/guardian/contributions-frontend.git","svn_url":"https://github.com/guardian/contributions-frontend","homepage":"https://contribute.theguardian.com/","size":1770,"stargazers_count":1,"watchers_count":1,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/contributions-frontend/pulls/85"},"html":{"href":"https://github.com/guardian/contributions-frontend/pull/85"},"issue":{"href":"https://api.github.com/repos/guardian/contributions-frontend/issues/85"},"comments":{"href":"https://api.github.com/repos/guardian/contributions-frontend/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/contributions-frontend/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/contributions-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/contributions-frontend/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/contributions-frontend/statuses/23ab8f8290a663b0f0d2e3ae525fce1264d93906"}}}}
{"actor":{"display_login":"markjamesbutler"}}