-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added django payment checkout using stripe
- Loading branch information
Joel Wembo
committed
Oct 15, 2023
1 parent
285157c
commit 2b76761
Showing
53 changed files
with
2,281 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
SERVER= | ||
DEBUG=True | ||
SECRET_KEY= | ||
DJANGO_SECRET_KEY= | ||
DJANGO_SUPERUSER_PASSWORD=abcde@12345 | ||
DJANGO_SUPERUSER_EMAIL=[email protected] | ||
DJANGO_SUPERUSER_USERNAME=joelwembo | ||
|
||
DEBUG=True | ||
SECRET_KEY=S3cr3t_K#Key77666345001 | ||
SERVER=https://prodxengine.com | ||
DJANGO_SECRET_KEY=%jjnu7=54g6s%qjfnhbpw0zeoei=$!her*y(p%!&84rs$4l85io | ||
ALLOWED_PORTS=0.0.0.0 | ||
POSTGRES_NAME=fintech_enterpriseDB | ||
ALLOWED_PORTS=localhost | ||
POSTGRES_NAME=CloudAppDB | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=postgres | ||
POSTGRES_PORT=5432 | ||
# POSTGRES_HOST=localhost | ||
POSTGRES_HOST=host.docker.internal | ||
# POSTGRES_HOST=3.0.55.190 | ||
POSTGRES_HOST=localhost | ||
# POSTGRES_HOST=host.docker.internal | ||
# POSTGRES_HOST=3.0.55.190 | ||
|
||
STRIPE_PUBLISHABLE_KEY= | ||
STRIPE_SECRET_KEY= | ||
BACKEND_DOMAIN=http://127.0.0.1:8585/ | ||
PAYMENT_SUCCESS_URL=http://127.0.0.1:8585/api/v1/products/success/ | ||
PAYMENT_CANCEL_URL=http://127.0.0.1:8585/api/v1/products/cancel/ | ||
STRIPE_WEBHOOK_SECRET= |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.4 on 2023-10-05 11:42 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("finances", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Restaurant", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("name", models.CharField(max_length=100)), | ||
("address", models.CharField(max_length=200)), | ||
], | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
apps/finances/migrations/0003_delete_restaurant_alter_account_initial_balance.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,20 @@ | ||
# Generated by Django 4.2.6 on 2023-10-15 14:14 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("finances", "0002_restaurant"), | ||
] | ||
|
||
operations = [ | ||
migrations.DeleteModel( | ||
name="Restaurant", | ||
), | ||
migrations.AlterField( | ||
model_name="account", | ||
name="initial_balance", | ||
field=models.DecimalField(decimal_places=2, default=1, max_digits=10), | ||
), | ||
] |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import graphene | ||
from graphene_django import DjangoObjectType | ||
from .models import Account | ||
|
||
|
||
class AccountType(DjangoObjectType): | ||
class Meta: | ||
model = Account | ||
fields = ("id", "name", "initial_balance", "active") | ||
|
||
|
||
class Query(graphene.ObjectType): | ||
""" | ||
Queries for the Account model | ||
""" | ||
accounts = graphene.List(AccountType) | ||
|
||
def resolve_accounts(self, info, **kwargs): | ||
return Account.objects.all() | ||
|
||
|
||
class CreateAccount(graphene.Mutation): | ||
class Arguments: | ||
name = graphene.String() | ||
initial_balance = graphene.Float() | ||
active = graphene.Boolean() | ||
|
||
ok = graphene.Boolean() | ||
account = graphene.Field(AccountType) | ||
|
||
def mutate(self, info, name, initial_balance, active): | ||
account = Account(name=name, initial_balance=initial_balance, active=active) | ||
account.save() | ||
return CreateAccount(ok=True, account=account) | ||
|
||
class DeleteAccount(graphene.Mutation): | ||
class Arguments: | ||
id = graphene.Int() | ||
|
||
ok = graphene.Boolean() | ||
|
||
def mutate(self, info, id): | ||
account = Account.objects.get(id=id) | ||
account.delete() | ||
return DeleteAccount(ok=True) | ||
|
||
|
||
class UpdateAccount(graphene.Mutation): | ||
class Arguments: | ||
id = graphene.Int() | ||
name = graphene.String() | ||
initial_balance = graphene.Float() | ||
active = graphene.Boolean() | ||
|
||
ok = graphene.Boolean() | ||
account = graphene.Field(AccountType) | ||
|
||
def mutate(self, info, id, name, initial_balance, active): | ||
account = Account.objects.get(id=id) | ||
account.name = name | ||
account.initial_balance = initial_balance | ||
account.active = active | ||
account.save() | ||
return UpdateAccount(ok=True, account=account) | ||
|
||
|
||
class Mutation(graphene.ObjectType): | ||
create_Account = CreateAccount.Field() | ||
delete_Account = DeleteAccount.Field() | ||
update_Account = UpdateAccount.Field() | ||
|
||
|
||
schema = graphene.Schema(query=Query, mutation=Mutation) |
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,74 @@ | ||
import graphene | ||
from graphene_django import DjangoObjectType | ||
from .models import Transaction | ||
|
||
|
||
class TransactionType(DjangoObjectType): | ||
class Meta: | ||
model = Transaction | ||
fields = ("id", "date", "amount", "description", "type", "category", "account") | ||
|
||
|
||
|
||
class Query(graphene.ObjectType): | ||
""" | ||
Queries for the Account model | ||
""" | ||
transactions = graphene.List(TransactionType) | ||
|
||
def resolve_accounts(self, info, **kwargs): | ||
return Transaction.objects.all() | ||
|
||
|
||
# class CreateAccount(graphene.Mutation): | ||
# class Arguments: | ||
# name = graphene.String() | ||
# initial_balance = graphene.Float() | ||
# active = graphene.Boolean() | ||
|
||
# ok = graphene.Boolean() | ||
# account = graphene.Field(AccountType) | ||
|
||
# def mutate(self, info, name, initial_balance, active): | ||
# account = Account(name=name, initial_balance=initial_balance, active=active) | ||
# account.save() | ||
# return CreateAccount(ok=True, account=account) | ||
|
||
# class DeleteAccount(graphene.Mutation): | ||
# class Arguments: | ||
# id = graphene.Int() | ||
|
||
# ok = graphene.Boolean() | ||
|
||
# def mutate(self, info, id): | ||
# account = Account.objects.get(id=id) | ||
# account.delete() | ||
# return DeleteAccount(ok=True) | ||
|
||
|
||
# class UpdateAccount(graphene.Mutation): | ||
# class Arguments: | ||
# id = graphene.Int() | ||
# name = graphene.String() | ||
# initial_balance = graphene.Float() | ||
# active = graphene.Boolean() | ||
|
||
# ok = graphene.Boolean() | ||
# account = graphene.Field(AccountType) | ||
|
||
# def mutate(self, info, id, name, initial_balance, active): | ||
# account = Account.objects.get(id=id) | ||
# account.name = name | ||
# account.initial_balance = initial_balance | ||
# account.active = active | ||
# account.save() | ||
# return UpdateAccount(ok=True, account=account) | ||
|
||
|
||
# class Mutation(graphene.ObjectType): | ||
# create_Account = CreateAccount.Field() | ||
# delete_Account = DeleteAccount.Field() | ||
# update_Account = UpdateAccount.Field() | ||
|
||
|
||
schema = graphene.Schema(query=Query) |
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
Empty file.
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,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
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,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class PaymentsConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "apps.home" |
Empty file.
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,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
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,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,5 @@ | ||
from django.urls import path | ||
from . import views | ||
urlpatterns = [ | ||
path('', views.home, name = 'home'), | ||
] |
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,8 @@ | ||
from django.shortcuts import render | ||
from django.http import HttpResponse | ||
import requests | ||
|
||
# display users | ||
def home(request): | ||
return render(request, "home/index.html") | ||
|
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,3 +0,0 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
Oops, something went wrong.