-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
275 additions
and
143 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
File renamed without changes.
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,11 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
|
||
|
||
if __name__ == "__main__": | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") | ||
|
||
from django.core.management import execute_from_command_line | ||
|
||
execute_from_command_line(sys.argv) |
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,113 @@ | ||
# flake8: noqa | ||
|
||
import os | ||
import sys | ||
|
||
abspath = lambda *p: os.path.abspath(os.path.join(*p)) | ||
|
||
PROJECT_ROOT = abspath(os.path.dirname(__file__)) | ||
PAYMENT_MODULE_PATH = abspath(PROJECT_ROOT, '..') | ||
sys.path.insert(0, PAYMENT_MODULE_PATH) | ||
|
||
DEBUG = True | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': 'test.db' | ||
}, | ||
} | ||
|
||
SECRET_KEY = 'not_so_secret' | ||
|
||
USE_TZ = True | ||
|
||
# Use a fast hasher to speed up tests. | ||
PASSWORD_HASHERS = [ | ||
'django.contrib.auth.hashers.MD5PasswordHasher', | ||
] | ||
|
||
INSTALLED_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.contenttypes', | ||
'django_fsm', | ||
'djmoney', | ||
'tests', | ||
'payment.apps.PaymentConfig', | ||
] | ||
|
||
MIDDLEWARE = [ | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
] | ||
|
||
STATIC_URL = '/static/' | ||
|
||
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static/') | ||
|
||
STATICFILES_DIRS = [os.path.join(PROJECT_ROOT, 'project/static')] | ||
|
||
ROOT_URLCONF = 'urls' | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': ['templates'], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.contrib.auth.context_processors.auth', | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.i18n', | ||
'django.template.context_processors.request', | ||
'django.template.context_processors.static', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
DUMMY = "dummy" | ||
STRIPE = "stripe" | ||
|
||
CHECKOUT_PAYMENT_GATEWAYS = { | ||
DUMMY: "Dummy gateway", | ||
STRIPE: "Stripe", | ||
} | ||
|
||
PAYMENT_GATEWAYS = { | ||
DUMMY: { | ||
"module": "payment.gateways.dummy", | ||
"config": { | ||
"auto_capture": True, | ||
"connection_params": {}, | ||
"template_path": "payment/dummy.html", | ||
}, | ||
}, | ||
STRIPE: { | ||
"module": "payment.gateways.stripe", | ||
"config": { | ||
"auto_capture": True, | ||
"template_path": "payment/stripe.html", | ||
"connection_params": { | ||
"public_key": os.environ.get("STRIPE_PUBLIC_KEY"), | ||
"secret_key": os.environ.get("STRIPE_SECRET_KEY"), | ||
"store_name": os.environ.get("STRIPE_STORE_NAME", "skioo shop"), | ||
"store_image": os.environ.get("STRIPE_STORE_IMAGE", None), | ||
"prefill": os.environ.get("STRIPE_PREFILL", True), | ||
"remember_me": os.environ.get("STRIPE_REMEMBER_ME", False), | ||
"locale": os.environ.get("STRIPE_LOCALE", "auto"), | ||
"enable_billing_address": os.environ.get( | ||
"STRIPE_ENABLE_BILLING_ADDRESS", False | ||
), | ||
"enable_shipping_address": os.environ.get( | ||
"STRIPE_ENABLE_SHIPPING_ADDRESS", False | ||
), | ||
}, | ||
}, | ||
}, | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,21 @@ | ||
from django.contrib import admin | ||
from django.urls import path | ||
|
||
from views.stripe import view_payment, checkout, elements_token, payment_intents_manual_flow, \ | ||
payment_intents_confirm_payment, capture | ||
|
||
urlpatterns = [ | ||
path('admin/', admin.site.urls), | ||
|
||
path('<payment_id>', view_payment, name='view_payment'), | ||
|
||
path('<payment_id>/stripe/checkout', checkout, name='stripe_checkout'), | ||
path('<payment_id>/stripe/elements_token', elements_token, name='stripe_elements_token'), | ||
|
||
path('<payment_id>/stripe/payment_intents_manual_flow', payment_intents_manual_flow, | ||
name='stripe_payment_intents_manual_flow'), | ||
path('<payment_id>/stripe/payment_intents_confirm_payment', payment_intents_confirm_payment, | ||
name='stripe_payment_intents_confirm_payment'), | ||
|
||
path('<payment_id>/stripe/capture', capture, name='strip_capture'), | ||
] |
File renamed without changes.
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
Oops, something went wrong.