Lists webhook event notifications. Use query parameters to filter the response.
public static all ( array $params, |
||
$params | array | |
$apiContext | is the APIContext for this call. It can be used to pass dynamic configuration and credentials. | |
$restCall | is the Rest Call Service that is used to make rest calls | |
return |
/** * @dataProvider mockProvider * @param WebhookEvent $obj */ public function testList($obj, $mockApiContext) { $mockPayPalRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock(); $mockPayPalRestCall->expects($this->any())->method('execute')->will($this->returnValue(WebhookEventListTest::getJson())); $params = array(); $result = $obj->all($params, $mockApiContext, $mockPayPalRestCall); $this->assertNotNull($result); }
public function testEventSearch() { $result = WebhookEvent::all(array(), $this->apiContext, $this->mockPayPalRestCall); $this->assertNotNull($result); return $result; }
<?php // # Search Webhook Events Sample // // This sample code demonstrate how to use this call to search for all webhook events., as documented here at: // https://developer.paypal.com/docs/api/#search-webhook-events // API used: GET /v1/notifications/webhooks-events // ## Get Webhook Instance // ## PLEASE NOTE: // Creating webhook is sample purposes only. In real scenario, you dont need to create a new webhook everytime you want to search // for a webhook events. This is made in a sample just to make sure there is minimum of one webhook to listen to. /** @var \PayPal\Api\Webhook $webhook */ $webhook = (require __DIR__ . '/../bootstrap.php'); $params = array(); // ### Search Webhook events try { $output = \PayPal\Api\WebhookEvent::all($params, $apiContext); } catch (Exception $ex) { // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY ResultPrinter::printError("Search Webhook events", "WebhookEventList", null, null, $ex); exit(1); } // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY ResultPrinter::printResult("Search Webhook events", "WebhookEventList", null, $params, $output); return $output;