WIP Stripe integration.

This commit is contained in:
Víðir Valberg Guðmundsson 2023-01-22 10:04:52 +01:00
parent b9f77251f1
commit 9c777e3d9d
7 changed files with 53 additions and 6 deletions

3
env
View file

@ -5,3 +5,6 @@ POSTGRES_PORT=5432
DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres
DEBUG=True
DJANGO_ENV=development
STRIPE_LIVE_SECRET_KEY=getfromstripeaccount
STRIPE_TEST_SECRET_KEY=getfromstripeaccount
STRIPE_WEBHOOK_SECRET=getfromstripeaccount

View file

@ -6,3 +6,4 @@ environs[django]==9.3
uvicorn==0.13
whitenoise==5.2
django-zen-queries==2.1.0
dj-stripe==2.7.3

View file

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements/base.txt requirements/base.in
@ -22,13 +22,17 @@ dj-database-url==1.0.0
# via environs
dj-email-url==1.0.6
# via environs
dj-stripe==2.7.3
# via -r requirements/base.in
django==4.1.5
# via
# -r requirements/base.in
# dj-database-url
# dj-stripe
# django-allauth
# django-money
# django-zen-queries
# jsonfield
django-allauth==0.46
# via -r requirements/base.in
django-cache-url==3.4.2
@ -43,6 +47,8 @@ h11==0.14.0
# via uvicorn
idna==3.4
# via requests
jsonfield==3.1.0
# via dj-stripe
marshmallow==3.19.0
# via environs
oauthlib==3.2.2
@ -67,10 +73,13 @@ requests==2.28.1
# via
# django-allauth
# requests-oauthlib
# stripe
requests-oauthlib==1.3.1
# via django-allauth
sqlparse==0.4.3
# via django
stripe==4.2.0
# via dj-stripe
urllib3==1.26.12
# via requests
uvicorn==0.13

View file

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements/dev.txt requirements/dev.in
@ -48,10 +48,13 @@ dj-email-url==1.0.6
# via
# -r requirements/test.txt
# environs
dj-stripe==2.7.3
# via -r requirements/test.txt
django==4.1.5
# via
# -r requirements/test.txt
# dj-database-url
# dj-stripe
# django-allauth
# django-browser-reload
# django-debug-toolbar
@ -60,6 +63,7 @@ django==4.1.5
# django-stubs
# django-stubs-ext
# django-zen-queries
# jsonfield
django-allauth==0.46
# via -r requirements/test.txt
django-browser-reload==1.6.0
@ -96,6 +100,10 @@ ipython==8.6.0
# via -r requirements/dev.in
jedi==0.18.1
# via ipython
jsonfield==3.1.0
# via
# -r requirements/test.txt
# dj-stripe
lxml==4.9.1
# via
# -r requirements/test.txt
@ -165,6 +173,7 @@ requests==2.28.1
# -r requirements/test.txt
# django-allauth
# requests-oauthlib
# stripe
requests-oauthlib==1.3.1
# via
# -r requirements/test.txt
@ -178,12 +187,14 @@ sqlparse==0.4.3
# django-debug-toolbar
stack-data==0.6.1
# via ipython
stripe==4.2.0
# via
# -r requirements/test.txt
# dj-stripe
tblib==1.7.0
# via -r requirements/test.txt
tomli==2.0.1
# via
# django-stubs
# mypy
# via django-stubs
traitlets==5.5.0
# via
# ipython

View file

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=requirements/test.txt requirements/test.in
@ -42,13 +42,17 @@ dj-email-url==1.0.6
# via
# -r requirements/base.txt
# environs
dj-stripe==2.7.3
# via -r requirements/base.txt
django==4.1.5
# via
# -r requirements/base.txt
# dj-database-url
# dj-stripe
# django-allauth
# django-money
# django-zen-queries
# jsonfield
django-allauth==0.46
# via -r requirements/base.txt
django-cache-url==3.4.2
@ -69,6 +73,10 @@ idna==3.4
# via
# -r requirements/base.txt
# requests
jsonfield==3.1.0
# via
# -r requirements/base.txt
# dj-stripe
lxml==4.9.1
# via unittest-xml-reporting
marshmallow==3.19.0
@ -114,6 +122,7 @@ requests==2.28.1
# -r requirements/base.txt
# django-allauth
# requests-oauthlib
# stripe
requests-oauthlib==1.3.1
# via
# -r requirements/base.txt
@ -122,6 +131,10 @@ sqlparse==0.4.3
# via
# -r requirements/base.txt
# django
stripe==4.2.0
# via
# -r requirements/base.txt
# dj-stripe
tblib==1.7.0
# via -r requirements/test.in
unittest-xml-reporting==3.2.0

View file

@ -40,6 +40,7 @@ DJANGO_APPS = [
THIRD_PARTY_APPS = [
"allauth",
"allauth.account",
"djstripe",
]
LOCAL_APPS = [
@ -162,3 +163,11 @@ if DEBUG:
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda _x: DEBUG,
}
# Stripe configuration
STRIPE_LIVE_SECRET_KEY = env.str("STRIPE_LIVE_SECRET_KEY")
STRIPE_TEST_SECRET_KEY = env.str("STRIPE_TEST_SECRET_KEY")
STRIPE_LIVE_MODE = False
DJSTRIPE_WEBHOOK_SECRET = env.str("STRIPE_WEBHOOK_SECRET")
DJSTRIPE_USE_NATIVE_JSONFIELD = True
DJSTRIPE_FOREIGN_KEY_TO_FIELD = "id"

View file

@ -22,6 +22,7 @@ urlpatterns = [
name="admin-members-detail",
),
path("accounts/", include("allauth.urls")),
path("stripe/", include("djstripe.urls", namespace="djstripe")),
path("_admin/", admin.site.urls),
]