{"action":"created","comment":{"url":"https://api.github.com/repos/Shopify/offsite_payments/pulls/comments/23797289","id":23797289,"diff_hunk":"@@ -0,0 +1,75 @@\n+require 'test_helper'\n+\n+class MollieMistercashHelperTest < Test::Unit::TestCase\n+  include OffsitePayments::Integrations\n+\n+  def setup\n+    @required_options = {\n+      :account_name => \"My shop\",\n+      :description => 'Order #111',\n+      :amount => 500,\n+      :currency => 'EUR',\n+      :return_url => 'https://return.com'\n+    }\n+\n+    @helper = MollieMistercash::Helper.new('order-500','1234567', @required_options)\n+\n+    Mollie::API.stubs(:new).with('1234567').returns(@mock_api = mock())\n+  end\n+\n+  def test_credential_based_url\n+    @mock_api.expects(:post_request)\n+      .with('payments', :amount => 500, :description => 'Order #111', :method => 'mistercash', :redirectUrl => 'https://return.com', :metadata => {:order => 'order-500'})\n+      .returns(CREATE_PAYMENT_RESPONSE_JSON)\n+\n+    assert_equal Hash.new, @helper.fields\n+    uri = @helper.credential_based_url\n+\n+    assert_equal \"https://www.mollie.com/paymentscreen/mistercash/testmode/ca8195a3dc8d5cbf2f7b130654abe5a5\", uri\n+    assert_equal nil, @helper.fields['transaction_id']\n+    assert_equal nil, @helper.fields['bank_trxid']\n+  end\n+\n+  def test_credential_based_url_errors\n+    @mock_api.expects(:post_request)\n+      .with('payments', :amount => 500, :description => 'Order #111', :method => 'mistercash', :redirectUrl => 'https://return.com', :metadata => {:order => 'order-500'})\n+      .raises(ActiveUtils::ResponseError.new(stub(:code => \"403\", :message => \"Internal Server Error\", :body => '{\"error\": {\"message\": \"bleh\"}}')))\n+\n+    assert_raises ActionViewHelperError do\n+      @helper.credential_based_url\n+    end\n+  end\n+\n+  def test_credential_based_url_server_errors\n+    @mock_api.expects(:post_request).raises(ActiveUtils::ResponseError.new(stub(:code => \"503\", :message => \"Service Unavailable\")))\n+\n+    assert_raises ActionViewHelperError do\n+      @helper.credential_based_url\n+    end\n+  end\n+\n+  def test_raises_without_required_options\n+    assert_raises(ArgumentError) { MollieMistercash::Helper.new('order-500','1234567', @required_options.merge(:return_url => nil)) }\n+    assert_raises(ArgumentError) { MollieMistercash::Helper.new('order-500','1234567', @required_options.merge(:description => nil)) }\n+  end\n+\n+  CREATE_PAYMENT_RESPONSE_JSON = JSON.parse(<<-JSON)","path":"test/unit/integrations/mollie_mistercash/mollie_mistercash_helper_test.rb","position":56,"original_position":56,"commit_id":"20caa0c25daa99ca1d850d9d927ba4166fd49994","original_commit_id":"20caa0c25daa99ca1d850d9d927ba4166fd49994","user":{"login":"girasquid","id":60324,"avatar_url":"https://avatars.githubusercontent.com/u/60324?v=3","gravatar_id":"","url":"https://api.github.com/users/girasquid","html_url":"https://github.com/girasquid","followers_url":"https://api.github.com/users/girasquid/followers","following_url":"https://api.github.com/users/girasquid/following{/other_user}","gists_url":"https://api.github.com/users/girasquid/gists{/gist_id}","starred_url":"https://api.github.com/users/girasquid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girasquid/subscriptions","organizations_url":"https://api.github.com/users/girasquid/orgs","repos_url":"https://api.github.com/users/girasquid/repos","events_url":"https://api.github.com/users/girasquid/events{/privacy}","received_events_url":"https://api.github.com/users/girasquid/received_events","type":"User","site_admin":false},"body":"Is the `)` at the end of the line supposed to be here? Shouldn't it be down on line 74?","created_at":"2015-01-29T19:54:45Z","updated_at":"2015-01-29T19:54:45Z","html_url":"https://github.com/Shopify/offsite_payments/pull/115#discussion_r23797289","pull_request_url":"https://api.github.com/repos/Shopify/offsite_payments/pulls/115","_links":{"self":{"href":"https://api.github.com/repos/Shopify/offsite_payments/pulls/comments/23797289"},"html":{"href":"https://github.com/Shopify/offsite_payments/pull/115#discussion_r23797289"},"pull_request":{"href":"https://api.github.com/repos/Shopify/offsite_payments/pulls/115"}}},"pull_request":{"url":"https://api.github.com/repos/Shopify/offsite_payments/pulls/115","id":27994282,"html_url":"https://github.com/Shopify/offsite_payments/pull/115","diff_url":"https://github.com/Shopify/offsite_payments/pull/115.diff","patch_url":"https://github.com/Shopify/offsite_payments/pull/115.patch","issue_url":"https://api.github.com/repos/Shopify/offsite_payments/issues/115","number":115,"state":"open","locked":false,"title":"Added Mollie Mistercash ","user":{"login":"andrewpaliga","id":2962326,"avatar_url":"https://avatars.githubusercontent.com/u/2962326?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewpaliga","html_url":"https://github.com/andrewpaliga","followers_url":"https://api.github.com/users/andrewpaliga/followers","following_url":"https://api.github.com/users/andrewpaliga/following{/other_user}","gists_url":"https://api.github.com/users/andrewpaliga/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewpaliga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewpaliga/subscriptions","organizations_url":"https://api.github.com/users/andrewpaliga/orgs","repos_url":"https://api.github.com/users/andrewpaliga/repos","events_url":"https://api.github.com/users/andrewpaliga/events{/privacy}","received_events_url":"https://api.github.com/users/andrewpaliga/received_events","type":"User","site_admin":false},"body":"- Added Mollie Mistercash integration\r\n- Refactored Mollie API/redirect creation to a parent module\r\n- Fixed failing tests in `remote_mollie_ideal_test.rb`\r\n- Added tests for `mollie_mistercash.rb`\r\n\r\nFor testing I tried both checkouts locally and they worked for me. I was not able to test the redirection back to Shopify.\r\n\r\n@wvanbergen @girasquid ","created_at":"2015-01-25T16:44:12Z","updated_at":"2015-01-29T19:54:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aea97d1574e4539cc644c41543d63967d152bbff","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/offsite_payments/pulls/115/commits","review_comments_url":"https://api.github.com/repos/Shopify/offsite_payments/pulls/115/comments","review_comment_url":"https://api.github.com/repos/Shopify/offsite_payments/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Shopify/offsite_payments/issues/115/comments","statuses_url":"https://api.github.com/repos/Shopify/offsite_payments/statuses/20caa0c25daa99ca1d850d9d927ba4166fd49994","head":{"label":"Shopify:add_mollie_mistercash","ref":"add_mollie_mistercash","sha":"20caa0c25daa99ca1d850d9d927ba4166fd49994","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":20425338,"name":"offsite_payments","full_name":"Shopify/offsite_payments","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/offsite_payments","description":"A simple and unified API to handle dozens of different offsite payment pages.","fork":false,"url":"https://api.github.com/repos/Shopify/offsite_payments","forks_url":"https://api.github.com/repos/Shopify/offsite_payments/forks","keys_url":"https://api.github.com/repos/Shopify/offsite_payments/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/offsite_payments/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/offsite_payments/teams","hooks_url":"https://api.github.com/repos/Shopify/offsite_payments/hooks","issue_events_url":"https://api.github.com/repos/Shopify/offsite_payments/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/offsite_payments/events","assignees_url":"https://api.github.com/repos/Shopify/offsite_payments/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/offsite_payments/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/offsite_payments/tags","blobs_url":"https://api.github.com/repos/Shopify/offsite_payments/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/offsite_payments/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/offsite_payments/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/offsite_payments/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/offsite_payments/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/offsite_payments/languages","stargazers_url":"https://api.github.com/repos/Shopify/offsite_payments/stargazers","contributors_url":"https://api.github.com/repos/Shopify/offsite_payments/contributors","subscribers_url":"https://api.github.com/repos/Shopify/offsite_payments/subscribers","subscription_url":"https://api.github.com/repos/Shopify/offsite_payments/subscription","commits_url":"https://api.github.com/repos/Shopify/offsite_payments/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/offsite_payments/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/offsite_payments/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/offsite_payments/issues/comments/{number}","contents_url":"https://api.github.com/repos/Shopify/offsite_payments/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/offsite_payments/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/offsite_payments/merges","archive_url":"https://api.github.com/repos/Shopify/offsite_payments/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/offsite_payments/downloads","issues_url":"https://api.github.com/repos/Shopify/offsite_payments/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/offsite_payments/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/offsite_payments/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/offsite_payments/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/offsite_payments/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/offsite_payments/releases{/id}","created_at":"2014-06-03T01:11:00Z","updated_at":"2015-01-29T19:03:10Z","pushed_at":"2015-01-29T19:29:11Z","git_url":"git://github.com/Shopify/offsite_payments.git","ssh_url":"git@github.com:Shopify/offsite_payments.git","clone_url":"https://github.com/Shopify/offsite_payments.git","svn_url":"https://github.com/Shopify/offsite_payments","homepage":"","size":1640,"stargazers_count":34,"watchers_count":34,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":60,"forks":56,"open_issues":60,"watchers":34,"default_branch":"master"}},"base":{"label":"Shopify:master","ref":"master","sha":"813280d7d5f9e982c65c511484e0a4e73811ecd3","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":20425338,"name":"offsite_payments","full_name":"Shopify/offsite_payments","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/offsite_payments","description":"A simple and unified API to handle dozens of different offsite payment pages.","fork":false,"url":"https://api.github.com/repos/Shopify/offsite_payments","forks_url":"https://api.github.com/repos/Shopify/offsite_payments/forks","keys_url":"https://api.github.com/repos/Shopify/offsite_payments/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/offsite_payments/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/offsite_payments/teams","hooks_url":"https://api.github.com/repos/Shopify/offsite_payments/hooks","issue_events_url":"https://api.github.com/repos/Shopify/offsite_payments/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/offsite_payments/events","assignees_url":"https://api.github.com/repos/Shopify/offsite_payments/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/offsite_payments/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/offsite_payments/tags","blobs_url":"https://api.github.com/repos/Shopify/offsite_payments/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/offsite_payments/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/offsite_payments/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/offsite_payments/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/offsite_payments/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/offsite_payments/languages","stargazers_url":"https://api.github.com/repos/Shopify/offsite_payments/stargazers","contributors_url":"https://api.github.com/repos/Shopify/offsite_payments/contributors","subscribers_url":"https://api.github.com/repos/Shopify/offsite_payments/subscribers","subscription_url":"https://api.github.com/repos/Shopify/offsite_payments/subscription","commits_url":"https://api.github.com/repos/Shopify/offsite_payments/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/offsite_payments/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/offsite_payments/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/offsite_payments/issues/comments/{number}","contents_url":"https://api.github.com/repos/Shopify/offsite_payments/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/offsite_payments/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/offsite_payments/merges","archive_url":"https://api.github.com/repos/Shopify/offsite_payments/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/offsite_payments/downloads","issues_url":"https://api.github.com/repos/Shopify/offsite_payments/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/offsite_payments/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/offsite_payments/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/offsite_payments/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/offsite_payments/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/offsite_payments/releases{/id}","created_at":"2014-06-03T01:11:00Z","updated_at":"2015-01-29T19:03:10Z","pushed_at":"2015-01-29T19:29:11Z","git_url":"git://github.com/Shopify/offsite_payments.git","ssh_url":"git@github.com:Shopify/offsite_payments.git","clone_url":"https://github.com/Shopify/offsite_payments.git","svn_url":"https://github.com/Shopify/offsite_payments","homepage":"","size":1640,"stargazers_count":34,"watchers_count":34,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":56,"mirror_url":null,"open_issues_count":60,"forks":56,"open_issues":60,"watchers":34,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/offsite_payments/pulls/115"},"html":{"href":"https://github.com/Shopify/offsite_payments/pull/115"},"issue":{"href":"https://api.github.com/repos/Shopify/offsite_payments/issues/115"},"comments":{"href":"https://api.github.com/repos/Shopify/offsite_payments/issues/115/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/offsite_payments/pulls/115/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/offsite_payments/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Shopify/offsite_payments/pulls/115/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/offsite_payments/statuses/20caa0c25daa99ca1d850d9d927ba4166fd49994"}}}}