Giter VIP home page Giter VIP logo

pretix-passbook's Introduction

pretix-passbook

image

image

This is a plugin for pretix. It allows to provide tickets in the passbook format supported by Apple Wallet and a number of Android apps.

Contributing

If you like to contribute to this project, you are very welcome to do so. If you have any questions in the process, please do not hesitate to ask us.

Please note that we have a Code of Conduct in place that applies to all project contributions, including issues, pull requests, etc.

Development setup

  1. Make sure that you have a working pretix development setup.
  2. Clone this repository, eg to local/pretix-passbook.
  3. Activate the virtual environment you use for pretix development.
  4. Execute pip install -e . 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.

Generating Passbook keys and configuring them in pretix

You can generate a key and CSR using:

export CERT_NAME=pass-pretix
openssl genrsa -out $CERT_NAME.key 2048
openssl pkey -in $CERT_NAME.key -traditional > $CERT_NAME.key.pem
openssl req -new -key $CERT_NAME.key -out $CERT_NAME.csr

You can then request a certificate using that CSR in your Apple developer account. You can then convert the downloaded certificate like this:

openssl x509 -inform der -in $CERT_NAME.cer -out $CERT_NAME.pem

After generating the .pem file, upload it to pretix as passbook certificate. Make sure you have uploaded the key generated before (pass-pretix.key) and added the passbook CA of apple. Next add your Team ID in pretix and the passbook type id. The passbook type id is your identifier, as example pass.pretix.example. The Team ID can be found under "Organizational Unit" when opening the passbook certificate, e.g. with Keychain on MacOS. If you have configured your private rsa key with a password you can provide it in pretix.

Click on Save. Enjoy!

License

Copyright 2016 Tobias 'rixx' Kunze and Raphael Michel

Released under the terms of the Apache License 2.0

pretix-passbook's People

Contributors

abdullah-g avatar akhun-delar avatar chronikum avatar edd28 avatar eltorio avatar gruenzeug avatar lalejand avatar lapor-kris avatar luelista avatar maartenberg avatar oocf avatar osokoltreesoft avatar pc-coholic avatar per0x avatar pretix-translations avatar raphaelm avatar regendrogenbogen avatar rhonalchirinos avatar rimi-itk avatar rixx avatar ronijalm avatar sggua avatar tophattom avatar webappconcept avatar wiffbi avatar yichengsd avatar yvovandoorn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pretix-passbook's Issues

TypeError: write() argument must be str, not bytes

[2023-10-26 12:50:29,744: ERROR/ForkPoolWorker-15] Task pretix.base.services.tickets.generate[4a8ce832-be37-45e9-b76c-2b9b6b7abf9e] raised unexpected: TypeError('write() argument must be str, not bytes')
Traceback (most recent call last):
File "/home/rhonal/pretix/venv/lib/python3.10/site-packages/celery/app/trace.py", line 477, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/rhonal/pretix/venv/lib/python3.10/site-packages/pretix/base/services/tasks.py", line 62, in call
ret = super().call(*args, **kwargs)
File "/home/rhonal/pretix/venv/lib/python3.10/site-packages/celery/app/trace.py", line 760, in protected_call
return self.run(*args, **kwargs)
File "/home/rhonal/pretix/venv/lib/python3.10/site-packages/pretix/base/services/tickets.py", line 89, in generate
return generate_orderposition(pk, provider)
File "/home/rhonal/pretix/venv/lib/python3.10/site-packages/pretix/base/services/tickets.py", line 52, in generate_orderposition
filename, ttype, data = prov.generate(order_position)
File "/home/rhonal/pretix/venv/lib/python3.10/site-packages/pretix_passbook/passbook.py", line 380, in generate
certfile.write(order.event.settings.passbook_certificate_file.read())
File "/usr/lib/python3.10/tempfile.py", line 622, in func_wrapper
return func(*args, **kwargs)
TypeError: write() argument must be str, not bytes

Validate PEM Format for RSA Private Key

According to RFC 7468 PKIX Textual Encodings (Chapter 10/11) the Textual Encoding of Private Key Info use the "PRIVATE KEY" label. Encrypted Private Key Info use the "ENCRYPTED PRIVATE KEY" label.
So the key file can also start/end with the following lines

-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----

or

-----BEGIN ENCRYPTED PRIVATE KEY-----
...
-----END ENCRYPTED PRIVATE KEY-----

depending on the application, which creates the key file.

For example, the openssl application with the genpkey command creates PEM files with the aforementioned labels.
Also the openssl req command with the -newkey rsa:2048 option creates this kind of label.
According to the man page, the openssl genrsa command is superseded by genpkey for the generation of RSA Private Keys.

Therefore, it might be a good idea to replace

 openssl genrsa -out $CERT_NAME.key 2048

by

 openssl genpkey -out $CERT_NAME.key -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048

in the README.rst

