Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretix integration within Discord app #3

Closed
DhanshreeA opened this issue May 24, 2023 · 6 comments
Closed

Pretix integration within Discord app #3

DhanshreeA opened this issue May 24, 2023 · 6 comments

Comments

@DhanshreeA
Copy link

  • Authenticating Discord bot with Pretix
    We can authenticate the app with Pretix with a simple API token (unclear about which permissions are required at this point)

  • Validating a ticket
    We can use the Orders API to validate if a user holds a paid ticket, and the type of ticket they hold (if needed). If the status of the Order is p (Paid) then we can assume that the user holds a valid ticket. A caveat here would arise if we start charging cancellation fees but I don't think we do that. (Refer to the state diagram here)

  • Fetching an Order
    We can fetch individual orders using either the order code or filtering by order creation email/company name/attendee email

  • Determining Ticket type:
    The Order object contains information about individual products contained within the it as Order Position Resource. The Item field within this object should help us identify the ticket type.

@Kislovskiy
Copy link
Contributor

@DhanshreeA I see that the Item field is numeric, do you have an idea how we can convert it to the known ticket types, e.g. speaker, or business?

@DhanshreeA
Copy link
Author

Hey @Kislovskiy sorry for not getting to this sooner. The Items API lists the visible name for an item which can help us identify the known ticket types.

@Kislovskiy
Copy link
Contributor

Hey @Kislovskiy sorry for not getting to this sooner. The Items API lists the visible name for an item which can help us identify the known ticket types.

ah, cool. Thank you! I build a prototype using the check-in list. I'll open a PR soon. You could take a look 🤓

@DhanshreeA
Copy link
Author

@Kislovskiy
Okay I think we can also identify speakers (with the conference vs tutorial variations)

So, when you query the Orders API with an order code, within positions you would see two fields of interest (item and variation):

	"id": 21385480,
	"order": "RCZN9",
	"positionid": 1,
	"item": 339045,
	"variation": 163263,

And when you query the Items API with the item ID 339045, you see a list of variations as a list:

{
	"id": 339045,
	"category": null,
	"name": {
		"en": "Presenter"
	},
......,
	"variations": [
		{
			"id": 163263,
			"value": {
				"en": "Speaker"
			},
			"active": true,
			"description": {
				"en": "Speaker Ticket - Access to three days of the conference: Wednesday-Friday (19-21 July 2023) + Sprints Weekend.<br>\r\nThank you for choosing EuroPython to share your time and experience with the community. We hope that you have a fantastic time presenting at the conference.<br>\r\nThe ticket is free. If you'd like to support our Finaid Programme - consider buying a ticket. Thanks! :)"
			},
			"position": 0,

wherein, value gives us the name of the ticket (so Presenter here), and if you look at the variations id, it tells you which type of presenter this person is (in this case, a Speaker... there are other variations it would appear, ie Tutorial presenter, Keynote presenter etc)

@Kislovskiy
Copy link
Contributor

Kislovskiy commented Jun 21, 2023

Hey, @DhanshreeA. Exactly, thank you for sharing this. I'll open a PR soon, however I found that it's easier to call /checkinlists endpoint.

e.g.

curl --location 'https://pretix.eu/api/v1/organizers/europython/events/ep2023-staging2/checkinlists/295151/positions?order=M09CT&attendee_name=order%202%20dog' \
--header 'Authorization: Token <TOKEN>'

I'll share the Postman collection

@NMertsch
Copy link
Contributor

NMertsch commented Jun 2, 2024

Basic Pretix integration was implemented in 711eeb2. Thanks to everyone who was involved in it! 🎉

@NMertsch NMertsch closed this as completed Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants