verbb / events

Craft CMS Plugin for events management and ticketing.
Other
21 stars 12 forks source link

Overbooking is possible #129

Closed mihob closed 8 months ago

mihob commented 10 months ago

Describe the bug

It is possible to buy any number of tickets as long as an event is not fully booked.

For example, if an event has 10 seats, it is possible to buy 100 tickets.

It should not be possible to add more tickets to the shopping basket than are available.

The same problem exists on a ticket basis

Steps to reproduce

  1. For example, set the capacity limit of an event or a ticket to 10
  2. Add 20 tickets to the shopping basket
  3. Finalise the purchase

Craft CMS version

Craft Pro 4.5.11.1

Plugin version

2.0.2

Multi-site?

Yes

Additional context

No response

engram-design commented 10 months ago

Not seeing that, sorry. I'm getting the message "You reached the maximum ticket quantity for Test Event" whenever I try and add more tickets to my cart than are available for the event. This should be controlled through here

mihob commented 10 months ago

I think the problem is that we don't add a ticket with a quantity of 10, but the ticket 10 times as a single item (each with a unique hash hidden in the option array).

We do this because we have to query the first name and surname for each individual ticket and therefore need individual line items.

You don't seem to be looking at the total quantity that is added to the shopping basket.

engram-design commented 10 months ago

Gotcha. Yes, when singular line items are added this will be an issue. Normally, even if you add a ticket one at a time, they are combined into a single line item with multiple quantity set.

Fixed for the next release. To get this early, run composer require verbb/events:"dev-craft-4 as 2.0.2".

I should also note that the plugin doesn't provide a 100% bullet-proof overbooking protection mechanism. For one, there's no reserve system, so technically if multiple people checkout at the same time, there's the potential for tickets to be purchased at the same time, over the limit. There's also no reservation on "stock" when adding to the cart, so one user might've added all remaining tickets to the cart (but not purchased) and another user does the same, and whoever checks out first gets the tickets.

engram-design commented 8 months ago

Should be fixed in 2.0.3