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
Commits
b805c615
Commit
b805c615
authored
2 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Move payment preferences to model
parent
4b0f3cea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!15
Update dependency django-payments to v1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aleksis/apps/tezor/forms.py
+13
-1
13 additions, 1 deletion
aleksis/apps/tezor/forms.py
aleksis/apps/tezor/models/base.py
+24
-19
24 additions, 19 deletions
aleksis/apps/tezor/models/base.py
aleksis/apps/tezor/preferences.py
+0
-30
0 additions, 30 deletions
aleksis/apps/tezor/preferences.py
with
37 additions
and
50 deletions
aleksis/apps/tezor/forms.py
+
13
−
1
View file @
b805c615
from
django.utils.translation
import
gettext
as
_
from
material
import
Layout
,
Row
from
material
import
Layout
,
Row
,
Fieldset
from
aleksis.core.forms
import
ActionForm
from
aleksis.core.mixins
import
ExtensibleForm
...
...
@@ -29,14 +29,26 @@ class EditClientForm(ExtensibleForm):
layout
=
Layout
(
Row
(
"
name
"
,
"
email
"
),
Fieldset
(
_
(
"
Payment pledge
"
),
Row
(
"
pledge_enabled
"
),
),
Fieldset
(
_
(
"
Sofort / Klarna
"
),
"
sofort_enabled
"
,
Row
(
"
sofort_api_id
"
,
"
sofort_api_key
"
,
"
sofort_project_id
"
),
),
Fieldset
(
_
(
"
PayPal
"
),
"
paypal_enabled
"
,
Row
(
"
paypal_client_id
"
,
"
paypal_secret
"
,
"
paypal_capture
"
),
),
Fieldset
(
_
(
"
Debit
"
),
"
sdd_enabled
"
,
Row
(
"
sdd_creditor
"
,
"
sdd_creditor_identifier
"
),
Row
(
"
sdd_iban
"
,
"
sdd_bic
"
)
),
)
class
Meta
:
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/tezor/models/base.py
+
24
−
19
View file @
b805c615
from
django.core.validators
import
RegexValidator
from
django.db
import
models
from
django.db.models
import
Q
from
django.utils.translation
import
gettext_lazy
as
_
from
localflavor.generic.models
import
IBANField
,
BICField
from
aleksis.core.util.core_helpers
import
get_site_preferences
from
aleksis.core.mixins
import
ExtensibleModel
...
...
@@ -10,54 +13,56 @@ class Client(ExtensibleModel):
name
=
models
.
CharField
(
verbose_name
=
_
(
"
Name
"
),
max_length
=
255
)
email
=
models
.
EmailField
(
verbose_name
=
_
(
"
Email
"
))
sofort_api_id
=
models
.
CharField
(
verbose_name
=
_
(
"
Sofort / Klarna API ID
"
),
blank
=
True
)
sofort_api_key
=
models
.
CharField
(
verbose_name
=
_
(
"
Sofort / Klarna API key
"
),
blank
=
True
)
sofort_project_id
=
models
.
CharField
(
verbose_name
=
_
(
"
Sofort / Klarna Project ID
"
),
blank
=
True
)
sofort_enabled
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Sofort / Klarna enabled
"
),
default
=
False
)
sofort_api_id
=
models
.
CharField
(
verbose_name
=
_
(
"
Sofort / Klarna API ID
"
),
blank
=
True
,
max_length
=
255
)
sofort_api_key
=
models
.
CharField
(
verbose_name
=
_
(
"
Sofort / Klarna API key
"
),
blank
=
True
,
max_length
=
255
)
sofort_project_id
=
models
.
CharField
(
verbose_name
=
_
(
"
Sofort / Klarna Project ID
"
),
blank
=
True
,
max_length
=
255
)
paypal_client_id
=
models
.
CharField
(
verbose_name
=
_
(
"
PayPal client ID
"
),
blank
=
True
)
paypal_secret
=
models
.
CharField
(
verbose_name
=
_
(
"
PayPal secret
"
),
blank
=
True
)
paypal_enabled
=
models
.
BooleanField
(
verbose_name
=
_
(
"
PayPal enabled
"
),
default
=
False
)
paypal_client_id
=
models
.
CharField
(
verbose_name
=
_
(
"
PayPal client ID
"
),
blank
=
True
,
max_length
=
255
)
paypal_secret
=
models
.
CharField
(
verbose_name
=
_
(
"
PayPal secret
"
),
blank
=
True
,
max_length
=
255
)
paypal_capture
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Use PayPal Authorize & Capture
"
),
default
=
False
)
sdd_creditor
=
models
.
CharField
(
verbose_name
=
_
(
"
SEPA Direct Debit - Creditor name
"
),
blank
=
True
)
sdd_enabled
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Debit enabled
"
),
default
=
False
)
sdd_creditor
=
models
.
CharField
(
verbose_name
=
_
(
"
SEPA Direct Debit - Creditor name
"
),
blank
=
True
,
max_length
=
255
)
sdd_creditor_identifier
=
models
.
CharField
(
verbose_name
=
_
(
"
SEPA Direct Debit - Creditor identifier
"
),
blank
=
True
verbose_name
=
_
(
"
SEPA Direct Debit - Creditor identifier
"
),
blank
=
True
,
max_length
=
35
,
validators
=
[
RegexValidator
(
"
^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,31}$
"
)]
)
sdd_iban
=
IBANField
(
verbose_name
=
_
(
"
IBAN of bank account
"
),
blank
=
True
)
sdd_bic
=
BICField
(
verbose_name
=
_
(
"
BIC/SWIFT code of bank
"
),
blank
=
True
)
class
Meta
:
sofort_enabled
=
get_site_preferences
(
"
payments__sofort_enabled
"
)
paypal_enabled
=
get_site_preferences
(
"
payments__paypal_enabled
"
)
debit_enabled
=
get_site_preferences
(
"
payments__debit_enabled
"
)
pledge_enabled
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Pledge enabled
"
),
default
=
False
)
class
Meta
:
constraints
=
[
models
.
UniqueConstraint
(
fields
=
[
"
name
"
,
"
site
"
],
name
=
"
uniq_client_per_site
"
),
models
.
CheckConstraint
(
check
=
(
check
=
(
(
Q
(
sofort_enabled
=
True
)
&
~
Q
(
sofort_api_id
=
""
)
&
~
Q
(
sofort_api_key
=
""
)
&
~
Q
(
sofort_project_id
=
""
)
)
|
Q
(
sofort_enabled
=
False
),
|
Q
(
sofort_enabled
=
False
)
)
,
name
=
"
sofort_enabled_configured
"
,
),
models
.
CheckConstraint
(
check
=
(
Q
(
debit
_enabled
=
True
)
check
=
(
(
Q
(
sdd
_enabled
=
True
)
&
~
Q
(
sdd_creditor
=
""
)
&
~
Q
(
sdd_creditor_identifier
=
""
)
&
~
Q
(
sdd_iban
=
""
)
&
~
Q
(
sdd_bic
=
""
)
)
|
Q
(
debit
_enabled
=
False
),
name
=
"
debit
_enabled_configured
"
,
|
Q
(
sdd
_enabled
=
False
)
)
,
name
=
"
sdd
_enabled_configured
"
,
),
models
.
CheckConstraint
(
check
=
(
Q
(
paypal_enabled
=
True
)
&
~
Q
(
paypal_client_id
=
""
)
&
~
Q
(
paypal_secret
=
""
))
|
Q
(
paypal_enabled
=
False
),
check
=
(
(
Q
(
paypal_enabled
=
True
)
&
~
Q
(
paypal_client_id
=
""
)
&
~
Q
(
paypal_secret
=
""
))
|
Q
(
paypal_enabled
=
False
)
)
,
name
=
"
paypal_enabled_configured
"
,
),
]
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/tezor/preferences.py
+
0
−
30
View file @
b805c615
...
...
@@ -32,33 +32,3 @@ class EnablePledge(BooleanPreference):
verbose_name
=
_
(
"
Enable pledged payments
"
)
default
=
False
required
=
False
@site_preferences_registry.register
class
EnablePayPal
(
BooleanPreference
):
"""
Payment paypal payment backend - enable or not.
"""
section
=
payments
name
=
"
paypal_enabled
"
verbose_name
=
_
(
"
Enable PayPal payments
"
)
default
=
False
required
=
False
@site_preferences_registry.register
class
EnableSofort
(
BooleanPreference
):
"""
Payment sofort payment backend - enable or not.
"""
section
=
payments
name
=
"
sofort_enabled
"
verbose_name
=
_
(
"
Enable Sofort payments
"
)
default
=
False
required
=
False
@site_preferences_registry.register
class
EnableDebit
(
BooleanPreference
):
"""
Payment debit payment backend - enable or not.
"""
section
=
payments
name
=
"
sdd_enabled
"
verbose_name
=
_
(
"
Enable debit payments
"
)
default
=
False
required
=
False
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment