示例#1
0
        public async Task SetupPrintfulWebhook()
        {
            var currentSettings = await _printfulClient.GetWebhookConfiguration();

            // Only try to setup if webhook is not configured
            if (string.IsNullOrWhiteSpace(currentSettings?.WebhookInfo?.WebhookReturnUrl))
            {
                var request = new SetUpWebhookConfigurationRequest
                {
                    WebhookReturnUrl     = $"{_configService.Get<string>("WebsiteLink")}/MerchWebhook/Event",
                    EnabledWebhookEvents = new List <string>
                    {
                        WebhookEventType.PackageShipped.ToWebhookTypeString(),
                    WebhookEventType.PackageReturned.ToWebhookTypeString(),
                    WebhookEventType.OrderFailed.ToWebhookTypeString(),
                    WebhookEventType.OrderCancelled.ToWebhookTypeString(),
                    WebhookEventType.ProductSynced.ToWebhookTypeString(),
                    WebhookEventType.ProductUpdated.ToWebhookTypeString(),
                    WebhookEventType.OrderPutOnHold.ToWebhookTypeString(),
                    WebhookEventType.OrderRemoveHold.ToWebhookTypeString()
                    },
                    OptionalParams = new object {}
                };

                var result = await _printfulClient.SetWebhookConfiguration(request);
            }
        }
示例#2
0
        internal async Task <WebhookConfigurationResponse> SetUp(SetUpWebhookConfigurationRequest request)
        {
            var response = await _client.PostAsync <WebhookConfigurationResponse, SetUpWebhookConfigurationRequest>("webhooks", request);

            return(response);
        }
示例#3
0
        public async Task <WebhookConfigurationResponse> SetWebhookConfiguration(SetUpWebhookConfigurationRequest request)
        {
            var result = await _webhookSetupService.SetUp(request);

            return(result);
        }