-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Naz-iv/setup-stripe-payments
Setup stripe payments
- Loading branch information
Showing
16 changed files
with
189 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.8 on 2023-12-15 14:54 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("borrowing_service", "0001_initial"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="borrowing", | ||
name="user", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="borrowings", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
payment_service/migrations/0002_alter_payment_money_to_be_paid_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Django 4.2.8 on 2023-12-15 16:06 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("payment_service", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="payment", | ||
name="money_to_be_paid", | ||
field=models.DecimalField( | ||
blank=True, decimal_places=2, max_digits=10000, null=True | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="payment", | ||
name="session_id", | ||
field=models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name="payment", | ||
name="session_url", | ||
field=models.URLField(blank=True, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
from rest_framework import serializers | ||
from rest_framework.serializers import ModelSerializer | ||
|
||
from borrowing_service.serializers import BorrowingSerializer | ||
from payment_service.models import Payment | ||
|
||
|
||
class PaymentSerializer(ModelSerializer): | ||
|
||
class PaymentSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Payment | ||
fields = "__all__" | ||
|
||
|
||
class PaymentListSerializer(PaymentSerializer): | ||
borrowing = BorrowingSerializer() | ||
borrowing = serializers.StringRelatedField(many=False, read_only=True) | ||
|
||
class Meta: | ||
model = Payment | ||
fields = ( | ||
"id", | ||
"borrowing", | ||
"money_to_be_paid", | ||
"payment_type", | ||
"money_to_be_paid" | ||
"status", | ||
"money_to_be_paid", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
from django.urls import path, include | ||
from rest_framework import routers | ||
|
||
from payment_service.views import CreateCheckoutSessionView, PaymentViewSet | ||
from payment_service.views import PaymentViewSet | ||
|
||
router = routers.DefaultRouter() | ||
router.register("payments", PaymentViewSet, basename="payments") | ||
|
||
urlpatterns = [ | ||
path( | ||
"create-checkout-session/<int:pk>/", | ||
CreateCheckoutSessionView.as_view(), | ||
name="create-checkout-session", | ||
), | ||
path("", include(router.urls)) | ||
path("", include(router.urls)), | ||
] | ||
|
||
app_name = "payment_service" |
Oops, something went wrong.