{"action":"created","comment":{"url":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/comments/37296972","id":37296972,"diff_hunk":"@@ -2,12 +2,12 @@\n   has_many :store_payment_methods\n   has_many :stores, :through => :store_payment_methods\n \n-  def self.available(display_on = 'both', store = nil)\n-    result = all.select do |p|\n-      p.active &&\n-        (p.environment == Rails.env || p.environment.blank?) &&\n-        (store.nil? || store.payment_methods.empty? || store.payment_methods.include?(p)) &&\n-        (p.display_on == display_on.to_s || p.display_on.blank?)\n+  class << self\n+    alias_method :available_without_store, :available\n+    def available(display_on = 'both', store = nil)\n+      available_without_store(display_on).select do |p|\n+        store.nil? || store.payment_methods.empty? || store.payment_methods.include?(p)","path":"app/models/spree/payment_method_decorator.rb","position":14,"original_position":14,"commit_id":"e9865ebbccba3a636fe9e89f4287f105e0765417","original_commit_id":"e9865ebbccba3a636fe9e89f4287f105e0765417","user":{"login":"athal7","id":467872,"avatar_url":"https://avatars.githubusercontent.com/u/467872?v=3","gravatar_id":"","url":"https://api.github.com/users/athal7","html_url":"https://github.com/athal7","followers_url":"https://api.github.com/users/athal7/followers","following_url":"https://api.github.com/users/athal7/following{/other_user}","gists_url":"https://api.github.com/users/athal7/gists{/gist_id}","starred_url":"https://api.github.com/users/athal7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/athal7/subscriptions","organizations_url":"https://api.github.com/users/athal7/orgs","repos_url":"https://api.github.com/users/athal7/repos","events_url":"https://api.github.com/users/athal7/events{/privacy}","received_events_url":"https://api.github.com/users/athal7/received_events","type":"User","site_admin":false},"body":"this isn't your code, but i find it a bit odd that we would use another store's payment method if this store doesn't have any. This change is definitely an improvement, though it would be nice to not override the method and provide some sort of 'available_filter' that can be added to this class.","created_at":"2015-08-18T13:27:30Z","updated_at":"2015-08-18T13:27:30Z","html_url":"https://github.com/solidusio/solidus_multi_domain/pull/13#discussion_r37296972","pull_request_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/comments/37296972"},"html":{"href":"https://github.com/solidusio/solidus_multi_domain/pull/13#discussion_r37296972"},"pull_request":{"href":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/13","id":42644499,"html_url":"https://github.com/solidusio/solidus_multi_domain/pull/13","diff_url":"https://github.com/solidusio/solidus_multi_domain/pull/13.diff","patch_url":"https://github.com/solidusio/solidus_multi_domain/pull/13.patch","issue_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues/13","number":13,"state":"open","locked":false,"title":"DRY up PaymentMethod#available decoration","user":{"login":"magnusvk","id":704153,"avatar_url":"https://avatars.githubusercontent.com/u/704153?v=3","gravatar_id":"","url":"https://api.github.com/users/magnusvk","html_url":"https://github.com/magnusvk","followers_url":"https://api.github.com/users/magnusvk/followers","following_url":"https://api.github.com/users/magnusvk/following{/other_user}","gists_url":"https://api.github.com/users/magnusvk/gists{/gist_id}","starred_url":"https://api.github.com/users/magnusvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magnusvk/subscriptions","organizations_url":"https://api.github.com/users/magnusvk/orgs","repos_url":"https://api.github.com/users/magnusvk/repos","events_url":"https://api.github.com/users/magnusvk/events{/privacy}","received_events_url":"https://api.github.com/users/magnusvk/received_events","type":"User","site_admin":false},"body":"Rather than copy & pasting code, call the original method and further filter the list of available payment methods from there. This way, if the upstream logic changes those changes aren't overridden by solidus_multi_domain.\r\n\r\nI think this is better in this case as it's simpler than the full-on extension point.","created_at":"2015-08-17T23:02:53Z","updated_at":"2015-08-18T13:27:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75b9a4a60de4607ecbb159385fb542766b376bd4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/13/commits","review_comments_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/13/comments","review_comment_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/comments{/number}","comments_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues/13/comments","statuses_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/statuses/e9865ebbccba3a636fe9e89f4287f105e0765417","head":{"label":"solidusio:dry-up-available-extension","ref":"dry-up-available-extension","sha":"e9865ebbccba3a636fe9e89f4287f105e0765417","user":{"login":"solidusio","id":11045486,"avatar_url":"https://avatars.githubusercontent.com/u/11045486?v=3","gravatar_id":"","url":"https://api.github.com/users/solidusio","html_url":"https://github.com/solidusio","followers_url":"https://api.github.com/users/solidusio/followers","following_url":"https://api.github.com/users/solidusio/following{/other_user}","gists_url":"https://api.github.com/users/solidusio/gists{/gist_id}","starred_url":"https://api.github.com/users/solidusio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solidusio/subscriptions","organizations_url":"https://api.github.com/users/solidusio/orgs","repos_url":"https://api.github.com/users/solidusio/repos","events_url":"https://api.github.com/users/solidusio/events{/privacy}","received_events_url":"https://api.github.com/users/solidusio/received_events","type":"Organization","site_admin":false},"repo":{"id":36041211,"name":"solidus_multi_domain","full_name":"solidusio/solidus_multi_domain","owner":{"login":"solidusio","id":11045486,"avatar_url":"https://avatars.githubusercontent.com/u/11045486?v=3","gravatar_id":"","url":"https://api.github.com/users/solidusio","html_url":"https://github.com/solidusio","followers_url":"https://api.github.com/users/solidusio/followers","following_url":"https://api.github.com/users/solidusio/following{/other_user}","gists_url":"https://api.github.com/users/solidusio/gists{/gist_id}","starred_url":"https://api.github.com/users/solidusio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solidusio/subscriptions","organizations_url":"https://api.github.com/users/solidusio/orgs","repos_url":"https://api.github.com/users/solidusio/repos","events_url":"https://api.github.com/users/solidusio/events{/privacy}","received_events_url":"https://api.github.com/users/solidusio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/solidusio/solidus_multi_domain","description":"","fork":false,"url":"https://api.github.com/repos/solidusio/solidus_multi_domain","forks_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/forks","keys_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/teams","hooks_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/hooks","issue_events_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues/events{/number}","events_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/events","assignees_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/assignees{/user}","branches_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/branches{/branch}","tags_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/tags","blobs_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/refs{/sha}","trees_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/statuses/{sha}","languages_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/languages","stargazers_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/stargazers","contributors_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/contributors","subscribers_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/subscribers","subscription_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/subscription","commits_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/commits{/sha}","git_commits_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/commits{/sha}","comments_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/comments{/number}","issue_comment_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues/comments{/number}","contents_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/contents/{+path}","compare_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/merges","archive_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/downloads","issues_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues{/number}","pulls_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls{/number}","milestones_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/milestones{/number}","notifications_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/labels{/name}","releases_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/releases{/id}","created_at":"2015-05-21T22:53:47Z","updated_at":"2015-06-30T21:24:22Z","pushed_at":"2015-08-17T23:02:53Z","git_url":"git://github.com/solidusio/solidus_multi_domain.git","ssh_url":"git@github.com:solidusio/solidus_multi_domain.git","clone_url":"https://github.com/solidusio/solidus_multi_domain.git","svn_url":"https://github.com/solidusio/solidus_multi_domain","homepage":null,"size":456,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"solidusio:master","ref":"master","sha":"6909c682a40ccf204dba6a9e95a66637889b3e23","user":{"login":"solidusio","id":11045486,"avatar_url":"https://avatars.githubusercontent.com/u/11045486?v=3","gravatar_id":"","url":"https://api.github.com/users/solidusio","html_url":"https://github.com/solidusio","followers_url":"https://api.github.com/users/solidusio/followers","following_url":"https://api.github.com/users/solidusio/following{/other_user}","gists_url":"https://api.github.com/users/solidusio/gists{/gist_id}","starred_url":"https://api.github.com/users/solidusio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solidusio/subscriptions","organizations_url":"https://api.github.com/users/solidusio/orgs","repos_url":"https://api.github.com/users/solidusio/repos","events_url":"https://api.github.com/users/solidusio/events{/privacy}","received_events_url":"https://api.github.com/users/solidusio/received_events","type":"Organization","site_admin":false},"repo":{"id":36041211,"name":"solidus_multi_domain","full_name":"solidusio/solidus_multi_domain","owner":{"login":"solidusio","id":11045486,"avatar_url":"https://avatars.githubusercontent.com/u/11045486?v=3","gravatar_id":"","url":"https://api.github.com/users/solidusio","html_url":"https://github.com/solidusio","followers_url":"https://api.github.com/users/solidusio/followers","following_url":"https://api.github.com/users/solidusio/following{/other_user}","gists_url":"https://api.github.com/users/solidusio/gists{/gist_id}","starred_url":"https://api.github.com/users/solidusio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solidusio/subscriptions","organizations_url":"https://api.github.com/users/solidusio/orgs","repos_url":"https://api.github.com/users/solidusio/repos","events_url":"https://api.github.com/users/solidusio/events{/privacy}","received_events_url":"https://api.github.com/users/solidusio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/solidusio/solidus_multi_domain","description":"","fork":false,"url":"https://api.github.com/repos/solidusio/solidus_multi_domain","forks_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/forks","keys_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/teams","hooks_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/hooks","issue_events_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues/events{/number}","events_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/events","assignees_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/assignees{/user}","branches_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/branches{/branch}","tags_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/tags","blobs_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/refs{/sha}","trees_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/statuses/{sha}","languages_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/languages","stargazers_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/stargazers","contributors_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/contributors","subscribers_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/subscribers","subscription_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/subscription","commits_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/commits{/sha}","git_commits_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/git/commits{/sha}","comments_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/comments{/number}","issue_comment_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues/comments{/number}","contents_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/contents/{+path}","compare_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/merges","archive_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/downloads","issues_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues{/number}","pulls_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls{/number}","milestones_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/milestones{/number}","notifications_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/labels{/name}","releases_url":"https://api.github.com/repos/solidusio/solidus_multi_domain/releases{/id}","created_at":"2015-05-21T22:53:47Z","updated_at":"2015-06-30T21:24:22Z","pushed_at":"2015-08-17T23:02:53Z","git_url":"git://github.com/solidusio/solidus_multi_domain.git","ssh_url":"git@github.com:solidusio/solidus_multi_domain.git","clone_url":"https://github.com/solidusio/solidus_multi_domain.git","svn_url":"https://github.com/solidusio/solidus_multi_domain","homepage":null,"size":456,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/13"},"html":{"href":"https://github.com/solidusio/solidus_multi_domain/pull/13"},"issue":{"href":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues/13"},"comments":{"href":"https://api.github.com/repos/solidusio/solidus_multi_domain/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/solidusio/solidus_multi_domain/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/solidusio/solidus_multi_domain/statuses/e9865ebbccba3a636fe9e89f4287f105e0765417"}}}}