PATH:
home
/
lab2454c
/
keebchat.com
/
core
/
libs
/
paypal
/
vendor
/
paypal
/
rest-api-sdk-php
/
lib
/
PayPal
/
Api
<?php namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Validation\ArgumentValidator; use PayPal\Api\WebhookList; use PayPal\Rest\ApiContext; use PayPal\Validation\UrlValidator; /** * Class Webhook * * One or more webhook objects. * * @package PayPal\Api * * @property string id * @property string url * @property \PayPal\Api\WebhookEventType[] event_types */ class Webhook extends PayPalResourceModel { /** * The ID of the webhook. * * @param string $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * The ID of the webhook. * * @return string */ public function getId() { return $this->id; } /** * The URL that is configured to listen on `localhost` for incoming `POST` notification messages that contain event information. * * @param string $url * @throws \InvalidArgumentException * @return $this */ public function setUrl($url) { UrlValidator::validate($url, "Url"); $this->url = $url; return $this; } /** * The URL that is configured to listen on `localhost` for incoming `POST` notification messages that contain event information. * * @return string */ public function getUrl() { return $this->url; } /** * A list of up to ten events to which to subscribe your webhook. To subscribe to all events including new events as they are added, specify the asterisk (`*`) wildcard. To replace the `event_types` array, specify the `*` wildcard. To see all supported events, [list available events](#available-event-type.list). * * @param \PayPal\Api\WebhookEventType[] $event_types * * @return $this */ public function setEventTypes($event_types) { $this->event_types = $event_types; return $this; } /** * A list of up to ten events to which to subscribe your webhook. To subscribe to all events including new events as they are added, specify the asterisk (`*`) wildcard. To replace the `event_types` array, specify the `*` wildcard. To see all supported events, [list available events](#available-event-type.list). * * @return \PayPal\Api\WebhookEventType[] */ public function getEventTypes() { return $this->event_types; } /** * Append EventTypes to the list. * * @param \PayPal\Api\WebhookEventType $webhookEventType * @return $this */ public function addEventType($webhookEventType) { if (!$this->getEventTypes()) { return $this->setEventTypes(array($webhookEventType)); } else { return $this->setEventTypes( array_merge($this->getEventTypes(), array($webhookEventType)) ); } } /** * Remove EventTypes from the list. * * @param \PayPal\Api\WebhookEventType $webhookEventType * @return $this */ public function removeEventType($webhookEventType) { return $this->setEventTypes( array_diff($this->getEventTypes(), array($webhookEventType)) ); } /** * Subscribes your webhook listener to events. A successful call returns a [`webhook`](/docs/api/webhooks/#definition-webhook) object, which includes the webhook ID for later use. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Webhook */ public function create($apiContext = null, $restCall = null) { $payLoad = $this->toJSON(); $json = self::executeCall( "/v1/notifications/webhooks", "POST", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Shows details for a webhook, by ID. * * @param string $webhookId * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Webhook */ public static function get($webhookId, $apiContext = null, $restCall = null) { ArgumentValidator::validate($webhookId, 'webhookId'); $payLoad = ""; $json = self::executeCall( "/v1/notifications/webhooks/$webhookId", "GET", $payLoad, null, $apiContext, $restCall ); $ret = new Webhook(); $ret->fromJson($json); return $ret; } /** * Retrieves all Webhooks for the application associated with access token. * * @deprecated Please use Webhook#getAllWithParams instead. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookList */ public static function getAll($apiContext = null, $restCall = null) { return self::getAllWithParams(array(), $apiContext, $restCall); } /** * Lists all webhooks for an app. * * @param array $params * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return WebhookList */ public static function getAllWithParams($params = array(), $apiContext = null, $restCall = null) { ArgumentValidator::validate($params, 'params'); $payLoad = ""; $allowedParams = array( 'anchor_type' => 1, ); $json = self::executeCall( "/v1/notifications/webhooks?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall ); $ret = new WebhookList(); $ret->fromJson($json); return $ret; } /** * Replaces webhook fields with new values. Pass a `json_patch` object with `replace` operation and `path`, which is `/url` for a URL or `/event_types` for events. The `value` is either the URL or a list of events. * * @param PatchRequest $patchRequest * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Webhook */ public function update($patchRequest, $apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); ArgumentValidator::validate($patchRequest, 'patchRequest'); $payLoad = $patchRequest->toJSON(); $json = self::executeCall( "/v1/notifications/webhooks/{$this->getId()}", "PATCH", $payLoad, null, $apiContext, $restCall ); $this->fromJson($json); return $this; } /** * Deletes a webhook, by ID. * * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return bool */ public function delete($apiContext = null, $restCall = null) { ArgumentValidator::validate($this->getId(), "Id"); $payLoad = ""; self::executeCall( "/v1/notifications/webhooks/{$this->getId()}", "DELETE", $payLoad, null, $apiContext, $restCall ); return true; } }
[-] PaymentTerm.php
[edit]
[-] Patch.php
[edit]
[-] AgreementTransaction.php
[edit]
[-] OverrideChargeModel.php
[edit]
[-] RefundDetail.php
[edit]
[-] PaymentExecution.php
[edit]
[-] CurrencyConversion.php
[edit]
[-] InvoiceItem.php
[edit]
[-] Terms.php
[edit]
[-] PaymentDetail.php
[edit]
[-] BillingInfo.php
[edit]
[-] CreditCardList.php
[edit]
[-] MerchantInfo.php
[edit]
[-] Links.php
[edit]
[-] Transactions.php
[edit]
[-] PaymentDefinition.php
[edit]
[+]
..
[-] PaymentSummary.php
[edit]
[-] OpenIdError.php
[edit]
[-] BillingAgreementToken.php
[edit]
[-] Sale.php
[edit]
[-] Item.php
[edit]
[-] Address.php
[edit]
[-] InvoiceNumber.php
[edit]
[-] Payee.php
[edit]
[-] TransactionBase.php
[edit]
[-] ExtendedBankAccount.php
[edit]
[-] AgreementStateDescriptor.php
[edit]
[-] RecipientBankingInstruction.php
[edit]
[-] WebProfile.php
[edit]
[-] Payout.php
[edit]
[-] FundingDetail.php
[edit]
[-] CreditFinancingOffered.php
[edit]
[-] PaymentCardToken.php
[edit]
[-] ProcessorResponse.php
[edit]
[-] OpenIdTokeninfo.php
[edit]
[-] PotentialPayerInfo.php
[edit]
[-] MerchantPreferences.php
[edit]
[-] InstallmentInfo.php
[edit]
[-] InvoiceSearchResponse.php
[edit]
[-] FmfDetails.php
[edit]
[-] Agreement.php
[edit]
[-] Incentive.php
[edit]
[-] OpenIdSession.php
[edit]
[-] Plan.php
[edit]
[-] Refund.php
[edit]
[-] BaseAddress.php
[edit]
[-] CreditCardToken.php
[edit]
[-] Amount.php
[edit]
[-] CreateProfileResponse.php
[edit]
[-] AgreementDetails.php
[edit]
[-] Order.php
[edit]
[-] CarrierAccount.php
[edit]
[-] FuturePayment.php
[edit]
[-] FileAttachment.php
[edit]
[-] Image.php
[edit]
[-] Details.php
[edit]
[-] RedirectUrls.php
[edit]
[-] RelatedResources.php
[edit]
[-] AlternatePayment.php
[edit]
[-] PrivateLabelCard.php
[edit]
[-] Tax.php
[edit]
[-] Phone.php
[edit]
[-] Measurement.php
[edit]
[-] RefundRequest.php
[edit]
[-] Payer.php
[edit]
[-] FundingSource.php
[edit]
[-] PayoutBatch.php
[edit]
[-] VerifyWebhookSignatureResponse.php
[edit]
[-] CarrierAccountToken.php
[edit]
[-] PayoutItem.php
[edit]
[-] Authorization.php
[edit]
[-] CreditCardHistory.php
[edit]
[-] WebhookEventTypeList.php
[edit]
[-] TemplateSettingsMetadata.php
[edit]
[-] Cost.php
[edit]
[-] PayoutItemDetails.php
[edit]
[-] NameValuePair.php
[edit]
[-] CancelNotification.php
[edit]
[-] WebhookEvent.php
[edit]
[-] ShippingInfo.php
[edit]
[-] FundingOption.php
[edit]
[-] ShippingAddress.php
[edit]
[-] HyperSchema.php
[edit]
[-] CartBase.php
[edit]
[-] PayerInfo.php
[edit]
[-] Notification.php
[edit]
[-] PaymentHistory.php
[edit]
[-] CustomAmount.php
[edit]
[-] WebhookList.php
[edit]
[-] Credit.php
[edit]
[-] PlanList.php
[edit]
[-] Metadata.php
[edit]
[-] ShippingCost.php
[edit]
[-] TemplateData.php
[edit]
[-] ChargeModel.php
[edit]
[-] Capture.php
[edit]
[-] Transaction.php
[edit]
[-] InputFields.php
[edit]
[-] OpenIdUserinfo.php
[edit]
[-] PatchRequest.php
[edit]
[-] DetailedRefund.php
[edit]
[-] PaymentCard.php
[edit]
[-] AgreementTransactions.php
[edit]
[-] Currency.php
[edit]
[-] Participant.php
[edit]
[-] PaymentOptions.php
[edit]
[-] VerifyWebhookSignature.php
[edit]
[-] BankAccountsList.php
[edit]
[-] Template.php
[edit]
[-] CountryCode.php
[edit]
[-] ErrorDetails.php
[edit]
[-] PaymentInstruction.php
[edit]
[-] TemplateSettings.php
[edit]
[-] Payment.php
[edit]
[-] Search.php
[edit]
[-] InstallmentOption.php
[edit]
[-] Invoice.php
[edit]
[-] BankAccount.php
[edit]
[-] FundingInstrument.php
[edit]
[-] FlowConfig.php
[edit]
[-] ItemList.php
[edit]
[-] Templates.php
[edit]
[-] BankToken.php
[edit]
[-] PayoutSenderBatchHeader.php
[edit]
[-] PayoutBatchHeader.php
[edit]
[-] Presentation.php
[edit]
[-] Billing.php
[edit]
[-] WebhookEventType.php
[edit]
[-] OpenIdAddress.php
[edit]
[-] InvoiceAddress.php
[edit]
[-] CreditCard.php
[edit]
[-] Webhook.php
[edit]
[-] ExternalFunding.php
[edit]
[-] WebhookEventList.php
[edit]
[-] Error.php
[edit]