{"action":"created","comment":{"url":"https://api.github.com/repos/openSUSE/osem/pulls/comments/74118591","id":74118591,"diff_hunk":"@@ -32,4 +33,61 @@\n       expect(payment.amount_to_pay).to eq(8000)\n     end\n   end\n+\n+  describe '#purchase' do\n+    let!(:user) { create(:user) }\n+    let!(:conference) { create(:conference) }\n+    let!(:ticket_1) { create(:ticket, price: 10, price_currency: 'USD', conference: conference) }\n+    let!(:tickets) { {ticket_1.id.to_s => '2'} }\n+    let(:stripe_helper) { StripeMock.create_test_helper }\n+\n+    before { StripeMock.start }\n+    after { StripeMock.stop }\n+\n+    before { TicketPurchase.purchase(conference, user, tickets) }\n+    let!(:payment) { create(:payment, user: user, conference: conference, stripe_customer_token: stripe_helper.generate_card_token, stripe_customer_email: user.email) }\n+\n+    context 'when the payment is successful' do\n+      before { payment.purchase }\n+\n+      it 'assigns amount' do\n+        expect(payment.amount).to eq(2000)\n+      end\n+\n+      it 'assigns last4' do\n+        expect(payment.last4).to eq('4242')\n+      end\n+\n+      it \"assigns 'success' to payment.status\" do\n+        expect(payment.status).to eq('success')\n+      end\n+\n+      it 'assigns authorization_code' do\n+        expect(payment.authorization_code).to eq('test_ch_3')\n+      end\n+    end\n+\n+    context 'if the payment is not successful' do\n+      before { StripeMock.prepare_card_error(:invalid_number) }\n+\n+      let(:payment) { create(:payment, user: user, conference: conference, stripe_customer_token: 'bogus_card_token', stripe_customer_email: user.email) }\n+\n+      before { payment.purchase }\n+\n+      context 'when the card is invalid' do","path":"spec/models/payment_spec.rb","position":77,"original_position":51,"commit_id":"1e83cf5c6cf2f2c10cfd42fce54207930743a494","original_commit_id":"1e83cf5c6cf2f2c10cfd42fce54207930743a494","user":{"login":"rishabhs95","id":10002834,"avatar_url":"https://avatars.githubusercontent.com/u/10002834?v=3","gravatar_id":"","url":"https://api.github.com/users/rishabhs95","html_url":"https://github.com/rishabhs95","followers_url":"https://api.github.com/users/rishabhs95/followers","following_url":"https://api.github.com/users/rishabhs95/following{/other_user}","gists_url":"https://api.github.com/users/rishabhs95/gists{/gist_id}","starred_url":"https://api.github.com/users/rishabhs95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rishabhs95/subscriptions","organizations_url":"https://api.github.com/users/rishabhs95/orgs","repos_url":"https://api.github.com/users/rishabhs95/repos","events_url":"https://api.github.com/users/rishabhs95/events{/privacy}","received_events_url":"https://api.github.com/users/rishabhs95/received_events","type":"User","site_admin":false},"body":"Considering them","created_at":"2016-08-09T18:35:48Z","updated_at":"2016-08-09T18:35:48Z","html_url":"https://github.com/openSUSE/osem/pull/1108#discussion_r74118591","pull_request_url":"https://api.github.com/repos/openSUSE/osem/pulls/1108","_links":{"self":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/comments/74118591"},"html":{"href":"https://github.com/openSUSE/osem/pull/1108#discussion_r74118591"},"pull_request":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/1108"}}},"pull_request":{"url":"https://api.github.com/repos/openSUSE/osem/pulls/1108","id":79040589,"html_url":"https://github.com/openSUSE/osem/pull/1108","diff_url":"https://github.com/openSUSE/osem/pull/1108.diff","patch_url":"https://github.com/openSUSE/osem/pull/1108.patch","issue_url":"https://api.github.com/repos/openSUSE/osem/issues/1108","number":1108,"state":"open","locked":false,"title":"Online payment feature - direct stripe integration","user":{"login":"rishabhs95","id":10002834,"avatar_url":"https://avatars.githubusercontent.com/u/10002834?v=3","gravatar_id":"","url":"https://api.github.com/users/rishabhs95","html_url":"https://github.com/rishabhs95","followers_url":"https://api.github.com/users/rishabhs95/followers","following_url":"https://api.github.com/users/rishabhs95/following{/other_user}","gists_url":"https://api.github.com/users/rishabhs95/gists{/gist_id}","starred_url":"https://api.github.com/users/rishabhs95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rishabhs95/subscriptions","organizations_url":"https://api.github.com/users/rishabhs95/orgs","repos_url":"https://api.github.com/users/rishabhs95/repos","events_url":"https://api.github.com/users/rishabhs95/events{/privacy}","received_events_url":"https://api.github.com/users/rishabhs95/received_events","type":"User","site_admin":false},"body":"This PR is in succession to PR #1042.\r\n\r\nThis makes the feature SAQ-A PCI-compliant which is the easiest and cheapest amongst all available, thereby reducing the PCI burden for our clients.\r\n\r\n<img width=\"1680\" alt=\"screen shot 2016-07-27 at 8 36 32 pm\" src=\"https://cloud.githubusercontent.com/assets/10002834/17180444/2043095e-543a-11e6-9c73-7043fdbddacf.png\">\r\n\r\n<img width=\"1680\" alt=\"screen shot 2016-07-27 at 8 36 47 pm\" src=\"https://cloud.githubusercontent.com/assets/10002834/17180448/2202db02-543a-11e6-9050-c14c37dc071b.png\">\r\n\r\n<img width=\"1680\" alt=\"screen shot 2016-07-27 at 8 37 47 pm\" src=\"https://cloud.githubusercontent.com/assets/10002834/17180457/26aa7d54-543a-11e6-8a14-376098517345.png\">\r\n\r\n<img width=\"1680\" alt=\"screen shot 2016-07-27 at 8 38 00 pm\" src=\"https://cloud.githubusercontent.com/assets/10002834/17180458/2751cdca-543a-11e6-9aaf-f09023399332.png\">","created_at":"2016-07-27T15:02:15Z","updated_at":"2016-08-09T18:35:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d1d177e05b9d436570ba19a91cf6d6cd8e26e85e","assignee":{"login":"lagartoflojo","id":2944,"avatar_url":"https://avatars.githubusercontent.com/u/2944?v=3","gravatar_id":"","url":"https://api.github.com/users/lagartoflojo","html_url":"https://github.com/lagartoflojo","followers_url":"https://api.github.com/users/lagartoflojo/followers","following_url":"https://api.github.com/users/lagartoflojo/following{/other_user}","gists_url":"https://api.github.com/users/lagartoflojo/gists{/gist_id}","starred_url":"https://api.github.com/users/lagartoflojo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lagartoflojo/subscriptions","organizations_url":"https://api.github.com/users/lagartoflojo/orgs","repos_url":"https://api.github.com/users/lagartoflojo/repos","events_url":"https://api.github.com/users/lagartoflojo/events{/privacy}","received_events_url":"https://api.github.com/users/lagartoflojo/received_events","type":"User","site_admin":false},"assignees":[{"login":"lagartoflojo","id":2944,"avatar_url":"https://avatars.githubusercontent.com/u/2944?v=3","gravatar_id":"","url":"https://api.github.com/users/lagartoflojo","html_url":"https://github.com/lagartoflojo","followers_url":"https://api.github.com/users/lagartoflojo/followers","following_url":"https://api.github.com/users/lagartoflojo/following{/other_user}","gists_url":"https://api.github.com/users/lagartoflojo/gists{/gist_id}","starred_url":"https://api.github.com/users/lagartoflojo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lagartoflojo/subscriptions","organizations_url":"https://api.github.com/users/lagartoflojo/orgs","repos_url":"https://api.github.com/users/lagartoflojo/repos","events_url":"https://api.github.com/users/lagartoflojo/events{/privacy}","received_events_url":"https://api.github.com/users/lagartoflojo/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/openSUSE/osem/pulls/1108/commits","review_comments_url":"https://api.github.com/repos/openSUSE/osem/pulls/1108/comments","review_comment_url":"https://api.github.com/repos/openSUSE/osem/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openSUSE/osem/issues/1108/comments","statuses_url":"https://api.github.com/repos/openSUSE/osem/statuses/1e83cf5c6cf2f2c10cfd42fce54207930743a494","head":{"label":"rishabhs95:stripe","ref":"stripe","sha":"1e83cf5c6cf2f2c10cfd42fce54207930743a494","user":{"login":"rishabhs95","id":10002834,"avatar_url":"https://avatars.githubusercontent.com/u/10002834?v=3","gravatar_id":"","url":"https://api.github.com/users/rishabhs95","html_url":"https://github.com/rishabhs95","followers_url":"https://api.github.com/users/rishabhs95/followers","following_url":"https://api.github.com/users/rishabhs95/following{/other_user}","gists_url":"https://api.github.com/users/rishabhs95/gists{/gist_id}","starred_url":"https://api.github.com/users/rishabhs95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rishabhs95/subscriptions","organizations_url":"https://api.github.com/users/rishabhs95/orgs","repos_url":"https://api.github.com/users/rishabhs95/repos","events_url":"https://api.github.com/users/rishabhs95/events{/privacy}","received_events_url":"https://api.github.com/users/rishabhs95/received_events","type":"User","site_admin":false},"repo":{"id":53156214,"name":"osem","full_name":"rishabhs95/osem","owner":{"login":"rishabhs95","id":10002834,"avatar_url":"https://avatars.githubusercontent.com/u/10002834?v=3","gravatar_id":"","url":"https://api.github.com/users/rishabhs95","html_url":"https://github.com/rishabhs95","followers_url":"https://api.github.com/users/rishabhs95/followers","following_url":"https://api.github.com/users/rishabhs95/following{/other_user}","gists_url":"https://api.github.com/users/rishabhs95/gists{/gist_id}","starred_url":"https://api.github.com/users/rishabhs95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rishabhs95/subscriptions","organizations_url":"https://api.github.com/users/rishabhs95/orgs","repos_url":"https://api.github.com/users/rishabhs95/repos","events_url":"https://api.github.com/users/rishabhs95/events{/privacy}","received_events_url":"https://api.github.com/users/rishabhs95/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rishabhs95/osem","description":"Open Source Event Manager. An event management tool tailored to Free and Open Source Software conferences.","fork":true,"url":"https://api.github.com/repos/rishabhs95/osem","forks_url":"https://api.github.com/repos/rishabhs95/osem/forks","keys_url":"https://api.github.com/repos/rishabhs95/osem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rishabhs95/osem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rishabhs95/osem/teams","hooks_url":"https://api.github.com/repos/rishabhs95/osem/hooks","issue_events_url":"https://api.github.com/repos/rishabhs95/osem/issues/events{/number}","events_url":"https://api.github.com/repos/rishabhs95/osem/events","assignees_url":"https://api.github.com/repos/rishabhs95/osem/assignees{/user}","branches_url":"https://api.github.com/repos/rishabhs95/osem/branches{/branch}","tags_url":"https://api.github.com/repos/rishabhs95/osem/tags","blobs_url":"https://api.github.com/repos/rishabhs95/osem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rishabhs95/osem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rishabhs95/osem/git/refs{/sha}","trees_url":"https://api.github.com/repos/rishabhs95/osem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rishabhs95/osem/statuses/{sha}","languages_url":"https://api.github.com/repos/rishabhs95/osem/languages","stargazers_url":"https://api.github.com/repos/rishabhs95/osem/stargazers","contributors_url":"https://api.github.com/repos/rishabhs95/osem/contributors","subscribers_url":"https://api.github.com/repos/rishabhs95/osem/subscribers","subscription_url":"https://api.github.com/repos/rishabhs95/osem/subscription","commits_url":"https://api.github.com/repos/rishabhs95/osem/commits{/sha}","git_commits_url":"https://api.github.com/repos/rishabhs95/osem/git/commits{/sha}","comments_url":"https://api.github.com/repos/rishabhs95/osem/comments{/number}","issue_comment_url":"https://api.github.com/repos/rishabhs95/osem/issues/comments{/number}","contents_url":"https://api.github.com/repos/rishabhs95/osem/contents/{+path}","compare_url":"https://api.github.com/repos/rishabhs95/osem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rishabhs95/osem/merges","archive_url":"https://api.github.com/repos/rishabhs95/osem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rishabhs95/osem/downloads","issues_url":"https://api.github.com/repos/rishabhs95/osem/issues{/number}","pulls_url":"https://api.github.com/repos/rishabhs95/osem/pulls{/number}","milestones_url":"https://api.github.com/repos/rishabhs95/osem/milestones{/number}","notifications_url":"https://api.github.com/repos/rishabhs95/osem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rishabhs95/osem/labels{/name}","releases_url":"https://api.github.com/repos/rishabhs95/osem/releases{/id}","deployments_url":"https://api.github.com/repos/rishabhs95/osem/deployments","created_at":"2016-03-04T18:15:27Z","updated_at":"2016-03-04T18:15:29Z","pushed_at":"2016-08-09T14:54:40Z","git_url":"git://github.com/rishabhs95/osem.git","ssh_url":"git@github.com:rishabhs95/osem.git","clone_url":"https://github.com/rishabhs95/osem.git","svn_url":"https://github.com/rishabhs95/osem","homepage":"http://osem.io","size":23216,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openSUSE:master","ref":"master","sha":"424b1302cb4770b557a5203041f4e3f95466a163","user":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":5911225,"name":"osem","full_name":"openSUSE/osem","owner":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openSUSE/osem","description":"Open Source Event Manager. An event management tool tailored to Free and Open Source Software conferences.","fork":false,"url":"https://api.github.com/repos/openSUSE/osem","forks_url":"https://api.github.com/repos/openSUSE/osem/forks","keys_url":"https://api.github.com/repos/openSUSE/osem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openSUSE/osem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openSUSE/osem/teams","hooks_url":"https://api.github.com/repos/openSUSE/osem/hooks","issue_events_url":"https://api.github.com/repos/openSUSE/osem/issues/events{/number}","events_url":"https://api.github.com/repos/openSUSE/osem/events","assignees_url":"https://api.github.com/repos/openSUSE/osem/assignees{/user}","branches_url":"https://api.github.com/repos/openSUSE/osem/branches{/branch}","tags_url":"https://api.github.com/repos/openSUSE/osem/tags","blobs_url":"https://api.github.com/repos/openSUSE/osem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openSUSE/osem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openSUSE/osem/git/refs{/sha}","trees_url":"https://api.github.com/repos/openSUSE/osem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openSUSE/osem/statuses/{sha}","languages_url":"https://api.github.com/repos/openSUSE/osem/languages","stargazers_url":"https://api.github.com/repos/openSUSE/osem/stargazers","contributors_url":"https://api.github.com/repos/openSUSE/osem/contributors","subscribers_url":"https://api.github.com/repos/openSUSE/osem/subscribers","subscription_url":"https://api.github.com/repos/openSUSE/osem/subscription","commits_url":"https://api.github.com/repos/openSUSE/osem/commits{/sha}","git_commits_url":"https://api.github.com/repos/openSUSE/osem/git/commits{/sha}","comments_url":"https://api.github.com/repos/openSUSE/osem/comments{/number}","issue_comment_url":"https://api.github.com/repos/openSUSE/osem/issues/comments{/number}","contents_url":"https://api.github.com/repos/openSUSE/osem/contents/{+path}","compare_url":"https://api.github.com/repos/openSUSE/osem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openSUSE/osem/merges","archive_url":"https://api.github.com/repos/openSUSE/osem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openSUSE/osem/downloads","issues_url":"https://api.github.com/repos/openSUSE/osem/issues{/number}","pulls_url":"https://api.github.com/repos/openSUSE/osem/pulls{/number}","milestones_url":"https://api.github.com/repos/openSUSE/osem/milestones{/number}","notifications_url":"https://api.github.com/repos/openSUSE/osem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openSUSE/osem/labels{/name}","releases_url":"https://api.github.com/repos/openSUSE/osem/releases{/id}","deployments_url":"https://api.github.com/repos/openSUSE/osem/deployments","created_at":"2012-09-22T07:40:18Z","updated_at":"2016-08-07T12:09:36Z","pushed_at":"2016-08-09T18:09:57Z","git_url":"git://github.com/openSUSE/osem.git","ssh_url":"git@github.com:openSUSE/osem.git","clone_url":"https://github.com/openSUSE/osem.git","svn_url":"https://github.com/openSUSE/osem","homepage":"http://osem.io","size":40091,"stargazers_count":164,"watchers_count":164,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":117,"mirror_url":null,"open_issues_count":121,"forks":117,"open_issues":121,"watchers":164,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/1108"},"html":{"href":"https://github.com/openSUSE/osem/pull/1108"},"issue":{"href":"https://api.github.com/repos/openSUSE/osem/issues/1108"},"comments":{"href":"https://api.github.com/repos/openSUSE/osem/issues/1108/comments"},"review_comments":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/1108/comments"},"review_comment":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/1108/commits"},"statuses":{"href":"https://api.github.com/repos/openSUSE/osem/statuses/1e83cf5c6cf2f2c10cfd42fce54207930743a494"}}}}
{"actor":{"display_login":"rishabhs95"}}