Skip to content
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

Dev server #2110

Merged
merged 12 commits into from
Jun 22, 2024
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
3 changes: 2 additions & 1 deletion api/donate/donate_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@


class DonorSerializer(serializers.ModelSerializer):
currency = serializers.CharField(allow_null=True, allow_blank=True, default='INR')

class Meta:
model = Donor
exclude = ['created_by', 'created_at', 'id']
exclude = ['created_by', 'created_at', 'id', 'payment_id', 'payment_method']

def create(self, validated_data):
validated_data["created_by_id"] = settings.SYSTEM_ADMIN_ID
Expand Down
12 changes: 5 additions & 7 deletions api/donate/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ def post(self, request):
request.data.get("razorpay_payment_id")
)
transaction_details = {
"Payment ID": data['id'],
"Payment Method": data['method'],
"Amount": float(data['amount']) / 100,
"Currency": data['currency'],
"Currency": data['currency', None],
"Name": data['notes']['name'],
"Email": data['notes']['email'],
}
Expand All @@ -115,12 +113,12 @@ def post(self, request):
if extra_data := data['notes'].get('phone_number', None):
transaction_details["Phone Number"] = extra_data
if extra_data := data['notes'].get('pan_number', None):
transaction_details["PAN number"] = extra_data
transaction_details["PAN number"] = extra_data

serializer = DonorSerializer(data=data['notes']['validated_data'])
# if serializer.is_valid():
# serializer.save()
if serializer.is_valid():
serializer.save()

return create_receipt(transaction_details)
except razorpay.errors.SignatureVerificationError as e:
return CustomResponse(message=str(e)).get_failure_response()
return CustomResponse(general_message = "Payment Verification Failed").get_failure_response()
6 changes: 3 additions & 3 deletions api/launchpad/launchpad_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def get(self, request):
district_name=F("user_organization_link_user__org__district__name"),
state=F("user_organization_link_user__org__district__zone__state__name"),
level=F("user_role_link_user__role__title"),
time_=Max("karma_activity_log_user__created_at"),
time_=Max("karma_activity_log_user__created_at")
).filter(
level__in=allowed_levels
Q(level__in=allowed_levels) | Q(level__isnull=True)
).distinct()

paginated_queryset = CommonUtils.get_paginated_queryset(
Expand Down Expand Up @@ -431,4 +431,4 @@ def post(self, request):
errors[data.get('email')]["not_found_colleges"] = not_found_colleges
if error:
return CustomResponse(message=errors).get_failure_response()
return CustomResponse(general_message="Successfully added users").get_success_response()
return CustomResponse(general_message="Successfully added users").get_success_response()
2 changes: 1 addition & 1 deletion api/launchpad/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class LaunchpadParticipantsSerializer(serializers.ModelSerializer):
org = serializers.CharField(allow_null=True, allow_blank=True)
district_name = serializers.CharField(allow_null=True, allow_blank=True)
state = serializers.CharField(allow_null=True, allow_blank=True)
level = serializers.CharField()
level = serializers.CharField(allow_null=True, allow_blank=True)

class Meta:
model = User
Expand Down
Loading