From 4908754b0d5c38c2889719c80bf215baaa1a7195 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Wed, 22 Jun 2022 00:36:46 +0530 Subject: [PATCH] feat: init billing app --- .env-sample | 2 ++ .woodpecker.yml | 1 + Makefile | 1 + dashboard/settings.py | 17 +++++++++++++++++ dashboard/urls.py | 2 ++ requirements.txt | 4 ++++ 6 files changed, 27 insertions(+) diff --git a/.env-sample b/.env-sample index 4320203..ad0189d 100644 --- a/.env-sample +++ b/.env-sample @@ -1,3 +1,5 @@ export DATABASE_URL="" export db="" export OIDC_RSA_PRIVATE_KEY="" +export STRIPE_SECRET_KEY="" +export STRIPE_PUBLIC_KEY="" diff --git a/.woodpecker.yml b/.woodpecker.yml index cb39bdb..d74a7fa 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -10,6 +10,7 @@ pipeline: - make lint - make test - make coverage + secrets: [ STRIPE_PUBLIC_KEY, STRIPE_SECRET_KEY ] services: database: diff --git a/Makefile b/Makefile index 55f1726..2af4ca2 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ lint: ## Run linter @./venv/bin/black ./accounts/* @./venv/bin/black ./dash/* @./venv/bin/black ./support/* + @./venv/bin/black ./billing/* migrate: ## Run migrations $(call run_migrations) diff --git a/dashboard/settings.py b/dashboard/settings.py index d970967..831c722 100644 --- a/dashboard/settings.py +++ b/dashboard/settings.py @@ -45,6 +45,8 @@ INSTALLED_APPS = [ "dash", "support", "oauth2_provider", + "payments", + "billing", ] MIDDLEWARE = [ @@ -144,6 +146,21 @@ OAUTH2_PROVIDER = { } +## django-payments configuration + +PAYMENT_MODEL = "billing.Payment" # please don't change this value +PAYMENT_HOST = "http://localhost:8000" +PAYMENT_VARIANTS = { + "stripe": ( + "payments.stripe.StripeProvider", + { + "secret_key": env.get_value("STRIPE_SECRET_KEY"), + "public_key": env.get_value("STRIPE_PUBLIC_KEY"), + }, + ) +} + + ### Dashbaord specific configuration options HOSTEA = { diff --git a/dashboard/urls.py b/dashboard/urls.py index 7100c8a..12c3a14 100644 --- a/dashboard/urls.py +++ b/dashboard/urls.py @@ -18,6 +18,8 @@ from django.urls import path, include urlpatterns = [ path("o/", include("oauth2_provider.urls", namespace="oauth2_provider")), + path("payments/", include("payments.urls")), + path("billing/", include("billing.urls")), path("admin/", admin.site.urls), path("dash/", include("dash.urls")), path("support/", include("support.urls")), diff --git a/requirements.txt b/requirements.txt index 7dcf61f..50a105c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,8 @@ Deprecated==1.2.13 Django==4.0.3 django-environ==0.8.1 django-oauth-toolkit==2.0.0 +django-payments==1.0.0 +django-phonenumber-field==6.3.0 djangorestframework==3.13.1 greenlet==1.1.2 idna==3.3 @@ -24,6 +26,7 @@ mypy-extensions==0.4.3 oauthlib==3.2.0 parso==0.8.3 pathspec==0.9.0 +phonenumberslite==8.12.50 platformdirs==2.5.1 psycopg2==2.9.3 pycparser==2.21 @@ -32,6 +35,7 @@ pynvim==0.4.3 pytz==2022.1 requests==2.27.1 sqlparse==0.4.2 +stripe==3.4.0 tblib==1.7.0 toml==0.10.2 tomli==2.0.1