Skip to content

Commit

Permalink
Merge pull request #83 from AAISS/sms
Browse files Browse the repository at this point in the history
0 payment
  • Loading branch information
AlirezaYousefpourM authored Jan 14, 2025
2 parents 056e719 + 6bac3a6 commit 6a094a8
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 52 deletions.
4 changes: 3 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
data
media
static
*.json
*.json
.venv/
db.sqlite3
1 change: 1 addition & 0 deletions backend/aaiss_backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'rest_framework_simplejwt',
'corsheaders',
'backend_api',
'drf_yasg',
]

MIDDLEWARE = [
Expand Down
17 changes: 17 additions & 0 deletions backend/aaiss_backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,25 @@
"""
from django.contrib import admin
from django.urls import path, include
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi

schema_view = get_schema_view(
openapi.Info(
title="Your Project API",
default_version='v1',
description="API documentation for your project",
terms_of_service="https://www.google.com/policies/terms/",
contact=openapi.Contact(email="[email protected]"),
license=openapi.License(name="BSD License"),
),
public=True,
permission_classes=[permissions.AllowAny,],
)
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('backend_api.urls')),
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
]

5 changes: 5 additions & 0 deletions backend/backend_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ def payment(self, request):
except ValidationError as e:
return Response(e)
payment = Payment.create_payment_for_user(user, discount)

if payment.amount < 1:
payment.update_payment_status(Payment.PaymentStatus.PAYMENT_CONFIRMED)
return Response(new_detailed_response(status.HTTP_202_ACCEPTED, "Payment created successfully",{}))

response = ZIFYRequest().create_payment(str(payment.pk), payment.discounted_amount, user.name,
user.phone_number,
user.account.email)
Expand Down
Binary file modified backend/requirements.txt
Binary file not shown.
Loading

0 comments on commit 6a094a8

Please sign in to comment.