{"action":"created","comment":{"url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/comments/45139874","id":45139874,"diff_hunk":"@@ -7,10 +7,10 @@ class AdyenRedirectController < StoreController\n \n     # This is the entry point after an Adyen HPP payment is completed\n     def confirm\n-      ActiveRecord::Base.transaction do\n+      @order.with_lock do\n         # reload order as it might have changed since previously loading it","path":"app/controllers/spree/adyen_redirect_controller.rb","position":6,"original_position":6,"commit_id":"861ba5bdd41314560c7b3708afb33659e2e2d0c7","original_commit_id":"861ba5bdd41314560c7b3708afb33659e2e2d0c7","user":{"login":"jhawthorn","id":131752,"avatar_url":"https://avatars.githubusercontent.com/u/131752?v=3","gravatar_id":"","url":"https://api.github.com/users/jhawthorn","html_url":"https://github.com/jhawthorn","followers_url":"https://api.github.com/users/jhawthorn/followers","following_url":"https://api.github.com/users/jhawthorn/following{/other_user}","gists_url":"https://api.github.com/users/jhawthorn/gists{/gist_id}","starred_url":"https://api.github.com/users/jhawthorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhawthorn/subscriptions","organizations_url":"https://api.github.com/users/jhawthorn/orgs","repos_url":"https://api.github.com/users/jhawthorn/repos","events_url":"https://api.github.com/users/jhawthorn/events{/privacy}","received_events_url":"https://api.github.com/users/jhawthorn/received_events","type":"User","site_admin":false},"body":"This comment could be moved up and it should be noted that there is an implicit reload in the lock","created_at":"2015-11-17T23:39:48Z","updated_at":"2015-11-17T23:39:48Z","html_url":"https://github.com/StemboltHQ/solidus-adyen/pull/46#discussion_r45139874","pull_request_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/comments/45139874"},"html":{"href":"https://github.com/StemboltHQ/solidus-adyen/pull/46#discussion_r45139874"},"pull_request":{"href":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/46","id":51016350,"html_url":"https://github.com/StemboltHQ/solidus-adyen/pull/46","diff_url":"https://github.com/StemboltHQ/solidus-adyen/pull/46.diff","patch_url":"https://github.com/StemboltHQ/solidus-adyen/pull/46.patch","issue_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues/46","number":46,"state":"open","locked":false,"title":"Use transaction with lock on order","user":{"login":"Dkendal","id":3162299,"avatar_url":"https://avatars.githubusercontent.com/u/3162299?v=3","gravatar_id":"","url":"https://api.github.com/users/Dkendal","html_url":"https://github.com/Dkendal","followers_url":"https://api.github.com/users/Dkendal/followers","following_url":"https://api.github.com/users/Dkendal/following{/other_user}","gists_url":"https://api.github.com/users/Dkendal/gists{/gist_id}","starred_url":"https://api.github.com/users/Dkendal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dkendal/subscriptions","organizations_url":"https://api.github.com/users/Dkendal/orgs","repos_url":"https://api.github.com/users/Dkendal/repos","events_url":"https://api.github.com/users/Dkendal/events{/privacy}","received_events_url":"https://api.github.com/users/Dkendal/received_events","type":"User","site_admin":false},"body":"Lock the order by row to prevent completing segments from creating a new\npayment + payment source and attempting to complete the order.\n\nBoth sections do more or less the same thing so they really need to happen\nin isolation as they branch based on whether or not the order is completed.","created_at":"2015-11-17T22:43:09Z","updated_at":"2015-11-17T23:39:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"03168a3f195a9c4a70ec43837eebd6cb18e375fe","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/46/commits","review_comments_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/46/comments","review_comment_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues/46/comments","statuses_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/statuses/861ba5bdd41314560c7b3708afb33659e2e2d0c7","head":{"label":"StemboltHQ:bug/fix-order-race-condition","ref":"bug/fix-order-race-condition","sha":"861ba5bdd41314560c7b3708afb33659e2e2d0c7","user":{"login":"StemboltHQ","id":1585390,"avatar_url":"https://avatars.githubusercontent.com/u/1585390?v=3","gravatar_id":"","url":"https://api.github.com/users/StemboltHQ","html_url":"https://github.com/StemboltHQ","followers_url":"https://api.github.com/users/StemboltHQ/followers","following_url":"https://api.github.com/users/StemboltHQ/following{/other_user}","gists_url":"https://api.github.com/users/StemboltHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/StemboltHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StemboltHQ/subscriptions","organizations_url":"https://api.github.com/users/StemboltHQ/orgs","repos_url":"https://api.github.com/users/StemboltHQ/repos","events_url":"https://api.github.com/users/StemboltHQ/events{/privacy}","received_events_url":"https://api.github.com/users/StemboltHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":42688552,"name":"solidus-adyen","full_name":"StemboltHQ/solidus-adyen","owner":{"login":"StemboltHQ","id":1585390,"avatar_url":"https://avatars.githubusercontent.com/u/1585390?v=3","gravatar_id":"","url":"https://api.github.com/users/StemboltHQ","html_url":"https://github.com/StemboltHQ","followers_url":"https://api.github.com/users/StemboltHQ/followers","following_url":"https://api.github.com/users/StemboltHQ/following{/other_user}","gists_url":"https://api.github.com/users/StemboltHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/StemboltHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StemboltHQ/subscriptions","organizations_url":"https://api.github.com/users/StemboltHQ/orgs","repos_url":"https://api.github.com/users/StemboltHQ/repos","events_url":"https://api.github.com/users/StemboltHQ/events{/privacy}","received_events_url":"https://api.github.com/users/StemboltHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StemboltHQ/solidus-adyen","description":"Adyen HPP payments for Solidus Stores","fork":false,"url":"https://api.github.com/repos/StemboltHQ/solidus-adyen","forks_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/forks","keys_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/teams","hooks_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/hooks","issue_events_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues/events{/number}","events_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/events","assignees_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/assignees{/user}","branches_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/branches{/branch}","tags_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/tags","blobs_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/refs{/sha}","trees_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/statuses/{sha}","languages_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/languages","stargazers_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/stargazers","contributors_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/contributors","subscribers_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/subscribers","subscription_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/subscription","commits_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/commits{/sha}","git_commits_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/commits{/sha}","comments_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/comments{/number}","issue_comment_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues/comments{/number}","contents_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/contents/{+path}","compare_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/merges","archive_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/downloads","issues_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues{/number}","pulls_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls{/number}","milestones_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/milestones{/number}","notifications_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/labels{/name}","releases_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/releases{/id}","created_at":"2015-09-17T23:53:47Z","updated_at":"2015-11-06T01:48:41Z","pushed_at":"2015-11-17T23:01:25Z","git_url":"git://github.com/StemboltHQ/solidus-adyen.git","ssh_url":"git@github.com:StemboltHQ/solidus-adyen.git","clone_url":"https://github.com/StemboltHQ/solidus-adyen.git","svn_url":"https://github.com/StemboltHQ/solidus-adyen","homepage":"","size":422,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"StemboltHQ:master","ref":"master","sha":"cbd37d5d1f71058851ddc548065453712bbe8666","user":{"login":"StemboltHQ","id":1585390,"avatar_url":"https://avatars.githubusercontent.com/u/1585390?v=3","gravatar_id":"","url":"https://api.github.com/users/StemboltHQ","html_url":"https://github.com/StemboltHQ","followers_url":"https://api.github.com/users/StemboltHQ/followers","following_url":"https://api.github.com/users/StemboltHQ/following{/other_user}","gists_url":"https://api.github.com/users/StemboltHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/StemboltHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StemboltHQ/subscriptions","organizations_url":"https://api.github.com/users/StemboltHQ/orgs","repos_url":"https://api.github.com/users/StemboltHQ/repos","events_url":"https://api.github.com/users/StemboltHQ/events{/privacy}","received_events_url":"https://api.github.com/users/StemboltHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":42688552,"name":"solidus-adyen","full_name":"StemboltHQ/solidus-adyen","owner":{"login":"StemboltHQ","id":1585390,"avatar_url":"https://avatars.githubusercontent.com/u/1585390?v=3","gravatar_id":"","url":"https://api.github.com/users/StemboltHQ","html_url":"https://github.com/StemboltHQ","followers_url":"https://api.github.com/users/StemboltHQ/followers","following_url":"https://api.github.com/users/StemboltHQ/following{/other_user}","gists_url":"https://api.github.com/users/StemboltHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/StemboltHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StemboltHQ/subscriptions","organizations_url":"https://api.github.com/users/StemboltHQ/orgs","repos_url":"https://api.github.com/users/StemboltHQ/repos","events_url":"https://api.github.com/users/StemboltHQ/events{/privacy}","received_events_url":"https://api.github.com/users/StemboltHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StemboltHQ/solidus-adyen","description":"Adyen HPP payments for Solidus Stores","fork":false,"url":"https://api.github.com/repos/StemboltHQ/solidus-adyen","forks_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/forks","keys_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/teams","hooks_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/hooks","issue_events_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues/events{/number}","events_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/events","assignees_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/assignees{/user}","branches_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/branches{/branch}","tags_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/tags","blobs_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/refs{/sha}","trees_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/statuses/{sha}","languages_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/languages","stargazers_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/stargazers","contributors_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/contributors","subscribers_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/subscribers","subscription_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/subscription","commits_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/commits{/sha}","git_commits_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/git/commits{/sha}","comments_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/comments{/number}","issue_comment_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues/comments{/number}","contents_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/contents/{+path}","compare_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/merges","archive_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/downloads","issues_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues{/number}","pulls_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls{/number}","milestones_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/milestones{/number}","notifications_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/labels{/name}","releases_url":"https://api.github.com/repos/StemboltHQ/solidus-adyen/releases{/id}","created_at":"2015-09-17T23:53:47Z","updated_at":"2015-11-06T01:48:41Z","pushed_at":"2015-11-17T23:01:25Z","git_url":"git://github.com/StemboltHQ/solidus-adyen.git","ssh_url":"git@github.com:StemboltHQ/solidus-adyen.git","clone_url":"https://github.com/StemboltHQ/solidus-adyen.git","svn_url":"https://github.com/StemboltHQ/solidus-adyen","homepage":"","size":422,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/46"},"html":{"href":"https://github.com/StemboltHQ/solidus-adyen/pull/46"},"issue":{"href":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues/46"},"comments":{"href":"https://api.github.com/repos/StemboltHQ/solidus-adyen/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StemboltHQ/solidus-adyen/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/StemboltHQ/solidus-adyen/statuses/861ba5bdd41314560c7b3708afb33659e2e2d0c7"}}}}