| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\Route; |
| 4 |
|
| 5 |
use Give\Controller\PayPalWebhooks as Controller; |
| 6 |
|
| 7 |
class PayPalWebhooks implements Route |
| 8 |
{ |
| 9 |
/** |
| 10 |
* @inheritDoc |
| 11 |
*/ |
| 12 |
public function init() |
| 13 |
{ |
| 14 |
add_action('wp', [$this, 'callController']); |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Calls the corresponding controller for the route in the appropriate context |
| 19 |
* |
| 20 |
* @since 2.8.0 |
| 21 |
*/ |
| 22 |
public function callController() |
| 23 |
{ |
| 24 |
if (isset($_GET['give-listener']) && $_GET['give-listener'] === 'paypal-commerce') { |
| 25 |
give(Controller::class)->handle(); |
| 26 |
|
| 27 |
http_response_code(200); |
| 28 |
die(); |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Returns the route URL |
| 34 |
* |
| 35 |
* @since 2.8.0 |
| 36 |
* |
| 37 |
* @return string |
| 38 |
*/ |
| 39 |
public function getRouteUrl() |
| 40 |
{ |
| 41 |
return get_site_url(null, 'index.php?give-listener=paypal-commerce', 'https'); |
| 42 |
} |
| 43 |
} |
| 44 |
|