if not value.startswith('-----BEGIN RSA PRIVATE KEY-----') or not value.endswith('-----END RSA PRIVATE KEY-----'):

openssl genrsa -out $CERT_NAME.key 2048

Provide preview without certificates

I think we should be able to provide a general preview (won't work on Apple devices, but still) coupled with a warning if the global settings are not set.

Question: Passbook Customization

Hello, We are wanting to use a dark background for our pretix tickets but currently, passbook only displays text in black font. Is there a way to change this?

Passbook not working

Hey together,

i just followed the official documentation to implement passbook ticketing.
I also created the keys with
openssl genrsa -out pass-pretix.key 2048 / openssl req -new -key pass-pretix.key -out pass-pretix.csr

Bildschirmfoto 2019-03-18 um 19 50 15

I could download the .pkpass files but I am not able to open them with any iOS Device.
I just attached the generated preview ( pkpass files not allowed, just created a zip file)
ticket-preview.pkpass.zip

Validate that global settings are set

Currently, if you do not set a global certificate and then activate the plugin for an event, all ticket downloads will fail with an error 500 and the admin will not be warned.

Clarify on image file formats

Apple devices expect PNG images. We should either

(a) validate that we only get PNG files

(b) convert the images appropriately

Font colors chosen incorrectly

I had set the background for the passbook/wallet tickets to a light blueish color png.
Unfortunately, this sets the font color of event and product details, as well as the dates, to white, which is unreadable.
The header font color is set to black (in this case, correctly).
In the preview, all is well, all fonts black, but the actual wallet item shows white color.

Internal Server Error

hey i uploaded the csr into the global settings but this bug still persists, i can't Preview the Passbook.

Can anyone help
11
Unbenannt

Clarify on certificate file formats

Apple gives out certificates in DER format but we need PEM format. We could

(a) validate that and reject DER files with a helpful error message

(b) try to automatically convert the file

Question: Passbook Setup

Could someone point me in the right direction on how to setup passbook? I have generated my certificate signing request and gone into the apple developer program and generated a certificate. I have then uploaded the certificate to pretix. I have uploaded the apple CA certificate. Then for the secret key, I cannot get it to accept the private key that is included with the apple certificate.

Add to Apple Wallet Button

Please allow adding the Add to Apple Wallet image next to the View Order Details. It's much more intuitive than explaining that they are supposed to click the attachment on their iOS device. If possible, you could add a QR code for desktop devices so they can download it with their iOS device.

Apple Wallet support broken?

We are currently using pretix 4.2.0, passbook-tickets 1.9.0.
On Android mobile devices everything works fine, but on iOS (iPhone), an error message is displayed:
"Safari cannot download this file".
Any help regarding this issue would be highly appreciated...

Display more details on the pass

We can fill the passes front and back with useful details, if we want to

  • Order codes
  • Human-readable locations
  • Attendee name
  • ...

Notification on lock screen is empty

When I add the coordinates for the geofencing feature, the ticket appears on the lock screen at the location, but the text is completely missing. Only the icon and the preview of the ticket are appearing. Tested on two devices with iOS 16.5 and 16.6.

Thanks,
Lukas
IMG_0851

Error while loading suggested geolocations

Thanks for this nice plugin!
It's working fine here so far, but I can't seem to be able to enter the geolocations in the correct format, I'm always getting the above error...

Naming of Maps API Key

The plugin has a setting to provide an API-Key for the geocoding-Feature.

('passbook_gmaps_api_key', forms.CharField(
label=_('Google Maps API key'),
widget=forms.PasswordInput(render_value=True),
required=False,
help_text=_('Optional, only necessary to find coordinates automatically.')
)),

I would like to reuse it in the Google Pay Passes plugin. While setting up the API-key for myself, I realized that calling the setting "Google Maps API key" might be confusing, as in reality we need a Key for the Geocoding API.

Should we perhaps change the label to "Google Geocoding API key"? The Google API-console is a little confusing at times, as it they call the API "Geocoding API", but sometimes show a Google Maps-Icon next to it.

Please let me know what you think - I would then piggyback on that decision and setting ;-)

"Could not read signing key" and Internal Server Error when generating pass

Both pretix and the plugin are the latest version. I have configured the keys and certificates in the settings. When a pass is generated, an Internal Server Error is thrown and the following is written to the logfile:

