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

Gracefully handle unrefundable ticket refund attempts #1063

Open
wants to merge 3 commits into
base: production
Choose a base branch
from

Conversation

timiwahalahti
Copy link
Collaborator

CampTix allows users to refund their ticket purchases, but Stipe and PayPal only allow refunds within a certain number of days after the ticket purchase.

transaction_is_refundable method was added to CampTix_Payment_Method with it defaulting to true in order to maintain backwards compatibility. CampTix_Payment_Method_Stripe and CampTix_Payment_Method_PayPal override that method with their own, quite similar checks.

If the method class recognises that the transaction is not refundable, WP_Error is returned for passing a nice message to the tickets frontend if refunds are otherwise enabled.

Also if someone tries to go directly to the refund URL, they will be sent to the tickets page with an error and that will be logged. Some code styling was made on the same go.

Fixes #577

Props @iandunn @actual-saurabh @ePascalC

Screenshots

CleanShot 2023-09-22 at 00 04 30@2x

How to test the changes in this Pull Request:

  1. Go to WordCamp site and tickets -> setup -> enable refunds
  2. Go to tickets -> attendees and open a ticket that has been bought over 4 months ago
  3. Visit the access token link
  4. Refund error message should be visible
  5. Repeat steps 2-4 with both Stripe and PayPal paid tickets
  6. Repeat steps 2-4 with ticket that has been bought less than a month ago -> refund should be possible

… of is_refundable logic bit better and show message if refunds enabled but payment method says no
@renintw renintw added [Type] Good First Issue Straightforward, self-contained, doesn't require deep knowledge of codebase Migrated from Trac [Priority] Low and removed [Priority] 4 labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] CampTix Including addons Migrated from Trac [Priority] Low [Type] Good First Issue Straightforward, self-contained, doesn't require deep knowledge of codebase
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

Gracefully handle unrefundable ticket refund attempts
2 participants