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
2214a86d
Commit
2214a86d
authored
3 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Update Invoice if person changes
parent
ac70f7f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!17
Update Invoice if person changes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/tezor/preferences.py
+11
-0
11 additions, 0 deletions
aleksis/apps/tezor/preferences.py
aleksis/apps/tezor/util/invoice.py
+23
-0
23 additions, 0 deletions
aleksis/apps/tezor/util/invoice.py
with
34 additions
and
0 deletions
aleksis/apps/tezor/preferences.py
+
11
−
0
View file @
2214a86d
...
...
@@ -32,3 +32,14 @@ class EnablePledge(BooleanPreference):
verbose_name
=
_
(
"
Enable pledged payments
"
)
default
=
False
required
=
False
@site_preferences_registry.register
class
UpdateOnPersonChange
(
BooleanPreference
):
"""
Update Invoices if person data changes.
"""
section
=
payments
name
=
"
update_on_person_change
"
verbose_name
=
_
(
"
Update Invoices if person data changes
"
)
default
=
True
required
=
False
This diff is collapsed.
Click to expand it.
aleksis/apps/tezor/util/invoice.py
+
23
−
0
View file @
2214a86d
from
django.db.models.signals
import
pre_save
from
django.dispatch
import
receiver
from
aleksis.core.util.core_helpers
import
get_site_preferences
from
aleksis.core.models
import
Person
from
..models.invoice
import
Invoice
def
provider_factory
(
variant
,
payment
=
None
):
from
djp_sepa.providers
import
DirectDebitProvider
,
PaymentPledgeProvider
# noqa
from
payments.paypal
import
PaypalProvider
# noqa
...
...
@@ -41,3 +49,18 @@ def provider_factory(variant, payment=None):
)
return
KeyError
(
"
Provider not found or not configured for client.
"
)
@receiver
(
post_save
,
sender
=
Person
)
def
update_on_person_change
(
sender
,
**
kwargs
):
if
Invoice
.
objects
.
filter
(
person
=
sender
,
status__in
=
(
"
waiting
"
,
"
input
"
,
"
preauth
"
)).
exists
()
and
get_site_preferences
()[
"
payments__update_on_person_change
"
]:
Invoice
.
objects
.
filter
(
person
=
sender
).
update
(
billing_email
=
person
.
email
,
billing_first_name
=
person
.
first_name
,
billing_last_name
=
person
.
last_name
,
billing_address_1
=
f
"
{
person
.
street
}
{
person
.
housenumber
}
"
,
billing_postcode
=
person
.
postal_code
,
billing_city
=
person
.
place
,
)
else
:
pass
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