public async Task <Result> Send(BookingWebhookData webhookData) { var serializedData = JsonSerializer.Serialize(webhookData, _jsonOptions.JsonSerializerOptions); var error = $"Failed to execute a request to {_webhookOptions.WebhookUrl}"; var message = new HttpRequestMessage(HttpMethod.Post, _webhookOptions.WebhookUrl) { Content = new StringContent(serializedData) }; var response = await _httpClient.SendAsync(message); if (!response.IsSuccessStatusCode) { return(Result.Failure($"{error} {nameof(response.StatusCode)} '{response.StatusCode}'")); } return(Result.Success()); }
private bool IsWebhookDataValid(BookingWebhookData webhookData) => IsSignatureValid(webhookData.Signature, webhookData.Timestamp);