{"action":"created","comment":{"url":"https://api.github.com/repos/gebv/acca/pulls/comments/341813464","pull_request_review_id":310773178,"id":341813464,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM0MTgxMzQ2NA==","diff_hunk":"@@ -0,0 +1,75 @@\n+package stripe\n+\n+import (\n+\t\"encoding/json\"\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"net/http\"\n+\t\"os\"\n+\n+\t\"github.com/labstack/echo\"\n+\t\"github.com/stripe/stripe-go\"\n+\t\"github.com/stripe/stripe-go/webhook\"\n+)\n+\n+// If you are testing your webhook locally with the Stripe CLI you\n+// can find the endpoint's secret by running `stripe trigger`\n+// Otherwise, find your endpoint's secret in your webhook settings in the Developer Dashboard\n+var endpointSecret = \"whsec_IDoODms1QL7LRHhEpmwRuwAmp3lejhKi\"\n+\n+// StripeWebhookHandler обработчик вебхука от stripe.\n+func (p *Provider) SberbankWebhookHandler() echo.HandlerFunc {\n+\treturn func(c echo.Context) error {\n+\t\tconst MaxBodyBytes = int64(65536)\n+\t\tc.Request().Body = http.MaxBytesReader(c.Response(), c.Request().Body, MaxBodyBytes)\n+\t\tpayload, err := ioutil.ReadAll(c.Request().Body)\n+\t\tif err != nil {\n+\t\t\tfmt.Fprintf(os.Stderr, \"Error reading request body: %v\\n\", err)\n+\t\t\tc.Response().WriteHeader(http.StatusServiceUnavailable)\n+\t\t\treturn nil\n+\t\t}\n+\n+\t\t// Pass the request body and Stripe-Signature header to ConstructEvent, along\n+\t\t// with the webhook signing key.\n+\t\tevent, err := webhook.ConstructEvent(payload, c.Request().Header.Get(\"Stripe-Signature\"),\n+\t\t\tendpointSecret)\n+\n+\t\tif err != nil {\n+\t\t\tfmt.Fprintf(os.Stderr, \"Error verifying webhook signature: %v\\n\", err)\n+\t\t\tc.Response().WriteHeader(http.StatusBadRequest) // Return a 400 error on a bad signature\n+\t\t\treturn nil\n+\t\t}\n+\n+\t\t// Unmarshal the event data into an appropriate struct depending on its Type\n+\t\tswitch event.Type {\n+\t\tcase \"payment_intent.succeeded\":","path":"provider/stripe/webhook.go","position":45,"original_position":45,"commit_id":"e13b5ee9994909ebae048b03cf4b29f20e82a50c","original_commit_id":"e13b5ee9994909ebae048b03cf4b29f20e82a50c","user":{"login":"gebv","id":1389048,"node_id":"MDQ6VXNlcjEzODkwNDg=","avatar_url":"https://avatars0.githubusercontent.com/u/1389048?v=4","gravatar_id":"","url":"https://api.github.com/users/gebv","html_url":"https://github.com/gebv","followers_url":"https://api.github.com/users/gebv/followers","following_url":"https://api.github.com/users/gebv/following{/other_user}","gists_url":"https://api.github.com/users/gebv/gists{/gist_id}","starred_url":"https://api.github.com/users/gebv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gebv/subscriptions","organizations_url":"https://api.github.com/users/gebv/orgs","repos_url":"https://api.github.com/users/gebv/repos","events_url":"https://api.github.com/users/gebv/events{/privacy}","received_events_url":"https://api.github.com/users/gebv/received_events","type":"User","site_admin":false},"body":"Значение eventType вынести в константы","created_at":"2019-11-02T14:37:59Z","updated_at":"2019-11-02T14:41:19Z","html_url":"https://github.com/gebv/acca/pull/35#discussion_r341813464","pull_request_url":"https://api.github.com/repos/gebv/acca/pulls/35","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/gebv/acca/pulls/comments/341813464"},"html":{"href":"https://github.com/gebv/acca/pull/35#discussion_r341813464"},"pull_request":{"href":"https://api.github.com/repos/gebv/acca/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/gebv/acca/pulls/35","id":335775046,"node_id":"MDExOlB1bGxSZXF1ZXN0MzM1Nzc1MDQ2","html_url":"https://github.com/gebv/acca/pull/35","diff_url":"https://github.com/gebv/acca/pull/35.diff","patch_url":"https://github.com/gebv/acca/pull/35.patch","issue_url":"https://api.github.com/repos/gebv/acca/issues/35","number":35,"state":"open","locked":false,"title":"[WIP] добавление провайдера stripe #2aejup","user":{"login":"AndreyDyubin","id":20102451,"node_id":"MDQ6VXNlcjIwMTAyNDUx","avatar_url":"https://avatars0.githubusercontent.com/u/20102451?v=4","gravatar_id":"","url":"https://api.github.com/users/AndreyDyubin","html_url":"https://github.com/AndreyDyubin","followers_url":"https://api.github.com/users/AndreyDyubin/followers","following_url":"https://api.github.com/users/AndreyDyubin/following{/other_user}","gists_url":"https://api.github.com/users/AndreyDyubin/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreyDyubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreyDyubin/subscriptions","organizations_url":"https://api.github.com/users/AndreyDyubin/orgs","repos_url":"https://api.github.com/users/AndreyDyubin/repos","events_url":"https://api.github.com/users/AndreyDyubin/events{/privacy}","received_events_url":"https://api.github.com/users/AndreyDyubin/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-11-02T08:20:01Z","updated_at":"2019-11-02T14:41:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"624680ee012b1825f3dc7701f565772c43fa9e02","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/gebv/acca/pulls/35/commits","review_comments_url":"https://api.github.com/repos/gebv/acca/pulls/35/comments","review_comment_url":"https://api.github.com/repos/gebv/acca/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gebv/acca/issues/35/comments","statuses_url":"https://api.github.com/repos/gebv/acca/statuses/e13b5ee9994909ebae048b03cf4b29f20e82a50c","head":{"label":"AndreyDyubin:#2aejup","ref":"#2aejup","sha":"e13b5ee9994909ebae048b03cf4b29f20e82a50c","user":{"login":"AndreyDyubin","id":20102451,"node_id":"MDQ6VXNlcjIwMTAyNDUx","avatar_url":"https://avatars0.githubusercontent.com/u/20102451?v=4","gravatar_id":"","url":"https://api.github.com/users/AndreyDyubin","html_url":"https://github.com/AndreyDyubin","followers_url":"https://api.github.com/users/AndreyDyubin/followers","following_url":"https://api.github.com/users/AndreyDyubin/following{/other_user}","gists_url":"https://api.github.com/users/AndreyDyubin/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreyDyubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreyDyubin/subscriptions","organizations_url":"https://api.github.com/users/AndreyDyubin/orgs","repos_url":"https://api.github.com/users/AndreyDyubin/repos","events_url":"https://api.github.com/users/AndreyDyubin/events{/privacy}","received_events_url":"https://api.github.com/users/AndreyDyubin/received_events","type":"User","site_admin":false},"repo":{"id":196934850,"node_id":"MDEwOlJlcG9zaXRvcnkxOTY5MzQ4NTA=","name":"acca","full_name":"AndreyDyubin/acca","private":false,"owner":{"login":"AndreyDyubin","id":20102451,"node_id":"MDQ6VXNlcjIwMTAyNDUx","avatar_url":"https://avatars0.githubusercontent.com/u/20102451?v=4","gravatar_id":"","url":"https://api.github.com/users/AndreyDyubin","html_url":"https://github.com/AndreyDyubin","followers_url":"https://api.github.com/users/AndreyDyubin/followers","following_url":"https://api.github.com/users/AndreyDyubin/following{/other_user}","gists_url":"https://api.github.com/users/AndreyDyubin/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreyDyubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreyDyubin/subscriptions","organizations_url":"https://api.github.com/users/AndreyDyubin/orgs","repos_url":"https://api.github.com/users/AndreyDyubin/repos","events_url":"https://api.github.com/users/AndreyDyubin/events{/privacy}","received_events_url":"https://api.github.com/users/AndreyDyubin/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AndreyDyubin/acca","description":"Financial accounting","fork":true,"url":"https://api.github.com/repos/AndreyDyubin/acca","forks_url":"https://api.github.com/repos/AndreyDyubin/acca/forks","keys_url":"https://api.github.com/repos/AndreyDyubin/acca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AndreyDyubin/acca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AndreyDyubin/acca/teams","hooks_url":"https://api.github.com/repos/AndreyDyubin/acca/hooks","issue_events_url":"https://api.github.com/repos/AndreyDyubin/acca/issues/events{/number}","events_url":"https://api.github.com/repos/AndreyDyubin/acca/events","assignees_url":"https://api.github.com/repos/AndreyDyubin/acca/assignees{/user}","branches_url":"https://api.github.com/repos/AndreyDyubin/acca/branches{/branch}","tags_url":"https://api.github.com/repos/AndreyDyubin/acca/tags","blobs_url":"https://api.github.com/repos/AndreyDyubin/acca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AndreyDyubin/acca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AndreyDyubin/acca/git/refs{/sha}","trees_url":"https://api.github.com/repos/AndreyDyubin/acca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AndreyDyubin/acca/statuses/{sha}","languages_url":"https://api.github.com/repos/AndreyDyubin/acca/languages","stargazers_url":"https://api.github.com/repos/AndreyDyubin/acca/stargazers","contributors_url":"https://api.github.com/repos/AndreyDyubin/acca/contributors","subscribers_url":"https://api.github.com/repos/AndreyDyubin/acca/subscribers","subscription_url":"https://api.github.com/repos/AndreyDyubin/acca/subscription","commits_url":"https://api.github.com/repos/AndreyDyubin/acca/commits{/sha}","git_commits_url":"https://api.github.com/repos/AndreyDyubin/acca/git/commits{/sha}","comments_url":"https://api.github.com/repos/AndreyDyubin/acca/comments{/number}","issue_comment_url":"https://api.github.com/repos/AndreyDyubin/acca/issues/comments{/number}","contents_url":"https://api.github.com/repos/AndreyDyubin/acca/contents/{+path}","compare_url":"https://api.github.com/repos/AndreyDyubin/acca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AndreyDyubin/acca/merges","archive_url":"https://api.github.com/repos/AndreyDyubin/acca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AndreyDyubin/acca/downloads","issues_url":"https://api.github.com/repos/AndreyDyubin/acca/issues{/number}","pulls_url":"https://api.github.com/repos/AndreyDyubin/acca/pulls{/number}","milestones_url":"https://api.github.com/repos/AndreyDyubin/acca/milestones{/number}","notifications_url":"https://api.github.com/repos/AndreyDyubin/acca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AndreyDyubin/acca/labels{/name}","releases_url":"https://api.github.com/repos/AndreyDyubin/acca/releases{/id}","deployments_url":"https://api.github.com/repos/AndreyDyubin/acca/deployments","created_at":"2019-07-15T06:08:27Z","updated_at":"2019-07-15T06:08:29Z","pushed_at":"2019-11-02T08:19:07Z","git_url":"git://github.com/AndreyDyubin/acca.git","ssh_url":"git@github.com:AndreyDyubin/acca.git","clone_url":"https://github.com/AndreyDyubin/acca.git","svn_url":"https://github.com/AndreyDyubin/acca","homepage":null,"size":7544,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gebv:v1","ref":"v1","sha":"5b58d509ae1de8739d4739102702b5c13e4d1cfb","user":{"login":"gebv","id":1389048,"node_id":"MDQ6VXNlcjEzODkwNDg=","avatar_url":"https://avatars0.githubusercontent.com/u/1389048?v=4","gravatar_id":"","url":"https://api.github.com/users/gebv","html_url":"https://github.com/gebv","followers_url":"https://api.github.com/users/gebv/followers","following_url":"https://api.github.com/users/gebv/following{/other_user}","gists_url":"https://api.github.com/users/gebv/gists{/gist_id}","starred_url":"https://api.github.com/users/gebv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gebv/subscriptions","organizations_url":"https://api.github.com/users/gebv/orgs","repos_url":"https://api.github.com/users/gebv/repos","events_url":"https://api.github.com/users/gebv/events{/privacy}","received_events_url":"https://api.github.com/users/gebv/received_events","type":"User","site_admin":false},"repo":{"id":53321522,"node_id":"MDEwOlJlcG9zaXRvcnk1MzMyMTUyMg==","name":"acca","full_name":"gebv/acca","private":false,"owner":{"login":"gebv","id":1389048,"node_id":"MDQ6VXNlcjEzODkwNDg=","avatar_url":"https://avatars0.githubusercontent.com/u/1389048?v=4","gravatar_id":"","url":"https://api.github.com/users/gebv","html_url":"https://github.com/gebv","followers_url":"https://api.github.com/users/gebv/followers","following_url":"https://api.github.com/users/gebv/following{/other_user}","gists_url":"https://api.github.com/users/gebv/gists{/gist_id}","starred_url":"https://api.github.com/users/gebv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gebv/subscriptions","organizations_url":"https://api.github.com/users/gebv/orgs","repos_url":"https://api.github.com/users/gebv/repos","events_url":"https://api.github.com/users/gebv/events{/privacy}","received_events_url":"https://api.github.com/users/gebv/received_events","type":"User","site_admin":false},"html_url":"https://github.com/gebv/acca","description":"Financial accounting","fork":false,"url":"https://api.github.com/repos/gebv/acca","forks_url":"https://api.github.com/repos/gebv/acca/forks","keys_url":"https://api.github.com/repos/gebv/acca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gebv/acca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gebv/acca/teams","hooks_url":"https://api.github.com/repos/gebv/acca/hooks","issue_events_url":"https://api.github.com/repos/gebv/acca/issues/events{/number}","events_url":"https://api.github.com/repos/gebv/acca/events","assignees_url":"https://api.github.com/repos/gebv/acca/assignees{/user}","branches_url":"https://api.github.com/repos/gebv/acca/branches{/branch}","tags_url":"https://api.github.com/repos/gebv/acca/tags","blobs_url":"https://api.github.com/repos/gebv/acca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gebv/acca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gebv/acca/git/refs{/sha}","trees_url":"https://api.github.com/repos/gebv/acca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gebv/acca/statuses/{sha}","languages_url":"https://api.github.com/repos/gebv/acca/languages","stargazers_url":"https://api.github.com/repos/gebv/acca/stargazers","contributors_url":"https://api.github.com/repos/gebv/acca/contributors","subscribers_url":"https://api.github.com/repos/gebv/acca/subscribers","subscription_url":"https://api.github.com/repos/gebv/acca/subscription","commits_url":"https://api.github.com/repos/gebv/acca/commits{/sha}","git_commits_url":"https://api.github.com/repos/gebv/acca/git/commits{/sha}","comments_url":"https://api.github.com/repos/gebv/acca/comments{/number}","issue_comment_url":"https://api.github.com/repos/gebv/acca/issues/comments{/number}","contents_url":"https://api.github.com/repos/gebv/acca/contents/{+path}","compare_url":"https://api.github.com/repos/gebv/acca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gebv/acca/merges","archive_url":"https://api.github.com/repos/gebv/acca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gebv/acca/downloads","issues_url":"https://api.github.com/repos/gebv/acca/issues{/number}","pulls_url":"https://api.github.com/repos/gebv/acca/pulls{/number}","milestones_url":"https://api.github.com/repos/gebv/acca/milestones{/number}","notifications_url":"https://api.github.com/repos/gebv/acca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gebv/acca/labels{/name}","releases_url":"https://api.github.com/repos/gebv/acca/releases{/id}","deployments_url":"https://api.github.com/repos/gebv/acca/deployments","created_at":"2016-03-07T11:47:56Z","updated_at":"2019-06-29T07:20:03Z","pushed_at":"2019-11-02T08:20:02Z","git_url":"git://github.com/gebv/acca.git","ssh_url":"git@github.com:gebv/acca.git","clone_url":"https://github.com/gebv/acca.git","svn_url":"https://github.com/gebv/acca","homepage":null,"size":5554,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":17,"license":null,"forks":2,"open_issues":17,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gebv/acca/pulls/35"},"html":{"href":"https://github.com/gebv/acca/pull/35"},"issue":{"href":"https://api.github.com/repos/gebv/acca/issues/35"},"comments":{"href":"https://api.github.com/repos/gebv/acca/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/gebv/acca/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/gebv/acca/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gebv/acca/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/gebv/acca/statuses/e13b5ee9994909ebae048b03cf4b29f20e82a50c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gebv"}}