public WebhookEvent(WebhookEventType type, WebhookEventSource source, long timestamp, string mode)
 {
     Type      = type;
     Source    = source;
     Timestamp = timestamp;
     Mode      = mode;
 }
Esempio n. 2
0
        public static string ToWebhookTypeString(this WebhookEventType type)
        {
            switch (type)
            {
            case WebhookEventType.PackageShipped:
                return("package_shipped");

            case WebhookEventType.PackageReturned:
                return("package_returned");

            case WebhookEventType.OrderFailed:
                return("order_failed");

            case WebhookEventType.OrderCancelled:
                return("order_canceled");

            case WebhookEventType.ProductSynced:
                return("product_synced");

            case WebhookEventType.ProductUpdated:
                return("product_updated");

            case WebhookEventType.StockUpdated:
                return("stock_updated");

            case WebhookEventType.OrderPutOnHold:
                return("order_put_hold");

            case WebhookEventType.OrderRemoveHold:
                return("order_remove_hold");

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, "Unrecognised Webhook event type");
            }
        }
Esempio n. 3
0
        public static WebhookInvoiceEvent GetWebhookEvent(WebhookEventType webhookEventType)
        {
            switch (webhookEventType)
            {
            case WebhookEventType.InvoiceCreated:
                return(new WebhookInvoiceEvent(WebhookEventType.InvoiceCreated));

            case WebhookEventType.InvoiceReceivedPayment:
                return(new WebhookInvoiceReceivedPaymentEvent(WebhookEventType.InvoiceReceivedPayment));

            case WebhookEventType.InvoicePaymentSettled:
                return(new WebhookInvoicePaymentSettledEvent(WebhookEventType.InvoicePaymentSettled));

            case WebhookEventType.InvoiceProcessing:
                return(new WebhookInvoiceProcessingEvent(WebhookEventType.InvoiceProcessing));

            case WebhookEventType.InvoiceExpired:
                return(new WebhookInvoiceExpiredEvent(WebhookEventType.InvoiceExpired));

            case WebhookEventType.InvoiceSettled:
                return(new WebhookInvoiceSettledEvent(WebhookEventType.InvoiceSettled));

            case WebhookEventType.InvoiceInvalid:
                return(new WebhookInvoiceInvalidEvent(WebhookEventType.InvoiceInvalid));

            default:
                return(new WebhookInvoiceEvent(WebhookEventType.InvoiceCreated));
            }
        }
Esempio n. 4
0
        public static ILineEventDispatcher Create(WebhookEventType eventType)
        {
            switch (eventType)
            {
            case WebhookEventType.Message:
                return(new MessageEventDispatcher());

            case WebhookEventType.Postback:
                return(new PostbackEventDispatcher());

            case WebhookEventType.Join:
                return(new JoinEventDispatcher());

            case WebhookEventType.Leave:
                return(new LeaveEventDispatcher());

            case WebhookEventType.AccountLink:
                return(new AccountLinkEventDispatcher());

            case WebhookEventType.Beacon:
                return(new BeaconEventDispatcher());

            case WebhookEventType.Follow:
                return(new FollowEventDispatcher());

            case WebhookEventType.Unfollow:
                return(new UnfollowEventDispatcher());

            default:
                throw new UnsupportedWebhookEventTypeException();
            }
        }
Esempio n. 5
0
        public void WebhookEventTypeSubscribedEventsTest()
        {
            var webhookEventTypeList = WebhookEventType.SubscribedEventTypes(TestingUtil.GetApiContext(), "45R80540W07069023");

            Assert.IsNotNull(webhookEventTypeList);
            Assert.IsNotNull(webhookEventTypeList.event_types);
            Assert.AreEqual(2, webhookEventTypeList.event_types.Count);
        }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Webhook" /> class.
 /// </summary>
 /// <param name="Id">unique Signifyd generated integer identifying this webhook.</param>
 /// <param name="EventType">EventType.</param>
 /// <param name="EventDisplayText">A more human friendly version of the event type..</param>
 /// <param name="Url">the URL to which the webhook data should be sent when the event is triggered.</param>
 /// <param name="Team">Team.</param>
 public Webhook(int?Id = default(int?), WebhookEventType EventType = default(WebhookEventType), string EventDisplayText = default(string), string Url = default(string), Team Team = default(Team))
 {
     this.Id               = Id;
     this.EventType        = EventType;
     this.EventDisplayText = EventDisplayText;
     this.Url              = Url;
     this.Team             = Team;
 }
Esempio n. 7
0
        public void WebhookEventTypeAvailableEventsTest()
        {
            var webhookEventTypeList = WebhookEventType.AvailableEventTypes(TestingUtil.GetApiContext());

            Assert.IsNotNull(webhookEventTypeList);
            Assert.IsNotNull(webhookEventTypeList.event_types);
            Assert.IsTrue(webhookEventTypeList.event_types.Count > 2);
        }
Esempio n. 8
0
 public WebhookEvent(WebhookEventType type, WebhookEventSource source, long timestamp, string mode, string webhookEventId, DeliveryContext deliveryContext)
 {
     Type            = type;
     Source          = source;
     Timestamp       = timestamp;
     Mode            = mode;
     WebhookEventId  = webhookEventId;
     DeliveryContext = deliveryContext;
 }
