-
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
0 parents
commit cf8b4cd
Showing
17 changed files
with
497 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
.ropeproject/ | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
#Ipython Notebook | ||
.ipynb_checkpoints |
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,13 @@ | ||
Copyright 2017 Martin Gross | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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,3 @@ | ||
recursive-include pretix_cashpayment/static * | ||
recursive-include pretix_cashpayment/templates * | ||
recursive-include pretix_cashpayment/locale * |
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,8 @@ | ||
all: localecompile | ||
|
||
localecompile: | ||
django-admin compilemessages | ||
|
||
localegen: | ||
django-admin makemessages -l de_Informal -l de -i build -i dist -i "*egg*" | ||
|
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,32 @@ | ||
Pretix Cash payment plugin | ||
========================== | ||
|
||
This is a plugin for `pretix`_. | ||
|
||
Development setup | ||
----------------- | ||
|
||
1. Make sure that you have a working `pretix development setup`_. | ||
|
||
2. Clone this repository, eg to ``local/pretix-cashpayment``. | ||
|
||
3. Activate the virtual environment you use for pretix development. | ||
|
||
4. Execute ``python setup.py develop`` within this directory to register this application with pretix's plugin registry. | ||
|
||
5. Execute ``make`` within this directory to compile translations. | ||
|
||
6. Restart your local pretix server. You can now use the plugin from this repository for your events by enabling it in | ||
the 'plugins' tab in the settings. | ||
|
||
|
||
License | ||
------- | ||
|
||
Copyright 2017 Martin Gross | ||
|
||
Released under the terms of the Apache License 2.0 | ||
|
||
|
||
.. _pretix: https://github.com/pretix/pretix | ||
.. _pretix development setup: https://docs.pretix.eu/en/latest/development/setup.html |
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,19 @@ | ||
from django.apps import AppConfig | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
class PluginApp(AppConfig): | ||
name = 'pretix_cashpayment' | ||
verbose_name = 'Pretix Cash Payment plugin' | ||
|
||
class PretixPluginMeta: | ||
name = _('Cash Payment') | ||
author = 'Martin Gross' | ||
description = _('This plugin allows you to offer your customers a "pay with cash at the venue" option.') | ||
visible = True | ||
version = '1.0.0' | ||
|
||
def ready(self): | ||
from . import signals # NOQA | ||
|
||
|
||
default_app_config = 'pretix_cashpayment.PluginApp' |
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,79 @@ | ||
#: pretix_cashpayment/__init__.py:9 pretix_cashpayment/payment.py:14 | ||
msgid "Cash Payment" | ||
msgstr "Barzahlung" | ||
|
||
#: pretix_cashpayment/__init__.py:11 | ||
msgid "" | ||
"This plugin allows you to offer your customers a \"pay with cash at the venue" | ||
"\" option." | ||
msgstr "" | ||
"Dieses Plugin ermöglicht es Ihnen, Ihren Kunden die Barzahlung vor Ort " | ||
"anzubieten" | ||
|
||
#: pretix_cashpayment/payment.py:19 | ||
msgid "Payment information text" | ||
msgstr "Informationstext zur Zahlungsart" | ||
|
||
#: pretix_cashpayment/signals.py:13 | ||
msgid "You can pay your order by cash at the venue." | ||
msgstr "Sie können Ihre Bestellung vor Ort in Bar bezahlen." | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:4 | ||
msgid "This order has been paid via Cash Payment." | ||
msgstr "Diese Bestellung wurde in Bar bezahlt." | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:9 | ||
msgid "Payer" | ||
msgstr "Zahlender" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:11 | ||
msgid "Payment date" | ||
msgstr "Zahlungsdatum" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:13 | ||
msgid "Reference" | ||
msgstr "Verwendungszweck" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:18 | ||
msgid "This order has been marked as paid via Cash Payment manually." | ||
msgstr "Diese Bezahlung wurde manuell als per Barzahlung bezahlt markiert" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:22 | ||
msgid "" | ||
"This order has been planned to be paid via Cash Payment, but no payment has " | ||
"been received yet." | ||
msgstr "" | ||
"Diese Bestellung soll in Bar bezahlt werden, aber noch ist " | ||
"keine Zahlung eingegangen." | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:27 | ||
msgid "Reference code" | ||
msgstr "Verwendungszweck" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/email/order_pending.txt:1 | ||
#, python-format | ||
msgid "" | ||
"\n" | ||
"\n" | ||
"Reference: %(code)s\n" | ||
"Amount: %(total)s %(currency)s\n" | ||
"%(additional_details)s" | ||
msgstr "" | ||
"\n" | ||
"\n" | ||
"Verwendungszweck: %(code)s\n" | ||
"\n" | ||
"Betrag: %(total)s %(currency)s\n" | ||
"%(additional_details)s" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/pending.html:4 | ||
msgid "Please print out this page and bring it with you when paying." | ||
msgstr "Bitte drucken Sie diese Seite aus und bringen Sie diese beim Bezahlen mit." | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/pending.html:11 | ||
msgid "Amount:" | ||
msgstr "Betrag:" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/pending.html:12 | ||
msgid "Reference code (important):" | ||
msgstr "Verwendungszweck (wichtig):" |
79 changes: 79 additions & 0 deletions
79
pretix_cashpayment/locale/de_Informal/LC_MESSAGES/django.po
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,79 @@ | ||
#: pretix_cashpayment/__init__.py:9 pretix_cashpayment/payment.py:14 | ||
msgid "Cash Payment" | ||
msgstr "Barzahlung" | ||
|
||
#: pretix_cashpayment/__init__.py:11 | ||
msgid "" | ||
"This plugin allows you to offer your customers a \"pay with cash at the venue" | ||
"\" option." | ||
msgstr "" | ||
"Dieses Plugin ermöglicht es dir, deinen Kunden die Barzahlung vor Ort " | ||
"anzubieten" | ||
|
||
#: pretix_cashpayment/payment.py:19 | ||
msgid "Payment information text" | ||
msgstr "Informationstext zur Zahlungsart" | ||
|
||
#: pretix_cashpayment/signals.py:13 | ||
msgid "You can pay your order by cash at the venue." | ||
msgstr "Du kannst deine Bestellung vor Ort in Bar bezahlen." | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:4 | ||
msgid "This order has been paid via Cash Payment." | ||
msgstr "Diese Bestellung wurde in Bar bezahlt." | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:9 | ||
msgid "Payer" | ||
msgstr "Zahlender" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:11 | ||
msgid "Payment date" | ||
msgstr "Zahlungsdatum" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:13 | ||
msgid "Reference" | ||
msgstr "Verwendungszweck" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:18 | ||
msgid "This order has been marked as paid via Cash Payment manually." | ||
msgstr "Diese Bezahlung wurde manuell als per Barzahlung bezahlt markiert" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:22 | ||
msgid "" | ||
"This order has been planned to be paid via Cash Payment, but no payment has " | ||
"been received yet." | ||
msgstr "" | ||
"Diese Bestellung soll in Bar bezahlt werden, aber noch ist " | ||
"keine Zahlung eingegangen." | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/control.html:27 | ||
msgid "Reference code" | ||
msgstr "Verwendungszweck" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/email/order_pending.txt:1 | ||
#, python-format | ||
msgid "" | ||
"\n" | ||
"\n" | ||
"Reference: %(code)s\n" | ||
"Amount: %(total)s %(currency)s\n" | ||
"%(additional_details)s" | ||
msgstr "" | ||
"\n" | ||
"\n" | ||
"Verwendungszweck: %(code)s\n" | ||
"\n" | ||
"Betrag: %(total)s %(currency)s\n" | ||
"%(additional_details)s" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/pending.html:4 | ||
msgid "Please print out this page and bring it with you when paying." | ||
msgstr "Bitte drucke diese Seite aus und bringen sie beim Bezahlen mit." | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/pending.html:11 | ||
msgid "Amount:" | ||
msgstr "Betrag:" | ||
|
||
#: pretix_cashpayment/templates/pretix_cashpayment/pending.html:12 | ||
msgid "Reference code (important):" | ||
msgstr "Verwendungszweck (wichtig):" |
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,72 @@ | ||
import json | ||
import segno | ||
from collections import OrderedDict | ||
|
||
from django.template.loader import get_template | ||
from django.utils.translation import ugettext_lazy as _ | ||
from i18nfield.fields import I18nFormField, I18nTextarea | ||
from i18nfield.strings import LazyI18nString | ||
|
||
from pretix.base.payment import BasePaymentProvider | ||
|
||
class CashPayment(BasePaymentProvider): | ||
identifier = 'cashpayment' | ||
verbose_name =_('Cash Payment') | ||
|
||
@property | ||
def settings_form_fields(self): | ||
form_field = I18nFormField( | ||
label = _('Payment information text'), | ||
widget = I18nTextarea, | ||
) | ||
return OrderedDict( | ||
list(super().settings_form_fields.items()) + [('information_text', form_field)] | ||
) | ||
|
||
def payment_form_render(self, request) -> str: | ||
template = get_template('pretix_cashpayment/checkout_payment_form.html') | ||
ctx = { | ||
'request': request, | ||
'event': self.event, | ||
'information_text': self.settings.get('information_text', as_type=LazyI18nString), | ||
} | ||
return template.render(ctx) | ||
|
||
def checkout_prepare(self, request, total): | ||
return True | ||
|
||
def payment_is_valid_session(self, request): | ||
return True | ||
|
||
def checkout_confirm_render(self, request): | ||
return self.payment_form_render(request) | ||
|
||
def order_pending_mail_render(self, order) -> str: | ||
template = get_template('pretix_cashpayment/email/order_pending.txt') | ||
ctx = { | ||
'event': self.event, | ||
'order': order, | ||
'information_text': self.settings.get('information_text', as_type=LazyI18nString), | ||
} | ||
return template.render(ctx) | ||
|
||
def order_pending_render(self, request, order) -> str: | ||
template = get_template('pretix_cashpayment/pending.html') | ||
ctx = { | ||
'event': self.event, | ||
'order': order, | ||
'information_text': self.settings.get('information_text', as_type=LazyI18nString), | ||
'qrcode': segno.make_qr(order.full_code, error='H') | ||
.png_data_uri(scale=10, border=0), | ||
} | ||
return template.render(ctx) | ||
|
||
def order_control_render(self, request, order) -> str: | ||
if order.payment_info: | ||
payment_info = json.loads(order.payment_info) | ||
else: | ||
payment_info = None | ||
template = get_template('pretix_cashpayment/control.html') | ||
ctx = {'request': request, 'event': self.event, | ||
'payment_info': payment_info, 'order': order} | ||
return template.render(ctx) |
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,14 @@ | ||
from pretix.base.signals import register_payment_providers | ||
from django.dispatch import receiver | ||
from pretix.base.settings import settings_hierarkey | ||
from django.utils.translation import ugettext_lazy as _, ugettext_noop | ||
from i18nfield.strings import LazyI18nString | ||
|
||
@receiver(register_payment_providers, dispatch_uid="payment_cash") | ||
def register_payment_provider(sender, **kwargs): | ||
from .payment import CashPayment | ||
return CashPayment | ||
|
||
settings_hierarkey.add_default('payment_cashpayment_information_text', LazyI18nString.from_gettext(ugettext_noop( | ||
"You can pay your order by cash at the venue." | ||
)), LazyI18nString) |
5 changes: 5 additions & 0 deletions
5
pretix_cashpayment/templates/pretix_cashpayment/checkout_payment_form.html
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,5 @@ | ||
{% load i18n %} | ||
|
||
<address> | ||
{{ information_text|linebreaksbr }}<br> | ||
</address> |
Oops, something went wrong.