Пример #1
0
        public void WebhookGetListTest()
        {
            var webhookList = Webhook.GetAll(TestingUtil.GetApiContext());

            Assert.IsNotNull(webhookList);
            Assert.IsNotNull(webhookList.webhooks);
        }
Пример #2
0
        protected override void RunSample()
        {
            // ### Api Context
            // Pass in a `APIContext` object to authenticate
            // the call and to send a unique request id
            // (that ensures idempotency). The SDK generates
            // a request id if you do not pass one explicitly.
            // See [Configuration.cs](/Source/Configuration.html) to know more about APIContext.
            var apiContext = Configuration.GetAPIContext();

            // ^ Ignore workflow code segment
            #region Track Workflow
            this.flow.AddNewRequest("Get all webhooks");
            #endregion

            // ### Retrieve All Webhooks
            // Call `Webhook.GetAll()` to retrieve a list of all your webhooks.
            var webhookList = Webhook.GetAll(apiContext);

            // ^ Ignore workflow code segment
            #region Track Workflow
            this.flow.RecordResponse(webhookList);
            #endregion

            // For more information, please visit [PayPal Developer REST API Reference](https://developer.paypal.com/docs/api/).
        }
Пример #3
0
        public void RemoveAllWebhooks()
        {
            try
            {
                var apiContext = TestingUtil.GetApiContext();
                this.RecordConnectionDetails();

                var webhookList = Webhook.GetAll(apiContext);
                this.RecordConnectionDetails();

                foreach (var webhook in webhookList.webhooks)
                {
                    webhook.Delete(apiContext);
                    this.RecordConnectionDetails();
                }

                webhookList = Webhook.GetAll(apiContext);
                this.RecordConnectionDetails();

                Assert.NotNull(webhookList);
                Assert.Empty(webhookList.webhooks);
            }
            catch (ConnectionException)
            {
                this.RecordConnectionDetails(false);
                throw;
            }
        }
Пример #4
0
 public void WebhookGetListTest()
 {
     try
     {
         var webhookList = Webhook.GetAll(TestingUtil.GetApiContext());
         Assert.IsNotNull(webhookList);
         Assert.IsNotNull(webhookList.webhooks);
     }
     finally
     {
         TestingUtil.RecordConnectionDetails();
     }
 }
Пример #5
0
 public void WebhookGetListTest()
 {
     try
     {
         var webhookList = Webhook.GetAll(TestingUtil.GetApiContext());
         Assert.IsNotNull(webhookList);
         Assert.IsNotNull(webhookList.webhooks);
     }
     catch (ConnectionException ex)
     {
         TestingUtil.WriteConnectionExceptionDetails(ex);
         throw;
     }
 }
Пример #6
0
        // GET: Webhooks
        public ActionResult Index()
        {
            var apiContext = PayPalApiHelperService.GetApiContext();

            var list = Webhook.GetAll(apiContext);

            if (!list.webhooks.Any())
            {
                SeedWebhooks(apiContext);
                list = Webhook.GetAll(apiContext);
            }

            return(View(list));
        }
        protected override void RunSample()
        {
            // ### Api Context
            // Pass in a `APIContext` object to authenticate
            // the call and to send a unique request id
            // (that ensures idempotency). The SDK generates
            // a request id if you do not pass one explicitly.
            // See [Configuration.cs](/Source/Configuration.html) to know more about APIContext.
            var apiContext = Configuration.GetAPIContext();

            bool deleteAll = Convert.ToBoolean(Request.Params["deleteAll"]);

            if (deleteAll)
            {
                var webhookList = Webhook.GetAll(apiContext);
                foreach (var webhook in webhookList.webhooks)
                {
                    webhook.Delete(apiContext);
                }
            }
            else
            {
                var webhook = WebhookCreate.GetNewWebhook();

                #region Track Workflow
                //--------------------
                this.flow.AddNewRequest("Create a webhook", webhook);
                //--------------------
                #endregion

                var createdWebhook = webhook.Create(apiContext);

                #region Track Workflow
                //--------------------
                this.flow.RecordResponse(createdWebhook);
                this.flow.AddNewRequest("Delete the webhook", description: "ID: " + webhook.id);
                //--------------------
                #endregion

                createdWebhook.Delete(apiContext);

                #region Track Workflow
                //--------------------
                this.flow.RecordActionSuccess("Webhook successfully deleted.");
                //--------------------
                #endregion
            }
        }
Пример #8
0
        public void WebhookGetListTest()
        {
            try
            {
                var apiContext = TestingUtil.GetApiContext();
                this.RecordConnectionDetails();

                var webhookList = Webhook.GetAll(apiContext);
                this.RecordConnectionDetails();

                Assert.IsNotNull(webhookList);
                Assert.IsNotNull(webhookList.webhooks);
            }
            catch (ConnectionException)
            {
                this.RecordConnectionDetails(false);
                throw;
            }
        }