Initial commit

main
n0emis 2 years ago
commit 49a0bb34e0
Signed by: n0emis
GPG Key ID: 00FAF748B777CF10

63
.gitignore vendored

@ -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
# Django stuff:
*.log
data/
# Sphinx documentation
docs/_build/
# PyBuilder
target/
#Ipython Notebook
.ipynb_checkpoints

@ -0,0 +1,17 @@
#!/bin/sh
REPO_DIR=$(git rev-parse --show-toplevel)
GIT_DIR=$REPO_DIR/.git
VENV_ACTIVATE=$VIRTUAL_ENV/bin/activate
if [[ ! -f $VENV_ACTIVATE ]]
then
echo "Could not find your virtual environment"
fi
echo "#!/bin/sh" >> $GIT_DIR/hooks/pre-commit
echo "set -e" >> $GIT_DIR/hooks/pre-commit
echo "source $VENV_ACTIVATE" >> $GIT_DIR/hooks/pre-commit
echo "docformatter --check -r ." >> $GIT_DIR/hooks/pre-commit
echo "black --check ." >> $GIT_DIR/hooks/pre-commit
echo "isort -c ." >> $GIT_DIR/hooks/pre-commit
echo "flake8 ." >> $GIT_DIR/hooks/pre-commit
chmod +x $GIT_DIR/hooks/pre-commit

@ -0,0 +1,15 @@
Copyright 2022 n0emis
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.

@ -0,0 +1,5 @@
recursive-include pretix_poos/static *
recursive-include pretix_poos/templates *
recursive-include pretix_poos/locale *
include LICENSE
exclude .gitlab-ci.yml

@ -0,0 +1,10 @@
all: localecompile
LNGS:=`find pretix_poos/locale/ -mindepth 1 -maxdepth 1 -type d -printf "-l %f "`
localecompile:
django-admin compilemessages
localegen:
django-admin makemessages --keep-pot -i build -i dist -i "*egg*" $(LNGS)
.PHONY: all localecompile localegen

@ -0,0 +1,55 @@
Pretix POOS
==========================
This is a plugin for `pretix`_.
Short description
Development setup
-----------------
1. Make sure that you have a working `pretix development setup`_.
2. Clone this repository.
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.
This plugin has CI set up to enforce a few code style rules. To check locally, you need these packages installed::
pip install flake8 isort black docformatter
To check your plugin for rule violations, run::
docformatter --check -r .
black --check .
isort -c .
flake8 .
You can auto-fix some of these issues by running::
docformatter -r .
isort .
black .
To automatically check for these issues before you commit, you can run ``.install-hooks``.
License
-------
Copyright 2022 n0emis
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

@ -0,0 +1,28 @@
from django.utils.translation import gettext_lazy
try:
from pretix.base.plugins import PluginConfig
except ImportError:
raise RuntimeError("Please use pretix 2.7 or above to run this plugin!")
__version__ = "1.0.0"
class PluginApp(PluginConfig):
name = "pretix_poos"
verbose_name = "Pretix POOS"
class PretixPluginMeta:
name = gettext_lazy("Pretix POOS")
author = "n0emis"
description = gettext_lazy("Short description")
visible = True
version = __version__
category = "CUSTOMIZATION"
compatibility = "pretix>=2.7.0"
def ready(self):
from . import signals # NOQA
default_app_config = "pretix_poos.PluginApp"

@ -0,0 +1,19 @@
from django.dispatch import receiver
from pretix.base.signals import register_sales_channels
from pretix.base.channels import SalesChannel
class PoosSalesChannel(SalesChannel):
identifier = "pretixpos"
verbose_name = 'Box office (pretixPOS)'
icon = "shopping-basket"
payment_restrictions_supported = False
customer_accounts_supported = False
@receiver(register_sales_channels, dispatch_uid="poos_register_sales_channels")
def base_sales_channels(sender, **kwargs):
return (
PoosSalesChannel(),
)

@ -0,0 +1,10 @@
from pretix.api.urls import router, orga_router
from django.conf.urls import url
from .views import *
urlpatterns = [
url(r'^api/v1/organizers/(?P<organizer>[^/]+)/posdevices/(?P<device_id>[^/.]+)/closings/', ClosingsView.as_view(), name='api.closings'),
url(r'^api/v1/organizers/(?P<organizer>[^/]+)/pos/cashiers/', CashierView.as_view(), name='api.cashiers'),
]

@ -0,0 +1,45 @@
from rest_framework.response import Response
from rest_framework.views import APIView
class ClosingsView(APIView):
def get(self, request, organizer, device_id):
return Response({
'count': 0,
'next': None,
'previous': None,
'results': []
})
class CashierView(APIView):
def get(self, request, organizer):
return Response({
"count": 1,
"next": None,
"previous": None,
"results": [
{
"active": Trie,
"id": 1,
"last_modified": "2022-02-25T08:26:38.489714+01:00",
"name": "User",
"pin": None,
"team": {
"all_devices": True,
"can_accept_gift_cards": True,
"can_access_settings": True,
"can_manage_cash_close_sessions": False,
"can_open_drawer": True,
"can_perform_refunds": True,
"can_reprint_tickets": True,
"can_switch_events": True,
"can_view_all_orders": True,
"can_view_past_transactions": True,
"devices": [],
"id": 1,
"last_modified": "2022-02-25T08:26:38.484243+01:00",
"name": "Administrators"
},
"userid": "0001"
}
]
})

@ -0,0 +1,41 @@
[flake8]
ignore = N802,W503,E402
max-line-length = 160
exclude = migrations,.ropeproject,static,_static,build
[isort]
combine_as_imports = true
default_section = THIRDPARTY
include_trailing_comma = true
known_third_party = pretix
known_standard_library = typing
multi_line_output = 3
skip = setup.py
use_parentheses = True
force_grid_wrap = 0
line_length = 88
known_first_party = pretix_poos
[tool:pytest]
DJANGO_SETTINGS_MODULE = pretix.testutils.settings
[coverage:run]
source = pretix_poos
omit = */migrations/*,*/urls.py,*/tests/*
[coverage:report]
exclude_lines =
pragma: no cover
def __str__
der __repr__
if settings.DEBUG
NOQA
NotImplementedError
[check-manifest]
ignore =
.update-locales.sh
.install-hooks.sh
Makefile
manage.py
tests/*

@ -0,0 +1,45 @@
import os
from distutils.command.build import build
from django.core import management
from setuptools import find_packages, setup
from pretix_poos import __version__
try:
with open(
os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8"
) as f:
long_description = f.read()
except Exception:
long_description = ""
class CustomBuild(build):
def run(self):
management.call_command("compilemessages", verbosity=1)
build.run(self)
cmdclass = {"build": CustomBuild}
setup(
name="pretix-poos",
version=__version__,
description="Short description",
long_description=long_description,
url="GitHub repository URL",
author="n0emis",
author_email="git@N0emis.eu",
license="Apache",
install_requires=[],
packages=find_packages(exclude=["tests", "tests.*"]),
include_package_data=True,
cmdclass=cmdclass,
entry_points="""
[pretix.plugin]
pretix_poos=pretix_poos:PretixPluginMeta
""",
)
Loading…
Cancel
Save