Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Tezor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Onboarding
AlekSIS-App-Tezor
Merge requests
!3
Implement payment backends and interaction
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Implement payment backends and interaction
payment-backends
into
master
Overview
0
Commits
26
Pipelines
17
Changes
2
Merged
Nik | Klampfradler
requested to merge
payment-backends
into
master
3 years ago
Overview
0
Commits
26
Pipelines
17
Changes
2
Expand
Advances
#3 (closed)
Edited
3 years ago
by
Tom Teichler
0
0
Merge request reports
Viewing commit
8020b76a
Show latest version
2 files
+
113
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
Verified
8020b76a
Implement configuration of payment backends
· 8020b76a
Nik | Klampfradler
authored
3 years ago
aleksis/apps/tezor/apps.py
+
39
−
0
Options
from
django.apps
import
apps
from
aleksis.core.util.apps
import
AppConfig
from
aleksis.core.util.core_helpers
import
get_site_preferences
class
DefaultConfig
(
AppConfig
):
@@ -11,3 +14,39 @@ class DefaultConfig(AppConfig):
}
licence
=
"
EUPL-1.2+
"
copyright_info
=
(([
2022
],
"
Dominik George
"
,
"
dominik.george@teckids.org
"
),)
def
ready
(
self
):
from
django.conf
import
settings
# noqa
settings
.
PAYMENT_MODEL
=
"
tezor.Invoice
"
settings
.
PAYMENT_VARIANTS
=
{
"
dummy
"
:
(
"
payments.dummy.DummyProvider
"
,
{})
}
for
app_config
in
apps
.
app_configs
.
values
():
if
hasattr
(
app_config
,
"
get_payment_variants
"
):
variants
=
app_config
.
get_payment_variants
()
for
name
,
config
in
variants
.
items
():
if
name
not
in
settings
.
PAYMENT_VARIANTS
:
settings
.
PAYMENT_VARIANTS
[
name
]
=
config
def
get_payment_variants
(
self
):
prefs
=
get_site_preferences
()
variants
=
{}
if
prefs
[
"
payments__sofort_api_id
"
]:
variants
[
"
sofort
"
]
=
(
"
payments.sofort.SofortProvider
"
,
{
"
id
"
:
prefs
[
"
payments__sofort_api_id
"
],
"
key
"
:
prefs
[
"
payments__sofort_api_key
"
],
"
project_id
"
:
prefs
[
"
payments__sofort_project_id
"
],
"
endpoint
"
:
"
https://api.sofort.com/api/xml
"
,
})
if
prefs
[
"
payments__paypal_client_id
"
]:
variants
[
"
paypal
"
]
=
(
"
payments.paypal.PaypalProvider
"
,
{
"
client_id
"
:
prefs
[
"
payments__paypal_client_id
"
],
"
secret
"
:
prefs
[
"
payments__paypal_secret
"
],
"
capture
"
:
not
prefs
[
"
payments__paypal_capture
"
],
"
endpoint
"
:
"
https://api.paypal.com
"
,
})
return
variants
Loading