Skip to content

Harden payment gateway plugin requirements in CampTix#53

Open
dd32 wants to merge 2 commits intoproductionfrom
fix/claude/1550-harden-payment-gateways
Open

Harden payment gateway plugin requirements in CampTix#53
dd32 wants to merge 2 commits intoproductionfrom
fix/claude/1550-harden-payment-gateways

Conversation

@dd32
Copy link
Owner

@dd32 dd32 commented Mar 12, 2026

Summary

Addresses WordPress#1550 by adding validation and deprecation notices to enforce proper payment gateway behavior in CampTix.

  • Validate payment_result() data structure: When a gateway passes data for completed/pending payments, it now checks for the required transaction_id key and triggers _doing_it_wrong() plus a CampTix log entry when the data is unstructured (e.g. raw $_GET instead of [ "transaction_id" => ..., "transaction_details" => [...] ]). This is a deprecation warning rather than a hard rejection to avoid breaking existing gateways.
  • Deprecation notices for missing refund support: The base payment_refund() and send_refund_request() methods now emit _doing_it_wrong() notices with the gateway class name, making it clear which gateway lacks refund support.
  • New helper: update_attendees_for_payment_token(): Adds a method to CampTix_Plugin that updates a meta value for all attendees in a payment token group, reducing the duplicated pattern of fetching attendees and iterating to update meta. Also exposed to gateways via the __call whitelist.

Test plan

  • Verify that a properly structured payment_result() call (with transaction_id key) does not trigger any warnings
  • Verify that an improperly structured call (e.g. passing raw $_GET) triggers _doing_it_wrong and logs the issue
  • Verify that calling the base payment_refund() on a gateway without refund support triggers the deprecation notice
  • Verify that update_attendees_for_payment_token() correctly updates meta for all attendees sharing a token

Generated with Claude Code

dd32 and others added 2 commits March 13, 2026 09:28
Add validation and deprecation notices to enforce proper payment gateway
behavior, as outlined in WordPress#1550:

- Validate that payment_result() receives properly structured transaction
  data (with transaction_id and transaction_details keys) for completed
  and pending payments, logging a _doing_it_wrong notice when gateways
  pass unstructured data like raw $_GET.

- Add _doing_it_wrong notices to the base payment_refund() and
  send_refund_request() methods so gateway developers are warned when
  refund support is missing.

- Add update_attendees_for_payment_token() helper method to CampTix_Plugin
  to reduce code duplication when gateways need to store metadata (like
  checkout session IDs) across all attendees in a payment token group.

- Expose the new helper to payment gateways via the __call whitelist.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant