{"action":"created","comment":{"url":"https://api.github.com/repos/shoopio/shoop/pulls/comments/52348862","id":52348862,"diff_hunk":"@@ -45,6 +48,49 @@ class Meta:\n         model = Order\n \n \n+class DefaultPaymentSerializer(serializers.Serializer):\n+    payment_identifier = serializers.CharField(max_length=50)\n+    description = serializers.CharField(max_length=256, allow_null=True)\n+\n+\n+class PaymentSerializer(DefaultPaymentSerializer):\n+    amount_value = serializers.DecimalField(decimal_places=9, max_digits=36)\n+    currency = serializers.CharField(max_length=10)\n+\n+\n class OrderViewSet(ModelViewSet):\n     serializer_class = OrderSerializer\n     queryset = Order.objects.all()\n+\n+    @detail_route(methods=['post'])\n+    def create_payment(self, request, pk=None):\n+        order = self.get_object()\n+        serializer = PaymentSerializer(data=request.data)\n+        if serializer.is_valid():\n+            data = serializer.validated_data\n+            order.create_payment(\n+                Money(data[\"amount_value\"], data[\"currency\"]),\n+                data[\"payment_identifier\"],\n+                data.get(\"description\", \"\")\n+            )\n+            return Response({'status': 'payment created'})\n+        else:\n+            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n+\n+    @detail_route(methods=['post'])\n+    def set_fully_paid(self, request, pk=None):\n+        order = self.get_object()\n+        if order.is_paid():\n+            return Response({\"status\": \"order is already fully paid\"})\n+        serializer = DefaultPaymentSerializer(data=request.data)\n+        if serializer.is_valid():","path":"shoop/core/api/orders.py","position":70,"original_position":70,"commit_id":"f407f8099bdfc72c9a8e09e542bad9b00e796600","original_commit_id":"f407f8099bdfc72c9a8e09e542bad9b00e796600","user":{"login":"tulimaki","id":4940349,"avatar_url":"https://avatars.githubusercontent.com/u/4940349?v=3","gravatar_id":"","url":"https://api.github.com/users/tulimaki","html_url":"https://github.com/tulimaki","followers_url":"https://api.github.com/users/tulimaki/followers","following_url":"https://api.github.com/users/tulimaki/following{/other_user}","gists_url":"https://api.github.com/users/tulimaki/gists{/gist_id}","starred_url":"https://api.github.com/users/tulimaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tulimaki/subscriptions","organizations_url":"https://api.github.com/users/tulimaki/orgs","repos_url":"https://api.github.com/users/tulimaki/repos","events_url":"https://api.github.com/users/tulimaki/events{/privacy}","received_events_url":"https://api.github.com/users/tulimaki/received_events","type":"User","site_admin":false},"body":"Ok, thanks, will check these ASAP. And I think that we can use the same serializer for both.","created_at":"2016-02-09T18:13:32Z","updated_at":"2016-02-09T18:13:32Z","html_url":"https://github.com/shoopio/shoop/pull/342#discussion_r52348862","pull_request_url":"https://api.github.com/repos/shoopio/shoop/pulls/342","_links":{"self":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/comments/52348862"},"html":{"href":"https://github.com/shoopio/shoop/pull/342#discussion_r52348862"},"pull_request":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/342"}}},"pull_request":{"url":"https://api.github.com/repos/shoopio/shoop/pulls/342","id":58381942,"html_url":"https://github.com/shoopio/shoop/pull/342","diff_url":"https://github.com/shoopio/shoop/pull/342.diff","patch_url":"https://github.com/shoopio/shoop/pull/342.patch","issue_url":"https://api.github.com/repos/shoopio/shoop/issues/342","number":342,"state":"open","locked":false,"title":"Core: option to create payments with REST API","user":{"login":"tulimaki","id":4940349,"avatar_url":"https://avatars.githubusercontent.com/u/4940349?v=3","gravatar_id":"","url":"https://api.github.com/users/tulimaki","html_url":"https://github.com/tulimaki","followers_url":"https://api.github.com/users/tulimaki/followers","following_url":"https://api.github.com/users/tulimaki/following{/other_user}","gists_url":"https://api.github.com/users/tulimaki/gists{/gist_id}","starred_url":"https://api.github.com/users/tulimaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tulimaki/subscriptions","organizations_url":"https://api.github.com/users/tulimaki/orgs","repos_url":"https://api.github.com/users/tulimaki/repos","events_url":"https://api.github.com/users/tulimaki/events{/privacy}","received_events_url":"https://api.github.com/users/tulimaki/received_events","type":"User","site_admin":false},"body":"* Add create_payment detail route to OrderViewSet\r\n* Add custom PaymentSerializer with amount_value,\r\ncurrency, payment_identifier and description as fields.\r\n\r\nRefs SHOOP-2117 / SHOOP-1973","created_at":"2016-02-05T02:45:52Z","updated_at":"2016-02-09T18:13:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"377825f15e1a9a79b7487544087ac030da19edeb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shoopio/shoop/pulls/342/commits","review_comments_url":"https://api.github.com/repos/shoopio/shoop/pulls/342/comments","review_comment_url":"https://api.github.com/repos/shoopio/shoop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shoopio/shoop/issues/342/comments","statuses_url":"https://api.github.com/repos/shoopio/shoop/statuses/f407f8099bdfc72c9a8e09e542bad9b00e796600","head":{"label":"tulimaki:create_payment_api","ref":"create_payment_api","sha":"f407f8099bdfc72c9a8e09e542bad9b00e796600","user":{"login":"tulimaki","id":4940349,"avatar_url":"https://avatars.githubusercontent.com/u/4940349?v=3","gravatar_id":"","url":"https://api.github.com/users/tulimaki","html_url":"https://github.com/tulimaki","followers_url":"https://api.github.com/users/tulimaki/followers","following_url":"https://api.github.com/users/tulimaki/following{/other_user}","gists_url":"https://api.github.com/users/tulimaki/gists{/gist_id}","starred_url":"https://api.github.com/users/tulimaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tulimaki/subscriptions","organizations_url":"https://api.github.com/users/tulimaki/orgs","repos_url":"https://api.github.com/users/tulimaki/repos","events_url":"https://api.github.com/users/tulimaki/events{/privacy}","received_events_url":"https://api.github.com/users/tulimaki/received_events","type":"User","site_admin":false},"repo":{"id":41303409,"name":"shoop","full_name":"tulimaki/shoop","owner":{"login":"tulimaki","id":4940349,"avatar_url":"https://avatars.githubusercontent.com/u/4940349?v=3","gravatar_id":"","url":"https://api.github.com/users/tulimaki","html_url":"https://github.com/tulimaki","followers_url":"https://api.github.com/users/tulimaki/followers","following_url":"https://api.github.com/users/tulimaki/following{/other_user}","gists_url":"https://api.github.com/users/tulimaki/gists{/gist_id}","starred_url":"https://api.github.com/users/tulimaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tulimaki/subscriptions","organizations_url":"https://api.github.com/users/tulimaki/orgs","repos_url":"https://api.github.com/users/tulimaki/repos","events_url":"https://api.github.com/users/tulimaki/events{/privacy}","received_events_url":"https://api.github.com/users/tulimaki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tulimaki/shoop","description":"E-Commerce Platform","fork":true,"url":"https://api.github.com/repos/tulimaki/shoop","forks_url":"https://api.github.com/repos/tulimaki/shoop/forks","keys_url":"https://api.github.com/repos/tulimaki/shoop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tulimaki/shoop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tulimaki/shoop/teams","hooks_url":"https://api.github.com/repos/tulimaki/shoop/hooks","issue_events_url":"https://api.github.com/repos/tulimaki/shoop/issues/events{/number}","events_url":"https://api.github.com/repos/tulimaki/shoop/events","assignees_url":"https://api.github.com/repos/tulimaki/shoop/assignees{/user}","branches_url":"https://api.github.com/repos/tulimaki/shoop/branches{/branch}","tags_url":"https://api.github.com/repos/tulimaki/shoop/tags","blobs_url":"https://api.github.com/repos/tulimaki/shoop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tulimaki/shoop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tulimaki/shoop/git/refs{/sha}","trees_url":"https://api.github.com/repos/tulimaki/shoop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tulimaki/shoop/statuses/{sha}","languages_url":"https://api.github.com/repos/tulimaki/shoop/languages","stargazers_url":"https://api.github.com/repos/tulimaki/shoop/stargazers","contributors_url":"https://api.github.com/repos/tulimaki/shoop/contributors","subscribers_url":"https://api.github.com/repos/tulimaki/shoop/subscribers","subscription_url":"https://api.github.com/repos/tulimaki/shoop/subscription","commits_url":"https://api.github.com/repos/tulimaki/shoop/commits{/sha}","git_commits_url":"https://api.github.com/repos/tulimaki/shoop/git/commits{/sha}","comments_url":"https://api.github.com/repos/tulimaki/shoop/comments{/number}","issue_comment_url":"https://api.github.com/repos/tulimaki/shoop/issues/comments{/number}","contents_url":"https://api.github.com/repos/tulimaki/shoop/contents/{+path}","compare_url":"https://api.github.com/repos/tulimaki/shoop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tulimaki/shoop/merges","archive_url":"https://api.github.com/repos/tulimaki/shoop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tulimaki/shoop/downloads","issues_url":"https://api.github.com/repos/tulimaki/shoop/issues{/number}","pulls_url":"https://api.github.com/repos/tulimaki/shoop/pulls{/number}","milestones_url":"https://api.github.com/repos/tulimaki/shoop/milestones{/number}","notifications_url":"https://api.github.com/repos/tulimaki/shoop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tulimaki/shoop/labels{/name}","releases_url":"https://api.github.com/repos/tulimaki/shoop/releases{/id}","deployments_url":"https://api.github.com/repos/tulimaki/shoop/deployments","created_at":"2015-08-24T13:04:05Z","updated_at":"2016-01-12T06:01:42Z","pushed_at":"2016-02-09T16:34:38Z","git_url":"git://github.com/tulimaki/shoop.git","ssh_url":"git@github.com:tulimaki/shoop.git","clone_url":"https://github.com/tulimaki/shoop.git","svn_url":"https://github.com/tulimaki/shoop","homepage":"https://shoop.io","size":5357,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"shoopio:master","ref":"master","sha":"9b95da4e6dd5ea44e8445f802dc2180094e98dd2","user":{"login":"shoopio","id":12714852,"avatar_url":"https://avatars.githubusercontent.com/u/12714852?v=3","gravatar_id":"","url":"https://api.github.com/users/shoopio","html_url":"https://github.com/shoopio","followers_url":"https://api.github.com/users/shoopio/followers","following_url":"https://api.github.com/users/shoopio/following{/other_user}","gists_url":"https://api.github.com/users/shoopio/gists{/gist_id}","starred_url":"https://api.github.com/users/shoopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoopio/subscriptions","organizations_url":"https://api.github.com/users/shoopio/orgs","repos_url":"https://api.github.com/users/shoopio/repos","events_url":"https://api.github.com/users/shoopio/events{/privacy}","received_events_url":"https://api.github.com/users/shoopio/received_events","type":"Organization","site_admin":false},"repo":{"id":36803364,"name":"shoop","full_name":"shoopio/shoop","owner":{"login":"shoopio","id":12714852,"avatar_url":"https://avatars.githubusercontent.com/u/12714852?v=3","gravatar_id":"","url":"https://api.github.com/users/shoopio","html_url":"https://github.com/shoopio","followers_url":"https://api.github.com/users/shoopio/followers","following_url":"https://api.github.com/users/shoopio/following{/other_user}","gists_url":"https://api.github.com/users/shoopio/gists{/gist_id}","starred_url":"https://api.github.com/users/shoopio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoopio/subscriptions","organizations_url":"https://api.github.com/users/shoopio/orgs","repos_url":"https://api.github.com/users/shoopio/repos","events_url":"https://api.github.com/users/shoopio/events{/privacy}","received_events_url":"https://api.github.com/users/shoopio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shoopio/shoop","description":"E-Commerce Platform","fork":false,"url":"https://api.github.com/repos/shoopio/shoop","forks_url":"https://api.github.com/repos/shoopio/shoop/forks","keys_url":"https://api.github.com/repos/shoopio/shoop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shoopio/shoop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shoopio/shoop/teams","hooks_url":"https://api.github.com/repos/shoopio/shoop/hooks","issue_events_url":"https://api.github.com/repos/shoopio/shoop/issues/events{/number}","events_url":"https://api.github.com/repos/shoopio/shoop/events","assignees_url":"https://api.github.com/repos/shoopio/shoop/assignees{/user}","branches_url":"https://api.github.com/repos/shoopio/shoop/branches{/branch}","tags_url":"https://api.github.com/repos/shoopio/shoop/tags","blobs_url":"https://api.github.com/repos/shoopio/shoop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shoopio/shoop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shoopio/shoop/git/refs{/sha}","trees_url":"https://api.github.com/repos/shoopio/shoop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shoopio/shoop/statuses/{sha}","languages_url":"https://api.github.com/repos/shoopio/shoop/languages","stargazers_url":"https://api.github.com/repos/shoopio/shoop/stargazers","contributors_url":"https://api.github.com/repos/shoopio/shoop/contributors","subscribers_url":"https://api.github.com/repos/shoopio/shoop/subscribers","subscription_url":"https://api.github.com/repos/shoopio/shoop/subscription","commits_url":"https://api.github.com/repos/shoopio/shoop/commits{/sha}","git_commits_url":"https://api.github.com/repos/shoopio/shoop/git/commits{/sha}","comments_url":"https://api.github.com/repos/shoopio/shoop/comments{/number}","issue_comment_url":"https://api.github.com/repos/shoopio/shoop/issues/comments{/number}","contents_url":"https://api.github.com/repos/shoopio/shoop/contents/{+path}","compare_url":"https://api.github.com/repos/shoopio/shoop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shoopio/shoop/merges","archive_url":"https://api.github.com/repos/shoopio/shoop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shoopio/shoop/downloads","issues_url":"https://api.github.com/repos/shoopio/shoop/issues{/number}","pulls_url":"https://api.github.com/repos/shoopio/shoop/pulls{/number}","milestones_url":"https://api.github.com/repos/shoopio/shoop/milestones{/number}","notifications_url":"https://api.github.com/repos/shoopio/shoop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shoopio/shoop/labels{/name}","releases_url":"https://api.github.com/repos/shoopio/shoop/releases{/id}","deployments_url":"https://api.github.com/repos/shoopio/shoop/deployments","created_at":"2015-06-03T12:53:21Z","updated_at":"2016-02-09T13:45:30Z","pushed_at":"2016-02-09T18:05:55Z","git_url":"git://github.com/shoopio/shoop.git","ssh_url":"git@github.com:shoopio/shoop.git","clone_url":"https://github.com/shoopio/shoop.git","svn_url":"https://github.com/shoopio/shoop","homepage":"https://shoop.io","size":8022,"stargazers_count":278,"watchers_count":278,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":94,"mirror_url":null,"open_issues_count":18,"forks":94,"open_issues":18,"watchers":278,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/342"},"html":{"href":"https://github.com/shoopio/shoop/pull/342"},"issue":{"href":"https://api.github.com/repos/shoopio/shoop/issues/342"},"comments":{"href":"https://api.github.com/repos/shoopio/shoop/issues/342/comments"},"review_comments":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/342/comments"},"review_comment":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shoopio/shoop/pulls/342/commits"},"statuses":{"href":"https://api.github.com/repos/shoopio/shoop/statuses/f407f8099bdfc72c9a8e09e542bad9b00e796600"}}}}