Skip to content

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
@outdoor2kode outdoor2kode 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