subscribedEventTypes() public static method

Lists event subscriptions for a webhook, by ID.
public static subscribedEventTypes ( string $webhookId, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : WebhookEventTypeList
$webhookId string
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPalRestCall is the Rest Call Service that is used to make rest calls
return WebhookEventTypeList
コード例 #1
0
 /**
  * @dataProvider mockProvider
  * @param WebhookEventType $obj
  */
 public function testSubscribedEventTypes($obj, $mockApiContext)
 {
     $mockPayPalRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock();
     $mockPayPalRestCall->expects($this->any())->method('execute')->will($this->returnValue(WebhookEventTypeListTest::getJson()));
     $result = $obj->subscribedEventTypes("webhookId", $mockApiContext, $mockPayPalRestCall);
     $this->assertNotNull($result);
 }
コード例 #2
0
<?php

// # Get Webhook Sample
//
// This sample code demonstrate how you can get a webhook, as documented here at:
// https://developer.paypal.com/webapps/developer/docs/api/#get-a-webhook
// API used: GET /v1/notifications/webhooks/<Webhook-Id>
// ## List Subscribed Event Types
// Use this call to retrieve the list of events types that are subscribed to a webhook.
/** @var \PayPal\Api\Webhook $webhook */
$webhook = (require 'CreateWebhook.php');
$webhookId = $webhook->getId();
// ### Get List of Subscribed Event Types
try {
    $output = \PayPal\Api\WebhookEventType::subscribedEventTypes($webhookId, $apiContext);
} catch (Exception $ex) {
    // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
    ResultPrinter::printError("List subscribed webhook event types", "WebhookEventTypeList", null, $webhookId, $ex);
    exit(1);
}
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("List subscribed webhook event types", "WebhookEventTypeList", null, null, $output);
return $output;
 /**
  * @depends testGet
  * @param $webhook Webhook
  * @return WebhookEventTypeList
  */
 public function testGetSubscribedEventTypes($webhook)
 {
     $result = WebhookEventType::subscribedEventTypes($webhook->getId(), $this->apiContext, $this->mockPayPalRestCall);
     $this->assertNotNull($result);
     $this->assertEquals(2, sizeof($result->getEventTypes()));
     return $result;
 }