Harden payment gateway plugin requirements in CampTix#53
Open
dd32 wants to merge 2 commits intoproductionfrom
Open
Harden payment gateway plugin requirements in CampTix#53dd32 wants to merge 2 commits intoproductionfrom
dd32 wants to merge 2 commits intoproductionfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses WordPress#1550 by adding validation and deprecation notices to enforce proper payment gateway behavior in CampTix.
payment_result()data structure: When a gateway passes data for completed/pending payments, it now checks for the requiredtransaction_idkey and triggers_doing_it_wrong()plus a CampTix log entry when the data is unstructured (e.g. raw$_GETinstead of[ "transaction_id" => ..., "transaction_details" => [...] ]). This is a deprecation warning rather than a hard rejection to avoid breaking existing gateways.payment_refund()andsend_refund_request()methods now emit_doing_it_wrong()notices with the gateway class name, making it clear which gateway lacks refund support.update_attendees_for_payment_token(): Adds a method toCampTix_Pluginthat 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__callwhitelist.Test plan
payment_result()call (withtransaction_idkey) does not trigger any warnings$_GET) triggers_doing_it_wrongand logs the issuepayment_refund()on a gateway without refund support triggers the deprecation noticeupdate_attendees_for_payment_token()correctly updates meta for all attendees sharing a tokenGenerated with Claude Code