Skip to content

Commit

Permalink
Support for multiple statuses.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Aug 3, 2023
1 parent 0507376 commit dbbe3dd
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public async Task HandleRequestAsync(IntegrationContext context, HttpContext htt
var status = await GetClient(context).ParseSmsWebhookAsync(httpContext);

var result = ParseStatus(status);

if (result == default)
{
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ public async Task HandleRequestAsync(IntegrationContext context, HttpContext htt
}

var deliveryStatus = ParseStatus(status);

if (deliveryStatus == default)
{
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,35 @@ public async Task HandleRequestAsync(IntegrationContext context, HttpContext htt

var response = await Client.Providers.HandleWebhookAsync(requestDto, default);

var http = response.Http;

if (http != null)
if (response.Http != null)
{
var httpResponse = httpContext.Response;

if (http.Headers != null)
if (response.Http.Headers != null)
{
foreach (var (key, value) in http.Headers)
foreach (var (key, value) in response.Http.Headers)
{
httpResponse.Headers[key] = value;
}
}

if (http.StatusCode != null)
if (response.Http.StatusCode != null)
{
httpResponse.StatusCode = http.StatusCode.Value;
httpResponse.StatusCode = response.Http.StatusCode.Value;
}

if (http.Body != null)
if (response.Http.Body != null)
{
await httpResponse.WriteAsync(http.Body, default);
await httpResponse.WriteAsync(response.Http.Body, default);
}
}

var status = response.Status;

if (status != null)
if (response.Statuses != null)
{
await context.UpdateStatusAsync(status.TrackingToken, status.ToDeliveryResult());
foreach (var status in response.Statuses)
{
await context.UpdateStatusAsync(status.TrackingToken, status.ToDeliveryResult());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ private async Task UpdateUser(IntegrationContext context, TelegramUser from, Tel
}

var user = await context.IntegrationAdapter.FindUserByPropertyAsync(context.AppId, UserUsername.Name, username, default);

if (user == null)
{
await SendMessageAsync(context, GetUserNotFoundMessage(context), chatId, ct);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public Task HandleRequestAsync(IntegrationContext context, HttpContext httpConte
var status = httpContext.Request.Form[RequestKeys.MessageStatus].ToString();

var result = ParseStatus(status);

if (result == default)
{
return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public Task HandleRequestAsync(IntegrationContext context, HttpContext httpConte
var status = httpContext.Request.Form[RequestKeys.MessageStatus].ToString();

var result = ParseStatus(status);

if (result == default)
{
return Task.CompletedTask;
Expand Down

0 comments on commit dbbe3dd

Please sign in to comment.