Пример #1
0
        private int AddSubscription()
        {
            var request = new Subscribing
            {
                TargetUrl = "http://example.org/your_webhook_url",
                Event     = "customer.insert",
            };

            return(Sut.Subscribe(request).Id);
        }
Пример #2
0
 public void ProcessConnected(IConnection connection)
 {
     Log.V("Processing connected, state: {0}", this);
     if (IsUnsubscribed)
     {
         if (!_fsm.MarkAsDeleted)
         {
             var next = new Subscribing(this, connection);
             _awaiter.Succeed(next);
         }
     }
 }
Пример #3
0
        // Here comes the code I want to be executed when the event fires.
        public void ClickSubscribe()
        {
            // I make sure I have any subscribers before invoking the delegate
            // Then I call all the event handler methods registered with the Subscribing event.
            Subscribing?.Invoke();
            // Same as:
            //if (Subscribing != null)
            //{
            //    Subscribing();
            //}

            Console.WriteLine("You have subscribed to the newsletter.");
        }
Пример #4
0
        public void should_call_Subscribing()
        {
            //arrange
            var request = new Subscribing
            {
                TargetUrl = "http://example.org/your_webhook_url",
                Event     = "customer.insert",
            };
            //act
            var actual = Sut.Subscribe(request);

            //assert
            Assert.AreEqual(201, actual.Code);
            Assert.IsEmpty(actual.Message);
            Assert.AreEqual("OK", actual.Status);
        }
Пример #5
0
 /// <summary>
 /// Subscribing
 /// details: https://developer.chargeover.com/apidocs/rest/#subscribe-resthook
 /// </summary>
 public IIdentityResponse Subscribe(Subscribing request)
 {
     return(Create("/_resthook", request));
 }
Пример #6
0
 public void ClickSubscribe()
 {
     Subscribing?.Invoke();
     Console.WriteLine("You have subscribed to the newsletter.");
 }