diff --git a/app/dashboard/sync/helpers.py b/app/dashboard/sync/helpers.py
index 5e91c223900..cf27dd53c24 100644
--- a/app/dashboard/sync/helpers.py
+++ b/app/dashboard/sync/helpers.py
@@ -3,6 +3,7 @@
from dashboard.helpers import bounty_activity_event_adapter, get_bounty_data_for_activity
from dashboard.models import Activity, BountyEvent, BountyFulfillment
+from decimal import Decimal
logger = logging.getLogger(__name__)
@@ -26,7 +27,7 @@ def record_payout_activity(fulfillment):
kwargs['profile'] = fulfillment.funder_profile
kwargs['metadata']['from'] = fulfillment.funder_profile.handle
kwargs['metadata']['to'] = fulfillment.profile.handle
- kwargs['metadata']['payout_amount'] = str(fulfillment.payout_amount)
+ kwargs['metadata']['payout_amount'] = str(Decimal(fulfillment.payout_amount).normalize())
kwargs['metadata']['token_name'] = fulfillment.token_name
try:
diff --git a/app/dashboard/templates/bounty/details2.html b/app/dashboard/templates/bounty/details2.html
index e8e453d841f..9b007cb0433 100644
--- a/app/dashboard/templates/bounty/details2.html
+++ b/app/dashboard/templates/bounty/details2.html
@@ -932,7 +932,7 @@
ALL ACTIVITY
>
[[ activity.metadata.to ]]
- [[ activity.metadata.token_value ]] [[ activity.metadata.token_name ]]
+ [[ activity.metadata.payout_amount ]] [[ activity.metadata.token_name ]]
to [[ activity.metadata.token_value ]] [[ activity.metadata.token_name ]]
diff --git a/app/dashboard/tests/factories/bounty_factory.py b/app/dashboard/tests/factories/bounty_factory.py
new file mode 100644
index 00000000000..9d0fe04d5e3
--- /dev/null
+++ b/app/dashboard/tests/factories/bounty_factory.py
@@ -0,0 +1,15 @@
+from datetime import datetime, timedelta
+
+import factory
+from dashboard.models import Bounty
+
+
+class BountyFactory(factory.django.DjangoModelFactory):
+ class Meta:
+ model = Bounty
+
+ web3_created = datetime.now()
+ is_open = True
+ expires_date = datetime.now() + timedelta(days=365)
+ raw_data = {}
+ bounty_owner_github_username = 'gitcoin'
\ No newline at end of file
diff --git a/app/dashboard/tests/factories/fulfillment_factory.py b/app/dashboard/tests/factories/fulfillment_factory.py
new file mode 100644
index 00000000000..fba77211583
--- /dev/null
+++ b/app/dashboard/tests/factories/fulfillment_factory.py
@@ -0,0 +1,13 @@
+import factory
+
+from dashboard.models import BountyFulfillment
+from .bounty_factory import BountyFactory
+from .profile_factory import ProfileFactory
+
+
+class FulfillmentFactory(factory.django.DjangoModelFactory):
+ class Meta:
+ model = BountyFulfillment
+
+ bounty = factory.SubFactory(BountyFactory)
+ profile = factory.SubFactory(ProfileFactory)
\ No newline at end of file
diff --git a/app/dashboard/tests/views/test_bounty_api.py b/app/dashboard/tests/views/test_bounty_api.py
new file mode 100644
index 00000000000..7e6edf31083
--- /dev/null
+++ b/app/dashboard/tests/views/test_bounty_api.py
@@ -0,0 +1,16 @@
+import pytest
+from dashboard.tests.factories.bounty_factory import BountyFactory
+from rest_framework.test import APIClient
+
+
+class TestBountyAPI:
+ def test_retrieves_activities(self, django_user_model):
+ github_url = {'github_url': 'https://github.com/gitcoinco/web/issues/1'}
+ BountyFactory(**github_url)
+ user = django_user_model.objects.create(username="gitcoin", password="password123")
+ client = APIClient()
+
+ client.force_login(user)
+ response = client.get('/actions/api/v0.1/bounty/', github_url, format='json')
+
+ assert response.status_code == 200
\ No newline at end of file
diff --git a/app/dashboard/tests/views/test_bounty_payout.py b/app/dashboard/tests/views/test_bounty_payout.py
new file mode 100644
index 00000000000..b7ee7043333
--- /dev/null
+++ b/app/dashboard/tests/views/test_bounty_payout.py
@@ -0,0 +1,34 @@
+import pytest
+from dashboard.tests.factories.profile_factory import ProfileFactory
+from dashboard.tests.factories.bounty_factory import BountyFactory
+from dashboard.tests.factories.fulfillment_factory import FulfillmentFactory
+from rest_framework.test import APIClient
+
+
+@pytest.mark.django_db
+class TestBountyPayout:
+ def test_pays_out_bounty(self, django_user_model):
+ github_url = {'github_url': 'https://github.com/gitcoinco/web/issues/1'}
+ BountyFactory(**github_url)
+ user = django_user_model.objects.create(username="gitcoin", password="password123")
+ ProfileFactory(user=user)
+ fulfillment = FulfillmentFactory()
+
+ client = APIClient()
+
+ client.force_login(user)
+
+ payload = {
+ 'payout_type': 'fiat',
+ 'tenant': 'testtenant',
+ 'amount': '1',
+ 'token_name': 'ETH',
+ 'funder_address': '0x0',
+ 'payout_status': 'pending',
+ 'funder_identifier': 'test_funder_identifier',
+ 'payout_tx_id': '0x0',
+ }
+
+ response = client.post(f'/api/v1/bounty/payout/{fulfillment.id}', payload)
+
+ assert response.status_code == 200
\ No newline at end of file