8000 GITC-109: add txnhash to report endpoint by thelostone-mc · Pull Request #9223 · gitcoinco/web · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

GITC-109: add txnhash to report endpoint #9223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
11 changes: 8 additions & 3 deletions app/grants/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class TransactionsSerializer(serializers.Serializer):
amount = serializers.SerializerMethodField()
clr_round = serializers.SerializerMethodField()
usd_value = serializers.SerializerMethodField()
tx_hash = serializers.SerializerMethodField()

def get_amount(self, obj):
subscription = obj.subscription
Expand All @@ -73,11 +74,14 @@ def get_clr_round(self, obj):
def get_usd_value(self, obj):
subscription = obj.subscription
return subscription.get_converted_amount(ignore_gitcoin_fee=False)


def get_tx_hash(self, obj):
return obj.tx_id if obj.tx_id else obj.split_tx_id

class Meta:
"""Define the Transactions serializer metadata."""

fields = ('asset', 'timestamp', 'amount', 'clr_round', 'usd_value')
fields = ('asset', 'timestamp', 'amount', 'clr_round', 'usd_value', 'tx_hash')

class CLRPayoutsSerializer(serializers.Serializer):
"""Handle serializing CLR Payout information."""
Expand All @@ -87,14 +91,15 @@ class CLRPayoutsSerializer(serializers.Serializer):
usd_value = serializers.SerializerMethodField()
timestamp = serializers.DateTimeField(source='created_on')
round = serializers.IntegerField(source='round_number')
tx_hash = serializers.CharField(source='payout_tx')

def get_usd_value(self, obj):
return get_converted_amount(obj.amount, 'DAI')

class Meta:
"""Define the CLRPayout serializer metadata."""

fields = ('amount', 'asset', 'usd_value', 'timestamp', 'round')
fields = ('amount', 'asset', 'usd_value', 'timestamp', 'round', 'tx_hash')

class DonorSerializer(serializers.Serializer):
"""Handle serializing Donor information."""
Expand Down
4 changes: 3 additions & 1 deletion app/grants/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
from dashboard.models import Profile
from grants.models import Grant, GrantCollection, Subscription
from grants.utils import get_clr_rounds_metadata, save_grant_to_notion
from marketing.mails import new_contributions, new_grant, new_grant_admin, notion_failure_email, thank_you_for_supporting
from marketing.mails import (
new_contributions, new_grant, new_grant_admin, notion_failure_email, thank_you_for_supporting,
)
from marketing.models import Stat
from perftools.models import JSONStore
from townsquare.models import Comment
Expand Down
4 changes: 3 additions & 1 deletion app/grants/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
CartActivity, Contribution, Flag, Grant, GrantAPIKey, GrantBrandingRoutingPolicy, GrantCategory, GrantCLR,
GrantCollection, GrantType, MatchPledge, Subscription,
)
from grants.tasks import process_grant_creation_admin_email, process_grant_creation_email, process_notion_db_write, update_grant_metadata
from grants.tasks import (
process_grant_creation_admin_email, process_grant_creation_email, process_notion_db_write, update_grant_metadata,
)
from grants.utils import (
emoji_codes, generate_collection_thumbnail, generate_img_thumbnail_helper, get_clr_rounds_metadata, get_user_code,
is_grant_team_member, sync_payout,
Expand Down
0