WIP Stripe integration.
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build was killed

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 DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres
DEBUG=True DEBUG=True
DJANGO_ENV=development 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 uvicorn==0.13
whitenoise==5.2 whitenoise==5.2
django-zen-queries==2.1.0 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: # by the following command:
# #
# pip-compile --output-file=requirements/base.txt requirements/base.in # pip-compile --output-file=requirements/base.txt requirements/base.in
@ -22,13 +22,17 @@ dj-database-url==1.0.0
# via environs # via environs
dj-email-url==1.0.6 dj-email-url==1.0.6
# via environs # via environs
dj-stripe==2.7.3
# via -r requirements/base.in
django==4.1.5 django==4.1.5
# via # via
# -r requirements/base.in # -r requirements/base.in
# dj-database-url # dj-database-url
# dj-stripe
# django-allauth # django-allauth
# django-money # django-money
# django-zen-queries # django-zen-queries
# jsonfield
django-allauth==0.46 django-allauth==0.46
# via -r requirements/base.in # via -r requirements/base.in
django-cache-url==3.4.2 django-cache-url==3.4.2
@ -43,6 +47,8 @@ h11==0.14.0
# via uvicorn # via uvicorn
idna==3.4 idna==3.4
# via requests # via requests
jsonfield==3.1.0
# via dj-stripe
marshmallow==3.19.0 marshmallow==3.19.0
# via environs # via environs
oauthlib==3.2.2 oauthlib==3.2.2
@ -67,10 +73,13 @@ requests==2.28.1
# via # via
# django-allauth # django-allauth
# requests-oauthlib # requests-oauthlib
# stripe
requests-oauthlib==1.3.1 requests-oauthlib==1.3.1
# via django-allauth # via django-allauth
sqlparse==0.4.3 sqlparse==0.4.3
# via django # via django
stripe==4.2.0
# via dj-stripe
urllib3==1.26.12 urllib3==1.26.12
# via requests # via requests
uvicorn==0.13 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: # by the following command:
# #
# pip-compile --output-file=requirements/dev.txt requirements/dev.in # pip-compile --output-file=requirements/dev.txt requirements/dev.in
@ -48,10 +48,13 @@ dj-email-url==1.0.6
# via # via
# -r requirements/test.txt # -r requirements/test.txt
# environs # environs
dj-stripe==2.7.3
# via -r requirements/test.txt
django==4.1.5 django==4.1.5
# via # via
# -r requirements/test.txt # -r requirements/test.txt
# dj-database-url # dj-database-url
# dj-stripe
# django-allauth # django-allauth
# django-browser-reload # django-browser-reload
# django-debug-toolbar # django-debug-toolbar
@ -60,6 +63,7 @@ django==4.1.5
# django-stubs # django-stubs
# django-stubs-ext # django-stubs-ext
# django-zen-queries # django-zen-queries
# jsonfield
django-allauth==0.46 django-allauth==0.46
# via -r requirements/test.txt # via -r requirements/test.txt
django-browser-reload==1.6.0 django-browser-reload==1.6.0
@ -96,6 +100,10 @@ ipython==8.6.0
# via -r requirements/dev.in # via -r requirements/dev.in
jedi==0.18.1 jedi==0.18.1
# via ipython # via ipython
jsonfield==3.1.0
# via
# -r requirements/test.txt
# dj-stripe
lxml==4.9.1 lxml==4.9.1
# via # via
# -r requirements/test.txt # -r requirements/test.txt
@ -165,6 +173,7 @@ requests==2.28.1
# -r requirements/test.txt # -r requirements/test.txt
# django-allauth # django-allauth
# requests-oauthlib # requests-oauthlib
# stripe
requests-oauthlib==1.3.1 requests-oauthlib==1.3.1
# via # via
# -r requirements/test.txt # -r requirements/test.txt
@ -178,12 +187,14 @@ sqlparse==0.4.3
# django-debug-toolbar # django-debug-toolbar
stack-data==0.6.1 stack-data==0.6.1
# via ipython # via ipython
stripe==4.2.0
# via
# -r requirements/test.txt
# dj-stripe
tblib==1.7.0 tblib==1.7.0
# via -r requirements/test.txt # via -r requirements/test.txt
tomli==2.0.1 tomli==2.0.1
# via # via django-stubs
# django-stubs
# mypy
traitlets==5.5.0 traitlets==5.5.0
# via # via
# ipython # 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: # by the following command:
# #
# pip-compile --output-file=requirements/test.txt requirements/test.in # pip-compile --output-file=requirements/test.txt requirements/test.in
@ -42,13 +42,17 @@ dj-email-url==1.0.6
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# environs # environs
dj-stripe==2.7.3
# via -r requirements/base.txt
django==4.1.5 django==4.1.5
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# dj-database-url # dj-database-url
# dj-stripe
# django-allauth # django-allauth
# django-money # django-money
# django-zen-queries # django-zen-queries
# jsonfield
django-allauth==0.46 django-allauth==0.46
# via -r requirements/base.txt # via -r requirements/base.txt
django-cache-url==3.4.2 django-cache-url==3.4.2
@ -69,6 +73,10 @@ idna==3.4
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# requests # requests
jsonfield==3.1.0
# via
# -r requirements/base.txt
# dj-stripe
lxml==4.9.1 lxml==4.9.1
# via unittest-xml-reporting # via unittest-xml-reporting
marshmallow==3.19.0 marshmallow==3.19.0
@ -114,6 +122,7 @@ requests==2.28.1
# -r requirements/base.txt # -r requirements/base.txt
# django-allauth # django-allauth
# requests-oauthlib # requests-oauthlib
# stripe
requests-oauthlib==1.3.1 requests-oauthlib==1.3.1
# via # via
# -r requirements/base.txt # -r requirements/base.txt
@ -122,6 +131,10 @@ sqlparse==0.4.3
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# django # django
stripe==4.2.0
# via
# -r requirements/base.txt
# dj-stripe
tblib==1.7.0 tblib==1.7.0
# via -r requirements/test.in # via -r requirements/test.in
unittest-xml-reporting==3.2.0 unittest-xml-reporting==3.2.0

View file

@ -40,6 +40,7 @@ DJANGO_APPS = [
THIRD_PARTY_APPS = [ THIRD_PARTY_APPS = [
"allauth", "allauth",
"allauth.account", "allauth.account",
"djstripe",
] ]
LOCAL_APPS = [ LOCAL_APPS = [
@ -162,3 +163,11 @@ if DEBUG:
DEBUG_TOOLBAR_CONFIG = { DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda _x: DEBUG, "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", name="admin-members-detail",
), ),
path("accounts/", include("allauth.urls")), path("accounts/", include("allauth.urls")),
path("stripe/", include("djstripe.urls", namespace="djstripe")),
path("_admin/", admin.site.urls), path("_admin/", admin.site.urls),
] ]