ERROR 2024-03-08 21:31:57,898 django.request log Internal Server Error: /control/event/events/2024/settings/tickets/preview/passbook
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pretix/src/pretix/control/permissions.py", line 69, in wrapper
    return function(request, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pretix/src/pretix/control/views/event.py", line 829, in get
    fname, mimet, data = tickets.preview(self.request.event.pk, self.output.identifier)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pretix/src/pretix/base/services/tickets.py", line 123, in preview
    return prov.generate(p)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pretix_passbook/passbook.py", line 571, in generate
    _pass = passfile.create(
            ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wallet/models.py", line 302, in create
    signature = self._createSignature(manifest, certificate, key, wwdr_certificate, password)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wallet/models.py", line 347, in _createSignature
    raise Exception(error)
Exception: b'Could not read signing key from /tmp/tmpwmg6cdcv\n'

Not sure even where to start with this, any help would be appreciated! Let me know if you need any more information.

NFC Support

Please enable NFC Passkit Support. I understand that it requires a different certificate, and am working on it.

It should just require a checkbox and a few lines of code.

This is one of the reasons that I was looking at using Pretix.

AttributeError when pressing preview

I could install the plugin - then I selected 2 images and pressed preview. Then I got this error-page:

AttributeError at /control/event/bigevents/2017/settings/tickets/preview/passbook
'NoneType' object has no attribute 'name'
Request Method:	GET
Request URL:	http://localhost:8000/control/event/bigevents/2017/settings/tickets/preview/passbook
Django Version:	1.10.3
Exception Type:	AttributeError
Exception Value:	
'NoneType' object has no attribute 'name'
Exception Location:	/home/ligi/git/3rd/pretix/local/pretix-passbook/pretix_passbook/passbook.py in generate, line 105
Python Executable:	/usr/bin/python3
Python Version:	3.5.2
Python Path:	
['/home/ligi/git/3rd/pretix/src',
 '/usr/lib/python35.zip',
 '/usr/lib/python3.5',
 '/usr/lib/python3.5/plat-x86_64-linux-gnu',
 '/usr/lib/python3.5/lib-dynload',
 '/home/ligi/.local/lib/python3.5/site-packages',
 '/usr/local/lib/python3.5/dist-packages',
 '/home/ligi/git/3rd/pretix/local/pretix-passbook',
 '/usr/local/lib/python3.5/dist-packages/wallet_py3k-0.0.3-py3.5.egg',
 '/usr/lib/python3/dist-packages',
 '/home/ligi/git/3rd/pretix/src']
Server time:	Wed, 2 Nov 2016 19:48:55 +0000

Environment:


Request Method: GET
Request URL: http://localhost:8000/control/event/bigevents/2017/settings/tickets/preview/passbook

Django Version: 1.10.3
Python Version: 3.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'pretix.base',
 'pretix.control',
 'pretix.presale',
 'pretix.multidomain',
 'compressor',
 'bootstrap3',
 'djangoformsetjs',
 'pretix.plugins.banktransfer',
 'pretix.plugins.stripe',
 'pretix.plugins.paypal',
 'pretix.plugins.ticketoutputpdf',
 'pretix.plugins.sendmail',
 'pretix.plugins.statistics',
 'pretix.plugins.reports',
 'pretix.plugins.checkinlists',
 'pretix.plugins.pretixdroid',
 'easy_thumbnails',
 'django_markup',
 'django_otp',
 'django_otp.plugins.otp_totp',
 'django_otp.plugins.otp_static',
 'pretix_passbook',
 'debug_toolbar.apps.DebugToolbarConfig']
Installed Middleware:
['pretix.multidomain.middlewares.MultiDomainMiddleware',
 'pretix.multidomain.middlewares.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'pretix.multidomain.middlewares.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'pretix.control.middleware.PermissionMiddleware',
 'pretix.base.middleware.LocaleMiddleware',
 'pretix.presale.middleware.EventMiddleware',
 'pretix.base.middleware.SecurityMiddleware',
 'pretix.helpers.debug.DebugMiddlewareCompatibilityShim']



Traceback:

File "/home/ligi/.local/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  39.             response = get_response(request)

File "/home/ligi/.local/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/home/ligi/.local/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/ligi/git/3rd/pretix/src/pretix/control/permissions.py" in wrapper
  32.                     return function(request, *args, **kw)

File "/home/ligi/.local/lib/python3.5/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "/home/ligi/.local/lib/python3.5/site-packages/django/views/generic/base.py" in dispatch
  88.         return handler(request, *args, **kwargs)

File "/home/ligi/git/3rd/pretix/src/pretix/control/views/event.py" in get
  398.         fname, mimet, data = tickets.preview(self.request.event.pk, self.output.identifier)

File "/home/ligi/git/3rd/pretix/src/pretix/base/services/tickets.py" in preview
  58.                 return prov.generate(p)

File "/home/ligi/git/3rd/pretix/local/pretix-passbook/pretix_passbook/passbook.py" in generate
  105.         passfile.addFile('icon.png', default_storage.open(icon_file.name, 'rb'))

Exception Type: AttributeError at /control/event/bigevents/2017/settings/tickets/preview/passbook
Exception Value: 'NoneType' object has no attribute 'name'

might be related to #7

Ability to hide the ticket code

Currently, the ticket code is displayed on the ticket below the QR-Code:
image

It would be nice if the ticket code could be hidden from the ticket.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.