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); } }
internal async Task <WebhookConfigurationResponse> SetUp(SetUpWebhookConfigurationRequest request) { var response = await _client.PostAsync <WebhookConfigurationResponse, SetUpWebhookConfigurationRequest>("webhooks", request); return(response); }
public async Task <WebhookConfigurationResponse> SetWebhookConfiguration(SetUpWebhookConfigurationRequest request) { var result = await _webhookSetupService.SetUp(request); return(result); }