Esempio n. 9
0
        public static string EnumToString(this WebhookEventType type)
        {
            switch (type)
            {
            case WebhookEventType.InventoryUpdated: return("INVENTORY_UPDATED");

            case WebhookEventType.PaymentUpdated: return("PAYMENT_UPDATED");

            case WebhookEventType.TimecardUpdated: return("TIMECARD_UPDATED");

            default: throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 10
0
        private WebhookEvent GetTestWebHook(string storeId, string webhookId, WebhookEventType webhookEventType, Data.WebhookDeliveryData delivery)
        {
            var webhookEvent = GetWebhookEvent(webhookEventType);

            webhookEvent.InvoiceId          = "__test__" + Guid.NewGuid().ToString() + "__test__";
            webhookEvent.StoreId            = storeId;
            webhookEvent.DeliveryId         = delivery.Id;
            webhookEvent.WebhookId          = webhookId;
            webhookEvent.OriginalDeliveryId = "__test__" + Guid.NewGuid().ToString() + "__test__";
            webhookEvent.IsRedelivery       = false;
            webhookEvent.Timestamp          = delivery.Timestamp;

            return(webhookEvent);
        }
Esempio n. 11
0
        public void WebhookEventTypeAvailableEventsTest()
        {
            try
            {
                var apiContext = TestingUtil.GetApiContext();
                this.RecordConnectionDetails();

                var webhookEventTypeList = WebhookEventType.AvailableEventTypes(apiContext);
                this.RecordConnectionDetails();

                Assert.IsNotNull(webhookEventTypeList);
                Assert.IsNotNull(webhookEventTypeList.event_types);
                Assert.IsTrue(webhookEventTypeList.event_types.Count > 2);
            }
            catch (ConnectionException)
            {
                this.RecordConnectionDetails(false);
                throw;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Get the event object based on the event type enumeration
        /// </summary>
        public Type GetEventObjectType(WebhookEventType eventType)
        {
            switch (eventType)
            {
            case WebhookEventType.CustomerEvent:
                return(typeof(customerEvent));

            case WebhookEventType.FraudEvent:
                return(typeof(customerEvent));

            case WebhookEventType.PaymentEvent:
                return(typeof(customerEvent));

            case WebhookEventType.PaymentProfileEvent:
                return(typeof(customerEvent));

            case WebhookEventType.SubscriptionEvent:
                return(typeof(customerEvent));

            default:
                return(null);
            }
        }
Esempio n. 13
0
        public async Task <DeliveryResult> TestWebhook(string storeId, string webhookId, WebhookEventType webhookEventType, CancellationToken cancellationToken)
        {
            var delivery        = NewDelivery(webhookId);
            var webhook         = (await StoreRepository.GetWebhooks(storeId)).FirstOrDefault(w => w.Id == webhookId);
            var deliveryRequest = new WebhookDeliveryRequest(
                webhookId,
                GetTestWebHook(storeId, webhookId, webhookEventType, delivery),
                delivery,
                webhook.GetBlob()
                );

            return(await SendDelivery(deliveryRequest, cancellationToken));
        }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebhookRequest" /> class.
 /// </summary>
 /// <param name="_Event">_Event.</param>
 /// <param name="Url">the URL to which the webhook data should be sent when the event is triggered.</param>
 public WebhookRequest(WebhookEventType _Event = default(WebhookEventType), string Url = default(string))
 {
     this._Event = _Event;
     this.Url    = Url;
 }
Esempio n. 15
0
 public bool Match(WebhookEventType evt)
 {
     return(Everything || SpecificEvents.Contains(evt));
 }
Esempio n. 16
0
 public WebhookInvoiceReceivedPaymentEvent(WebhookEventType evtType) : base(evtType)
 {
 }
 public ReplyableEvent(WebhookEventType eventType, WebhookEventSource source, long timestamp, string replyToken)
     : base(eventType, source, timestamp)
 {
     ReplyToken = replyToken;
 }
Esempio n. 18
0
 public WebhookInvoiceInvalidEvent(WebhookEventType evtType) : base(evtType)
 {
 }
Esempio n. 19
0
 public WebhookInvoiceProcessingEvent(WebhookEventType evtType) : base(evtType)
 {
 }
Esempio n. 20
0
 public WebhookInvoiceSettledEvent(WebhookEventType evtType) : base(evtType)
 {
 }
Esempio n. 21
0
 public WebhookInvoiceEvent(WebhookEventType evtType)
 {
     this.Type = evtType;
 }
Esempio n. 22
0
 public WebhookInvoiceExpiredEvent(WebhookEventType evtType) : base(evtType)
 {
 }
Esempio n. 23
0
 public WebhookEvent(WebhookEventType type, WebhookEventSource source, long timestamp)
 {
     Type      = type;
     Source    = source;
     Timestamp = timestamp;
 }
Esempio n. 24
0
 public ReplyableEvent(WebhookEventType eventType, WebhookEventSource source, long timestamp, string replyToken, string mode, string webhookEventId, DeliveryContext deliveryContext)
     : base(eventType, source, timestamp, mode, webhookEventId, deliveryContext)
 {
     ReplyToken = replyToken;
 }