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

Add option to pass transaction fees onto buyers #762

Merged
merged 6 commits into from
Jan 4, 2025

Conversation

aviupadhyayula
Copy link
Member

@aviupadhyayula aviupadhyayula commented Jan 2, 2025

Refactors out event-wide settings for ticketed events into a new TicketSettings model. Adds backend support for club leaders to pass transaction fees onto buyers. (This isn't reflected in calculated cart totals yet. We're waiting on Penn Finance to determine how transaction fees will be collected before implementing this.)

Addresses #754.

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 5 lines in your changes missing coverage. Please review.

Project coverage is 72.03%. Comparing base (56b9394) to head (b4882c9).
Report is 1 commits behind head on ticketing-v2.

Files with missing lines Patch % Lines
backend/clubs/views.py 84.00% 4 Missing ⚠️
backend/clubs/models.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           ticketing-v2     #762      +/-   ##
================================================
+ Coverage         71.99%   72.03%   +0.04%     
================================================
  Files                32       32              
  Lines              6963     6977      +14     
================================================
+ Hits               5013     5026      +13     
- Misses             1950     1951       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

event = models.OneToOneField(
Event, on_delete=models.CASCADE, related_name="ticket_settings"
)
order_limit = models.IntegerField(null=True, blank=True)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the default order limit of 10 -- I don't see a reason why we should have it enabled by default. Happy to change it back if you guys disagree.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but I think it was more of a safety net for say club officers that wouldn't know why they might want to limit orders per customer. Having a default limit might force them to think about this and opt out after making an informed decision. Also, since we will be opening ticket purchases to non-penn people, we have a larger pool of potential bad actors

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Since there'll eventually be ticketed events with free tickets, letting non-Penn users check out all of them would be disastrous. Let's re-implement the limit.

@aviupadhyayula aviupadhyayula changed the base branch from master to ticketing-v2 January 3, 2025 04:44
)
order_limit = models.IntegerField(null=True, blank=True)
drop_time = models.DateTimeField(null=True, blank=True)
fee_charged_to_buyer = models.BooleanField(default=False)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting transaction fees to be shouldered by the club by default.

Copy link
Contributor

@Porcupine1 Porcupine1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! left a few comments

Comment on lines +2801 to +2804
# Tickets can't be edited after they've been sold or checked out
if event.tickets.filter(
Q(owner__isnull=False) | Q(holder__isnull=False)
).exists():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we won't be supporting ticket holds Q(holder__isnull=False) will be unnecessary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but I think I want to leave it in for now. If something changes with the redesign of checkout (e.g. we use holds in a different context), it'll be a pain to go back and add these checks to all the previous PRs. Once we commit to a specific implementation checkout, we can just go through and remove all the holding logic in one go.

status=status.HTTP_403_FORBIDDEN,
)

# Tickets can't be edited after they've been sold or held
ticket_settings, _ = TicketSettings.objects.get_or_create(event=event)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really matter, but can ticket_settings, _ = TicketSettings.objects.get_or_create(event=event) be moved down to after the if statement just below it since we don't use ticket_settings until after the if statement and in the case that the if is true we return immediately

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we're creating an event for the first time? Then there is no ticket_settings associated with the event, and the check below (if event.ticket_settings.drop_time is set) throws an exception, since TicketSettings is a one-to-one relationship.

event = models.OneToOneField(
Event, on_delete=models.CASCADE, related_name="ticket_settings"
)
order_limit = models.IntegerField(null=True, blank=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but I think it was more of a safety net for say club officers that wouldn't know why they might want to limit orders per customer. Having a default limit might force them to think about this and opt out after making an informed decision. Also, since we will be opening ticket purchases to non-penn people, we have a larger pool of potential bad actors

@aviupadhyayula aviupadhyayula merged commit f41a07f into ticketing-v2 Jan 4, 2025
8 checks passed
@aviupadhyayula aviupadhyayula deleted the refactor-ticket-settings branch January 4, 2025 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Allow club leaders to choose who pays transaction fees
2 participants