{"action":"created","comment":{"url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/comments/46071085","id":46071085,"diff_hunk":"@@ -0,0 +1,46 @@\n+from rest_framework import status, viewsets\n+from rest_framework.response import Response\n+from rest_framework.decorators import detail_route, list_route\n+from rest_framework.permissions import IsAuthenticated\n+from rest_framework import mixins\n+from crowdsourcing.models import FinancialAccount, Transaction, PayPalFlow, UserProfile\n+from crowdsourcing.serializers.payment import FinancialAccountSerializer, PayPalFlowSerializer, \\\n+    TransactionSerializer, PayPalPaymentSerializer\n+from crowdsourcing.permissions.payment import IsAccountOwner\n+\n+\n+class FinancialAccountViewSet(mixins.RetrieveModelMixin, mixins.UpdateModelMixin, viewsets.GenericViewSet):\n+    queryset = FinancialAccount.objects.filter(is_system=False)\n+    serializer_class = FinancialAccountSerializer\n+    permission_classes = [IsAuthenticated, IsAccountOwner]\n+\n+\n+class PayPalFlowViewSet(mixins.RetrieveModelMixin, mixins.CreateModelMixin, mixins.UpdateModelMixin,\n+                        viewsets.GenericViewSet):\n+    queryset = PayPalFlow.objects.all()\n+    serializer_class = PayPalFlowSerializer\n+\n+    def create(self, request, *args, **kwargs):\n+        serializer = PayPalPaymentSerializer(data=request.data, context={\"request\": request})\n+\n+        if serializer.is_valid():\n+            flow_data, http_status = serializer.create()\n+            return Response(data=flow_data, status=http_status)\n+        else:\n+            return Response(data=serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n+\n+    @list_route(methods=['post'])\n+    def execute(self, request, *args, **kwargs):","path":"crowdsourcing/viewsets/payment.py","position":33,"original_position":33,"commit_id":"db44adc42f83200049666536066ba48f83c652b0","original_commit_id":"db44adc42f83200049666536066ba48f83c652b0","user":{"login":"dmorina","id":2858281,"avatar_url":"https://avatars.githubusercontent.com/u/2858281?v=3","gravatar_id":"","url":"https://api.github.com/users/dmorina","html_url":"https://github.com/dmorina","followers_url":"https://api.github.com/users/dmorina/followers","following_url":"https://api.github.com/users/dmorina/following{/other_user}","gists_url":"https://api.github.com/users/dmorina/gists{/gist_id}","starred_url":"https://api.github.com/users/dmorina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmorina/subscriptions","organizations_url":"https://api.github.com/users/dmorina/orgs","repos_url":"https://api.github.com/users/dmorina/repos","events_url":"https://api.github.com/users/dmorina/events{/privacy}","received_events_url":"https://api.github.com/users/dmorina/received_events","type":"User","site_admin":false},"body":"how does that help here? actually in this case it's the opposite you dont want to tie the transaction commit/rollback to the result of the whole view code block, if user hits this endpoint we want to make sure that we capture this data and commit to DB \r\n\r\nmaybe you can elaborate what you had in mind here","created_at":"2015-11-27T21:48:09Z","updated_at":"2015-11-27T21:48:09Z","html_url":"https://github.com/crowdresearch/crowdsource-platform/pull/585#discussion_r46071085","pull_request_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/585","_links":{"self":{"href":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/comments/46071085"},"html":{"href":"https://github.com/crowdresearch/crowdsource-platform/pull/585#discussion_r46071085"},"pull_request":{"href":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/585"}}},"pull_request":{"url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/585","id":50581884,"html_url":"https://github.com/crowdresearch/crowdsource-platform/pull/585","diff_url":"https://github.com/crowdresearch/crowdsource-platform/pull/585.diff","patch_url":"https://github.com/crowdresearch/crowdsource-platform/pull/585.patch","issue_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues/585","number":585,"state":"open","locked":false,"title":"feature: paypal and payments backend ","user":{"login":"dmorina","id":2858281,"avatar_url":"https://avatars.githubusercontent.com/u/2858281?v=3","gravatar_id":"","url":"https://api.github.com/users/dmorina","html_url":"https://github.com/dmorina","followers_url":"https://api.github.com/users/dmorina/followers","following_url":"https://api.github.com/users/dmorina/following{/other_user}","gists_url":"https://api.github.com/users/dmorina/gists{/gist_id}","starred_url":"https://api.github.com/users/dmorina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmorina/subscriptions","organizations_url":"https://api.github.com/users/dmorina/orgs","repos_url":"https://api.github.com/users/dmorina/repos","events_url":"https://api.github.com/users/dmorina/events{/privacy}","received_events_url":"https://api.github.com/users/dmorina/received_events","type":"User","site_admin":false},"body":"-adds backend support for paypal and credit card payments\r\n-squashed and optimized migrations\r\n-hashids requirement added for future use\r\n\r\nps. load fixture dmorinaSystemFinancial.json\r\nto test create a new requester account -> that will create the financial accounts, and create a sandbox account with PayPal\r\n\r\n\r\ncloses #586 \r\n","created_at":"2015-11-12T23:06:35Z","updated_at":"2015-11-27T21:48:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8f3cd74e87c5a0e7cc59ec5a343d9410c5e1582","assignee":null,"milestone":{"url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/milestones/4","html_url":"https://github.com/crowdresearch/crowdsource-platform/milestones/v0.4","labels_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/milestones/4/labels","id":1367843,"number":4,"title":"v0.4","description":"Major design changes (new design to be applied), complete REST API to be used by external APIs, details to follow","creator":{"login":"dmorina","id":2858281,"avatar_url":"https://avatars.githubusercontent.com/u/2858281?v=3","gravatar_id":"","url":"https://api.github.com/users/dmorina","html_url":"https://github.com/dmorina","followers_url":"https://api.github.com/users/dmorina/followers","following_url":"https://api.github.com/users/dmorina/following{/other_user}","gists_url":"https://api.github.com/users/dmorina/gists{/gist_id}","starred_url":"https://api.github.com/users/dmorina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmorina/subscriptions","organizations_url":"https://api.github.com/users/dmorina/orgs","repos_url":"https://api.github.com/users/dmorina/repos","events_url":"https://api.github.com/users/dmorina/events{/privacy}","received_events_url":"https://api.github.com/users/dmorina/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":5,"state":"open","created_at":"2015-10-21T08:31:35Z","updated_at":"2015-11-26T00:55:59Z","due_on":"2015-12-10T23:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/585/commits","review_comments_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/585/comments","review_comment_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues/585/comments","statuses_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/statuses/db44adc42f83200049666536066ba48f83c652b0","head":{"label":"crowdresearch:feat-paypal-api-md","ref":"feat-paypal-api-md","sha":"db44adc42f83200049666536066ba48f83c652b0","user":{"login":"crowdresearch","id":11791223,"avatar_url":"https://avatars.githubusercontent.com/u/11791223?v=3","gravatar_id":"","url":"https://api.github.com/users/crowdresearch","html_url":"https://github.com/crowdresearch","followers_url":"https://api.github.com/users/crowdresearch/followers","following_url":"https://api.github.com/users/crowdresearch/following{/other_user}","gists_url":"https://api.github.com/users/crowdresearch/gists{/gist_id}","starred_url":"https://api.github.com/users/crowdresearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowdresearch/subscriptions","organizations_url":"https://api.github.com/users/crowdresearch/orgs","repos_url":"https://api.github.com/users/crowdresearch/repos","events_url":"https://api.github.com/users/crowdresearch/events{/privacy}","received_events_url":"https://api.github.com/users/crowdresearch/received_events","type":"Organization","site_admin":false},"repo":{"id":34006010,"name":"crowdsource-platform","full_name":"crowdresearch/crowdsource-platform","owner":{"login":"crowdresearch","id":11791223,"avatar_url":"https://avatars.githubusercontent.com/u/11791223?v=3","gravatar_id":"","url":"https://api.github.com/users/crowdresearch","html_url":"https://github.com/crowdresearch","followers_url":"https://api.github.com/users/crowdresearch/followers","following_url":"https://api.github.com/users/crowdresearch/following{/other_user}","gists_url":"https://api.github.com/users/crowdresearch/gists{/gist_id}","starred_url":"https://api.github.com/users/crowdresearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowdresearch/subscriptions","organizations_url":"https://api.github.com/users/crowdresearch/orgs","repos_url":"https://api.github.com/users/crowdresearch/repos","events_url":"https://api.github.com/users/crowdresearch/events{/privacy}","received_events_url":"https://api.github.com/users/crowdresearch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crowdresearch/crowdsource-platform","description":"The main repository for Crowdsource Platform","fork":false,"url":"https://api.github.com/repos/crowdresearch/crowdsource-platform","forks_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/forks","keys_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/teams","hooks_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/hooks","issue_events_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues/events{/number}","events_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/events","assignees_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/assignees{/user}","branches_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/branches{/branch}","tags_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/tags","blobs_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/languages","stargazers_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/stargazers","contributors_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/contributors","subscribers_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/subscribers","subscription_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/subscription","commits_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/contents/{+path}","compare_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/merges","archive_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/downloads","issues_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues{/number}","pulls_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/labels{/name}","releases_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/releases{/id}","created_at":"2015-04-15T16:36:52Z","updated_at":"2015-11-16T21:06:42Z","pushed_at":"2015-11-24T23:34:46Z","git_url":"git://github.com/crowdresearch/crowdsource-platform.git","ssh_url":"git@github.com:crowdresearch/crowdsource-platform.git","clone_url":"https://github.com/crowdresearch/crowdsource-platform.git","svn_url":"https://github.com/crowdresearch/crowdsource-platform","homepage":null,"size":33157,"stargazers_count":46,"watchers_count":46,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":121,"mirror_url":null,"open_issues_count":62,"forks":121,"open_issues":62,"watchers":46,"default_branch":"develop2"}},"base":{"label":"crowdresearch:develop2","ref":"develop2","sha":"4dcfd9169523b0538d7b24052a0479a828414777","user":{"login":"crowdresearch","id":11791223,"avatar_url":"https://avatars.githubusercontent.com/u/11791223?v=3","gravatar_id":"","url":"https://api.github.com/users/crowdresearch","html_url":"https://github.com/crowdresearch","followers_url":"https://api.github.com/users/crowdresearch/followers","following_url":"https://api.github.com/users/crowdresearch/following{/other_user}","gists_url":"https://api.github.com/users/crowdresearch/gists{/gist_id}","starred_url":"https://api.github.com/users/crowdresearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowdresearch/subscriptions","organizations_url":"https://api.github.com/users/crowdresearch/orgs","repos_url":"https://api.github.com/users/crowdresearch/repos","events_url":"https://api.github.com/users/crowdresearch/events{/privacy}","received_events_url":"https://api.github.com/users/crowdresearch/received_events","type":"Organization","site_admin":false},"repo":{"id":34006010,"name":"crowdsource-platform","full_name":"crowdresearch/crowdsource-platform","owner":{"login":"crowdresearch","id":11791223,"avatar_url":"https://avatars.githubusercontent.com/u/11791223?v=3","gravatar_id":"","url":"https://api.github.com/users/crowdresearch","html_url":"https://github.com/crowdresearch","followers_url":"https://api.github.com/users/crowdresearch/followers","following_url":"https://api.github.com/users/crowdresearch/following{/other_user}","gists_url":"https://api.github.com/users/crowdresearch/gists{/gist_id}","starred_url":"https://api.github.com/users/crowdresearch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowdresearch/subscriptions","organizations_url":"https://api.github.com/users/crowdresearch/orgs","repos_url":"https://api.github.com/users/crowdresearch/repos","events_url":"https://api.github.com/users/crowdresearch/events{/privacy}","received_events_url":"https://api.github.com/users/crowdresearch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crowdresearch/crowdsource-platform","description":"The main repository for Crowdsource Platform","fork":false,"url":"https://api.github.com/repos/crowdresearch/crowdsource-platform","forks_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/forks","keys_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/teams","hooks_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/hooks","issue_events_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues/events{/number}","events_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/events","assignees_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/assignees{/user}","branches_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/branches{/branch}","tags_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/tags","blobs_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/languages","stargazers_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/stargazers","contributors_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/contributors","subscribers_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/subscribers","subscription_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/subscription","commits_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/contents/{+path}","compare_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/merges","archive_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/downloads","issues_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues{/number}","pulls_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/labels{/name}","releases_url":"https://api.github.com/repos/crowdresearch/crowdsource-platform/releases{/id}","created_at":"2015-04-15T16:36:52Z","updated_at":"2015-11-16T21:06:42Z","pushed_at":"2015-11-24T23:34:46Z","git_url":"git://github.com/crowdresearch/crowdsource-platform.git","ssh_url":"git@github.com:crowdresearch/crowdsource-platform.git","clone_url":"https://github.com/crowdresearch/crowdsource-platform.git","svn_url":"https://github.com/crowdresearch/crowdsource-platform","homepage":null,"size":33157,"stargazers_count":46,"watchers_count":46,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":121,"mirror_url":null,"open_issues_count":62,"forks":121,"open_issues":62,"watchers":46,"default_branch":"develop2"}},"_links":{"self":{"href":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/585"},"html":{"href":"https://github.com/crowdresearch/crowdsource-platform/pull/585"},"issue":{"href":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues/585"},"comments":{"href":"https://api.github.com/repos/crowdresearch/crowdsource-platform/issues/585/comments"},"review_comments":{"href":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/585/comments"},"review_comment":{"href":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crowdresearch/crowdsource-platform/pulls/585/commits"},"statuses":{"href":"https://api.github.com/repos/crowdresearch/crowdsource-platform/statuses/db44adc42f83200049666536066ba48f83c652b0"}}}}