EuroPython / discord

A helpful conference Discord Bot
MIT License
6 stars 8 forks source link

Pretix integration within Discord app #3

Closed DhanshreeA closed 5 months ago

DhanshreeA commented 1 year ago
Kislovskiy commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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 commented 5 months ago

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