{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/support-frontend/pulls/comments/233004977","pull_request_review_id":174322102,"id":233004977,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzAwNDk3Nw==","diff_hunk":"@@ -56,9 +57,14 @@ class PayPalNvpService(apiConfig: PayPalConfig, wsClient: WSClient) extends Touc\n \n   // Takes an NVP response and retrieves a given parameter as a string.\n   private def retrieveNVPParam(response: QueryString, paramName: String) =\n-    response.paramMap(paramName).head\n+    response.paramMap(paramName).headOption match {\n+      case None =>\n+        SafeLogger.warn(s\"Parameter $paramName was missing from the NVP response - $response\")\n+        None\n+      case Some(value) => Some(value)","path":"app/services/PayPalNvpService.scala","position":25,"original_position":25,"commit_id":"feb032585a86a22e3a8e69f8c37d9baa14b54d7c","original_commit_id":"feb032585a86a22e3a8e69f8c37d9baa14b54d7c","user":{"login":"johnduffell","id":7304387,"node_id":"MDQ6VXNlcjczMDQzODc=","avatar_url":"https://avatars1.githubusercontent.com/u/7304387?v=4","gravatar_id":"","url":"https://api.github.com/users/johnduffell","html_url":"https://github.com/johnduffell","followers_url":"https://api.github.com/users/johnduffell/followers","following_url":"https://api.github.com/users/johnduffell/following{/other_user}","gists_url":"https://api.github.com/users/johnduffell/gists{/gist_id}","starred_url":"https://api.github.com/users/johnduffell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnduffell/subscriptions","organizations_url":"https://api.github.com/users/johnduffell/orgs","repos_url":"https://api.github.com/users/johnduffell/repos","events_url":"https://api.github.com/users/johnduffell/events{/privacy}","received_events_url":"https://api.github.com/users/johnduffell/received_events","type":"User","site_admin":false},"body":"not sure if it's the case here, but for deterministicness sake I tend to avoid headOption if I expect exactly one item, usually I do a pattern match on a head :: Nil and then send everything else to the bin","created_at":"2018-11-13T11:47:45Z","updated_at":"2018-11-13T11:47:45Z","html_url":"https://github.com/guardian/support-frontend/pull/1173#discussion_r233004977","pull_request_url":"https://api.github.com/repos/guardian/support-frontend/pulls/1173","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/guardian/support-frontend/pulls/comments/233004977"},"html":{"href":"https://github.com/guardian/support-frontend/pull/1173#discussion_r233004977"},"pull_request":{"href":"https://api.github.com/repos/guardian/support-frontend/pulls/1173"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/support-frontend/pulls/1173","id":230438284,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNDM4Mjg0","html_url":"https://github.com/guardian/support-frontend/pull/1173","diff_url":"https://github.com/guardian/support-frontend/pull/1173.diff","patch_url":"https://github.com/guardian/support-frontend/pull/1173.patch","issue_url":"https://api.github.com/repos/guardian/support-frontend/issues/1173","number":1173,"state":"closed","locked":false,"title":"Handle missing parameter in PayPal NVP responses better","user":{"login":"rupertbates","id":181371,"node_id":"MDQ6VXNlcjE4MTM3MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/181371?v=4","gravatar_id":"","url":"https://api.github.com/users/rupertbates","html_url":"https://github.com/rupertbates","followers_url":"https://api.github.com/users/rupertbates/followers","following_url":"https://api.github.com/users/rupertbates/following{/other_user}","gists_url":"https://api.github.com/users/rupertbates/gists{/gist_id}","starred_url":"https://api.github.com/users/rupertbates/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rupertbates/subscriptions","organizations_url":"https://api.github.com/users/rupertbates/orgs","repos_url":"https://api.github.com/users/rupertbates/repos","events_url":"https://api.github.com/users/rupertbates/events{/privacy}","received_events_url":"https://api.github.com/users/rupertbates/received_events","type":"User","site_admin":false},"body":"## Why are you doing this?\r\n\r\nWhile I was investigating a high 500 rate on support-frontend I noticed that one of them was because we were not handling an unexpected response from PayPal properly. This a PR that copes with this and also adds a bit more logging so we can hopefully diagnose the problem a bit more easily.\r\n\r\n","created_at":"2018-11-13T11:21:00Z","updated_at":"2018-11-13T11:47:45Z","closed_at":"2018-11-13T11:23:59Z","merged_at":"2018-11-13T11:23:59Z","merge_commit_sha":"531d9e091ae8aa902d1ef852862d322401e648cd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":613794126,"node_id":"MDU6TGFiZWw2MTM3OTQxMjY=","url":"https://api.github.com/repos/guardian/support-frontend/labels/Seen-on-PROD","name":"Seen-on-PROD","color":"bfe5bf","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/guardian/support-frontend/pulls/1173/commits","review_comments_url":"https://api.github.com/repos/guardian/support-frontend/pulls/1173/comments","review_comment_url":"https://api.github.com/repos/guardian/support-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/support-frontend/issues/1173/comments","statuses_url":"https://api.github.com/repos/guardian/support-frontend/statuses/feb032585a86a22e3a8e69f8c37d9baa14b54d7c","head":{"label":"guardian:fix-500-from-paypal","ref":"fix-500-from-paypal","sha":"feb032585a86a22e3a8e69f8c37d9baa14b54d7c","user":{"login":"guardian","id":164318,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDMxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","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":87204582,"node_id":"MDEwOlJlcG9zaXRvcnk4NzIwNDU4Mg==","name":"support-frontend","full_name":"guardian/support-frontend","private":false,"owner":{"login":"guardian","id":164318,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDMxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","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},"html_url":"https://github.com/guardian/support-frontend","description":"Frontend for the Supporter platform","fork":false,"url":"https://api.github.com/repos/guardian/support-frontend","forks_url":"https://api.github.com/repos/guardian/support-frontend/forks","keys_url":"https://api.github.com/repos/guardian/support-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/support-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/support-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/support-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/support-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/support-frontend/events","assignees_url":"https://api.github.com/repos/guardian/support-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/support-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/support-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/support-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/support-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/support-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/support-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/support-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/support-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/support-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/support-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/support-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/support-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/support-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/support-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/support-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/support-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/support-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/support-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/support-frontend/merges","archive_url":"https://api.github.com/repos/guardian/support-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/support-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/support-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/support-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/support-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/support-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/support-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/support-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/support-frontend/deployments","created_at":"2017-04-04T15:37:12Z","updated_at":"2018-11-13T11:41:51Z","pushed_at":"2018-11-13T11:41:49Z","git_url":"git://github.com/guardian/support-frontend.git","ssh_url":"git@github.com:guardian/support-frontend.git","clone_url":"https://github.com/guardian/support-frontend.git","svn_url":"https://github.com/guardian/support-frontend","homepage":"https://support.theguardian.com/","size":7732,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2,"open_issues":9,"watchers":4,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"2f1253fbe21b6a4c95a819fedb3307cb172eb06b","user":{"login":"guardian","id":164318,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDMxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","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":87204582,"node_id":"MDEwOlJlcG9zaXRvcnk4NzIwNDU4Mg==","name":"support-frontend","full_name":"guardian/support-frontend","private":false,"owner":{"login":"guardian","id":164318,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDMxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","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},"html_url":"https://github.com/guardian/support-frontend","description":"Frontend for the Supporter platform","fork":false,"url":"https://api.github.com/repos/guardian/support-frontend","forks_url":"https://api.github.com/repos/guardian/support-frontend/forks","keys_url":"https://api.github.com/repos/guardian/support-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/support-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/support-frontend/teams","hooks_url":"https://api.github.com/repos/guardian/support-frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/support-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/support-frontend/events","assignees_url":"https://api.github.com/repos/guardian/support-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/support-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/support-frontend/tags","blobs_url":"https://api.github.com/repos/guardian/support-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/support-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/support-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/support-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/support-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/support-frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/support-frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/support-frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/support-frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/support-frontend/subscription","commits_url":"https://api.github.com/repos/guardian/support-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/support-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/support-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/support-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/support-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/support-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/support-frontend/merges","archive_url":"https://api.github.com/repos/guardian/support-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/support-frontend/downloads","issues_url":"https://api.github.com/repos/guardian/support-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/support-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/support-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/support-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/support-frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/support-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/support-frontend/deployments","created_at":"2017-04-04T15:37:12Z","updated_at":"2018-11-13T11:41:51Z","pushed_at":"2018-11-13T11:41:49Z","git_url":"git://github.com/guardian/support-frontend.git","ssh_url":"git@github.com:guardian/support-frontend.git","clone_url":"https://github.com/guardian/support-frontend.git","svn_url":"https://github.com/guardian/support-frontend","homepage":"https://support.theguardian.com/","size":7732,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2,"open_issues":9,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/support-frontend/pulls/1173"},"html":{"href":"https://github.com/guardian/support-frontend/pull/1173"},"issue":{"href":"https://api.github.com/repos/guardian/support-frontend/issues/1173"},"comments":{"href":"https://api.github.com/repos/guardian/support-frontend/issues/1173/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/support-frontend/pulls/1173/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/support-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/support-frontend/pulls/1173/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/support-frontend/statuses/feb032585a86a22e3a8e69f8c37d9baa14b54d7c"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"johnduffell"}}