Skip to content
Snippets Groups Projects
Commit a5a60915 authored by mattwire's avatar mattwire
Browse files

Merge branch 'testwebhook' into 'master'

Send a friendly success response if we receive the test webhook

See merge request extensions/stripe!20
parents bae1863a aad96019
No related branches found
No related tags found
1 merge request!20Send a friendly success response if we receive the test webhook
...@@ -74,6 +74,15 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -74,6 +74,15 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
// Now re-retrieve the data from Stripe to ensure it's legit. // Now re-retrieve the data from Stripe to ensure it's legit.
\Stripe\Stripe::setApiKey($this->_paymentProcessor['user_name']); \Stripe\Stripe::setApiKey($this->_paymentProcessor['user_name']);
// Special case if this is the test webhook
if (substr($parameters->id, -15, 15) === '_00000000000000') {
http_response_code(200);
$test = (boolean) $this->_paymentProcessor['is_test'] ? '(Test processor)' : '(Live processor)';
echo "Test webhook from Stripe ({$parameters->id}) received successfully by CiviCRM {$test}.";
exit();
}
if ($this->verify_event) { if ($this->verify_event) {
$this->_inputParameters = \Stripe\Event::retrieve($parameters->id); $this->_inputParameters = \Stripe\Event::retrieve($parameters->id);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment